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 DressOpenOrderRentSaleSmallForm : LYFZ.Software.UI.Dresses.SetSmallForm.DressOpenOrderRentSaleSmallForm { 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 DressOpenOrderRentSaleSmallForm() { this.Load += DressOpenOrderRentSaleFormMain_Load; this.Shown += DressOpenOrderRentSaleFormMain_Shown; /*this.txtClientName.KeyDown += txtClientName_KeyDown; this.txtClientName.KeyPress += txtClientName_KeyPress; this.txtClientFixedPhone.KeyPress += txtClientFixedPhone_KeyPress; this.txtClientQQ.KeyPress += txtClientQQ_KeyPress; this.txtClientWorkUnit.KeyPress += txtClientWorkUnit_KeyPress; */ this.btn_AddCustomer.Click += btn_AddCustomer_Click; this.txtRentAmount.KeyPress += txtRentAmount_KeyPress; this.txtDeposit.KeyPress += txtDeposit_KeyPress; this.btnNewOrder.Click += btnNewOrder_Click; this.btnSaveed.Click += btnSaveed_Click; this.btnCloseed.Click += btnCloseed_Click; //this.btnDial.Click += btnDial_Click; //this.btnQQCall.Click += btnQQCall_Click; //this.btnClientSelect.Click += btnClientSelect_Click; this.btnDressDelete.Click += btnDressDelete_Click; this.btnDressToolbox.Click += btnDressToolbox_Click; this.FormClosing += DressOpenOrderFormMain_FormClosing; this.FormClosed += DressOpenOrderFormMain_FormClosed; //this.btn_CustomerEdit.Click += btn_CustomerEdit_Click; //btn_CustomerEdit.Visible = false; } 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(); } 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 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 btn_CustomerEdit_Click(object sender, EventArgs e) { LYFZ.ComponentLibrary.ButtonEx btnEx = (LYFZ.ComponentLibrary.ButtonEx)sender; if (btnEx.Text.Trim() == "编辑") { this.SetCustomerEditEnable(false); btnEx.Text = " 保存"; } else if (btnEx.Text.Trim() == "保存") { if (MessageBoxCustom.Show("如果修改客户信息,当前客户所关联的订单客户信息也会有变化\n是否继续?", "提示", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { LYFZ.Model.Model_ErpCustomer model = new Model.Model_ErpCustomer(); BLL.BLL_ErpCustomer customerBll = new BLL.BLL_ErpCustomer(); model = customerBll.GetModel("Cus_CustomerNumber", this.txtClientName.Tag.ToString().Trim()); 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.rdoNan.Checked) { model.Cus_Sex = false; } else { model.Cus_Sex = true; } 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"; } if (customerBll.Update(model)) { MessageBoxCustom.Show("修改成功!"); } this.SetCustomerEditEnable(true); btnEx.Text = " 编辑"; } } } public void SetCustomerEditEnable(bool bRead) { this.txtClientName.ReadOnly = bRead; this.txtClientTelephone.ReadOnly = bRead; this.txtClientQQ.ReadOnly = bRead; this.txtClientAddress.ReadOnly = bRead; this.txtClientWorkUnit.ReadOnly = bRead; this.txtClientBirthday.ReadOnly = bRead; this.chkClientBirthdayLunar.Enabled = true; this.txtClientDayForMarriage.ReadOnly = bRead; this.chkClientDayForMarriageLunar.Enabled = true; this.txtClientFixedPhone.ReadOnly = bRead; }*/ public string SysNumber = ""; /// /// 加载类型:出租、出售 /// public string LoadType = "出租"; /// /// 订单号 /// 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 DressOpenOrderRentSaleFormMain_Load( object sender, EventArgs e ) { if ( LoadType == "出售" ) { this.panelDeposit.Visible = false; this.panelReservationBackTime.Visible = false; // 出售的礼服,取衣时间不是必填项; this.labelEx16.Text = "取衣时间:"; } this.labelEx1.Text = LoadType + "资料"; this.labelEx2.Text = "* " + LoadType + "金额"; this.listViewData.View = View.Details; this.listViewData.GridLines = true; string StrDressPrice = LoadType + "价格"; string[] StrColumns = ("礼服编号,礼服名称,礼服尺寸,礼服数量," + StrDressPrice + "").Split( ',' ); for ( int i = 0; i < StrColumns.Length; i++ ) { ColumnHeader ch = new ColumnHeader(); ch.Text = StrColumns[i].Trim(); ch.Width = (this.listViewData.Width - 23) / 5; if ( StrColumns[i].Trim() == StrDressPrice ) { 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; this.lvwColumnSorter = new ComponentLibrary.ListViewColumnSorter(); this.listViewData.ListViewItemSorter = this.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 DressOpenOrderRentSaleFormMain_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.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.SysNumber = this.txtOrderNumber.Text; } this.btnSaveed.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights( LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DressManagement, CustomAttributes.OperatingAuthority.Dress_Rental ); this.TopMost = false; this.SysNumber = this.StrOrderNumber; if ( LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.AutoDressOrderNumber ) { txtOrderNumber.ReadOnly = false; } /*if (!string.IsNullOrEmpty(this.StrOrderNumber)) { btn_CustomerEdit.Visible = 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_Type,Dsro_CreateName,Dsro_Amount,Dsro_MortgageAmount,Dsro_TakeDressTime,Dsro_ReservationBackTime,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.txtRentAmount.Text = dtOrder.Rows[0]["Dsro_Amount"].ToString().Trim(); this.txtDeposit.Text = dtOrder.Rows[0]["Dsro_MortgageAmount"].ToString().Trim(); this.dtpTakeDressTime.DateValue = dtOrder.Rows[0]["Dsro_TakeDressTime"].ToString().Trim(); this.dtpReservationBackTime.DateValue = LYFZ.Command.Command_Validate.DateTimeToString( dtOrder.Rows[0]["Dsro_ReservationBackTime"] ); 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 = this.LoadType + "价格"; if ( this.LoadType == "出租" ) { ListSubItem.Text = dt.Rows[i]["Dsrd_RentPrice"].ToString().Trim(); } else { 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 ); } if ( this.listViewData.Items.Count > 0 && dtOrder.Rows[0]["Dsro_Type"].ToString().Trim() != "2" ) { this.dtpTakeDressTime.Enabled = false; } else { this.dtpTakeDressTime.Enabled = true; } } } /* /// /// 清空选择的客户 /// /// /// void txtClientName_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Back) { if (this.txtClientName.Tag != null && string.IsNullOrEmpty(this.StrOrderNumber) && this.IsUpdateClientData) { this.ClearClientData(); } } } /// /// 清空客户信息 /// void ClearClientData() { this.txtClientName.Text = ""; this.txtClientName.Tag = null; this.txtClientTelephone.Text = ""; this.txtClientFixedPhone.Text = ""; this.txtClientQQ.Text = ""; this.txtClientAddress.Text = ""; this.txtClientWorkUnit.Text = ""; this.txtClientBirthday.Text = ""; this.chkClientBirthdayLunar.Checked = false; this.txtClientDayForMarriage.Text = ""; this.chkClientDayForMarriageLunar.Checked = false; this.txtClientName.ReadOnly = false; this.txtClientTelephone.ReadOnly = false; this.txtClientQQ.ReadOnly = false; this.txtClientAddress.ReadOnly = false; this.txtClientWorkUnit.ReadOnly = false; this.txtClientBirthday.ReadOnly = false; this.chkClientBirthdayLunar.Enabled = true; this.txtClientDayForMarriage.ReadOnly = false; this.chkClientDayForMarriageLunar.Enabled = true; this.txtClientFixedPhone.ReadOnly = false; btn_CustomerEdit.Visible = false; btn_CustomerEdit.Text = " 编辑"; } /// /// 客户姓名输入限制 /// /// /// void txtClientName_KeyPress(object sender, KeyPressEventArgs e) { if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar) && !Char.IsLetterOrDigit(e.KeyChar) && e.KeyChar != '_' && e.KeyChar != ' ') { e.Handled = true; } } /// /// 客户固定电话输入限制 /// /// /// void txtClientFixedPhone_KeyPress(object sender, KeyPressEventArgs e) { if (Convert.ToString(e.KeyChar) == "-") { } else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar)) { e.Handled = true; } } /// /// 客户QQ输入限制 /// /// /// void txtClientQQ_KeyPress(object sender, KeyPressEventArgs e) { if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar)) { e.Handled = true; } } /// /// 客户工作单位输入限制 /// /// /// void txtClientWorkUnit_KeyPress(object sender, KeyPressEventArgs e) { if (Convert.ToString(e.KeyChar) == "-") { } else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar) && !Char.IsLetterOrDigit(e.KeyChar)) { e.Handled = true; } }*/ /// /// 订单押金输入限制 /// /// /// void txtDeposit_KeyPress( object sender, KeyPressEventArgs e ) { if ( Convert.ToString( e.KeyChar ) == "." ) { } else if ( !Char.IsNumber( e.KeyChar ) && !Char.IsControl( e.KeyChar ) ) { e.Handled = true; } } /// /// 订单出租金额、出售金额输入限制 /// /// /// void txtRentAmount_KeyPress( object sender, KeyPressEventArgs e ) { if ( Convert.ToString( e.KeyChar ) == "." ) { } else if ( !Char.IsNumber( e.KeyChar ) && !Char.IsControl( e.KeyChar ) ) { e.Handled = true; } } /// /// 新订单 /// /// /// void btnNewOrder_Click( object sender, EventArgs e ) { if ( MessageBoxCustom.Show( "重置后将清空所有数据,您确定要重置新订单吗?", "温馨提示", MessageBoxButtons.YesNo ) == DialogResult.Yes ) { this.IsGoForm = true; this.Close(); } } Hashtable htData_del = new Hashtable(); /// /// 保存 /// /// /// void btnSaveed_Click( object sender, EventArgs e ) { LYFZ.Model.Model_ErpDressSaleRentalOrder DressRentalModel = null; LYFZ.Model.Model_ErpDressSaleRentalDetail DressRentalDetailModel = null; if ( !string.IsNullOrEmpty( StrOrderNumber ) ) { DataTable dt = orbll.GetView_Custom( "BView_DressOrderReport", StrWhere: "订单号 = '" + this.StrOrderNumber + "'", ShowColumnName: "订单状态" ).Tables[0]; if ( dt.Rows.Count > 0 ) { if ( dt.Rows[0]["订单状态"].ToString().Trim() == "OK" ) { MessageBoxCustom.Show( "订单已完成,不能修改!若要操作建议重新开新单!" ); return; } } } #region 判断输入框不能为空 if ( string.IsNullOrEmpty( this.txtOrderNumber.Text.Trim() ) ) { MessageBoxCustom.Show( "单号不能为空!" ); return; } if ( string.IsNullOrEmpty( this.dtpTakeDressTime.DateValue ) && (LoadType != "出售") ) { MessageBoxCustom.Show( "取衣时间不能为空!" ); return; } if ( string.IsNullOrEmpty( this.txtRentAmount.Text.Trim() ) ) { MessageBoxCustom.Show( this.LoadType + "金额不能为空!" ); return; } else { try { Convert.ToDecimal( this.txtRentAmount.Text.Trim() ); } catch { MessageBoxCustom.Show( this.LoadType + "金额输入的金额不正确!" ); 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 #region 判断礼服是否撞期 if ( this.listViewData.Items.Count > 0 ) { if ( (LoadType != "出售") ) { string StrDressClash = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsDressClashDateTime( this.listViewData, Convert.ToDateTime( this.dtpTakeDressTime.DateValue ) ); if ( !string.IsNullOrEmpty( StrDressClash ) ) { MessageBoxCustom.Show( StrDressClash ); return; } } //string StrDressClash = ""; //DataTable dt_DressSaleRentalDetail = orbll.GetView_Custom("View_DressSaleRentalDetail", StrWhere: "Dsro_Type='0' and Dsrd_BackStatus='3'", ShowColumnName: "Id,Dsrd_Number,Dsrd_DressNumber,Dsrd_DressName,Dsrd_SaleRentalQuantity,Dsrd_CostPrice,Dsrd_SalePrice,Dsrd_BackTime,Dsrd_BackStatus,Dsrd_BackRemark,Dsrd_CreateDateTime,Dsrd_CreateName,Dsrd_UpdateDateTime,Dsrd_UpdateName,Dsro_Number,Dsro_Type,Dsro_Amount,Dsro_MortgageAmount,Dsro_CustomerNumber,Dsro_TakeDressTime,Dsro_ReservationBackTime,Dsro_Remark,Dsro_CreateDateTime,Dsro_CreateName,Dsro_UpdateDateTime,Dsro_UpdateName,Cus_Name,还衣天数,还衣天数取衣日期,还衣天数加还衣日期,Dsfm_RentPrice").Tables[0]; //for (int i = 0; i < this.listViewData.Items.Count; i++) //{ // //选择取衣时间 // DateTime TakeClothesTime = Convert.ToDateTime(this.dtpTakeDressTime.DateValue); // //礼服编号 // string Dsfm_DressNumber = this.listViewData.Items[i].Tag.ToString().Trim(); // DataRow[] row_DSRD = dt_DressSaleRentalDetail.Select(" Dsrd_DressNumber='" + Dsfm_DressNumber + "' "); // if (row_DSRD.Length > 0) // { // bool isFind = false; // for (int t = 0; t < row_DSRD.Length; t++) // { // if (TakeClothesTime >= Convert.ToDateTime(row_DSRD[t]["还衣天数取衣日期"]) && TakeClothesTime <= Convert.ToDateTime(row_DSRD[t]["还衣天数加还衣日期"])) // { isFind = true; } // } // if (isFind) // { StrDressClash += "礼服编号:" + Dsfm_DressNumber + " " + " 礼服名称:" + this.listViewData.Items[i].SubItems["礼服名称"].Text.Trim() + "\r\n"; } // } //} //if (!string.IsNullOrEmpty(StrDressClash)) //{ MessageBoxCustom.Show(StrDressClash + "已经撞期,无法租售!"); return; } } else { MessageBoxCustom.Show( "礼服资料不能为空!请选择礼服!" ); return; } #endregion DateTime StrTime = SDateTime.Now; List clist = new List(); #region 客户 string StrClientNumber = ""; string StrClientName = ""; string StrClientTelephone = ""; #region 客户 int indx = 1; foreach ( var item in dressCustomerList ) { LYFZ.Command.Result result = item.SaveCustomerData( ref StrClientName, ref StrClientTelephone, indx ); if ( result.Status ) { if ( !string.IsNullOrEmpty( StrClientNumber ) ) { StrClientNumber += ","; } StrClientNumber += result.StatusMsg; indx++; clist.AddRange( ((LYFZ.Command.Result>)result).clist ); } else { return; } } #endregion /*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.rdoNan.Checked) { model.Cus_Sex = false; } else { model.Cus_Sex = true; } 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(this.StrOrderNumber)) //{ // bool IsFind = true; // while (IsFind) // { // DataTable tbl = orbll.GetView_Custom("tb_ErpDressSaleRentalOrder", StrWhere: "Dsro_Number = '" + this.txtOrderNumber.Text.Trim() + "'", ShowColumnName: "ID").Tables[0]; // if (tbl.Rows.Count <= 0) // { IsFind = false; } // else // { this.txtOrderNumber.Text = LYFZ.BLL.BLL_ErpOrder.GenerateNewDressNumber(LYFZ.EnumPublic.EnumDressOrderType.出租); } // } //} //#endregion #region 出租检测 if ( this.LoadType == "出租" ) { if ( string.IsNullOrEmpty( this.txtDeposit.Text.Trim() ) ) { MessageBoxCustom.Show( "押金不能为空!" ); return; } else { try { Convert.ToDecimal( this.txtDeposit.Text.Trim() ); } catch { MessageBoxCustom.Show( this.LoadType + "金额输入的金额不正确!" ); return; } } if ( string.IsNullOrEmpty( this.dtpReservationBackTime.DateValue.Trim() ) ) { MessageBoxCustom.Show( "还回时间不能为空!" ); return; } if ( !string.IsNullOrEmpty( this.dtpTakeDressTime.DateValue.Trim() ) && !string.IsNullOrEmpty( this.dtpReservationBackTime.DateValue.Trim() ) ) { if ( Convert.ToDateTime( this.dtpTakeDressTime.DateValue.Trim() ) > Convert.ToDateTime( this.dtpReservationBackTime.DateValue.Trim() ) ) { MessageBoxCustom.Show( "取衣时间必须小于还衣时间!" ); return; } } } #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_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_AutoNumber = this.txtOrderNumber.Text; if ( this.LoadType == "出租" ) { DressRentalModel.Dsro_Type = "0"; DressRentalModel.Dsro_MortgageAmount = Convert.ToDecimal( this.txtDeposit.Text.Trim() ); DressRentalModel.Dsro_ReservationBackTime = Convert.ToDateTime( this.dtpReservationBackTime.DateValue.Trim() ); } else if ( this.LoadType == "出售" ) { DressRentalModel.Dsro_Type = "1"; DressRentalModel.Dsro_MortgageAmount = 0; DressRentalModel.Dsro_ReservationBackTime = Convert.ToDateTime( null ); } DressRentalModel.Dsro_Amount = Convert.ToDecimal( this.txtRentAmount.Text.Trim() ); if ( LoadType != "出售" ) DressRentalModel.Dsro_TakeDressTime = Convert.ToDateTime( this.dtpTakeDressTime.DateValue.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() ) ); if ( this.LoadType == "出售" ) { LYFZ.Model.Model_ErpDressFrom modelDress = sfbll.GetModel( "Dsfm_DressNumber", item.Value.ToString().Trim() ); modelDress.Dsfm_DressQuantity += 1; clist.Add( sfbll.GetUpdateCommandInfo( modelDress ) ); } } 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_CreateDateTime = StrTime; DressRentalDetailModel.Dsrd_CreateName = StrUserID; DressRentalDetailModel.Dsrd_TakeDressTime = DressRentalModel.Dsro_TakeDressTime; DressRentalDetailModel.Dsrd_BackTime = Convert.ToDateTime( null ); DressRentalDetailModel.Dsrd_BackRemark = ""; if ( this.LoadType == "出售" ) { DressRentalDetailModel.Dsrd_SalePrice = Convert.ToDecimal( this.listViewData.Items[i].SubItems[this.LoadType + "价格"].Text.Trim() ); DressRentalDetailModel.Dsrd_RentPrice = 0; DressRentalDetailModel.Dsrd_BackStatus = ""; LYFZ.Model.Model_ErpDressFrom modelDress = sfbll.GetModel( "Dsfm_DressNumber", this.listViewData.Items[i].ImageKey.ToString().Trim() ); modelDress.Dsfm_DressQuantity -= 1; clist.Add( sfbll.GetUpdateCommandInfo( modelDress ) ); } else { DressRentalDetailModel.Dsrd_SalePrice = 0; DressRentalDetailModel.Dsrd_RentPrice = Convert.ToDecimal( this.listViewData.Items[i].SubItems[this.LoadType + "价格"].Text.Trim() ); 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 = this.SysNumber; System.Threading.Thread t = new System.Threading.Thread( new System.Threading.ThreadStart( delegate () { Model.SMSParameters sparameters = new Model.SMSParameters(); sparameters.OrderNumber = this.StrOrderNumber; if ( this.LoadType == "出租" ) { new LYFZ.BLL.BLL_SMSTemplates().GenerateEventSMS( EnumPublic.SmsSendEvent.礼服出租订单后X分钟, sparameters, MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID ); } else { new LYFZ.BLL.BLL_SMSTemplates().GenerateEventSMS( EnumPublic.SmsSendEvent.礼服出售订单后X分钟, sparameters, MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID ); } } ) ); t.Start(); if ( LYFZ.BLL.BLL_ErpUser.GetRights( LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DressManagement, CustomAttributes.OperatingAuthority.ReceivablesAll ) ) { LYFZ.Software.MainBusiness.Dresses.DressManagement.Rental.FrmPayment frm = new DressManagement.Rental.FrmPayment(); frm.StrOrderNumber = this.StrOrderNumber; frm.ShowDialog(); } else { 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 btnDial_Click(object sender, EventArgs e) { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.PhoneCall(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.MaskedTextBoxExGetText(this.txtClientTelephone)); } /// /// QQ呼叫 /// /// /// void btnQQCall_Click(object sender, EventArgs e) { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.QQCall(this.txtClientQQ.Text.Trim()); }*/ /// /// 选择客户 /// /// /// void btnClientSelect_Click( object sender, EventArgs e ) { LYFZ.Software.MainBusiness.Dresses.DressManagement.FrmCusSelect frm = new DressManagement.FrmCusSelect(); frm.ShowDialog(); //if (!string.IsNullOrEmpty(frm.StrClientNumber)) //{ this.GetClientData(frm.StrClientNumber); } } /*/// /// 获取客户资料 /// /// /// void GetClientData(string StrClientNumber) { if (!string.IsNullOrEmpty(StrClientNumber)) { DataTable dt = orbll.GetView_Custom("tb_ErpCustomer", StrWhere: "Cus_CustomerNumber='" + StrClientNumber + "'", ShowColumnName: "Cus_Name,Cus_Sex,Cus_CustomerNumber,Cus_Telephone,Cus_FixedPhone,Cus_QQ,Cus_Address,Cus_WorkUnit,Cus_Birthday,Cus_BirthdayLunar,Cus_DayForMarriage,Cus_DayForMarriageLunar").Tables[0]; if (dt.Rows.Count > 0) { this.txtClientName.Text = dt.Rows[0]["Cus_Name"].ToString().Trim(); this.txtClientName.Tag = dt.Rows[0]["Cus_CustomerNumber"].ToString().Trim(); this.txtClientTelephone.Text = dt.Rows[0]["Cus_Telephone"].ToString().Trim(); this.txtClientFixedPhone.Text = dt.Rows[0]["Cus_FixedPhone"].ToString().Trim(); this.txtClientQQ.Text = dt.Rows[0]["Cus_QQ"].ToString().Trim(); this.txtClientAddress.Text = dt.Rows[0]["Cus_Address"].ToString().Trim(); this.txtClientWorkUnit.Text = dt.Rows[0]["Cus_WorkUnit"].ToString().Trim(); this.txtClientBirthday.Text = dt.Rows[0]["Cus_Birthday"].ToString().Trim(); if (dt.Rows[0]["Cus_BirthdayLunar"].ToString().Trim() == "1") { this.chkClientBirthdayLunar.Checked = true; } else { this.chkClientBirthdayLunar.Checked = false; } this.txtClientDayForMarriage.Text = dt.Rows[0]["Cus_DayForMarriage"].ToString().Trim(); if (dt.Rows[0]["Cus_DayForMarriageLunar"].ToString().Trim() == "1") { this.chkClientDayForMarriageLunar.Checked = true; } else { this.chkClientDayForMarriageLunar.Checked = false; } if (dt.Rows[0]["Cus_Sex"].ToString().Trim() == "1") { this.rdoNv.Checked = true; } else { this.rdoNan.Checked = true; } this.txtClientName.ReadOnly = true; this.txtClientTelephone.ReadOnly = true; this.txtClientQQ.ReadOnly = true; this.txtClientAddress.ReadOnly = true; this.txtClientWorkUnit.ReadOnly = true; this.txtClientBirthday.ReadOnly = true; this.chkClientBirthdayLunar.Enabled = false; this.txtClientDayForMarriage.ReadOnly = true; this.chkClientDayForMarriageLunar.Enabled = false; this.txtClientFixedPhone.ReadOnly = true; btn_CustomerEdit.Visible = true; } } }*/ /// /// 移除礼服 /// /// /// 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] ); } } if ( this.listViewData.Items.Count > 0 ) { this.dtpTakeDressTime.Enabled = false; } else { this.dtpTakeDressTime.Enabled = true; } } /// /// 礼服工具箱 /// /// /// void btnDressToolbox_Click( object sender, EventArgs e ) { if ( string.IsNullOrEmpty( this.dtpTakeDressTime.DateValue.Trim() ) && (LoadType != "出售") ) { MessageBoxCustom.Show( "请选择取衣时间!" ); return; } LYFZ.Software.MainBusiness.Dresses.SetSmallForm.ToolboxDressSamllForm frm = new ToolboxDressSamllForm(); frm.StrTakeDressTime = this.dtpTakeDressTime.DateValue.Trim(); frm.strReturnDressTime = this.dtpReservationBackTime.DateValue.Trim(); 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 = this.LoadType + "价格"; if ( this.LoadType == "出租" ) { ListSubItem.Text = dt.Rows[i]["Dsfm_RentPrice"].ToString().Trim(); } else if ( this.LoadType == "出售" ) { 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 ); } } if ( this.listViewData.Items.Count > 0 ) { this.dtpTakeDressTime.Enabled = false; } else { this.dtpTakeDressTime.Enabled = true; } } } /// /// 关闭窗体前判断是否提示 /// 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(); } } } public class DressOpenOrderRentSaleFormMain_ColumnHeaderModel { private int _id; /// /// ID /// public int ID { get { return _id; } set { _id = value; } } private string _strDressNumber; /// /// 礼服编号 /// public string StrDressNumber { get { return _strDressNumber; } set { _strDressNumber = value; } } private string _strCostPrice; /// /// 礼服成本价格 /// public string StrCostPrice { get { return _strCostPrice; } set { _strCostPrice = value; } } private string _strDressPhotoNames; /// /// 礼服相片集合 /// public string StrDressPhotoNames { get { return _strDressPhotoNames; } set { _strDressPhotoNames = value; } } } }