123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Collections;
- using LYFZ.Model.API;
- namespace LYFZ.Software.MainBusiness.DoorCityProcess.NewOrderCustomControls
- {
- public partial class OrderSightsControlsEx : LYFZ.Software.UI.DoorCityProcess.SetCustomControls.OrderSightsControlsEx
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpOrderDigital orvbll = new BLL.BLL_ErpOrderDigital();
- LYFZ.BLL.BLL_ErpSystemCategory scbll = new BLL.BLL_ErpSystemCategory();
- LYFZ.BLL.BLL_ErpOrdersPhotography opbll = new BLL.BLL_ErpOrdersPhotography();
- LYFZ.BLL.BLL_ErpOrderDigitalStatus orsbll = new BLL.BLL_ErpOrderDigitalStatus();
- public int OrdType = -1;
- public bool bUpgrade = false;
- public OrderSightsControlsEx()
- {
- this.Load += OrderSightsControlsEx_Load;
- this.btnSightsAdd.Click += btnSightsAdd_Click;
- this.btnSightsDelete.Click += btnSightsDelete_Click;
- this.btnSightsSet.Click += btnSightsSet_Click;
- this.btnReplace.Click += btnReplace_Click;
- this.listViewData_Sights.Click += listViewData_Sights_Click;
- this.listViewData_Sights.MouseDoubleClick += listViewData_Sights_MouseDoubleClick;
- this.txtText.KeyPress += txtText_KeyPress;
- this.txtText.Leave += txtText_Leave;
- this.cmbtreevText.Leave += cmbtreevText_Leave;
- this.dtpText.Leave += dtpText_Leave;
- this.lblBrowseSelect.Click += lblBrowseSelect_Click;
- this.IsClickToolbox = false;
- this.SetColumnHeaderText();
- this.listViewData_Sights.View = View.Details;
- this.listViewData_Sights.GridLines = true;
- ImageList imgList = new ImageList();
- imgList.ImageSize = new Size(1, 25);
- this.listViewData_Sights.SmallImageList = imgList;
- }
- private void OrderSightsControlsEx_Load(object sender, EventArgs e)
- {
- BindJingDianDenJi();
- }
-
- /// <summary>
- /// 绑定景点等级
- /// </summary>
- void BindJingDianDenJi()
- {
- FinancialManagement.frmEditStatisticsProgram.BindTreeView_SystemCategory(BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.景点等级).ToUpper(), this.cmbtreevText.TreeView, isExpandAll: false);
- }
- /// <summary>
- /// 是否修改了预约时间
- /// </summary>
- public bool isModifyAppointmentTime=false;
- void dtpText_Leave(object sender, EventArgs e)
- {
- isModifyAppointmentTime = true;
- string tempDate = this.dtpText.DateValue;
-
- bool IsPublicHoliday = false;
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- try
- {
- backgroundWorker.ReportProgress(0, "正在验证数据...");
- if (!String.IsNullOrWhiteSpace(tempDate))
- {
- if (LYFZ.BLL.ThumbtackRecord.IsPublicHoliday(Convert.ToDateTime(tempDate).ToYYYYMMddDate(), LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID()))
- {
- IsPublicHoliday = true;
- }
- }
-
- }
- catch (Exception ex)
- {
- MessageBoxCustom.Show(String.Format("加载数据时出错:{0}", ex.Message));
- }
- });
- if (IsPublicHoliday)
- {
- MessageBoxCustom.Show("选择的预拍日期为公休日,不可以预约,请改期");
- tempDate = "";
- this.dtpText.DateValue = "";
- }
- this.listViewData_Sights.SelectedItems[0].SubItems["预拍时间"].Text = tempDate;
- this.dtpText.Visible = false;
- }
- /// <summary>
- /// 登录者员工ID
- /// </summary>
- string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- #region 点击列显示下拉框
- /// <summary>
- /// 列表点击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Sights_Click(object sender, EventArgs e)
- {
- this.txtText.Visible = false;
- this.cmbtreevText.Visible = false;
- }
- /// <summary>
- /// 列表双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void listViewData_Sights_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- this.listViewData_Sights_Click(this, null);
- ListViewHitTestInfo info = this.listViewData_Sights.HitTest(e.X, e.Y);
- if (!string.IsNullOrEmpty(info.SubItem.Name.Trim()))
- {
- Rectangle rect = info.SubItem.Bounds;
- switch (info.SubItem.Name.Trim())
- {
- case "备注":
- case "服装套数":
- if (info.SubItem.Name.Trim() == "备注")
- { this.txtText.MaxLength = 400; }
- else
- {
- if (!string.IsNullOrEmpty(this.listViewData_Sights.SelectedItems[0].SubItems["来源"].Text.Trim()))
- {
- return;
- }
- else
- {
- this.txtText.MaxLength = 3;
- }
- }
- this.txtText.Location = new Point(rect.Location.X + this.listViewData_Sights.Location.X + 3, rect.Location.Y + this.listViewData_Sights.Location.Y + 2);
- this.txtText.Size = rect.Size;
- this.txtText.Visible = true;
- this.txtText.Tag = info.SubItem.Name.Trim();
- this.txtText.Text = info.SubItem.Text.Trim();
- this.txtText.Focus();
- break;
- case "拍摄级别":
- this.cmbtreevText.Location = new Point(rect.Location.X + this.listViewData_Sights.Location.X + 3, rect.Location.Y + this.listViewData_Sights.Location.Y + 4);
- this.cmbtreevText.Size = rect.Size;
- this.cmbtreevText.Visible = true;
- this.cmbtreevText.TextFindTag(info.SubItem.Text.Trim());
- this.cmbtreevText.Focus();
- break;
- case "预拍时间":
- this.dtpText.Location = new Point(rect.Location.X + this.listViewData_Sights.Location.X + 3, rect.Location.Y + this.listViewData_Sights.Location.Y + 4);
- this.dtpText.Size = rect.Size;
- this.dtpText.Visible = true;
- this.dtpText.DateValue = (info.SubItem.Text.Trim());
- this.dtpText.Focus();
- break;
- }
- }
- }
- /// <summary>
- /// 服装套数输入限制
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtText_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (this.txtText.Tag != null)
- {
- if (this.txtText.Tag.ToString().Trim() == "服装套数")
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- {
- e.Handled = true;
- }
- if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[0-9]") && e.KeyChar != ' ' && e.KeyChar != '\b')
- {
- e.Handled = true;
- }
- }
- }
- }
- /// <summary>
- /// 服装套数离开事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtText_Leave(object sender, EventArgs e)
- {
- if (this.txtText.Tag != null)
- {
- if (this.txtText.Tag.ToString().Trim() == "服装套数")
- {
- if (!string.IsNullOrEmpty(this.txtText.Text.Trim()))
- {
- try
- {
- if (!LYFZ.Command.Command_Validate.IsNumeric(this.txtText.Text.Trim()))
- {
- this.txtText.Text = "";
- }
- }
- catch
- {
- this.txtText.Text = "";
- }
- }
- try
- {
- this.listViewData_Sights.SelectedItems[0].SubItems[this.txtText.Tag.ToString().Trim()].Text = this.txtText.Text.Trim() == "" ? "1" : this.txtText.Text;
- }
- catch
- {
- }
- }
- else
- {
- this.listViewData_Sights.SelectedItems[0].SubItems[this.txtText.Tag.ToString().Trim()].Text = this.txtText.Text.Trim();
- }
- }
- this.listViewData_Sights_Click(this, null);
- }
- /// <summary>
- /// 拍摄级别离开事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void cmbtreevText_Leave(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.NewOrderCustomControls.SightsHeaderModel ColumnModel = (SightsHeaderModel)this.listViewData_Sights.SelectedItems[0].Tag;
- ColumnModel.SightsLevel = this.cmbtreevText.SelectedNode.Name.ToString().Trim();
- this.listViewData_Sights.SelectedItems[0].SubItems["拍摄级别"].Text = this.cmbtreevText.Text.Trim();
- this.listViewData_Sights_Click(this, null);
- }
- #endregion
- /// <summary>
- /// 景点添加
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSightsAdd_Click(object sender, EventArgs e)
- {
- if (!this.IsClickToolbox)
- {
- MessageBoxCustom.Show("请先选择套系名称!");
- return;
- }
- LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.SightsAddSmallForm frm = new SetSmallForm.SightsAddSmallForm();
- frm.LoadType = "景点设置";
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- this.SetOrderSightsValue(frm.mlist);
- }
- }
- /// <summary>
- /// 景点删除
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSightsDelete_Click(object sender, EventArgs e)
- {
- if (this.listViewData_Sights.SelectedItems.Count > 0)
- {
- ListViewItem item = this.listViewData_Sights.SelectedItems[0];
- if (string.IsNullOrEmpty(item.SubItems["来源"].Text.Trim()))
- {
- bool isDelete = true;
- if (this.currentOrderModel.ID>0)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.NewOrderCustomControls.SightsHeaderModel ColumnModel = (SightsHeaderModel)item.Tag;
- // if (!string.IsNullOrEmpty(ColumnModel.SightsOrderID))
- // {
- if (this.OrderDigitalList.Count > 0)
- {
- if (this.OrderPhotographyList.Any(p => p.ID.ToString() == ColumnModel.SightsOrderID && p.Ordpg_PhotographyStatus != "0"))
- {
- MessageBoxCustom.Show("此景点拍照已OK,不能删除");
- isDelete = false;
- }
- else
- {
- LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(this.CurrentOrderModel, this.OrderDigitalList[0]);
- List<string> sPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.PrimitivePicture, BLL.SelectPhotoHandling.PhotoType.Original, item.Text.Trim());
- if (sPhotoList.Count == 0)
- {
- isDelete = true;
- }
- else
- {
- MessageBoxCustom.Show("此景点已导片,不能删除");
- isDelete = false;
- }
- }
- }
- // }
- }
- if (isDelete)
- {
- if (MessageBoxCustom.Show("您确定要删除此拍摄景点吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- {
- return;
- }
- this.listViewData_Sights.Items.Remove(item);
- }
- }
- else
- {
- MessageBoxCustom.Show("礼包赠品不能删除");
- }
- }
- else {
- MessageBoxCustom.Show("请选择要删除内容");
- }
- this.listViewData_Sights.Focus();
- }
- /// <summary>
- /// 移除景点
- /// </summary>
- /// <param name="packType">设置套系类型,如果是 选择套系时只删除套系景点,如果是选择礼包套系时只删除礼包套系景点</param>
- void RemoveOrderSightsItem(EnumPublic.EnumPackagesType packType)
- {
- if (this.listViewData_Sights.Items.Count > 0)
- {
- if (packType == EnumPublic.EnumPackagesType.加载订单时)
- {
- this.listViewData_Sights.Items.Clear();
- this.listViewData_Sights.Groups.Clear();
- }
- List<ListViewItem> listItems = new List<ListViewItem>();
- foreach (ListViewItem item in this.listViewData_Sights.Items)
- {
- switch (packType)
- {
- case EnumPublic.EnumPackagesType.AAAAAAB:
- if (string.IsNullOrEmpty(item.SubItems["来源"].Text.Trim()))
- {
- listItems.Add(item);
- }
- break;
- case EnumPublic.EnumPackagesType.AAAAACA:
- if (!string.IsNullOrEmpty(item.SubItems["来源"].Text.Trim()))
- {
- listItems.Add(item);
- }
- break;
- case EnumPublic.EnumPackagesType.加载订单时:
- listItems.Add(item);
- break;
- }
-
- }
- LYFZ.BLL.SelectPhotoHandling sPh = null;
- if (this.OrderDigitalList.Count > 0 && this.CurrentOrderModel.ID > 0)
- {
- sPh = new BLL.SelectPhotoHandling(this.CurrentOrderModel, this.OrderDigitalList[0]);
- }
- foreach (ListViewItem item in listItems)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.NewOrderCustomControls.SightsHeaderModel ColumnModel = (SightsHeaderModel)item.Tag;
- //是否可以删除
- bool isDelete = true;
- if (this.OrderPhotographyList.Any(p => p.ID.ToString() == ColumnModel.SightsOrderID && p.Ordpg_PhotographyStatus != "0"))
- {
- isDelete = false;
- }
- else
- {
- if (sPh != null)
- {
- List<string> sPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.PrimitivePicture, BLL.SelectPhotoHandling.PhotoType.Small, item.Text.Trim());
- if (sPhotoList.Count > 0)
- {
- isDelete = false;
- }
- }
- }
- if (isDelete)
- {
- this.listViewData_Sights.Items.Remove(item);
- }
- }
- }
- }
-
- /// <summary>
- /// 景点设置
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnSightsSet_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.InitialSet.FrmAttractionsSet frm = new InitialSet.FrmAttractionsSet("0");
- frm.StrSightsType = "0";
- frm.ShowDialog();
- this.listViewData_Sights.Focus();
- }
- LYFZ.Model.Model_ErpOrder currentOrderModel = new Model.Model_ErpOrder();
- /// <summary>
- /// 当前订单对象
- /// </summary>
- public LYFZ.Model.Model_ErpOrder CurrentOrderModel
- {
- get { return currentOrderModel; }
- set { currentOrderModel = value; }
- }
- List<LYFZ.Model.Model_ErpOrderDigital> orderDigitalList = new List<Model.Model_ErpOrderDigital>();
- /// <summary>
- /// 当前打开订单数码表集合
- /// </summary>
- public List<LYFZ.Model.Model_ErpOrderDigital> OrderDigitalList
- {
- get { return orderDigitalList; }
- set { orderDigitalList = value; }
- }
- List<LYFZ.Model.Model_ErpOrdersPhotography> photographyList = new List<Model.Model_ErpOrdersPhotography>();
- /// <summary>
- /// 当前打开订单已有景点集合
- /// </summary>
- public List<LYFZ.Model.Model_ErpOrdersPhotography> OrderPhotographyList
- {
- get { return photographyList; }
- set { photographyList = value; }
- }
- /// <summary>
- /// 更换
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnReplace_Click(object sender, EventArgs e)
- {
- if (this.currentOrderModel.ID > 0)
- {
- if (this.listViewData_Sights.SelectedItems.Count <= 0)
- {
- MessageBoxCustom.Show("请选择你要更换的景点"); return;
- }
- LYFZ.Software.MainBusiness.DoorCityProcess.NewOrderCustomControls.SightsHeaderModel ColumnModel = (SightsHeaderModel)this.listViewData_Sights.SelectedItems[0].Tag;
- if (!string.IsNullOrEmpty(ColumnModel.SightsOrderID))
- {
- if (this.OrderPhotographyList.Any(p => p.ID.ToString() == ColumnModel.SightsOrderID && p.Ordpg_PhotographyStatus == "1"))
- {
- MessageBoxCustom.Show("此景点已拍照OK,不能更换");
- this.listViewData_Sights.Focus();
- return;
- }
- }
- }
- if (!this.IsClickToolbox)
- {
- MessageBoxCustom.Show("请先选择套系名称!");
- return;
- }
- if (this.listViewData_Sights.SelectedItems.Count != 1)
- {
- MessageBoxCustom.Show("请选择要更换的景点!");
- return;
- }
- List<string> SightsList = new List<string>();
- foreach (ListViewItem item in this.listViewData_Sights.Items)
- {
- SightsList.Add(item.Text.Trim());
- }
- LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.SightsAddSmallForm frm = new SetSmallForm.SightsAddSmallForm();
- frm.GetType = "更换";
- frm.LoadType = "景点设置";
- frm.RemovedSightsList = SightsList;
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- string StrOldSightsName = this.listViewData_Sights.SelectedItems[0].Text;
- LYFZ.Model.Model_ErpTheScenery modelss = frm.mlist[0];
- LYFZ.Software.MainBusiness.DoorCityProcess.NewOrderCustomControls.SightsHeaderModel ColumnModel = (SightsHeaderModel)this.listViewData_Sights.SelectedItems[0].Tag;
- ColumnModel.TheSceneryUpdateSightsHeaderModel(modelss);
- SetListViewItemValue(this.listViewData_Sights.SelectedItems[0], ColumnModel);
- }
- // this.listViewData_Sights.Focus();
- }
- /// <summary>
- /// 浏览选择
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void lblBrowseSelect_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.StyleViewSmallForm frm = new SetSmallForm.StyleViewSmallForm();
- frm.frmStyleViewVersion = SetSmallForm.StyleViewSmallForm.StyleViewVersion.景点浏览;
- List<string> OldSelectStyleList = new List<string>();
- for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
- {
- OldSelectStyleList.Add(this.listViewData_Sights.Items[i].Text.Trim());
- }
- frm.OldSelectStyleList = OldSelectStyleList;
- frm.WindowState = FormWindowState.Maximized;
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- StringBuilder StrWhere = new StringBuilder();
- foreach(string itemText in frm.SelectStyleList)
- {
- if (OldSelectStyleList.Any(s => s.ToLower() != itemText.Trim().ToLower()))
- {
- StrWhere.Append(String.Format("'{0}',", itemText.Trim()));
- }
- }
- if (!string.IsNullOrEmpty(StrWhere.ToString()))
- {
- LYFZ.BLL.BLL_ErpTheScenery tsybll = new BLL.BLL_ErpTheScenery();
- List<LYFZ.Model.Model_ErpTheScenery> mlist = tsybll.GetModelList("Tsc_Name in (" + StrWhere.ToString().TrimEnd(',') + ") And Tsc_Type = '0'");
- this.SetOrderSightsValue(mlist);
- }
- }
- }
- #region 属性
- /// <summary>
- /// 是否选择了套系名称
- /// </summary>
- private bool IsClickToolbox;
- /// <summary>
- /// 获取商品的总价
- /// </summary>
- /// <returns></returns>
- public decimal GetSightsAoumnt()
- {
- decimal dec_Aoumnt = 0;
- for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.NewOrderCustomControls.SightsHeaderModel ColumnModel = (SightsHeaderModel)this.listViewData_Sights.Items[i].Tag;
- dec_Aoumnt += Convert.ToDecimal(ColumnModel.SightsCostPrice);
- }
- return dec_Aoumnt;
- }
- /// <summary>
- /// 获取列表详情数据
- /// </summary>
- /// <returns></returns>
- public string GetOrderSightsContentDetails()
- {
- string StrContentDetails = "";
- for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
- { StrContentDetails += "名称:" + this.listViewData_Sights.Items[i].Text.Trim() + " 套数:" + this.listViewData_Sights.Items[i].SubItems["服装套数"].Text.Trim() + " ;"; }
- return StrContentDetails;
- }
- /// <summary>
- /// 获取当前列表
- /// </summary>
- /// <returns></returns>
- public DataTable GetListViewData()
- {
- DataTable NewTable = new DataTable();
- NewTable.Columns.Add("PgmID", typeof(string));
- for (int i = 0; i < this.listViewData_Sights.Columns.Count; i++)
- {
- NewTable.Columns.Add(this.listViewData_Sights.Columns[i].Text.Trim(), typeof(string));
- }
- for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
- {
- if (string.IsNullOrEmpty(this.listViewData_Sights.Items[i].SubItems["来源"].Text.Trim()))
- {
- DataRow newRow = NewTable.NewRow();
- for (int j = 0; j < this.listViewData_Sights.Columns.Count; j++)
- {
- if (j == 0)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.NewOrderCustomControls.SightsHeaderModel ColumnModel = (SightsHeaderModel)this.listViewData_Sights.Items[i].Tag;
- newRow["PgmID"] = ColumnModel.PgmID;
- newRow[this.listViewData_Sights.Columns[j].Text.Trim()] = this.listViewData_Sights.Items[i].Text.Trim();
- }
- else
- {
- newRow[this.listViewData_Sights.Columns[j].Text.Trim()] = this.listViewData_Sights.Items[i].SubItems[this.listViewData_Sights.Columns[j].Text.Trim()].Text.Trim();
- }
- }
- NewTable.Rows.Add(newRow);
- }
- }
- return NewTable;
- }
- #endregion
- /// <summary>
- /// 绑定景点的数据信息
- /// </summary>
- /// <param name="erpModel"></param>
- public void GetOrderSightsValueData(Api_ErpOrderModel erpModel)
- {
- erpModel.OrderSightData = new List<Api_StagesModel>();
- for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
- {
- SightsHeaderModel ColumnModel = (SightsHeaderModel)this.listViewData_Sights.Items[i].Tag;
- string strReservationPhotographyTime = this.listViewData_Sights.Items[i].SubItems["预拍时间"].Text.Trim();
- if (this.listViewData_Sights.Items[i].SubItems["预拍时间"].Tag != null)
- {
- string[] dateTimeList = this.listViewData_Sights.Items[i].SubItems["预拍时间"].Tag.ToString().Split(' ');
- if (dateTimeList.Length > 1)
- {
- strReservationPhotographyTime = strReservationPhotographyTime + " " + dateTimeList[1].Trim();
- }
- }
- Api_StagesModel model = new Api_StagesModel()
- {
- SightsOrderName = this.listViewData_Sights.Items[i].Text,
- PgmID = ColumnModel.PgmID,
- SightsLevel = ColumnModel.SightsLevel,
- SightsOrderID = ColumnModel.SightsOrderID,
- SightsCostPrice = ColumnModel.SightsCostPrice,
- SightsType = ColumnModel.SightsType,
- SightsRemark = this.listViewData_Sights.Items[i].SubItems["备注"].Text.Trim(),
- SightsPrice = this.listViewData_Sights.Items[i].SubItems["景点价格"].Text.Trim(),
- Source = this.listViewData_Sights.Items[i].SubItems["来源"].Text.Trim(),
- WearCount = Convert.ToInt32(this.listViewData_Sights.Items[i].SubItems["服装套数"].Text.Trim()),
- StagesReservationPhotographyTime = strReservationPhotographyTime.Trim()
- };
- erpModel.OrderSightData.Add(model);
- }
- }
-
- /// <summary>
- /// 设置景点(添加和浏览时使用)
- /// </summary>
- /// <param name="mlist"></param>
- public void SetOrderSightsValue(List<LYFZ.Model.Model_ErpTheScenery> mlist)
- {
- for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
- {
- for (int j = 0; j < mlist.Count; j++)
- {
- if (this.listViewData_Sights.Items[i].Text.Trim() == mlist[j].Tsc_Name.Trim())
- {
- mlist.RemoveAt(j);
- break;
- }
- }
- }
- foreach (LYFZ.Model.Model_ErpTheScenery tScenery in mlist)
- {
- SightsHeaderModel ColumnModel = new SightsHeaderModel();
- ColumnModel.TheSceneryToSightsHeaderModel(tScenery);
- ListViewItem lvItem = GetNewListViewItem();
- SetListViewItemValue(lvItem, ColumnModel);
- if ((this.listViewData_Sights.Items.Count % 2) > 0)
- {
- lvItem.BackColor = System.Drawing.Color.PapayaWhip;
- }
- else
- {
- lvItem.BackColor = System.Drawing.Color.PowderBlue;
- }
- this.listViewData_Sights.Items.Add(lvItem);
- }
-
- for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
- {
- this.listViewData_Sights.Items[i].Selected = false;
- }
- this.listViewData_Sights.Items[this.listViewData_Sights.Items.Count - 1].Selected = true;
- this.listViewData_Sights.Focus();
- }
- /// <summary>
- /// 加载订单时设置拍摄景点数据
- /// </summary>
- /// <param name="ord_SeriesName">订单套系名称</param>
- /// <param name="orderSightsTable">订单景点数据</param>
- public void SetOrderSightsValue(string ord_SeriesName, DataTable orderSightsTable)
- {
- this.btnReplace.Visible = true;
- this.RemoveOrderSightsItem(EnumPublic.EnumPackagesType.加载订单时);
- if (!String.IsNullOrEmpty(ord_SeriesName))
- {
- this.IsClickToolbox = true;
- }
- this.SetIsActivity();
- if (orderSightsTable != null)
- {
- foreach (DataRow row in orderSightsTable.Rows)
- {
- SightsHeaderModel ColumnModel = new SightsHeaderModel();
- ColumnModel.OpenOrderToSightsHeaderModel(row);
- ListViewItem lvItem = GetNewListViewItem();
- SetListViewItemValue(lvItem, ColumnModel);
- if ((this.listViewData_Sights.Items.Count % 2) > 0)
- {
- lvItem.BackColor = System.Drawing.Color.PapayaWhip;
- }
- else
- {
- lvItem.BackColor = System.Drawing.Color.PowderBlue;
- }
- this.listViewData_Sights.Items.Add(lvItem);
- }
- }
-
- }
- /// <summary>
- /// 选择套系时 加载景点
- /// </summary>
- /// <param name="listStages"></param>
- /// <param name="dtSet"></param>
- public string SetOrderSightsValue(DataRow[] dtRows, bool IsActivity, LYFZ.EnumPublic.EnumPackagesType PackagesType)
- {
- this._IsActivityTaoXi = IsActivity;
- string StrDeleteSights = "";
- this.RemoveOrderSightsItem(PackagesType);
- this.IsClickToolbox = true;
- string StrRepeatSightsName = "";
- foreach (DataRow row in dtRows)
- {
- SightsHeaderModel ColumnModel = new SightsHeaderModel();
- ColumnModel.TaoXiToSightsHeaderModel(row);
- if (ColumnModel.TheScenery_ID > 0)
- {
- if (BindSightExist(ColumnModel.ProductName.Trim()))
- {
- if (PackagesType == EnumPublic.EnumPackagesType.AAAAACA)
- {
- StrRepeatSightsName += "[" + ColumnModel.ProductName.Trim() + "],";
-
- }
- break;
- }
- ListViewItem lvItem = GetNewListViewItem();
- SetListViewItemValue(lvItem, ColumnModel);
- if ((this.listViewData_Sights.Items.Count % 2) > 0)
- {
- lvItem.BackColor = System.Drawing.Color.PapayaWhip;
- }
- else
- {
- lvItem.BackColor = System.Drawing.Color.PowderBlue;
- }
- this.listViewData_Sights.Items.Add(lvItem);
- }
- else
- {
- StrDeleteSights += ColumnModel.ProductName.Trim() + ",";
- }
- }
- if (StrDeleteSights.Trim() != "")
- {
- StrDeleteSights = "有景点已删除,已删除景点为:" + StrDeleteSights.TrimEnd(',') + ";";
- }
- if (PackagesType == EnumPublic.EnumPackagesType.AAAAAAB)
- {
- this.SetIsActivity();
- }
- if (!string.IsNullOrEmpty(StrRepeatSightsName))
- {
- MessageBoxCustom.Show("订单套系景点有包含礼包景点:\r\n" + StrRepeatSightsName.TrimEnd(','));
- }
- return StrDeleteSights;
- }
-
- static string[] subItemNames = new string[] { "景点名称", "景点价格", "来源", "景点类别", "拍摄级别", "服装套数", "预拍时间", "备注" };
- /// <summary>
- /// 设置列表表头
- /// </summary>
- void SetColumnHeaderText()
- {
- int SurplusCount = 230 + 80 * 3 + 80 + 70 + 5 + 90+43;
- foreach(string subItemName in subItemNames)
- {
- ColumnHeader ch = new ColumnHeader();
- ch.Text = subItemName.Trim();
- ch.TextAlign = HorizontalAlignment.Center;
- ch.Width = 80;
- switch (subItemName.Trim())
- {
- case "景点名称": ch.Width = 230; ch.TextAlign = HorizontalAlignment.Left; break;
- case "来源": ch.Width = 70; break;
- case "预拍时间": ch.Width = 90; break;
- case "备注": ch.Width = this.listViewData_Sights.Width - SurplusCount; break;
- case "景点价格": ch.TextAlign = HorizontalAlignment.Right; break;
- default: ch.Width = 80; break;
- }
- this.listViewData_Sights.Columns.Add(ch);
- }
- }
- /// <summary>
- /// 获取新的 ListViewItem
- /// </summary>
- /// <returns></returns>
- public static ListViewItem GetNewListViewItem()
- {
- ListViewItem lvItem = new ListViewItem();
- lvItem.Text = "";
- foreach (string subItemName in subItemNames)
- {
- if (subItemName != "景点名称")
- {
- ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem();
- ListSubItem.Name = subItemName;
- ListSubItem.Text = "";
- lvItem.SubItems.Add(ListSubItem);
- }
- }
- return lvItem;
-
- }
- /// <summary>
- /// 设置 ListViewItem 值
- /// </summary>
- /// <param name="vItem"></param>
- /// <param name="sightsModel">数据对象</param>
- public static void SetListViewItemValue(ListViewItem vItem, SightsHeaderModel sightsModel)
- {
- vItem.Tag = sightsModel;
- vItem.Text = sightsModel.ProductName;
- vItem.SubItems[1].Text = sightsModel.SalesPrice.ToString("n2");
- vItem.SubItems[2].Text = sightsModel.OpenOrderSource;
- vItem.SubItems[3].Text = sightsModel.SightsTypeToCategoryText();
- vItem.SubItems[4].Text = sightsModel.SightsLevelName;//景点等级
- vItem.SubItems[5].Text = sightsModel.ClothingSetsNumber.ToString();
- vItem.SubItems[6].Text = sightsModel.ReservationPhotographyTime;
- vItem.SubItems[6].Tag = sightsModel.SKReservationPhotographyTime;
- vItem.SubItems[7].Text = sightsModel.OpenOrderRemark;
- }
- /// <summary>
- /// 检查要添加的景点名在已有列表中是否存在
- /// </summary>
- /// <param name="sightText"></param>
- /// <returns></returns>
- bool BindSightExist(string sightText)
- {
- for (int i = 0; i < this.listViewData_Sights.Items.Count; i++)
- {
- if (this.listViewData_Sights.Items[i].Text.ToLower().Equals(sightText.ToLower()))
- {
- return true;
- }
- }
- return false;
- }
- /// <summary>
- /// 移除礼包的项目
- /// </summary>
- public void RemovePackageItem()
- {
- this.RemoveOrderSightsItem( EnumPublic.EnumPackagesType.AAAAACA);
- }
- bool _IsActivityTaoXi = false;
- /// <summary>
- /// 是否为活动套系
- /// </summary>
- public bool IsActivityTaoXi
- {
- get { return _IsActivityTaoXi; }
- set { _IsActivityTaoXi=value; }
- }
- /// <summary>
- /// 设置是否能操作
- /// </summary>
- /// <param name="IsActivity"></param>
- void SetIsActivity()
- {
- if (_IsActivityTaoXi && !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ChangeActiveContent)
- {
- this.btnSightsAdd.Enabled = false;
- this.btnSightsDelete.Enabled = false;
- this.btnSightsSet.Enabled = false;
- }
- else {
- this.btnSightsAdd.Enabled = true;
- this.btnSightsDelete.Enabled = true;
- this.btnSightsSet.Enabled = true;
- }
- }
- }
- /// <summary>
- /// 景点绑定处理数据对象
- /// </summary>
- public class SightsHeaderModel
- {
- public SightsHeaderModel()
- {
- }
- #region 对象属性字段
- int _TheScenery_ID = 0;
- private string _PgmID = "";
- string _ProductName = "";
- private string _SightsLevel = "";
- string _SightsLevelName = "";
- private string _SightsType = "";
- private string _SightsOrderID = "";
- private string _SightsCostPrice = "";
- private string _SightsRemark = "";
- string _OpenOrderRemark = "";
- string _OpenOrderSource = "";
- int _ClothingSetsNumber = 0;
- string _ReservationPhotographyTime = "";
- string _SKReservationPhotographyTime = "";
- int _IntoRegisterQuantity = 0;
- int _IntoBottomQuantity = 0;
- decimal _SalesPrice = 0;
- /// <summary>
- /// 景点表 景点ID (选择套系时传的的景点ID)如果ID 不存在说明该景点已被删除
- /// </summary>
- public int TheScenery_ID
- {
- get { return _TheScenery_ID; }
- set { _TheScenery_ID = value; }
- }
- /// <summary>
- /// 景点销售价格
- /// </summary>
- public decimal SalesPrice
- {
- get { return _SalesPrice; }
- set { _SalesPrice = value; }
- }
- /// <summary>
- /// 成长套系时的入册数
- /// </summary>
- public int IntoRegisterQuantity
- {
- get { return _IntoRegisterQuantity; }
- set { _IntoRegisterQuantity = value; }
- }
- /// <summary>
- /// 成长套系时的入底数
- /// </summary>
- public int IntoBottomQuantity
- {
- get { return _IntoBottomQuantity; }
- set { _IntoBottomQuantity = value; }
- }
- /// <summary>
- /// 景点名
- /// </summary>
- public string ProductName
- {
- get { return _ProductName; }
- set { _ProductName = value; }
- }
- /// <summary>
- /// 摄控本预约拍照时间
- /// </summary>
- public string SKReservationPhotographyTime
- {
- get { return _SKReservationPhotographyTime; }
- set { _SKReservationPhotographyTime = value; }
- }
- /// <summary>
- /// 开单时预约拍照
- /// </summary>
- public string ReservationPhotographyTime
- {
- get { return _ReservationPhotographyTime; }
- set { _ReservationPhotographyTime = value; }
- }
- /// <summary>
- /// 套系赠送商品ID(用于检查是否修改过套系商品)
- /// </summary>
- public string PgmID
- {
- get { return _PgmID; }
- set { _PgmID = value; }
- }
- /// <summary>
- /// 服装套数
- /// </summary>
- public int ClothingSetsNumber
- {
- get { return _ClothingSetsNumber; }
- set { _ClothingSetsNumber = value; }
- }
- /// <summary>
- /// 景点级别 码
- /// </summary>
- public string SightsLevel
- {
- get { return _SightsLevel; }
- set { _SightsLevel = value; }
- }
- /// <summary>
- /// 景点级别 名称
- /// </summary>
- public string SightsLevelName
- {
- get { return _SightsLevelName; }
- set { _SightsLevelName = value; }
- }
- /// <summary>
- /// 景点类别(内景、外景)
- /// </summary>
- public string SightsType
- {
- get { return _SightsType; }
- set { _SightsType = value; }
- }
- /// <summary>
- /// 订单景点ID
- /// </summary>
- public string SightsOrderID
- {
- get { return _SightsOrderID; }
- set { _SightsOrderID = value; }
- }
- /// <summary>
- /// 成本价
- /// </summary>
- public string SightsCostPrice
- {
- get { return _SightsCostPrice; }
- set { _SightsCostPrice = value; }
- }
- /// <summary>
- /// 景点备注
- /// </summary>
- public string SightsRemark
- {
- get { return _SightsRemark; }
- set { _SightsRemark = value; }
- }
- /// <summary>
- /// 开单时添加的景点备注
- /// </summary>
- public string OpenOrderRemark
- {
- get { return _OpenOrderRemark; }
- set { _OpenOrderRemark = value; }
- }
- /// <summary>
- /// 开单时景点来源(为空时 表示来源于套系或人工添加 )主要标记下是否为源于礼包
- /// </summary>
- public string OpenOrderSource
- {
- get { return _OpenOrderSource; }
- set { _OpenOrderSource = value; }
- }
- #endregion
- /// <summary>
- /// 景点类型值转为显示文字(0 为内景 1 为外景)
- /// </summary>
- /// <returns></returns>
- public string SightsTypeToCategoryText()
- {
- string retText = "";
- switch (this.SightsType)
- {
- case "0": retText = "内景"; break;
- case "1": retText = "外景"; break;
- case "2": retText = "次数"; break;
- }
- return retText;
- }
- /// <summary>
- /// 选择套系名称时,将套系景点数据转为当前对象
- /// </summary>
- /// <param name="row"></param>
- public void TaoXiToSightsHeaderModel(DataRow row)
- {
- try
- {
- if (row["ID"] != null && !String.IsNullOrEmpty(row["ID"].ToString()))
- {
- this.TheScenery_ID = Convert.ToInt32(row["ID"].ToString());
- }
- }
- catch {
- this.TheScenery_ID = 0;
- }
- this.PgmID = row["PgmID"].ToString().Trim();
- this.SightsLevel = row["Tsc_Rating"].ToString().Trim();
- this.SightsLevelName = row["Sc_ClassName"].ToString().Trim();
- this.SightsType = row["Tcs_Category"].ToString().Trim();
- this.SightsOrderID = "";
- this.SightsCostPrice = row["Tsc_CostPrice"].ToString().Trim();
- this.SightsRemark = row["Tsc_Remark"].ToString().Trim();
- this.ProductName = row["Pgm_ProductName"].ToString().Trim();
- try
- {
- this.SalesPrice = Convert.ToDecimal(row["Tsc_SalesPrice"].ToString());
- }
- catch {
- this.SalesPrice = 0;
- }
- this.OpenOrderRemark = "";
- this.OpenOrderSource = row["TaoXiNameSource"].ToString().Trim();
- try
- {
- this.ClothingSetsNumber = Convert.ToInt32(row["Pgm_Quantity"].ToString().Trim());
- }
- catch {
- this.ClothingSetsNumber = 0;
- }
- this.ReservationPhotographyTime = "";
- try
- {
- this.IntoRegisterQuantity = Convert.ToInt32(row["Pgm_IntoRegisterQuantity"].ToString().Trim());
- }
- catch
- {
- this.IntoRegisterQuantity = 0;
- }
- try
- {
- this.IntoBottomQuantity = Convert.ToInt32(row["Pgm_IntoBottomQuantity"].ToString().Trim());
- }
- catch
- {
- this.IntoBottomQuantity = 0;
- }
-
- }
- /// <summary>
- /// 打开订单时加载的订单数据,将订单景点数据转为当前对象
- /// </summary>
- /// <param name="row"></param>
- public void OpenOrderToSightsHeaderModel(DataRow row)
- {
-
- this.TheScenery_ID = 0;
- this.SightsLevel = row["Ordpg_SightsLevel"].ToString().Trim();
- this.SightsLevelName = row["Sc_ClassName"].ToString().Trim();
- this.SightsType = row["Ordpg_SightsType"].ToString().Trim();
- this.SightsOrderID = row["ID"].ToString().Trim();
- this.SightsCostPrice = row["Ordpg_CostPrice"].ToString().Trim();
- this.SightsRemark = row["Ordpg_SightsRemark"].ToString().Trim();
- this.ProductName = row["Ordpg_Sights"].ToString().Trim();
- try
- {
-
- this.SalesPrice = Convert.ToDecimal(row["Ordpg_SalesPrice"].ToString());
- }
- catch
- {
- this.SalesPrice = 0;
- }
- this.OpenOrderRemark = row["Ordpg_OpenOrderRemark"].ToString().Trim();
- this.OpenOrderSource = row["Ordpg_OpenOrderSource"].ToString().Trim();
- try
- {
- this.ClothingSetsNumber = Convert.ToInt32(row["Ordpg_ApparelQuantity"].ToString().Trim());
- }
- catch
- {
- this.ClothingSetsNumber = 0;
- }
- this.SKReservationPhotographyTime= LYFZ.Command.Command_Validate.DateTimeToString(row["Ordpg_ReservationPhotographyTime"], "yyyy-MM-dd HH:mm");
- this.ReservationPhotographyTime = LYFZ.Command.Command_Validate.DateTimeToString(row["Ordpg_ReservationPhotographyTime"]);//row["Ordpg_ReservationPhotographyTime"].ToString().Trim().Split(' ')[0];
- try
- {
- this.IntoRegisterQuantity = Convert.ToInt32(row["Pgm_IntoRegisterQuantity"].ToString().Trim());
- }
- catch
- {
- this.IntoRegisterQuantity = 0;
- }
- try
- {
- this.IntoBottomQuantity = Convert.ToInt32(row["Pgm_IntoBottomQuantity"].ToString().Trim());
- }
- catch
- {
- this.IntoBottomQuantity = 0;
- }
- }
- /// <summary>
- /// 添加和浏览添加景点时 转TheScenery数据为当前对象
- /// </summary>
- /// <param name="tScenery"></param>
- public void TheSceneryToSightsHeaderModel(LYFZ.Model.Model_ErpTheScenery tScenery)
- {
- this.TheScenery_ID = 0;
- this.SightsLevel = tScenery.Tsc_Rating.Trim();
- this.SightsLevelName = LYFZ.BLL.WageStatisticsProcess.SystemCodeToCodeName(tScenery.Tsc_Rating.Trim());
- this.SightsType = tScenery.Tcs_Category.ToString().Trim();
- this.SightsOrderID = "";
- this.SightsCostPrice = tScenery.Tsc_CostPrice.ToString().Trim();
- this.SightsRemark = tScenery.Tsc_Remark;
- this.ProductName = tScenery.Tsc_Name.Trim();
- this.SalesPrice = tScenery.Tsc_SalesPrice;
- this.OpenOrderRemark = "";
- this.OpenOrderSource = "";
- this.ClothingSetsNumber = 1;
- this.ReservationPhotographyTime ="";
- this.IntoRegisterQuantity = 0;
- this.IntoBottomQuantity = 0;
- }
- /// <summary>
- /// 更换景点时 更新对象
- /// </summary>
- /// <param name="tScenery"></param>
- public void TheSceneryUpdateSightsHeaderModel(LYFZ.Model.Model_ErpTheScenery tScenery)
- {
- this.OpenOrderRemark = String.Format("由'{0}'更换为'{1}'", this.ProductName, tScenery.Tsc_Name.Trim());
- this.SightsLevel = tScenery.Tsc_Rating.Trim();
- this.SightsLevelName = LYFZ.BLL.WageStatisticsProcess.SystemCodeToCodeName(tScenery.Tsc_Rating.Trim());
- this.SightsType = tScenery.Tcs_Category.ToString().Trim();
- this.SightsCostPrice = tScenery.Tsc_CostPrice.ToString().Trim();
- this.SightsRemark = tScenery.Tsc_Remark;
- this.ProductName = tScenery.Tsc_Name.Trim();
- this.SalesPrice = tScenery.Tsc_SalesPrice;
- this.ClothingSetsNumber = 1;
- }
- }
- }
|