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(); } /// /// 绑定景点等级 /// void BindJingDianDenJi() { FinancialManagement.frmEditStatisticsProgram.BindTreeView_SystemCategory(BLL.BLL_ErpSystemCategory.GetSysTemCategoryCode(BLL.SysTemCategoryCodeType.景点等级).ToUpper(), this.cmbtreevText.TreeView, isExpandAll: false); } /// /// 是否修改了预约时间 /// 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; } /// /// 登录者员工ID /// string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; #region 点击列显示下拉框 /// /// 列表点击事件 /// /// /// void listViewData_Sights_Click(object sender, EventArgs e) { this.txtText.Visible = false; this.cmbtreevText.Visible = false; } /// /// 列表双击事件 /// /// /// 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; } } } /// /// 服装套数输入限制 /// /// /// 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; } } } } /// /// 服装套数离开事件 /// /// /// 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); } /// /// 拍摄级别离开事件 /// /// /// 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 /// /// 景点添加 /// /// /// 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); } } /// /// 景点删除 /// /// /// 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 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(); } /// /// 移除景点 /// /// 设置套系类型,如果是 选择套系时只删除套系景点,如果是选择礼包套系时只删除礼包套系景点 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 listItems = new List(); 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 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); } } } } /// /// 景点设置 /// /// /// 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(); /// /// 当前订单对象 /// public LYFZ.Model.Model_ErpOrder CurrentOrderModel { get { return currentOrderModel; } set { currentOrderModel = value; } } List orderDigitalList = new List(); /// /// 当前打开订单数码表集合 /// public List OrderDigitalList { get { return orderDigitalList; } set { orderDigitalList = value; } } List photographyList = new List(); /// /// 当前打开订单已有景点集合 /// public List OrderPhotographyList { get { return photographyList; } set { photographyList = value; } } /// /// 更换 /// /// /// 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 SightsList = new List(); 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(); } /// /// 浏览选择 /// /// /// void lblBrowseSelect_Click(object sender, EventArgs e) { LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.StyleViewSmallForm frm = new SetSmallForm.StyleViewSmallForm(); frm.frmStyleViewVersion = SetSmallForm.StyleViewSmallForm.StyleViewVersion.景点浏览; List OldSelectStyleList = new List(); 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 mlist = tsybll.GetModelList("Tsc_Name in (" + StrWhere.ToString().TrimEnd(',') + ") And Tsc_Type = '0'"); this.SetOrderSightsValue(mlist); } } } #region 属性 /// /// 是否选择了套系名称 /// private bool IsClickToolbox; /// /// 获取商品的总价 /// /// 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; } /// /// 获取列表详情数据 /// /// 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; } /// /// 获取当前列表 /// /// 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 /// /// 绑定景点的数据信息 /// /// public void GetOrderSightsValueData(Api_ErpOrderModel erpModel) { erpModel.OrderSightData = new List(); 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); } } /// /// 设置景点(添加和浏览时使用) /// /// public void SetOrderSightsValue(List 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(); } /// /// 加载订单时设置拍摄景点数据 /// /// 订单套系名称 /// 订单景点数据 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); } } } /// /// 选择套系时 加载景点 /// /// /// 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[] { "景点名称", "景点价格", "来源", "景点类别", "拍摄级别", "服装套数", "预拍时间", "备注" }; /// /// 设置列表表头 /// 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); } } /// /// 获取新的 ListViewItem /// /// 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; } /// /// 设置 ListViewItem 值 /// /// /// 数据对象 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; } /// /// 检查要添加的景点名在已有列表中是否存在 /// /// /// 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; } /// /// 移除礼包的项目 /// public void RemovePackageItem() { this.RemoveOrderSightsItem( EnumPublic.EnumPackagesType.AAAAACA); } bool _IsActivityTaoXi = false; /// /// 是否为活动套系 /// public bool IsActivityTaoXi { get { return _IsActivityTaoXi; } set { _IsActivityTaoXi=value; } } /// /// 设置是否能操作 /// /// 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; } } } /// /// 景点绑定处理数据对象 /// 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; /// /// 景点表 景点ID (选择套系时传的的景点ID)如果ID 不存在说明该景点已被删除 /// public int TheScenery_ID { get { return _TheScenery_ID; } set { _TheScenery_ID = value; } } /// /// 景点销售价格 /// public decimal SalesPrice { get { return _SalesPrice; } set { _SalesPrice = value; } } /// /// 成长套系时的入册数 /// public int IntoRegisterQuantity { get { return _IntoRegisterQuantity; } set { _IntoRegisterQuantity = value; } } /// /// 成长套系时的入底数 /// public int IntoBottomQuantity { get { return _IntoBottomQuantity; } set { _IntoBottomQuantity = value; } } /// /// 景点名 /// public string ProductName { get { return _ProductName; } set { _ProductName = value; } } /// /// 摄控本预约拍照时间 /// public string SKReservationPhotographyTime { get { return _SKReservationPhotographyTime; } set { _SKReservationPhotographyTime = value; } } /// /// 开单时预约拍照 /// public string ReservationPhotographyTime { get { return _ReservationPhotographyTime; } set { _ReservationPhotographyTime = value; } } /// /// 套系赠送商品ID(用于检查是否修改过套系商品) /// public string PgmID { get { return _PgmID; } set { _PgmID = value; } } /// /// 服装套数 /// public int ClothingSetsNumber { get { return _ClothingSetsNumber; } set { _ClothingSetsNumber = value; } } /// /// 景点级别 码 /// public string SightsLevel { get { return _SightsLevel; } set { _SightsLevel = value; } } /// /// 景点级别 名称 /// public string SightsLevelName { get { return _SightsLevelName; } set { _SightsLevelName = value; } } /// /// 景点类别(内景、外景) /// public string SightsType { get { return _SightsType; } set { _SightsType = value; } } /// /// 订单景点ID /// public string SightsOrderID { get { return _SightsOrderID; } set { _SightsOrderID = value; } } /// /// 成本价 /// public string SightsCostPrice { get { return _SightsCostPrice; } set { _SightsCostPrice = value; } } /// /// 景点备注 /// public string SightsRemark { get { return _SightsRemark; } set { _SightsRemark = value; } } /// /// 开单时添加的景点备注 /// public string OpenOrderRemark { get { return _OpenOrderRemark; } set { _OpenOrderRemark = value; } } /// /// 开单时景点来源(为空时 表示来源于套系或人工添加 )主要标记下是否为源于礼包 /// public string OpenOrderSource { get { return _OpenOrderSource; } set { _OpenOrderSource = value; } } #endregion /// /// 景点类型值转为显示文字(0 为内景 1 为外景) /// /// public string SightsTypeToCategoryText() { string retText = ""; switch (this.SightsType) { case "0": retText = "内景"; break; case "1": retText = "外景"; break; case "2": retText = "次数"; break; } return retText; } /// /// 选择套系名称时,将套系景点数据转为当前对象 /// /// 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; } } /// /// 打开订单时加载的订单数据,将订单景点数据转为当前对象 /// /// 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; } } /// /// 添加和浏览添加景点时 转TheScenery数据为当前对象 /// /// 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; } /// /// 更换景点时 更新对象 /// /// 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; } } }