using LYFZ.Software.MainBusiness.Dresses.DressView; using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace LYFZ.Software.MainBusiness.Dresses.SetSmallForm { public partial class DressOpenOrdePreselectedSmallForm : LYFZ.Software.UI.Dresses.SetSmallForm.DressOpenOrdePreselectedSmallForm { LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder(); LYFZ.BLL.BLL_ErpDressFrom sfbll = new BLL.BLL_ErpDressFrom(); LYFZ.BLL.BLL_ErpCustomer ctbll = new BLL.BLL_ErpCustomer(); LYFZ.BLL.BLL_ErpSystemConfigure sgbll = new BLL.BLL_ErpSystemConfigure(); LYFZ.BLL.BLL_ErpDressSaleRentalOrder dsrobll = new BLL.BLL_ErpDressSaleRentalOrder(); LYFZ.BLL.BLL_ErpDressSaleRentalDetail dsrdbll = new BLL.BLL_ErpDressSaleRentalDetail(); List dressCustomerList = new List(); public DressOpenOrdePreselectedSmallForm() { this.Load += DressOpenOrdePreselectedFormMain_Load; this.Shown += DressOpenOrdePreselectedFormMain_Shown; this.btn_AddCustomer.Click+=btn_AddCustomer_Click; this.btnNewOrder.Click += btnNewOrder_Click; this.btnTurnRent.Click += btnTurnRent_Click; this.btnTurnSale.Click += btnTurnSale_Click; this.btnSaveed.Click += btnSaveed_Click; this.btnCloseed.Click += btnCloseed_Click; this.btnDressDelete.Click += btnDressDelete_Click; this.btnDressToolbox.Click += btnDressToolbox_Click; this.FormClosing += DressOpenOrderFormMain_FormClosing; this.FormClosed += DressOpenOrderFormMain_FormClosed; } private void btn_AddCustomer_Click(object sender, EventArgs e) { UCDressCustomer ucdressCustomer = new UCDressCustomer(); panel_CustomerItem.Controls.Add(ucdressCustomer); ucdressCustomer.Location = new Point(0, dressCustomerList.Count*120); ucdressCustomer.buttonForm1.Click += buttonForm1_Click; dressCustomerList.Add(ucdressCustomer); ucdressCustomer.StrOrderNumber = this.StrOrderNumber; ucdressCustomer.IsUpdateClientData = this.IsUpdateClientData; SetPanelItemHeight(); } public void SetPanelItemHeight() { int height = 0; foreach(var item in dressCustomerList) { height += 120; } panel_CustomerItem.Size = new System.Drawing.Size(panel_CustomerItem.Size.Width, height); } void buttonForm1_Click(object sender, EventArgs e) { if(MessageBoxCustom.Show("确定删除当前联系人信息?","提示", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { dressCustomerList.Remove((UCDressCustomer)(((Control)sender).Parent)); panel_CustomerItem.Controls.Remove(((Control)sender).Parent); SetPanelItemHeight(); } } public string AutoNumber = ""; public string SysNumber = ""; /// /// 订单号 /// public string StrOrderNumber = ""; /// /// 是否保存 /// public bool IsSaveed = false; /// /// 相片集合 /// ImageList mlistImage = new ImageList(); /// /// 是否能修改客户资料 /// bool IsUpdateClientData = true; /// /// 登录都编号 /// string StrUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; /// /// 登录都姓名 /// string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name; /// /// 用于排序的类 /// LYFZ.ComponentLibrary.ListViewColumnSorter lvwColumnSorter; /// /// 窗体加载事件 /// /// /// void DressOpenOrdePreselectedFormMain_Load(object sender, EventArgs e) { this.listViewData.View = View.Details; this.listViewData.GridLines = true; panel_CustomerItem.Padding = new Padding(18, 0, 0, 0); string[] StrColumns = ("礼服编号,礼服名称,礼服尺寸,礼服数量,出租价格,出售价格").Split(','); for (int i = 0; i < StrColumns.Length; i++) { ColumnHeader ch = new ColumnHeader(); ch.Text = StrColumns[i].Trim(); ch.Width = (this.listViewData.Width - 23) / 6; if (StrColumns[i].Trim() == "出租价格" || StrColumns[i].Trim() == "出售价格") { ch.TextAlign = HorizontalAlignment.Right; } else if (StrColumns[i].Trim() == "礼服数量") { ch.TextAlign = HorizontalAlignment.Center; } else { ch.TextAlign = HorizontalAlignment.Left; } this.listViewData.Columns.Add(ch); } this.mlistImage.ImageSize = new Size(25, 25); this.mlistImage.ColorDepth = ColorDepth.Depth32Bit; this.listViewData.SmallImageList = mlistImage; lvwColumnSorter = new ComponentLibrary.ListViewColumnSorter(); this.listViewData.ListViewItemSorter = lvwColumnSorter; UCDressCustomer ucdressCustomer = new UCDressCustomer(); ucdressCustomer.BindShowAndHideDelete(false); panel_CustomerItem.Controls.Add(ucdressCustomer); dressCustomerList.Add(ucdressCustomer); ucdressCustomer.StrOrderNumber = this.StrOrderNumber; ucdressCustomer.IsUpdateClientData = this.IsUpdateClientData; SetPanelItemHeight(); } /// /// 窗体加载事件 /// /// /// void DressOpenOrdePreselectedFormMain_Shown(object sender, EventArgs e) { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.cmbtreevOrderPerson, IsFirstNodeNull: true, IsShowResign: false, IsShowAdmin: false); if (!string.IsNullOrEmpty(this.StrOrderNumber)) { this.txtOrderNumber.Text = this.StrOrderNumber; this.OpenOrderData(); } else { this.btnTurnRent.Visible = false; this.btnTurnSale.Visible = false; this.txtOrderNumber.Text = LYFZ.BLL.BLL_ErpOrder.GenerateNewDressNumber(LYFZ.EnumPublic.EnumDressOrderType.预选); this.txtEnterName.Text = this.StrUserName; this.txtCreateDateTime.Text = SDateTime.Now.ToString("yyyy-MM-dd"); this.btnSaveed.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DressManagement, CustomAttributes.OperatingAuthority.Dress_Rental); } this.TopMost = false; SysNumber = this.StrOrderNumber; if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.AutoDressOrderNumber) { txtOrderNumber.ReadOnly = false; } } /// /// 打开订单数据 /// void OpenOrderData() { DataTable dtOrder = orbll.GetView_Custom("tb_ErpDressSaleRentalOrder Left Join tb_ErpUser on User_EmployeeID = Dsro_HandledName", StrWhere: "Dsro_Number = '" + this.StrOrderNumber + "'", ShowColumnName: "Dsro_Number,Dsro_CreateName,User_Name,Dsro_CreateDateTime,Dsro_Remark,Dsro_CustomerNumber,Dsro_AutoNumber").Tables[0]; if (dtOrder.Rows.Count > 0) { //this.btnClientSelect.Visible = false; //this.txtClientName.Width = this.txtClientQQ.Width; this.cmbtreevOrderPerson.TagFindText(dtOrder.Rows[0]["Dsro_CreateName"]); this.txtEnterName.Text = dtOrder.Rows[0]["User_Name"].ToString().Trim(); this.txtCreateDateTime.Text = LYFZ.Command.Command_Validate.DateTimeToString(dtOrder.Rows[0]["Dsro_CreateDateTime"]); this.txtRemark.Text = dtOrder.Rows[0]["Dsro_Remark"].ToString().Trim(); this.txtOrderNumber.Text = dtOrder.Rows[0]["Dsro_AutoNumber"].ToString().Trim(); this.txtOrderNumber.Tag = dtOrder.Rows[0]["Dsro_AutoNumber"].ToString().Trim(); if (string.IsNullOrEmpty(this.txtOrderNumber.Text)) { this.txtOrderNumber.Text = dtOrder.Rows[0]["Dsro_Number"].ToString().Trim(); this.txtOrderNumber.Tag = dtOrder.Rows[0]["Dsro_Number"].ToString().Trim(); } //this.GetClientData(dtOrder.Rows[0]["Dsro_CustomerNumber"].ToString().Trim()); string[] customerList = dtOrder.Rows[0]["Dsro_CustomerNumber"].ToString().Trim().Split(','); if (customerList.Length>1) { for (int i = 1; i < customerList.Length;i++ ) { UCDressCustomer ucdressCustomer = new UCDressCustomer(); ucdressCustomer.Location = new Point(0, dressCustomerList.Count * 120); panel_CustomerItem.Controls.Add(ucdressCustomer); ucdressCustomer.buttonForm1.Click += buttonForm1_Click; dressCustomerList.Add(ucdressCustomer); ucdressCustomer.StrOrderNumber = this.StrOrderNumber; ucdressCustomer.IsUpdateClientData = this.IsUpdateClientData; SetPanelItemHeight(); } } for (int i = 0; i < customerList.Length; i++) { dressCustomerList[i].GetClientData(customerList[i]); dressCustomerList[i].ReBindOrderNumber(); } this.IsUpdateClientData = false; DataTable dt = orbll.GetView_Custom("tb_ErpDressSaleRentalDetail Left Join tb_ErpDressFrom on Dsfm_DressNumber = Dsrd_DressNumber", StrWhere: "Dsrd_Number = '" + this.StrOrderNumber + "'", ShowColumnName: "tb_ErpDressSaleRentalDetail.ID,Dsrd_DressNumber,Dsfm_DressCustomNumber,Dsrd_DressName,Dsfm_DressSize,Dsrd_CostPrice,Dsrd_RentPrice,Dsrd_SalePrice,Dsfm_DressPhotoNames").Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { string[] StrArrayList = dt.Rows[i]["Dsfm_DressPhotoNames"].ToString().Trim().Split('|'); if (!this.mlistImage.Images.Keys.Contains(dt.Rows[i]["Dsrd_DressNumber"].ToString().Trim())) { Image img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDressImage_Small(StrArrayList[0].Trim()); try { this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate() { this.mlistImage.Images.Add(dt.Rows[i]["Dsrd_DressNumber"].ToString().Trim(), img); })); } catch { } } ListViewItem lvItem = new ListViewItem(); LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel modelColumn = new DressOpenOrderRentSaleFormMain_ColumnHeaderModel(); modelColumn.StrDressNumber = dt.Rows[i]["Dsrd_DressNumber"].ToString().Trim(); modelColumn.StrCostPrice = dt.Rows[i]["Dsrd_CostPrice"].ToString().Trim(); modelColumn.StrDressPhotoNames = dt.Rows[i]["Dsfm_DressPhotoNames"].ToString().Trim(); modelColumn.ID = Convert.ToInt32(dt.Rows[i]["ID"]); lvItem.Tag = modelColumn; lvItem.ImageKey = dt.Rows[i]["Dsrd_DressNumber"].ToString().Trim(); lvItem.Text = dt.Rows[i]["Dsfm_DressCustomNumber"].ToString().Trim(); ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem(); ListSubItem.Name = "礼服名称"; ListSubItem.Text = dt.Rows[i]["Dsrd_DressName"].ToString().Trim(); lvItem.SubItems.Add(ListSubItem); ListSubItem = new ListViewItem.ListViewSubItem(); ListSubItem.Name = "礼服尺寸"; ListSubItem.Text = dt.Rows[i]["Dsfm_DressSize"].ToString().Trim(); lvItem.SubItems.Add(ListSubItem); ListSubItem = new ListViewItem.ListViewSubItem(); ListSubItem.Name = "礼服数量"; ListSubItem.Text = "1"; lvItem.SubItems.Add(ListSubItem); ListSubItem = new ListViewItem.ListViewSubItem(); ListSubItem.Name = "出租价格"; ListSubItem.Text = dt.Rows[i]["Dsrd_RentPrice"].ToString().Trim(); lvItem.SubItems.Add(ListSubItem); ListSubItem = new ListViewItem.ListViewSubItem(); ListSubItem.Name = "出售价格"; ListSubItem.Text = dt.Rows[i]["Dsrd_SalePrice"].ToString().Trim(); lvItem.SubItems.Add(ListSubItem); this.listViewData.Items.Add(lvItem); LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData); } } } /// /// 新订单 /// /// /// void btnNewOrder_Click(object sender, EventArgs e) { if (MessageBoxCustom.Show("重置后将清空所有数据,您确定要重置新订单吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { this.IsGoForm = true; this.Close(); } } /// /// 转为出租订单 /// /// /// void btnTurnRent_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.StrOrderNumber)) { MessageBoxCustom.Show("订单未保存,不能直接转为出租订单!"); return; } LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleSmallForm frm = new SetSmallForm.DressOpenOrderRentSaleSmallForm(); frm.StrOrderNumber = this.StrOrderNumber; frm.LoadType = "出租"; frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual; frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y); frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height); frm.BringToFront(); frm.Show(); this.isClose = false; this.Hide(); } /// /// 转为出售订单 /// /// /// void btnTurnSale_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.StrOrderNumber)) { MessageBoxCustom.Show("订单未保存,不能直接转为出售订单!"); return; } LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleSmallForm frm = new SetSmallForm.DressOpenOrderRentSaleSmallForm(); frm.StrOrderNumber = this.StrOrderNumber; frm.LoadType = "出售"; frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual; frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y); frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height); frm.BringToFront(); frm.Show(); this.isClose = false; this.Hide(); } Hashtable htData_del = new Hashtable(); /// /// 保存 /// /// /// void btnSaveed_Click(object sender, EventArgs e) { LYFZ.Model.Model_ErpDressSaleRentalOrder DressRentalModel = null; LYFZ.Model.Model_ErpDressSaleRentalDetail DressRentalDetailModel = null; #region 判断输入框不能为空 if (string.IsNullOrEmpty(this.txtOrderNumber.Text.Trim())) { MessageBoxCustom.Show("单号不能为空!"); return; } if (string.IsNullOrEmpty(this.cmbtreevOrderPerson.Text.Trim())) { MessageBoxCustom.Show("销售人员不能为空!"); return; } foreach(var item in dressCustomerList) { LYFZ.Command.Result result = item.CheckCustomerData(); if(!result.Status) { return ; } } #endregion DateTime StrTime = SDateTime.Now; List clist = new List(); string StrClientNumber = ""; string StrClientName = ""; string StrClientTelephone = ""; #region 客户 foreach (var item in dressCustomerList) { LYFZ.Command.Result result = item.SaveCustomerData(ref StrClientName, ref StrClientTelephone); if(result.Status) { if (!string.IsNullOrEmpty(StrClientNumber)) { StrClientNumber += ","; } StrClientNumber += result.StatusMsg; clist.AddRange(((LYFZ.Command.Result>)result).clist); } else { return; } } #endregion /*#region 客户 string StrClientNumber = ""; if (this.txtClientName.Tag != null) { StrClientNumber = this.txtClientName.Tag.ToString().Trim(); } else { if (ctbll.Exists("Cus_Telephone", StrTelephone) == true)//判断手机存在 { MessageBoxCustom.Show("客户手机已经存在"); return; } LYFZ.Model.Model_ErpCustomer model = new Model.Model_ErpCustomer(); model.Cus_CustomerNumber = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().ToString("yyyyMMddHHmmssfff") + "1";//获取新编号 model.Cus_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID(); model.Cus_CustomizeNumber = ""; model.Cus_Type = "订单客户"; model.Cus_ServiceType = "Clothing"; model.Cus_Name = this.txtClientName.Text.ToString().Trim(); model.Cus_Telephone = this.txtClientTelephone.Text.ToString().Trim(); model.Cus_QQ = this.txtClientQQ.Text.ToString().Trim(); model.Cus_Address = this.txtClientAddress.Text.ToString().Trim(); model.Cus_WorkUnit = this.txtClientWorkUnit.Text.ToString().Trim(); model.Cus_Birthday = this.txtClientBirthday.StrValue.Trim(); if (this.chkClientBirthdayLunar.Checked == true) { model.Cus_BirthdayLunar = "1"; } else { model.Cus_BirthdayLunar = "0"; } model.Cus_DayForMarriage = this.txtClientDayForMarriage.StrValue.ToString(); if (this.chkClientDayForMarriageLunar.Checked == true) { model.Cus_DayForMarriageLunar = "1"; } else { model.Cus_DayForMarriageLunar = "0"; } model.Cus_CreateDateTime = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime(); model.Cus_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; clist.Add(ctbll.GetAddCommandInfo(model)); StrClientNumber = model.Cus_CustomerNumber; } #endregion*/ #region 检查自定义单号是否存在 if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.AutoDressOrderNumber) { DataTable tbl = orbll.GetView_Custom("tb_ErpDressSaleRentalOrder", StrWhere: "Dsro_AutoNumber = '" + this.txtOrderNumber.Text + "'", ShowColumnName: "ID").Tables[0]; if (string.IsNullOrEmpty(StrOrderNumber)) { if (tbl.Rows.Count > 0) { MessageBoxCustom.Show("自定义单号重复!"); return; } } else { if (this.txtOrderNumber.Text == (this.txtOrderNumber.Tag == null ? "" : this.txtOrderNumber.Tag.ToString())) { if (tbl.Rows.Count > 1) { MessageBoxCustom.Show("自定义单号重复!"); return; } } else { if (tbl.Rows.Count > 0) { MessageBoxCustom.Show("自定义单号重复!"); return; } } } } #endregion #region 检测订单号是否有存在 if (string.IsNullOrEmpty(SysNumber)) { bool IsFind = true; while (IsFind) { if (string.IsNullOrEmpty(SysNumber)) { SysNumber = LYFZ.BLL.BLL_ErpOrder.GenerateNewDressNumber(LYFZ.EnumPublic.EnumDressOrderType.出租); if (!LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.AutoDressOrderNumber) { this.txtOrderNumber.Text = SysNumber; } } DataTable tbl = orbll.GetView_Custom("tb_ErpDressSaleRentalOrder", StrWhere: "Dsro_Number = '" + SysNumber + "'", ShowColumnName: "ID").Tables[0]; if (tbl.Rows.Count <= 0) { IsFind = false; } else { //this.txtOrderNumber.Text SysNumber= LYFZ.BLL.BLL_ErpOrder.GenerateNewDressNumber(LYFZ.EnumPublic.EnumDressOrderType.出租); if (!LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.AutoDressOrderNumber) { this.txtOrderNumber.Text = SysNumber; } } } } #endregion #region 礼服预选订单 if (!string.IsNullOrEmpty(StrOrderNumber)) { DressRentalModel = dsrobll.GetModel("Dsro_Number", this.StrOrderNumber); DressRentalModel.Dsro_UpdateDateTime = StrTime; DressRentalModel.Dsro_UpdateName = this.StrUserID; DressRentalModel.Dsro_CustomerNumber = StrClientNumber; } else { DressRentalModel = new Model.Model_ErpDressSaleRentalOrder(); DressRentalModel.Dsro_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID(); DressRentalModel.Dsro_Number = SysNumber; DressRentalModel.Dsro_AutoNumber = this.txtOrderNumber.Text.Trim(); DressRentalModel.Dsro_CustomerNumber = StrClientNumber; DressRentalModel.Dsro_CreateDateTime = StrTime; DressRentalModel.Dsro_CreateName = this.cmbtreevOrderPerson.Tag.ToString().Trim(); DressRentalModel.Dsro_HandledName = this.StrUserID; } DressRentalModel.Dsro_CustomerName = StrClientName; DressRentalModel.Dsro_CustomerTelephone = StrClientTelephone; DressRentalModel.Dsro_Type = "2"; DressRentalModel.Dsro_Amount = 0; DressRentalModel.Dsro_MortgageAmount = 0; DressRentalModel.Dsro_AutoNumber = this.txtOrderNumber.Text.Trim(); DressRentalModel.Dsro_Remark = this.txtRemark.Text.Trim(); if (!string.IsNullOrEmpty(StrOrderNumber)) { clist.Add(dsrobll.GetUpdateCommandInfo((DressRentalModel))); } else { clist.Add(dsrobll.GetAddCommandInfo((DressRentalModel))); } #endregion #region 预选礼服详情表 foreach (DictionaryEntry item in htData_del) { clist.Add(dsrdbll.GetDeleteCommandInfo("ID", "=", item.Key.ToString().Trim())); } for (int i = 0; i < this.listViewData.Items.Count; i++) { LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel modelColumns = (DressOpenOrderRentSaleFormMain_ColumnHeaderModel)this.listViewData.Items[i].Tag; if (modelColumns.ID <= 0) { DressRentalDetailModel = new Model.Model_ErpDressSaleRentalDetail(); DressRentalDetailModel.Dsrd_Number = DressRentalModel.Dsro_Number; DressRentalDetailModel.Dsrd_DressNumber = this.listViewData.Items[i].ImageKey.ToString().Trim(); DressRentalDetailModel.Dsrd_DressName = this.listViewData.Items[i].SubItems["礼服名称"].Text.Trim(); DressRentalDetailModel.Dsrd_SaleRentalQuantity = Convert.ToInt32(this.listViewData.Items[i].SubItems["礼服数量"].Text.Trim()); DressRentalDetailModel.Dsrd_CostPrice = Convert.ToDecimal(modelColumns.StrCostPrice); DressRentalDetailModel.Dsrd_SalePrice = Convert.ToDecimal(this.listViewData.Items[i].SubItems["出售价格"].Text.Trim()); DressRentalDetailModel.Dsrd_RentPrice = Convert.ToDecimal(this.listViewData.Items[i].SubItems["出租价格"].Text.Trim()); DressRentalDetailModel.Dsrd_CreateDateTime = StrTime; DressRentalDetailModel.Dsrd_CreateName = StrUserID; DressRentalDetailModel.Dsrd_BackTime = Convert.ToDateTime(null); DressRentalDetailModel.Dsrd_BackRemark = ""; DressRentalDetailModel.Dsrd_BackStatus = "3"; clist.Add(dsrdbll.GetAddCommandInfo(DressRentalDetailModel)); } } #endregion if (clist.Count > 0) { if (MessageBoxCustom.Show("您确定要保存吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No) { return; } if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0) { this.IsSaveed = true; this.StrOrderNumber = SysNumber; this.btnTurnRent.Visible = true; this.btnTurnSale.Visible = true; MessageBoxCustom.Show("保存成功!"); for (int i = 0; i < this.listViewData.Items.Count; i++) { this.listViewData.Items[i].ForeColor = Color.Black; } } else { MessageBoxCustom.Show("保存失败!"); } } } /// /// 关闭 /// /// /// void btnCloseed_Click(object sender, EventArgs e) { isClose = false; if (!isClose) { if (MessageBoxCustom.Show("你确定要关闭吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No) { return; } } this.Close(); } /// /// 移除礼服 /// /// /// void btnDressDelete_Click(object sender, EventArgs e) { if (this.listViewData.Items.Count > 0) { if (MessageBoxCustom.Show("删除后无法找回,您确定要删除吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No) { return; } List delItem = new List(); for (int i = 0; i < this.listViewData.SelectedItems.Count; i++) { LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel modelColumn = (DressOpenOrderRentSaleFormMain_ColumnHeaderModel)this.listViewData.SelectedItems[i].Tag; if (modelColumn.ID > 0) { this.htData_del[modelColumn.ID] = this.listViewData.SelectedItems[i].ImageKey.ToString().Trim(); } delItem.Add(this.listViewData.SelectedItems[i]); } for (int i = 0; i < delItem.Count; i++) { this.listViewData.Items.Remove(delItem[i]); } } } /// /// 礼服工具箱 /// /// /// void btnDressToolbox_Click(object sender, EventArgs e) { LYFZ.Software.MainBusiness.Dresses.SetSmallForm.ToolboxDressSamllForm frm = new ToolboxDressSamllForm(); frm.WindowState = FormWindowState.Maximized; frm.ShowDialog(); if (frm.IsSaveed) { List frmList = frm.listSelect; for (int i = 0; i < this.listViewData.Items.Count; i++) { LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel modelColumn = (DressOpenOrderRentSaleFormMain_ColumnHeaderModel)this.listViewData.Items[i].Tag; if (frmList.Contains(modelColumn.StrDressNumber.Trim())) { frmList.Remove(modelColumn.StrDressNumber.Trim()); } } if (frmList.Count > 0) { string StrWhere = ""; for (int i = 0; i < frmList.Count; i++) { StrWhere += "'" + frmList[i].Trim() + "',"; } StrWhere = "Dsfm_DressNumber in (" + StrWhere.TrimEnd(',') + ")"; DataTable dt = orbll.GetView_Custom("tb_ErpDressFrom", StrWhere: StrWhere, ShowColumnName: "Dsfm_DressNumber,Dsfm_DressCustomNumber,Dsfm_DressName,Dsfm_DressSize,Dsfm_CostPrice,Dsfm_RentPrice,Dsfm_SalePrice,Dsfm_DressPhotoNames").Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string[] StrArrayList = dt.Rows[i]["Dsfm_DressPhotoNames"].ToString().Trim().Split('|'); if (!this.mlistImage.Images.Keys.Contains(dt.Rows[i]["Dsfm_DressNumber"].ToString().Trim())) { Image img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDressImage_Small(StrArrayList[0].Trim()); try { this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate() { this.mlistImage.Images.Add(dt.Rows[i]["Dsfm_DressNumber"].ToString().Trim(), img); })); } catch { } } ListViewItem lvItem = new ListViewItem(); lvItem.ForeColor = Color.Red; LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel modelColumn = new DressOpenOrderRentSaleFormMain_ColumnHeaderModel(); modelColumn.StrDressNumber = dt.Rows[i]["Dsfm_DressNumber"].ToString().Trim(); modelColumn.StrCostPrice = dt.Rows[i]["Dsfm_CostPrice"].ToString().Trim(); modelColumn.StrDressPhotoNames = dt.Rows[i]["Dsfm_DressPhotoNames"].ToString().Trim(); modelColumn.ID = 0; lvItem.Tag = modelColumn; lvItem.ImageKey = dt.Rows[i]["Dsfm_DressNumber"].ToString().Trim(); lvItem.Text = dt.Rows[i]["Dsfm_DressCustomNumber"].ToString().Trim(); ListViewItem.ListViewSubItem ListSubItem = new ListViewItem.ListViewSubItem(); ListSubItem.Name = "礼服名称"; ListSubItem.Text = dt.Rows[i]["Dsfm_DressName"].ToString().Trim(); lvItem.SubItems.Add(ListSubItem); ListSubItem = new ListViewItem.ListViewSubItem(); ListSubItem.Name = "礼服尺寸"; ListSubItem.Text = dt.Rows[i]["Dsfm_DressSize"].ToString().Trim(); lvItem.SubItems.Add(ListSubItem); ListSubItem = new ListViewItem.ListViewSubItem(); ListSubItem.Name = "礼服数量"; ListSubItem.Text = "1"; lvItem.SubItems.Add(ListSubItem); ListSubItem = new ListViewItem.ListViewSubItem(); ListSubItem.Name = "出租价格"; ListSubItem.Text = dt.Rows[i]["Dsfm_RentPrice"].ToString().Trim(); lvItem.SubItems.Add(ListSubItem); ListSubItem = new ListViewItem.ListViewSubItem(); ListSubItem.Name = "出售价格"; ListSubItem.Text = dt.Rows[i]["Dsfm_SalePrice"].ToString().Trim(); lvItem.SubItems.Add(ListSubItem); this.listViewData.Items.Add(lvItem); } LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.ListViewDrawSingleOrDoubleRows(this.listViewData); } } } } /// /// 关闭窗体前判断是否提示 /// private bool isClose = true; /// /// 关闭是否要跳转 /// bool IsGoForm = false; /// /// 关闭窗体前事件 /// /// /// void DressOpenOrderFormMain_FormClosing(object sender, FormClosingEventArgs e) { if (!this.IsGoForm) { if (this.isClose) { if (MessageBoxCustom.Show("你确定要关闭吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No) { e.Cancel = true; } } } } /// /// 关闭窗体后事件 /// /// /// void DressOpenOrderFormMain_FormClosed(object sender, FormClosedEventArgs e) { if (this.IsGoForm) { this.Hide(); LYFZ.Software.MainBusiness.Dresses.DressOpenOrderFirstFormMain frm = new DressOpenOrderFirstFormMain(); frm.StartPosition = FormStartPosition.CenterScreen; frm.TopMost = true; frm.Show(); } } } }