12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169 |
- 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 LYFZ.ComponentLibrary;
- using LYFZ.Model.API;
- namespace LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls
- {
- public partial class OrderClientParentsControlsEx : LYFZ.Software.UI.DoorCityProcess.SetCustomControls.OrderClientParentsControlsEx
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpCustomer ctbll = new BLL.BLL_ErpCustomer();
- LYFZ.BLL.BLL_ErpSystemCategory scbll = new BLL.BLL_ErpSystemCategory();
- bool IsShowPhone = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OtherPermissionsSet, LYFZ.CustomAttributes.OperatingAuthority.ProhibitViewCustomerPhoneNumber);
- public OrderClientParentsControlsEx()
- {
- if (this.IsShowPhone && !LYFZ.BLL.BLL_ErpUser.IsAdministrator())
- {
- this.txtCusTelephone.PasswordChar = '*';
- this.txtCusFixedPhone.PassChar = '*';
- }
- this.PictEdit.Click += PictEdit_Click;
- this.PictReset.Click += PictReset_Click;
- this.PictDelete.Click += PictDelete_Click;
- this.btnTips.Click += btnTips_Click;
- this.btnDial.Click += btnDial_Click;
- this.btnQQCall.Click += btnQQCall_Click;
- this.btnSet.Click += btnSet_Click;
- this.btnSetRegion.Click += btnSetRegion_Click;
- this.txtCusName.EventTextBoxEx_TextChanged += txtCusName_EventTextBoxEx_TextChanged;
- this.txtCusName.KeyDown += txtCusName_KeyDown;
- this.txtCusTelephone.TextChanged += txtCusTelephone_TextChanged;
- this.txtCusTelephone.Leave += txtCusTelephone_Leave;
- this.txtCusTelephone.KeyDown += txtCusTelephone_KeyDown;
- this.txtCusAddress.KeyPress += txtCusAddress_KeyPress;
- this.txtCusFixedPhone.KeyPress += txtCusFixedPhone_KeyPress;
- this.txtCusName.KeyPress += txtCusName_KeyPress;
- this.txtCusQQ.KeyPress += txtCusQQ_KeyPress;
- this.txtCusWorkUnit.KeyPress += txtCusWorkUnit_KeyPress;
-
- this.btnSetRegion.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.OrderClientRegionSet);
- this.btnSet.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresOPenSingle, LYFZ.CustomAttributes.OperatingAuthority.OrderClientRelationSet);
- this.panelIDNumber.Visible = LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnabledIDNumber;
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_ClientRelation("BFABDBAJBJCEBDJCJ", this.cmbtreevCusRelation);
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_ClientRelation("AAAAAAC", this.cmbtreevCusRegion, true);
- }
-
-
-
- public bool IsUpdateOrderLoad = false;
- public delegate void OrderClientParents_PictDeleteClick(LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.OrderClientParentsControlsEx senderEx);
-
-
-
- [Category("控件扩展事件"), Description("删除客户")]
- public event OrderClientParents_PictDeleteClick DeleteClick;
-
-
-
-
-
- private void PictDelete_Click(object sender, EventArgs e)
- {
- if (this.DeleteClick != null)
- {
- if (MessageBoxCustom.Show("你确定要删除吗!", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- { return; }
- this.DeleteClick(this);
- this.Parent.Controls.Remove(this);
- }
- }
-
-
-
-
-
- private void PictReset_Click(object sender, EventArgs e)
- {
- if (MessageBoxCustom.Show("重置后数据将会清空,您确定要重置吗?", "温馨提示", MessageBoxButtons.YesNo) != DialogResult.No)
- {
- this.SetClientValue(null);
- this.IsPictEditShow = false;
- this.IsPictResetShow = false;
- }
- }
-
-
-
-
-
- private void PictEdit_Click(object sender, EventArgs e)
- {
- this.SetClientEdit(this.IsUpdateOrderLoad);
- }
- public delegate string OrderClientParents_IsExistClient(string StrControlsName, string StrClientNumber);
-
-
-
- [Category("控件扩展事件"), Description("提示详情")]
- public event OrderClientParents_IsExistClient IsExistClient;
-
-
-
-
-
- void btnTips_Click(object sender, EventArgs e)
- {
- string StrPhone = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.MaskedTextBoxExGetText(this.txtCusTelephone);
- LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.OrderHistoryCustomerSuperSmallForm frm = new SuperSmallForm.OrderHistoryCustomerSuperSmallForm();
- if (this.txtCusName.Text.Trim().Length > 0 && StrPhone.Length > 0)
- { frm.StrWhere = "Cus_Telephone Like '" + StrPhone.Trim() + "%' And Cus_Name like '%" + this.txtCusName.Text.Trim() + "%' and Cus_Type != '儿童'"; }
- else if (this.txtCusName.Text.Trim().Length > 0 && StrPhone.Length <= 0)
- { frm.StrWhere = "Cus_Name like '%" + this.txtCusName.Text.Trim() + "%' and Cus_Type != '儿童'"; }
- else if (this.txtCusName.Text.Trim().Length <= 0 && StrPhone.Length > 0)
- { frm.StrWhere = "Cus_Telephone Like '" + StrPhone.Trim() + "%'"; }
-
-
-
-
-
-
-
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- if (this.IsExistClient != null && !string.IsNullOrEmpty(frm.model.Cus_CustomerNumber.Trim()))
- {
-
- string StrTitleName = this.IsExistClient(this.Name.Trim(), frm.model.Cus_CustomerNumber);
- if (!string.IsNullOrEmpty(StrTitleName))
- {
- this.panelTips.Visible = false;
- this.txtTips.Text = "";
- MessageBoxCustom.Show("你选择的客户在" + StrTitleName + "已存在,一个订单不能同时存在两个相同的客户");
- return;
- }
- }
-
- DataTable tbl = orbll.GetView_Custom("View_CustomerGroupAndCustomerGroupMembersAndErpCustomer", StrWhere: "GP_GroupType = '2' and Cus_CustomerNumber = '" + frm.model.Cus_CustomerNumber + "'", ShowColumnName: "GP_CustomerGroupID", GroupBy: "GP_CustomerGroupID,GP_OrderNumber").Tables[0];
- if (tbl.Rows.Count > 0)
- {
-
- if (tbl.Rows.Count == 1)
- {
- DataTable tblOrderNumber = orbll.GetView_Custom("tb_ErpCustomerGroup", StrWhere: "GP_CustomerGroupID = '" + tbl.Rows[0]["GP_CustomerGroupID"].ToString().Trim() + "'", ShowColumnName: "GP_OrderNumber").Tables[0];
- if (tblOrderNumber.Rows[0]["GP_OrderNumber"].ToString().Trim() != "")
- {
- if (MessageBoxCustom.Show("根据你选择的客户:'" + frm.model.Cus_Name.Trim() + "' 电话:'" + frm.model.Cus_Telephone + "' 系统查找到'" + frm.model.Cus_Name.Trim() + "'有一个未完成的意向订单,您是否要对意向订单进行完成订单?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- if (this.UpdateOrderGroup != null)
- { this.UpdateOrderGroup("OrderNumber|" + tblOrderNumber.Rows[0]["GP_OrderNumber"].ToString().Trim()); }
- }
- }
- else
- {
- if (!lblClientName.Text.Contains("其他联系人"))
- {
- if (MessageBoxCustom.Show("根据你选择的客户:'" + frm.model.Cus_Name.Trim() + "' 电话:'" + frm.model.Cus_Telephone + "' 系统查找到'" + frm.model.Cus_Name.Trim() + "'有一个未完成的意向客户组,您是否要对意向客户组进行完成订单?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- if (this.UpdateOrderGroup != null)
- {
- this.UpdateOrderGroup("ClientGroup|" + tbl.Rows[0]["GP_CustomerGroupID"].ToString().Trim());
- }
- }
- }
- }
- }
- else
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.SelectIntentClientSuperSmallForm frmIntent = new SuperSmallForm.SelectIntentClientSuperSmallForm();
- frmIntent.StrInputClientName = frm.model.Cus_Name.Trim();
- frmIntent.tblOrderGroup = tbl;
- frmIntent.ShowDialog();
- if (!frmIntent.IsSaveed)
- { return; }
- if (!string.IsNullOrEmpty(frmIntent.SelectOrderNumber))
- { this.UpdateOrderGroup("IntentClient|" + tbl.Rows[0]["GP_OrderNumber"].ToString().Trim() + "," + tbl.Rows[0]["GP_CustomerGroupID"].ToString().Trim()); }
- else
- {
- if (this.UpdateOrderGroup != null)
- {
- if (!lblClientName.Text.Contains("其他联系人"))
- {
- this.UpdateOrderGroup("ClientGroup|" + tbl.Rows[0]["GP_CustomerGroupID"].ToString().Trim());
- }
- }
- }
- }
- }
- this.SetClientValue(frm.model, true);
- this.IsPictResetShow = true;
- this.IsPictEditShow = true;
- }
- }
-
-
-
-
-
- void btnDial_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.PhoneCall(this.txtCusTelephone);
- }
-
-
-
-
-
- void btnQQCall_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.QQCall(this.txtCusQQ.Text.Trim());
- }
- public delegate void OrderClientParents_RelationSet(object obj);
-
-
-
- [Category("控件扩展事件"), Description("关系设置")]
- public event OrderClientParents_RelationSet RelationSet;
-
-
-
-
-
- void btnSet_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet frm = new InitialSet.FrmSystemSet();
- frm.TypeName = "BFABDBAJBJCEBDJCJ";
- frm.Version = "Version";
- if (frm.ShowDialog() == DialogResult.OK)
- {
- if (this.RelationSet != null)
- { this.RelationSet(this.cmbtreevCusRelation); }
- else
- { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_ClientRelation("BFABDBAJBJCEBDJCJ", this.cmbtreevCusRelation); }
- }
- }
- public delegate void OrderClientParents_RegionSet(object obj);
-
-
-
- [Category("控件扩展事件"), Description("地区设置")]
- public event OrderClientParents_RegionSet RegionSet;
-
-
-
-
-
- void btnSetRegion_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet frm = new InitialSet.FrmSystemSet();
- frm.TypeName = "AAAAAAC";
- frm.Version = "Version";
- if (frm.ShowDialog() == DialogResult.OK)
- {
- if (this.RegionSet != null)
- { this.RegionSet(this.cmbtreevCusRegion); }
- else
- { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_ClientRelation("AAAAAAC", this.cmbtreevCusRegion, true); }
- }
- }
-
-
-
-
-
- void txtCusName_EventTextBoxEx_TextChanged(object sender, EventArgs e)
- {
- if (this.IsTextChanged)
- {
- this.txtCusName.Tag = "";
- this.txtTips.Text = "";
- this.panelTips.Visible = false;
- if (this.txtCusName.Text.Trim() != "")
- {
- string StrWhere = "";
- string StrPhone = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.MaskedTextBoxExGetText(this.txtCusTelephone);
- if (StrPhone.Length > 0)
- { StrWhere = " And Cus_Telephone Like '" + StrPhone.Trim() + "%'"; }
- DataTable tbl = ctbll.GetListCustomer("Cus_Name", "Cus_Name like '" + this.txtCusName.Text.Trim() + "%' and Cus_Type != '儿童'" + StrWhere).Tables[0];
- if (tbl.Rows.Count > 0)
- {
- this.btnTips.Tag = true;
- this.panelTips.Visible = true;
- this.txtTips.Text = "找到类似客户:" + tbl.Rows.Count + " (根据名字和电话查找)";
- }
- }
- }
- }
-
-
-
-
-
- void txtCusName_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- if (this.btnTips.Visible)
- { this.btnTips_Click(this, null); }
- }
- }
- public delegate void OrderClientParents_UpdateOrderGroup(object obj);
-
-
-
- [Category("控件扩展事件"), Description("地区设置")]
- public event OrderClientParents_UpdateOrderGroup UpdateOrderGroup;
-
-
-
-
-
- void txtCusTelephone_TextChanged(object sender, EventArgs e)
- {
- if (this.IsTextChanged)
- {
- this.panelTips.Visible = false;
- this.txtTips.Text = "";
- string CusTelephone = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.MaskedTextBoxExGetText(this.txtCusTelephone);
- if (CusTelephone != "" && CusTelephone.Trim().Length > 6)
- {
- if (CusTelephone.Length == 11)
- {
- DataTable dtRow = orbll.GetView_Custom("tb_ErpCustomer", StrWhere: "Cus_Telephone Like '" + CusTelephone + "%'", ShowColumnName: "ID, Cus_CustomerNumber, Cus_Telephone, Cus_Name").Tables[0];
- if (dtRow.Rows.Count > 0)
- {
- DataTable tbl = orbll.GetView_Custom("View_CustomerGroupAndCustomerGroupMembersAndErpCustomer", StrWhere: "GP_GroupType = '2' and Cus_CustomerNumber = '" + dtRow.Rows[0]["Cus_CustomerNumber"].ToString().Trim() + "'", ShowColumnName: "GP_CustomerGroupID", GroupBy: "GP_CustomerGroupID").Tables[0];
- if (tbl.Rows.Count > 0)
- {
- DataTable tblOrderNumber = orbll.GetView_Custom("tb_ErpCustomerGroup", StrWhere: "GP_CustomerGroupID = '" + tbl.Rows[0]["GP_CustomerGroupID"].ToString().Trim() + "'", ShowColumnName: "GP_OrderNumber").Tables[0];
- if (tblOrderNumber.Rows[0]["GP_OrderNumber"].ToString().Trim() != "")
- {
- DialogResult dirst = MessageBoxCustom.Show("根据你选择的客户:'" + dtRow.Rows[0]["Cus_Name"].ToString().Trim() + "' 电话:'" + dtRow.Rows[0]["Cus_Telephone"].ToString().Trim() + "' 系统查找到'" + dtRow.Rows[0]["Cus_Name"].ToString().Trim() + "'有一个未完成的意向订单,您是否要对意向订单进行完成订单?", "温馨提示", MessageBoxButtons.YesNoCancel);
- if (dirst == DialogResult.Yes)
- {
- this.IsPictResetShow = true;
- this.IsPictEditShow = true;
- if (this.UpdateOrderGroup != null)
- { this.UpdateOrderGroup("OrderNumber|" + tblOrderNumber.Rows[0]["GP_OrderNumber"].ToString().Trim()); }
- }
- else if (dirst == DialogResult.No)
- {
- LYFZ.Model.Model_ErpCustomer modelClientModel = ctbll.GetModel(Convert.ToInt32(dtRow.Rows[0]["ID"].ToString().Trim()));
- this.SetClientValue(modelClientModel);
- this.SetClientEdit(false);
- }
- else
- {
- txtCusTelephone.Text = CusTelephone.Substring(0, CusTelephone.Length - 1);
- txtCusTelephone.ForCharMaskedTextBox();
- }
- }
- else
- {
- if (!lblClientName.Text.Contains("其他联系人"))
- {
- DialogResult dirst = MessageBoxCustom.Show("根据你选择的客户:'" + dtRow.Rows[0]["Cus_Name"].ToString().Trim() + "' 电话:'" + dtRow.Rows[0]["Cus_Telephone"].ToString().Trim() + "' 系统查找到'" + dtRow.Rows[0]["Cus_Name"].ToString().Trim() + "'有一个未完成的意向客户组,您是否要对意向客户组进行完成订单?", "温馨提示", MessageBoxButtons.YesNoCancel);
- if (dirst == DialogResult.Yes)
- {
- LYFZ.Model.Model_ErpCustomer modelClientModel = ctbll.GetModel(Convert.ToInt32(dtRow.Rows[0]["ID"].ToString().Trim()));
- this.SetClientValue(modelClientModel, true);
- this.IsPictResetShow = true;
- this.IsPictEditShow = true;
- if (this.UpdateOrderGroup != null)
- { this.UpdateOrderGroup("ClientGroup|" + tbl.Rows[0]["GP_CustomerGroupID"].ToString().Trim()); }
- }
- else if (dirst == DialogResult.No)
- {
- LYFZ.Model.Model_ErpCustomer modelClientModel = ctbll.GetModel(Convert.ToInt32(dtRow.Rows[0]["ID"].ToString().Trim()));
- this.SetClientValue(modelClientModel);
- this.SetClientEdit(false);
- }
- else
- {
- txtCusTelephone.Text = CusTelephone.Substring(0, CusTelephone.Length - 1);
- txtCusTelephone.ForCharMaskedTextBox();
- }
- }
- }
- }
- else
- {
- if (MessageBoxCustom.Show("根据电话<" + CusTelephone + ">查找到1位相同客户,是否要加载此客户资料?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No)
- {
- txtCusTelephone.Text = CusTelephone.Substring(0, CusTelephone.Length - 1);
- txtCusTelephone.ForCharMaskedTextBox();
- }
- else
- {
- LYFZ.Model.Model_ErpCustomer modelClientModel = ctbll.GetModel(Convert.ToInt32(dtRow.Rows[0]["ID"].ToString().Trim()));
- this.SetClientValue(modelClientModel);
- this.PictEdit.Tag = true;
- this.SetClientEdit(false);
- this.IsPictResetShow = true;
- this.IsPictEditShow = true;
- }
- }
- }
- }
- else
- {
- string StrWhere = "";
- if (this.txtCusName.Text.Trim().Length > 0)
- { StrWhere = " And Cus_Name like '%" + this.txtCusName.Text.Trim() + "%' and Cus_Type != '儿童'"; }
- DataTable dt = orbll.GetView_Custom("tb_ErpCustomer", StrWhere: "Cus_Telephone Like '" + CusTelephone + "%'" + StrWhere, ShowColumnName: "Count(ID) AS CountID").Tables[0];
- if (Convert.ToInt32(dt.Rows[0]["CountID"]) > 0)
- {
- this.btnTips.Tag = true;
- this.panelTips.Visible = true;
- this.txtTips.Text = "找到类似客户:" + dt.Rows[0]["CountID"].ToString().Trim() + " (根据电话查找)";
- }
- }
- }
- }
- }
- public delegate void OrderClientParents_PhoneLeave(object objForm);
-
-
-
- [Category("控件扩展事件"), Description("地区设置")]
- public event OrderClientParents_PhoneLeave PhoneLeave;
-
-
-
-
-
- void txtCusTelephone_Leave(object sender, EventArgs e)
- {
- if (this.PhoneLeave != null)
- { this.PhoneLeave(this); }
- }
-
-
-
-
-
- void txtCusTelephone_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- if (this.btnTips.Visible)
- { this.btnTips_Click(this, null); }
- }
- }
- #region 输入限制
-
-
-
-
-
- void txtCusAddress_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 txtCusFixedPhone_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (Convert.ToString(e.KeyChar) == "-")
- { }
- else if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
-
-
-
-
-
- void txtCusName_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 txtCusQQ_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (!Char.IsNumber(e.KeyChar) && !Char.IsControl(e.KeyChar))
- { e.Handled = true; }
- }
-
-
-
-
-
- void txtCusWorkUnit_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; }
- }
- #endregion
- #region 属性
-
-
-
- private bool IsTextChanged = true;
- private string _strClientAttribute;
-
-
-
- public string StrClientAttribute
- {
- get { return _strClientAttribute; }
- set { _strClientAttribute = value; }
- }
- private string _lblClientName;
-
-
-
- public string LblClientName
- {
- get { return _lblClientName; }
- set
- {
- _lblClientName = value;
- this.lblClientName.Text = this._lblClientName;
- }
- }
- private bool _isPictDeleteShow;
-
-
-
- public bool IsPictDeleteShow
- {
- get { return _isPictDeleteShow; }
- set
- {
- _isPictDeleteShow = value;
- this.PictDelete.Visible = _isPictDeleteShow;
- }
- }
- private bool _isPictEdit;
-
-
-
- public bool IsPictEditShow
- {
- get { return _isPictEdit; }
- set
- {
- _isPictEdit = value;
- this.PictEdit.Visible = _isPictEdit;
- }
- }
- private bool _isPictResetShow;
-
-
-
- public bool IsPictResetShow
- {
- get { return _isPictResetShow; }
- set
- {
- _isPictResetShow = value;
- this.PictReset.Visible = _isPictResetShow;
- }
- }
- private bool _isShowRelation;
-
-
-
- public bool IsShowRelation
- {
- get { return _isShowRelation; }
- set
- {
- _isShowRelation = value;
- if (_isShowRelation)
- { this.panelRelation.Visible = true; }
- else
- { this.panelRelation.Visible = false; }
- }
- }
- private string _lblRelationText;
-
-
-
- public string LblRelationText
- {
- get { return _lblRelationText; }
- set
- {
- _lblRelationText = value;
- this.lblClientRelation.Text = this._lblRelationText;
- }
- }
- private LYFZ.Model.Model_ErpCustomer _modelCilent;
-
-
-
- public LYFZ.Model.Model_ErpCustomer modelCilent
- {
- get { return _modelCilent; }
- set { _modelCilent = value; }
- }
-
-
-
-
- public void isShowPhoneSymbol(bool IsValue)
- { this.labelEx13.Visible = IsValue; }
- private string _strClientPhone;
-
-
-
- public string StrClientPhone
- {
- get
- {
- _strClientPhone = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.MaskedTextBoxExGetText(this.txtCusTelephone);
- return _strClientPhone;
- }
- set
- {
- _strClientPhone = value;
- this.txtCusTelephone.Text = _strClientPhone;
- this.modelCilent = null;
- }
- }
- private ComboBoxTreeViewEx _cmbtreevRelation;
-
-
-
- public ComboBoxTreeViewEx CmbtreevRelation
- {
- get
- {
- _cmbtreevRelation = this.cmbtreevCusRelation;
- return _cmbtreevRelation;
- }
- set
- {
- _cmbtreevRelation = value;
- this.cmbtreevCusRelation = _cmbtreevRelation;
- }
- }
- private ComboBoxTreeViewEx _cmbtreevRegion;
-
-
-
- public ComboBoxTreeViewEx CmbtreevRegion
- {
- get
- {
- _cmbtreevRegion = this.cmbtreevCusRegion;
- return _cmbtreevRegion;
- }
- set
- {
- _cmbtreevRegion = value;
- this.cmbtreevCusRegion = _cmbtreevRegion;
- }
- }
- #endregion
-
-
-
-
-
- public void GetClientValueData(Api_ErpOrderModel erpModel, ref string MainClientRelation)
- {
- string StrTelephone = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.MaskedTextBoxExGetText(this.txtCusTelephone);
- if (erpModel.customerData == null)
- {
- erpModel.customerData = new List<Api_CustomerModel>();
- }
- Api_CustomerModel apiModel = new Api_CustomerModel()
- {
- cusAttr = this.StrClientAttribute,
- ClientModel = new API_ClientDataModel(),
- cus_Type = "成人"
- };
- LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.ClientModel model = new ClientModel();
- if (this.modelCilent != null)
- {
- model.ID = this.modelCilent.ID;
-
- }
- else
- {
- model.ID = -1;
-
- }
-
-
-
-
-
-
-
-
- apiModel.ClientModel.ID = model.ID;
- apiModel.ClientModel.CusRelations = this.cmbtreevCusRelation.Text.Trim();
- apiModel.ClientModel.CusAddress = this.txtCusAddress.Text.Trim();
- apiModel.ClientModel.Cus_Birthday = this.maskBirthday.StrValue.Trim();
- apiModel.ClientModel.Cus_BirthdayLunar ="";
- apiModel.ClientModel.Cus_Zodiac = "";
- if (apiModel.ClientModel.Cus_Birthday != "")
- {
- apiModel.ClientModel.Cus_BirthdayLunar = this.chkBirthday.Checked ? "1" : "0";
- apiModel.ClientModel.Cus_Zodiac = LYFZ.Command.Command_CalendarTurnLunar.GetZodiac(model.CusBirthday, this.chkBirthday.Checked);
- }
- apiModel.ClientModel.CusIDNumber = "";
- if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnabledIDNumber)
- { apiModel.ClientModel.CusIDNumber = this.maskedIDNumber.StrValue; }
- apiModel.ClientModel.Cus_Name = LYFZ.BLL.OtherCommonModel.ClearSpecialCharacter(this.txtCusName.Text.Trim());
- model.CusName = apiModel.ClientModel.Cus_Name;
- apiModel.ClientModel.Cus_NamePinyin = LYFZ.Command.Command_ChineseToPinyin.GetChineseSpellPinyin(model.CusName.Trim()).ToLower();
- apiModel.ClientModel.CusQQ = this.txtCusQQ.Text.Trim();
- apiModel.ClientModel.CusRegion = this.cmbtreevCusRegion.Text.Trim();
- apiModel.ClientModel.Cus_Sex = this.rdoCusSex1.Checked ? false : true;
- apiModel.ClientModel.CusTelephone = StrTelephone;
- apiModel.ClientModel.CusMicroSignal = this.txtMicroSignal.Text.Trim();
- apiModel.ClientModel.CusWorkUnit = this.txtCusWorkUnit.Text.Trim();
- apiModel.ClientModel.CusFixedPhone = this.txtCusFixedPhone.Text.Trim();
-
- if (MainClientRelation == "" && this.IsShowRelation)
- {
- MainClientRelation = this.cmbtreevCusRelation.Text.Trim();
- if (string.IsNullOrEmpty(MainClientRelation))
- {
- if (cmbtreevCusRelation.Nodes.Count>0)
- {
- MainClientRelation = cmbtreevCusRelation.Nodes[0].Text;
- }
- else
- {
- MainClientRelation = "未知";
-
- }
- }
- }
- if (this.IsShowRelation)
- {
- apiModel.userRelation = string.IsNullOrEmpty(this.cmbtreevCusRelation.Text.Trim()) ? "未知" : this.cmbtreevCusRelation.Text.Trim();
- apiModel.ClientModel.CusRelations = string.IsNullOrEmpty(this.cmbtreevCusRelation.Text.Trim()) ? "未知" : this.cmbtreevCusRelation.Text.Trim() ;
- }
-
- erpModel.customerData.Add(apiModel);
- }
-
-
-
- public LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.ClientModel GetClientValue(ref string MainClientRelation)
- {
- int intMasse = this.maskBirthday.CheckDateValue(this.maskBirthday, this.chkBirthday);
- if (intMasse == 1) { MessageBoxCustom.Show(this.lblClientName.Text + "生日日期格式输入错误!"); return null; }
- else if (intMasse == 2)
- { MessageBoxCustom.Show(this.lblClientName.Text + "生日:" + this.maskBirthday.StrValue.Trim() + "不是公历日期,若要保存请勾上农历!"); return null; }
- if (this.txtCusName.Text.Trim() == "")
- { MessageBoxCustom.Show(this.lblClientName.Text + "姓名不能为空!"); return null; }
- string StrTelephone = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.MaskedTextBoxExGetText(this.txtCusTelephone);
- if (StrTelephone == this.txtCusFixedPhone.Text.Trim())
- {
- if (!string.IsNullOrEmpty(this.txtCusFixedPhone.Text.Trim()) && !string.IsNullOrEmpty(StrTelephone))
- { MessageBoxCustom.Show(this.lblClientName.Text + "手机号与固定电话不能一样!"); this.txtCusTelephone.Text = ""; return null; }
- }
- if (this.StrClientAttribute == "Man_")
- {
- if (string.IsNullOrEmpty(StrTelephone))
- { MessageBoxCustom.Show(this.lblClientName.Text + "手机号不能为空!"); return null; }
- else
- {
- if (StrTelephone.Length != 11)
- { MessageBoxCustom.Show(this.lblClientName.Text + "手机号长度不足11位!"); return null; }
- }
- }
- LYFZ.Software.MainBusiness.DoorCityProcess.SetCustomControls.ClientModel model = new ClientModel();
- if (this.modelCilent != null)
- { model.ID = this.modelCilent.ID; }
- else
- { model.ID = -1; }
-
-
-
-
-
-
-
-
- model.CusRelations = this.cmbtreevCusRelation.Text.Trim();
- model.CusAddress = this.txtCusAddress.Text.Trim();
- model.CusBirthday = this.maskBirthday.StrValue.Trim();
- model.CusBirthdayLunar = "";
- model.CusZodiac = "";
- if (model.CusBirthday != "")
- {
- model.CusBirthdayLunar = this.chkBirthday.Checked ? "1" : "0";
- model.CusZodiac = LYFZ.Command.Command_CalendarTurnLunar.GetZodiac(model.CusBirthday, this.chkBirthday.Checked);
- }
- model.CusIDNumber = "";
- if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnabledIDNumber)
- { model.CusIDNumber = this.maskedIDNumber.StrValue; }
- model.CusName = LYFZ.BLL.OtherCommonModel.ClearSpecialCharacter(this.txtCusName.Text.Trim());
- model.CusNamePinyin = LYFZ.Command.Command_ChineseToPinyin.GetChineseSpellPinyin(model.CusName.Trim()).ToLower();
- model.CusQQ = this.txtCusQQ.Text.Trim();
- model.CusRegion = this.cmbtreevCusRegion.Text.Trim();
- model.CusSex = this.rdoCusSex1.Checked ? false : true;
- model.CusTelephone = StrTelephone;
- model.CusMicroSignal = this.txtMicroSignal.Text.Trim();
- model.CusWorkUnit = this.txtCusWorkUnit.Text.Trim();
- model.CusFixedPhone = this.txtCusFixedPhone.Text.Trim();
- if (MainClientRelation == "")
- { MainClientRelation = this.cmbtreevCusRelation.Text.Trim(); }
- return model;
- }
-
-
-
-
- public void SetClientValue(LYFZ.Model.Model_ErpCustomer model, bool IsReadOnly = false, string MainClientRelation = "")
- {
- this.IsTextChanged = false;
- if (model == null)
- {
- this.txtCusAddress.Text = "";
- this.maskBirthday.StrValue = "";
- this.chkBirthday.Checked = false;
- this.txtCusName.Text = "";
- this.txtCusQQ.Text = "";
- this.cmbtreevCusRegion.Text = "";
- this.rdoCusSex2.Checked = true;
- this.txtCusTelephone.Text = "";
- this.txtMicroSignal.Text = "";
- this.txtCusWorkUnit.Text = "";
- this.txtCusFixedPhone.Text = "";
- this.cmbtreevCusRelation.Text = "";
- this.maskedIDNumber.Text = "";
- }
- else
- {
- this.txtCusAddress.Text = model.Cus_Address;
- this.maskBirthday.StrValue = model.Cus_Birthday;
- this.chkBirthday.Checked = model.Cus_BirthdayLunar == "1" ? true : false;
- this.txtCusName.Text = model.Cus_Name;
- this.txtCusQQ.Text = model.Cus_QQ;
- this.cmbtreevCusRegion.Text = model.Cus_Region;
- if (model.Cus_Sex)
- { this.rdoCusSex2.Checked = true; }
- else
- { this.rdoCusSex1.Checked = true; }
- this.txtCusTelephone.Text = model.Cus_Telephone;
- this.txtMicroSignal.Text = model.Cus_MicroSignal;
- this.txtCusWorkUnit.Text = model.Cus_WorkUnit;
- this.txtCusFixedPhone.Text = model.Cus_FixedPhone;
- this.cmbtreevCusRelation.Text = "";
- this.cmbtreevCusRelation.Tag = "";
- this.maskedIDNumber.Text = model.Cus_IDNumber;
- }
- this.cmbtreevCusRelation.TextFindTag(MainClientRelation);
- this.modelCilent = model;
- if (IsReadOnly)
- {
- this.txtCusAddress.ReadOnly = true;
- this.maskBirthday.ReadOnly = true;
- this.chkBirthday.Enabled = false;
- this.txtCusName.ReadOnly = true;
- this.txtCusQQ.ReadOnly = true;
- this.cmbtreevCusRegion.Enabled = false;
- this.rdoCusSex1.Enabled = false;
- this.rdoCusSex2.Enabled = false;
- this.txtCusTelephone.ReadOnly = true;
- this.txtMicroSignal.ReadOnly = true;
- this.txtCusWorkUnit.ReadOnly = true;
- this.txtCusFixedPhone.ReadOnly = true;
- this.cmbtreevCusRelation.Enabled = false;
- this.maskedIDNumber.ReadOnly = true;
- }
- else
- {
- this.txtCusAddress.ReadOnly = false;
- this.maskBirthday.ReadOnly = false;
- this.chkBirthday.Enabled = true;
- this.txtCusName.ReadOnly = false;
- this.txtCusQQ.ReadOnly = false;
- this.cmbtreevCusRegion.Enabled = true;
- this.rdoCusSex1.Enabled = true;
- this.rdoCusSex2.Enabled = true;
- this.txtCusTelephone.ReadOnly = false;
- this.txtMicroSignal.ReadOnly = false;
- this.txtCusWorkUnit.ReadOnly = false;
- this.txtCusFixedPhone.ReadOnly = false;
- this.cmbtreevCusRelation.Enabled = true;
- this.maskedIDNumber.ReadOnly = false;
- }
- this.panelTips.Visible = false;
- this.panelTips.Tag = null;
- this.IsTextChanged = true;
- }
-
-
-
-
- public void setHospitalClientValue(LYFZ.Model.Model_ErpHospitalClient model)
- {
- if (model == null)
- {
- this.txtCusAddress.Text = "";
- this.maskBirthday.StrValue = "";
- this.chkBirthday.Checked = false;
- this.txtCusName.Text = "";
- this.txtCusQQ.Text = "";
- this.cmbtreevCusRegion.Text = "";
- this.rdoCusSex1.Checked = true;
- this.txtCusTelephone.Text = "";
- this.txtMicroSignal.Text = "";
- this.txtCusWorkUnit.Text = "";
- this.txtCusFixedPhone.Text = "";
- this.cmbtreevCusRelation.Text = "";
- this.maskedIDNumber.Text = "";
- }
- else
- {
- this.txtCusAddress.Text = model.Hct_HomeAddress;
- this.maskBirthday.StrValue = "";
- this.chkBirthday.Checked = false;
- this.txtCusName.Text = model.Hct_CustomerName;
- this.txtCusQQ.Text = model.Hct_QQ;
- this.cmbtreevCusRegion.Text = model.Hct_CustomerRegions;
- this.rdoCusSex2.Checked = true;
- this.txtCusTelephone.Text = model.Hct_MyselfMobile;
- this.txtMicroSignal.Text = "";
- this.txtCusWorkUnit.Text = "";
- this.txtCusFixedPhone.Text = model.Hct_FamilyPhone;
- this.cmbtreevCusRelation.Text = "";
- this.cmbtreevCusRelation.Tag = "";
- this.maskedIDNumber.Text = "";
- }
- }
-
-
-
- public void SetClientEdit(bool IsUpdateName = false)
- {
- Image img = null;
- if (Convert.ToBoolean(this.PictEdit.Tag))
- {
- this.txtCusAddress.ReadOnly = true;
- this.maskBirthday.ReadOnly = true;
- this.chkBirthday.Enabled = false;
- this.txtCusQQ.ReadOnly = true;
- this.cmbtreevCusRegion.Enabled = false;
- this.rdoCusSex1.Enabled = false;
- this.rdoCusSex2.Enabled = false;
- this.txtCusTelephone.ReadOnly = true;
- this.txtMicroSignal.ReadOnly = true;
- this.txtCusWorkUnit.ReadOnly = true;
- this.txtCusFixedPhone.ReadOnly = true;
- this.txtCusName.ReadOnly = true;
- this.cmbtreevCusRelation.Enabled = false;
- this.maskedIDNumber.ReadOnly = true;
- this.PictEdit.Tag = false;
- img = LYFZ.ComponentLibrary.Properties.Resources.pitEdit;
- this.toolTip1.SetToolTip(this.PictEdit, "进入编辑");
- }
- else
- {
- this.txtCusAddress.ReadOnly = false;
- this.maskBirthday.ReadOnly = false;
- this.chkBirthday.Enabled = true;
- this.txtCusQQ.ReadOnly = false;
- this.cmbtreevCusRegion.Enabled = true;
- this.rdoCusSex1.Enabled = true;
- this.rdoCusSex2.Enabled = true;
- this.txtCusTelephone.ReadOnly = false;
- this.txtMicroSignal.ReadOnly = false;
- this.txtCusWorkUnit.ReadOnly = false;
- this.txtCusFixedPhone.ReadOnly = false;
-
- if (IsUpdateName)
- { this.txtCusName.ReadOnly = false; }
- else
- { this.txtCusName.ReadOnly = true; }
- this.cmbtreevCusRelation.Enabled = true;
- this.maskedIDNumber.ReadOnly = false;
- this.PictEdit.Tag = true;
- img = LYFZ.ComponentLibrary.Properties.Resources.pitEditOk;
- this.toolTip1.SetToolTip(this.PictEdit, "编辑OK");
- }
- this.PictEdit.Image = img;
- }
- }
- public class ClientModel
- {
- #region Model
- private int _id;
- private string _cus_name;
- private string _cus_namepinyin;
- private bool _cus_sex;
- private string _cus_birthday;
- private string _cus_birthdaylunar;
- private string _cus_IDNumber;
- private string _cus_relations;
- private string _cus_qq;
- private string _cus_microsignal;
- private string _cus_telephone;
- private string _cus_fixedphone;
- private string _cus_region;
- private string _cus_address;
- private string _cus_workunit;
- private string _cus_zodiac;
-
-
-
- public int ID
- {
- set { _id = value; }
- get { return _id; }
- }
-
-
-
- public string CusName
- {
- set { _cus_name = value; }
- get { return _cus_name; }
- }
-
-
-
- public string CusNamePinyin
- {
- get { return _cus_namepinyin; }
- set { _cus_namepinyin = value; }
- }
-
-
-
- public bool CusSex
- {
- set { _cus_sex = value; }
- get { return _cus_sex; }
- }
-
-
-
- public string CusBirthday
- {
- set { _cus_birthday = value; }
- get { return _cus_birthday; }
- }
-
-
-
- public string CusBirthdayLunar
- {
- set { _cus_birthdaylunar = value; }
- get { return _cus_birthdaylunar; }
- }
-
-
-
- public string CusRelations
- {
- set { _cus_relations = value; }
- get { return _cus_relations; }
- }
-
-
-
- public string CusQQ
- {
- set { _cus_qq = value; }
- get { return _cus_qq; }
- }
-
-
-
- public string CusMicroSignal
- {
- set { _cus_microsignal = value; }
- get { return _cus_microsignal; }
- }
-
-
-
- public string CusTelephone
- {
- set { _cus_telephone = value; }
- get { return _cus_telephone; }
- }
-
-
-
- public string CusFixedPhone
- {
- set { _cus_fixedphone = value; }
- get { return _cus_fixedphone; }
- }
-
-
-
- public string CusRegion
- {
- set { _cus_region = value; }
- get { return _cus_region; }
- }
-
-
-
- public string CusAddress
- {
- set { _cus_address = value; }
- get { return _cus_address; }
- }
-
-
-
- public string CusWorkUnit
- {
- set { _cus_workunit = value; }
- get { return _cus_workunit; }
- }
-
-
-
- public string CusZodiac
- {
- set { _cus_zodiac = value; }
- get { return _cus_zodiac; }
- }
-
-
-
- public string CusIDNumber
- {
- get { return _cus_IDNumber; }
- set { _cus_IDNumber = value; }
- }
- #endregion Model
- }
- }
|