using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Globalization; using LYFZ.ComponentLibrary; using System.Web.UI.WebControls; using LYFZ.DAL; using LYFZ.Software.MainBusiness.Customers.OldCustomer; using LYFZ.BLL; namespace LYFZ.Software.MainBusiness.Customers { public partial class FrmOldCustomer : LYFZ.Software.UI.Customers.FrmOldCustomer { private delegate void UpdateControl(); public FrmOldCustomer() { this.btnAdd.Click += btnAdd_Click; this.btnUpdate.Click += btnUpdate_Click; this.btnSlect.Click += btnSlect_Click; this.btnDelete.Click += btnDelete_Click; this.btnExport.Click += btnExport_Click; this.btnClose.Click += btnClose_Click; this.btnTexting.Click += btnTexting_Click; this.Shown += FrmOldCustomer_Shown; this.chkHs.Click += chkHs_Click; this.chkEt.Click += chkEt_Click; this.chkXz.Click += chkXz_Click; this.chkFw.Click += chkFw_Click; this.Type = 1; this.btnExcel.Click += btnExcel_Click; this.dgv.CellDoubleClick += dgv_CellDoubleClick; this.Resize += FrmOldCustomer_Resize; orbll.UpdateNullDataToLunar(); // 虚拟模式; this.dgv.VirtualMode = true; this.dgv.CellValueNeeded += Dgv_CellValueNeeded; } DataTable newTable = new DataTable(); private void Dgv_CellValueNeeded(object sender, DataGridViewCellValueEventArgs e) { if (newTable != null && newTable.Rows.Count == 0 && e.RowIndex == newTable.Rows.Count) return; DataGridViewRow dgr = this.dgv.Rows[e.RowIndex]; if (e.RowIndex % 2 == 0) {//偶行; dgr.DefaultCellStyle.BackColor = System.Drawing.Color.PowderBlue; } else {//奇行; dgr.DefaultCellStyle.BackColor = System.Drawing.Color.PapayaWhip; } //客户组编号 if (e.ColumnIndex == 0) e.Value = newTable.Rows[e.RowIndex]["GP_CustomerGroupID"].ToString().Trim(); //名字 if (e.ColumnIndex == 1) e.Value = newTable.Rows[e.RowIndex]["Cus_Name"].ToString().Trim(); //性别 if (e.ColumnIndex == 2) e.Value = newTable.Rows[e.RowIndex]["Cus_Sex_cs"].ToString().Trim(); //手机 if (e.ColumnIndex == 3) e.Value = newTable.Rows[e.RowIndex]["Cus_Telephone"].ToString().Trim(); //区域 if (e.ColumnIndex == 4) e.Value = newTable.Rows[e.RowIndex]["Cus_Region"].ToString().Trim(); //客户类型 0 为婚纱订单客户 1 为儿童订单客户 2 写真订单客户 3 为服务套系 4 为其它订单客户 if (e.ColumnIndex == 5) e.Value = GetType(newTable.Rows[e.RowIndex]["GP_CustomerType"].ToString().Trim()); //客户来源; if (e.ColumnIndex == 6) e.Value = newTable.Rows[e.RowIndex]["GP_CustomerSource"].ToString().Trim(); //客户生日 if (e.ColumnIndex == 7) e.Value = newTable.Rows[e.RowIndex]["Cus_BirthdayText"].ToString().Trim(); //客户婚期 if (e.ColumnIndex == 8) e.Value = newTable.Rows[e.RowIndex]["Cus_DayForMarriageText"].ToString().Trim(); //添加时间 if (e.ColumnIndex == 9) e.Value = newTable.Rows[e.RowIndex]["GP_CreateDatetime"].ToString().Trim(); //套系名称 if (e.ColumnIndex == 10) e.Value = newTable.Rows[e.RowIndex]["History_Type"].ToString().Trim(); //套系价格 if (e.ColumnIndex == 11) e.Value = newTable.Rows[e.RowIndex]["History_Money"].ToString().Trim(); //订单时间 if (e.ColumnIndex == 12) e.Value = newTable.Rows[e.RowIndex]["History_OrderTime"].ToString().Trim(); } /// /// 客户类型 /// public int Type; LYFZ.BLL.BLL_ErpOrder orbll = new BLL_ErpOrder(); LYFZ.BLL.BLL_ErpCustomer ctbll = new BLL_ErpCustomer(); LYFZ.BLL.BLL_ErpCustomerGroup cgbll = new BLL.BLL_ErpCustomerGroup(); LYFZ.BLL.BLL_ErpCustomerGroupMembers cgmbll = new BLL.BLL_ErpCustomerGroupMembers(); LYFZ.BLL.BLL_OldOrderHistory oohbll = new BLL.BLL_OldOrderHistory(); LYFZ.BLL.BLL_ErpSystemLogs slogbll = new BLL_ErpSystemLogs(); List Versions = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessTypeList(); /// /// 窗体加载事件 /// /// /// void FrmOldCustomer_Shown(object sender, EventArgs e) { this.chkEt.Visible = false; this.chkXz.Visible = false; this.chkHs.Visible = false; for (int i = 0; i < this.Versions.Count; i++) { LYFZ.Software.MainBusiness.EnumPermissions.BusinessType Version = this.Versions[i]; if (Version.ToString() == EnumPermissions.BusinessType.写真版.ToString()) { this.chkXz.Visible = true; } if (Version.ToString() == EnumPermissions.BusinessType.婚纱版.ToString()) { this.chkHs.Visible = true; } if (Version.ToString() == EnumPermissions.BusinessType.儿童版.ToString()) { this.chkEt.Visible = true; } } this.PublicFunctionRows(); this.btnAdd.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OldCustomerCompetence, CustomAttributes.OperatingAuthority.Add); this.btnUpdate.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OldCustomerCompetence, CustomAttributes.OperatingAuthority.Update); this.btnDelete.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OldCustomerCompetence, CustomAttributes.OperatingAuthority.Delete); this.btnExport.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OldCustomerCompetence, CustomAttributes.OperatingAuthority.DataExport); this.btnTexting.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OldCustomerCompetence, CustomAttributes.OperatingAuthority.SMSSend); this.btnExcel.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OldCustomerCompetence, LYFZ.CustomAttributes.OperatingAuthority.DataImport); } /// /// 查询 /// /// /// void btnSlect_Click(object sender, EventArgs e) { this.PublicFunctionRows(); } /// /// 增加 /// /// /// void btnAdd_Click(object sender, EventArgs e) { string StrClientType = ""; if (this.chkHs.Checked == false && this.chkEt.Checked == false && this.chkXz.Checked == false && this.chkFw.Checked == false) { FrmOrdersCustomerRecord frm = new FrmOrdersCustomerRecord(); if (frm.ShowDialog() == DialogResult.OK) { StrClientType = frm.DindanType.Trim(); } else { return; } } if (chkHs.Checked || StrClientType == "0")//0 为婚纱订单客户 { LYFZ.Software.MainBusiness.Customers.OldCustomer.FrmOldCustomerOtheEdit frmHS = new OldCustomer.FrmOldCustomerOtheEdit(); frmHS.type = this.Type; if (frmHS.ShowDialog() == DialogResult.OK) { this.PublicFunctionRows(); } } else if (chkEt.Checked || StrClientType == "1")//1 为儿童订单客户 { LYFZ.Software.MainBusiness.Customers.OldCustomer.FrmOldCustomerPortraitEdit frmET = new OldCustomer.FrmOldCustomerPortraitEdit(); frmET.type = this.Type; if (frmET.ShowDialog() == DialogResult.OK) { this.PublicFunctionRows(); } } else if (chkXz.Checked || StrClientType == "2") // 2 写真订单客户 { LYFZ.Software.MainBusiness.Customers.OldCustomer.FrmOldCustomerPortraitAdd frmXZ = new OldCustomer.FrmOldCustomerPortraitAdd(); frmXZ.type = this.Type; if (frmXZ.ShowDialog() == DialogResult.OK) { this.PublicFunctionRows(); } } else if (chkFw.Checked || StrClientType == "3")// 3 为服务套系 { LYFZ.Software.MainBusiness.Customers.OldCustomer.FrmOldCustomerOtherAdd frmFW = new OldCustomer.FrmOldCustomerOtherAdd(); frmFW.type = this.Type; if (frmFW.ShowDialog() == DialogResult.OK) { this.PublicFunctionRows(); } } } /// /// 双击列表修改 /// /// /// void dgv_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex >= 0 && e.ColumnIndex >= 0) { if (this.dgv.SelectedRows.Count > 0) { if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OldCustomerCompetence, CustomAttributes.OperatingAuthority.Update)) { return; } if (this.dgv.CurrentRow.Cells["GP_CustomerType"].Value.ToString() == "儿童客户") { FrmOldCustomerEditBaby from = new FrmOldCustomerEditBaby(); from.GM = this.dgv.CurrentRow.Cells["GP_CustomerGroupID"].Value.ToString(); from.type = this.Type; if (from.ShowDialog() == DialogResult.OK) { this.PublicFunctionRows(); } } else { FrmOldCustomerEdit from = new FrmOldCustomerEdit(); from.GM = this.dgv.CurrentRow.Cells["GP_CustomerGroupID"].Value.ToString(); from.Leixing = this.dgv.CurrentRow.Cells["GP_CustomerType"].Value.ToString(); from.type = this.Type; if (from.ShowDialog() == DialogResult.OK) { this.PublicFunctionRows(); } } } } } catch (Exception ex) { MessageBoxCustom.Show(ex.Message); } } /// /// 修改 /// /// /// void btnUpdate_Click(object sender, EventArgs e) { try { if (this.dgv.SelectedRows.Count == 0) { MessageBoxCustom.Show("请选择你要编辑的数据!"); return; } if (this.dgv.CurrentRow.Cells["GP_CustomerType"].Value.ToString() == "儿童客户") { FrmOldCustomerEditBaby from = new FrmOldCustomerEditBaby(); from.GM = this.dgv.CurrentRow.Cells["GP_CustomerGroupID"].Value.ToString(); from.type = this.Type; if (from.ShowDialog() == DialogResult.OK) { this.PublicFunctionRows(); } } else { FrmOldCustomerEdit from = new FrmOldCustomerEdit(); from.GM = this.dgv.CurrentRow.Cells["GP_CustomerGroupID"].Value.ToString(); from.Leixing = this.dgv.CurrentRow.Cells["GP_CustomerType"].Value.ToString(); from.type = this.Type; if (from.ShowDialog() == DialogResult.OK) { this.PublicFunctionRows(); } } } catch (Exception ex) { MessageBoxCustom.Show(ex.Message); } } /// /// 删除 /// /// /// void btnDelete_Click(object sender, EventArgs e) { try { if (this.dgv.SelectedRows.Count == 0) { MessageBoxCustom.Show("请选中你要删除的数据!"); return; } if (MessageBoxCustom.Show("你确定要删除吗?", "删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { List clist = new List(); List StrGroupList = new List(); for (int i = 0; i < this.dgv.SelectedRows.Count; i++) { StrGroupList.Add(this.dgv.SelectedRows[i].Cells["GP_CustomerGroupID"].Value.ToString().Trim()); } int IsExecuteSqlTran = 0; LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker) { for (int i = 0; i < StrGroupList.Count; i++) { clist.Add(cgmbll.GetDeleteCommandInfo(whereStr: "GM_CustomerGroupID='" + StrGroupList[i].Trim() + "' ")); clist.Add(cgbll.GetDeleteCommandInfo(whereStr: "GP_CustomerGroupID='" + StrGroupList[i].Trim() + "'")); clist.Add(oohbll.GetDeleteCommandInfo(whereStr: "History_ID='" + StrGroupList[i].Trim() + "'")); DataTable tblGroupMembers = orbll.GetView_Custom("tb_ErpCustomerGroupMembers", StrWhere: "GM_CustomerGroupID = '" + StrGroupList[i].Trim() + "'", ShowColumnName: "GM_CustomerID").Tables[0]; for (int j = 0; j < tblGroupMembers.Rows.Count; j++) { DataTable tblClient = orbll.GetView_Custom("tb_ErpCustomer", StrWhere: "Cus_CustomerNumber = '" + tblGroupMembers.Rows[j]["GM_CustomerID"].ToString().Trim() + "'", ShowColumnName: "Cus_Name,Cus_Telephone").Tables[0]; DataTable tblTwoSales = orbll.GetView_Custom("tb_ErpTwoSalesOrder", StrWhere: "Tsorder_CustomerNumber = '" + tblGroupMembers.Rows[j]["GM_CustomerID"].ToString().Trim() + "'", ShowColumnName: "ID").Tables[0]; DataTable tblGroupMembers2 = orbll.GetView_Custom("tb_ErpCustomerGroupMembers", StrWhere: "GM_CustomerGroupID != '" + StrGroupList[i].Trim() + "' And GM_CustomerID = '" + tblGroupMembers.Rows[j]["GM_CustomerID"].ToString().Trim() + "'", ShowColumnName: "ID").Tables[0]; if (tblTwoSales.Rows.Count <= 0 && tblGroupMembers2.Rows.Count <= 0) { DataTable dt = orbll.GetView_Custom("tb_ErpMemberCard", StrWhere: "Mc_CustomerNumber = '" + tblGroupMembers.Rows[j]["GM_CustomerID"].ToString().Trim() + "' And Mc_Status = '1' And Mc_CradNumber != ''", ShowColumnName: "ID").Tables[0]; if (dt.Rows.Count <= 0) { clist.Add(ctbll.GetDeleteCommandInfo(whereStr: "Cus_CustomerNumber='" + tblGroupMembers.Rows[j]["GM_CustomerID"].ToString().Trim() + "'")); } if (tblClient.Rows.Count > 0) { clist.Add(slogbll.GetAddCommandInfo(LYFZ.BLL.BLL_ErpSystemLogs.GetWriteLogModel(LYFZ.EnumPublic.SystemLogsType.删除客户资料, "删除联系人:" + tblClient.Rows[0]["Cus_Name"].ToString().Trim() + ",电话:" + tblClient.Rows[0]["Cus_Telephone"].ToString().Trim() + "客户编号:" + tblGroupMembers.Rows[j]["GM_CustomerID"].ToString().Trim() + ",时间:" + SDateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name, StrInfoID: LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID()))); } } else { clist.Add(slogbll.GetAddCommandInfo(LYFZ.BLL.BLL_ErpSystemLogs.GetWriteLogModel(LYFZ.EnumPublic.SystemLogsType.删除客户资料, "删除客户组编号:" + StrGroupList[i].Trim() + ",时间:" + SDateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name, StrInfoID: LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID()))); } } } if (clist.Count > 0) { IsExecuteSqlTran = LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist); if (IsExecuteSqlTran > 0) { for (int i = 0; i < StrGroupList.Count; i++) { DAL_ErpCustomer.UpdateAggregationCustomer(StrGroupList[i].Trim()); } } } }); if (IsExecuteSqlTran > 0) { MessageBoxCustom.Show("删除成功!"); this.PublicFunctionRows(); } else { MessageBoxCustom.Show("删除失败!"); } ////批量删除 速度过慢 //List ctlist = new List(); //List datelist = new List(); //List namelist = new List(); //StringBuilder where = new StringBuilder(); //int DeleteCount = 0; //LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker) //{ // //串客户组ID // for (int i = 0; i < dgv.SelectedRows.Count; i++) // { // if (i + 1 != dgv.SelectedRows.Count) // { where.Append("'" + dgv.SelectedRows[i].Cells["GP_CustomerGroupID"].Value.ToString().Trim() + "',"); } // else // { where.Append("'" + dgv.SelectedRows[i].Cells["GP_CustomerGroupID"].Value.ToString().Trim() + "'"); } // } // //根据客户组查客户ID // DataTable dtList = orbll.GetView_Custom("SELECT GM_CustomerID FROM tb_ErpCustomerGroupMembers where GM_CustomerGroupID in (" + where.ToString() + ") group by GM_CustomerID ").Tables[0]; // foreach (DataGridViewRow item in dgv.SelectedRows) // { // ctlist.Add(cgmbll.GetDeleteCommandInfo(whereStr: "GM_CustomerGroupID='" + item.Cells["GP_CustomerGroupID"].Value.ToString() + "' ")); // ctlist.Add(cgbll.GetDeleteCommandInfo(whereStr: "GP_CustomerGroupID='" + item.Cells["GP_CustomerGroupID"].Value.ToString() + "'")); // ctlist.Add(oohbll.GetDeleteCommandInfo(whereStr: "History_ID='" + item.Cells["GP_CustomerGroupID"].Value.ToString() + "'")); // datelist.Add(item.Cells["GP_CustomerGroupID"].Value.ToString()); // namelist.Add(item.Cells["Cus_Name"].Value.ToString()); // } // DeleteCount = LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(ctlist); //if (DeleteCount > 0) //{ // string Cusid = ""; // //串客户ID // foreach (DataRow row in dtList.Rows) // { Cusid += "'" + row[0].ToString() + "',"; } // Cusid = Cusid.Substring(0, Cusid.Length - 1); // //查二消表 // DataTable dtTwo = orbll.GetView_Custom("select Tsorder_CustomerNumber from tb_ErpTwoSalesOrder where Tsorder_CustomerNumber in (" + Cusid + ")").Tables[0]; // //查客户成员表 // DataTable dtCus = orbll.GetView_Custom("select GM_CustomerID from tb_ErpCustomerGroupMembers where GM_CustomerID in (" + Cusid + ")").Tables[0]; // //循环客户ID次数 // for (int i = 0; i < Cusid.Split(',').Length; i++) // { // //如果二消表或者 成员表都没有数据可直接删除 // if (dtTwo.Select(" Tsorder_CustomerNumber = " + Cusid.Split(',')[i].ToString() + "").Length < 1 && dtCus.Select("GM_CustomerID=" + Cusid.Split(',')[i].ToString()).Length < 1) // { ctbll.Delete("Cus_CustomerNumber=" + Cusid.Split(',')[i].ToString()); } // } // foreach (string item in namelist) // { // //日志 // LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog(LYFZ.EnumPublic.SystemLogsType.删除客户资料, "删除联系人资料:" + item + ",时间:" + SDateTime.Now, LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name); // } // foreach (string item in datelist) // { DAL_ErpCustomer.UpdateAggregationCustomer(item); } //} //}); //if (DeleteCount > 0) //{ // this.Bind(); // MessageBoxCustom.Show("删除成功!"); //} //else //{ MessageBoxCustom.Show("删除失败!"); } } } catch (Exception ex) { MessageBoxCustom.Show(ex.Message); } } /// /// 关闭 /// /// /// void btnClose_Click(object sender, EventArgs e) { this.Close(); } /// /// 导出 /// /// /// void btnExport_Click(object sender, EventArgs e) { this.dgv.ExportDataTable(); } /// /// 发短信 /// /// /// void btnTexting_Click(object sender, EventArgs e) { try { string Sj1 = ""; LYFZ.Software.MainBusiness.SMSManagement.SmsSend.FrmSendSms set = new SMSManagement.SmsSend.FrmSendSms(); if (dgv.SelectedRows.Count == 0) { MessageBoxCustom.Show("选择你要发送短信的客户!"); return; } for (int i = 0; i < dgv.SelectedRows.Count; i++) { //检查手机合法性 string tempPhones = this.dgv.SelectedRows[i].Cells["客户电话"].Value.ToString(); string okPhones = ""; LYFZ.WinAPI.CustomPublicMethod.ValidationPhones(tempPhones.Replace('/', ','), ref okPhones); okPhones = okPhones.Trim().Trim(','); foreach (string phone in okPhones.Split(',')) { if (phone.Trim().Length >= 11 && !Sj1.Contains(phone)) { Sj1 += phone + ","; } } } set.Phone = Sj1.Trim(','); set.ShowDialog(); } catch (Exception ex) { MessageBoxCustom.Show(ex.Message); } } /// /// 创建行 /// void PublicFunctionRows() { if (this.dgv.Rows.Count > 0) { this.dgv.Rows.Clear(); } StringBuilder str = new StringBuilder(); string keyword = this.cmbQueryText.Text.Trim(); str.Append(" and tempTB_AggregationCustomer.GP_GroupType='1' "); if (!string.IsNullOrEmpty(keyword)) { str.Append(" and (Cus_Name like '%" + keyword + "%' or Cus_Name_py like '%" + keyword + "%' or Cus_Telephone like '%" + keyword + "%' or Cus_Region like '%" + keyword + "%') "); if (chkFw.Checked)//服务 { str.Append(" and tempTB_AggregationCustomer.GP_CustomerType = '3' "); } else if (chkHs.Checked)//婚纱 { str.Append(" and tempTB_AggregationCustomer.GP_CustomerType = '0' "); } else if (chkEt.Checked)//儿童 { str.Append(" and tempTB_AggregationCustomer.GP_CustomerType = '1' "); } else if (chkXz.Checked)//写真 { str.Append(" and tempTB_AggregationCustomer.GP_CustomerType = '2' "); } } else { if (chkFw.Checked)//服务 { str.Append(" and tempTB_AggregationCustomer.GP_CustomerType = '3'"); } else if (chkHs.Checked)//婚纱 { str.Append(" and tempTB_AggregationCustomer.GP_CustomerType = '0'"); } else if (chkEt.Checked)//儿童 { str.Append(" and tempTB_AggregationCustomer.GP_CustomerType = '1'"); } else if (chkXz.Checked)//写真 { str.Append(" and tempTB_AggregationCustomer.GP_CustomerType = '2'"); } } LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker) { newTable = LYFZ.BLL.BLL_ErpOrderView.GetData_ClientManagementClientOld(str.ToString().Trim()); }); #if IGNORE for (int t = 0; t < newTable.Rows.Count; t++) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewCell cell = null; //客户组编号 cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["GP_CustomerGroupID"].ToString().Trim(); dgvr.Cells.Add(cell); //名字 cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["Cus_Name"].ToString().Trim(); dgvr.Cells.Add(cell); //性别 cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["Cus_Sex_cs"].ToString().Trim(); dgvr.Cells.Add(cell); //手机 cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["Cus_Telephone"].ToString().Trim(); dgvr.Cells.Add(cell); //区域 cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["Cus_Region"].ToString().Trim(); dgvr.Cells.Add(cell); //客户类型 0 为婚纱订单客户 1 为儿童订单客户 2 写真订单客户 3 为服务套系 4 为其它订单客户 cell = new DataGridViewTextBoxCell(); cell.Value = GetType(newTable.Rows[t]["GP_CustomerType"].ToString().Trim()); dgvr.Cells.Add(cell); //客户来源; cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["GP_CustomerSource"].ToString().Trim(); dgvr.Cells.Add(cell); //客户生日 cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["Cus_BirthdayText"].ToString().Trim(); dgvr.Cells.Add(cell); //客户婚期 cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["Cus_DayForMarriageText"].ToString().Trim(); dgvr.Cells.Add(cell); //添加时间 cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["GP_CreateDatetime"].ToString().Trim(); dgvr.Cells.Add(cell); //套系名称 cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["History_Type"].ToString().Trim(); dgvr.Cells.Add(cell); //套系价格 cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["History_Money"].ToString().Trim(); dgvr.Cells.Add(cell); //订单时间 cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["History_OrderTime"].ToString().Trim(); dgvr.Cells.Add(cell); this.dgv.Rows.Add(dgvr); } #endif this.dgv.RowCount = newTable.Rows.Count; this.lblTotalCount.Text = "总条数:" + newTable.Rows.Count; //this.ucPagerEx1.PageCurrent = 1; //this.ucPagerEx1.PageSize = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPageSize();//3;分页条数 //this.ucPagerEx1.Bind(); } /// /// 导出Excel /// /// /// void btnExcel_Click(object sender, EventArgs e) { if (this.Type == 1) { ImportExcel excel = new ImportExcel(); FrmOrdersCustomerRecord frm = new FrmOrdersCustomerRecord(); if (frm.ShowDialog() == DialogResult.OK) { excel.Type = this.Type; excel.Leixing = Convert.ToInt32(frm.DindanType); if (excel.ShowDialog() == DialogResult.OK) { this.PublicFunctionRows(); } } } if (this.Type == 2) { ImportExcel excel = new ImportExcel(); excel.Type = this.Type; if (excel.ShowDialog() == DialogResult.OK) { this.PublicFunctionRows(); } } } /// /// 窗体大小发生变化 /// /// /// void FrmOldCustomer_Resize(object sender, EventArgs e) { switch (this.panelTotalCount.Location.Y) { case 3: this.flowLayoutPanel1.Height = 36; break; case 37: this.flowLayoutPanel1.Height = 70; break; } } /// /// 写真 /// /// /// void chkXz_Click(object sender, EventArgs e) { this.chkHs.Checked = false; this.chkEt.Checked = false; this.chkFw.Checked = false; this.PublicFunctionRows(); } /// /// 儿童 /// /// /// void chkEt_Click(object sender, EventArgs e) { this.chkHs.Checked = false; this.chkFw.Checked = false; this.chkXz.Checked = false; this.PublicFunctionRows(); } /// /// 婚纱 /// /// /// void chkHs_Click(object sender, EventArgs e) { this.chkEt.Checked = false; this.chkFw.Checked = false; this.chkXz.Checked = false; this.PublicFunctionRows(); } /// /// 服务 /// /// /// void chkFw_Click(object sender, EventArgs e) { this.chkHs.Checked = false; this.chkEt.Checked = false; this.chkXz.Checked = false; this.PublicFunctionRows(); } /// /// 订单类型 /// /// 0 为婚纱订单客户 1 为儿童订单客户 2 写真订单客户 3 为服务套系 4 为其它订单客户 /// string GetType(string Gotype) { string Tpy = ""; switch (Gotype) { case "1": Tpy = "儿童客户"; break; case "2": Tpy = "写真客户"; break; case "3": Tpy = "服务客户"; break; case "0": Tpy = "婚纱客户"; break; case "4": Tpy = "其他客户"; break; } return Tpy; } } }