protected void btnClientToHighSeas_Click(object sender, EventArgs e) { CRM_STAFF_CUSTOMER con = new CRM_STAFF_CUSTOMER(); con._Cus_ID = Convert.ToInt32(txt_cus_id.Value); con._SID = txt_s_id.Value; int count = BLLTable <CRM_STAFF_CUSTOMER> .Factory(conn).Delete(con); CRM_STAFF_CUSTOMER_CONTACTRECORDS ccon = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); ccon.ID = Convert.ToDecimal(txt_ContactDetailID.Value); count += BLLTable <CRM_STAFF_CUSTOMER_CONTACTRECORDS> .Factory(conn).Delete(ccon); if (count > 1) { //丢入公海成功 } else { //丢入公海失败 return; } showEditStr = "<div style=\"display:none\">"; showEditEnd = "</div>"; Cus_Status.Enabled = false; Cus_Status.SelectedIndex = Convert.ToInt32(txt_cus_status.Value); btnClientToHighSeas.Visible = false; //UpdatePanel3.UpdateMode = UpdatePanelUpdateMode.Always; //UpdatePanel3.Update(); }
/// <summary> /// 将过期客户投入公海 /// </summary> public void OutPutCustToHighSeas() { int count = 0; CRM_STAFF_CUSTOMER_CONTACTRECORDS cSelVal = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); cSelVal._SID = ""; cSelVal._Cus_ID = 0; CRM_STAFF_CUSTOMER_CONTACTRECORDS ccon = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); ccon.Where("{0} is null and {1} < '{2}'", CRM_STAFF_CUSTOMER_CONTACTRECORDS.Attribute.ContactTime, CRM_STAFF_CUSTOMER_CONTACTRECORDS.Attribute.NextContactTime.FieldName, DateTime.Now.Date.AddDays(-60)); List <CRM_STAFF_CUSTOMER_CONTACTRECORDS> csccList = BLLTable <CRM_STAFF_CUSTOMER_CONTACTRECORDS> .Factory(conn).Select(cSelVal, ccon); if (csccList.Count < 1) { return; } CRM_STAFF_CUSTOMER_CONTACTRECORDS cval = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); cval._ContactTime = DateTime.Now; cval._ContactRecords = "过期联系人,系统自动丢入公海!"; count += BLLTable <CRM_STAFF_CUSTOMER_CONTACTRECORDS> .Factory(conn).Update(cval, ccon);//更新未联系为已联系 List <string> sidList = new List <string>(); List <int> cusidList = new List <int>(); foreach (CRM_STAFF_CUSTOMER_CONTACTRECORDS cscc in csccList) { if (!sidList.Contains(cscc.SID)) { sidList.Add(cscc.SID); } if (!cusidList.Contains(cscc.Cus_ID)) { cusidList.Add(cscc.Cus_ID); } } string[] sidArr = sidList.ToArray(); int[] cusidArr = cusidList.ToArray(); CRM_STAFF_CUSTOMER con = new CRM_STAFF_CUSTOMER();//删除员工与客户关联 con.In(CRM_STAFF_CUSTOMER.Attribute.SID, sidArr); con.In(CRM_STAFF_CUSTOMER.Attribute.Cus_ID, cusidArr); count += BLLTable <CRM_STAFF_CUSTOMER> .Factory(conn).Delete(con); CRM_CUSTOMER ccCon = new CRM_CUSTOMER(); ccCon.In(CRM_CUSTOMER.Attribute.Cus_Id, cusidArr); CRM_CUSTOMER ccVal = new CRM_CUSTOMER(); ccVal._LoadHighSeasTime = DateTime.Now; count += BLLTable <CRM_CUSTOMER> .Factory(conn).Update(ccVal, ccCon);//更新加入公海时间 }
protected void btnClientToHighSeas_Click(object sender, EventArgs e) { CRM_STAFF_CUSTOMER con = new CRM_STAFF_CUSTOMER(); con._Cus_ID = Convert.ToInt32(txt_cus_id.Value); con._SID = txt_s_id.Value; int count = BLLTable <CRM_STAFF_CUSTOMER> .Factory(conn).Delete(con); CRM_STAFF_CUSTOMER_CONTACTRECORDS cval = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); cval.ID = Convert.ToDecimal(txt_ContactDetailID.Value); cval.ContactTime = DateTime.Now; cval.ContactRecords = "被" + userBase.RealName + "(" + userBase.UserID + ")抛入公海"; count += BLLTable <CRM_STAFF_CUSTOMER_CONTACTRECORDS> .Factory(conn).Update(cval, CRM_STAFF_CUSTOMER_CONTACTRECORDS.Attribute.ID); CRM_CUSTOMER ccVal = new CRM_CUSTOMER(); ccVal._Cus_Id = con._Cus_ID; ccVal._LoadHighSeasTime = DateTime.Now; count += BLLTable <CRM_CUSTOMER> .Factory(conn).Update(ccVal, CRM_CUSTOMER.Attribute.Cus_Id);//更新加入公海时间 if (count > 2) { //丢入公海成功 AgileFrame.Core.ScriptHelper.Alert(Page, "投入公海成功!"); AgileFrame.Core.ScriptHelper.CloseMe(Page); } else { //丢入公海失败 AgileFrame.Core.ScriptHelper.Alert(Page, "投入公海失败!"); return; } addCustConnDailt.Visible = false; Cus_Status.Enabled = false; Cus_Status.SelectedIndex = Convert.ToInt32(txt_cus_status.Value); btnClientToHighSeas.Visible = false; //UpdatePanel3.UpdateMode = UpdatePanelUpdateMode.Always; //UpdatePanel3.Update(); }
/// <summary> /// 将过期客户投入公海 /// </summary> public void OutPutCustToHighSeas() { int count = 0; CRM_STAFF_CUSTOMER_CONTACTRECORDS cSelVal = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); cSelVal._SID = ""; cSelVal._Cus_ID = 0; CRM_STAFF_CUSTOMER_CONTACTRECORDS ccon = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); ccon.Where("{0} is null and {1} < '{2}'",CRM_STAFF_CUSTOMER_CONTACTRECORDS.Attribute.ContactTime, CRM_STAFF_CUSTOMER_CONTACTRECORDS.Attribute.NextContactTime.FieldName, DateTime.Now.Date.AddDays(-60)); List<CRM_STAFF_CUSTOMER_CONTACTRECORDS> csccList = BLLTable<CRM_STAFF_CUSTOMER_CONTACTRECORDS>.Factory(conn).Select(cSelVal, ccon); if (csccList.Count < 1) return; CRM_STAFF_CUSTOMER_CONTACTRECORDS cval = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); cval._ContactTime = DateTime.Now; cval._ContactRecords = "过期联系人,系统自动丢入公海!"; count += BLLTable<CRM_STAFF_CUSTOMER_CONTACTRECORDS>.Factory(conn).Update(cval, ccon);//更新未联系为已联系 List<string> sidList = new List<string>(); List<int> cusidList = new List<int>(); foreach (CRM_STAFF_CUSTOMER_CONTACTRECORDS cscc in csccList) { if (!sidList.Contains(cscc.SID)) sidList.Add(cscc.SID); if (!cusidList.Contains(cscc.Cus_ID)) cusidList.Add(cscc.Cus_ID); } string[] sidArr = sidList.ToArray(); int[] cusidArr = cusidList.ToArray(); CRM_STAFF_CUSTOMER con = new CRM_STAFF_CUSTOMER();//删除员工与客户关联 con.In(CRM_STAFF_CUSTOMER.Attribute.SID, sidArr); con.In(CRM_STAFF_CUSTOMER.Attribute.Cus_ID, cusidArr); count += BLLTable<CRM_STAFF_CUSTOMER>.Factory(conn).Delete(con); CRM_CUSTOMER ccCon = new CRM_CUSTOMER(); ccCon.In(CRM_CUSTOMER.Attribute.Cus_Id, cusidArr); CRM_CUSTOMER ccVal = new CRM_CUSTOMER(); ccVal._LoadHighSeasTime = DateTime.Now; count += BLLTable<CRM_CUSTOMER>.Factory(conn).Update(ccVal, ccCon);//更新加入公海时间 }
protected void btnOk_Click(object sender, EventArgs e) { if (Cus_Status.SelectedIndex == 0) { lit_Info.Text = "<a style=\"color:Red;\">请选择客户状态!</a>"; return; } if (string.IsNullOrEmpty(ContactRecords.Value)) { lit_Info.Text = "<a style=\"color:Red;\">请输入联系记录!</a>"; return; } DateTime _nextContactTime = DateTime.MinValue; if (!DateTime.TryParse(NextContactTime.Value, out _nextContactTime)) { lit_Info.Text = "<a style=\"color:Red;\">请输入下次联系时间!</a>"; return; } if (_nextContactTime.AddDays(1).AddSeconds(-1) <= DateTime.Now) { lit_Info.Text = "<a style=\"color:Red;\">请输入一个等于或晚于今天的下次联系时间!</a>"; return; } DateTime dt = DateTime.MinValue; CRM_STAFF_CUSTOMER_CONTACTRECORDS crm_sta_cc = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); crm_sta_cc._Cus_ID = Convert.ToInt32(txt_cus_id.Value); crm_sta_cc._SID = txt_s_id.Value; crm_sta_cc._CustStatus = Cus_Status.SelectedIndex; crm_sta_cc._NextContactTime = _nextContactTime; txt_cus_status.Value = crm_sta_cc._CustStatus.ToString(); try { int count = BLLTable <CRM_STAFF_CUSTOMER_CONTACTRECORDS> .Factory(conn).Insert(crm_sta_cc); if (count < 1) { lit_Info.Text = "<a style=\"color:Red;\">提交失败!存在重复的记录!</a>"; return; } //ContactDetailID.Value crm_sta_cc.ID = decimal.Parse(txt_ContactDetailID.Value); crm_sta_cc._ContactRecords = ContactRecords.Value; crm_sta_cc._ContactTime = DateTime.Now; dt = DateTime.MinValue; DateTime.TryParse(txt_lastnextContactTime.Value, out dt); crm_sta_cc._NextContactTime = dt; count = 0; count = BLLTable <CRM_STAFF_CUSTOMER_CONTACTRECORDS> .Factory(conn).Update(crm_sta_cc, CRM_STAFF_CUSTOMER_CONTACTRECORDS.Attribute.SID, CRM_STAFF_CUSTOMER_CONTACTRECORDS.Attribute.Cus_ID, CRM_STAFF_CUSTOMER_CONTACTRECORDS.Attribute.NextContactTime, CRM_STAFF_CUSTOMER_CONTACTRECORDS.Attribute.ID); if (count < 1) { lit_Info.Text = "<a style=\"color:Red;\">提交失败!</a>"; return; } } catch { lit_Info.Text = "<a style=\"color:Red;\">提交失败!存在重复的记录!</a>"; return; } CRM_STAFF_CUSTOMER crm_sta_c = new CRM_STAFF_CUSTOMER(); crm_sta_c._Cus_ID = Convert.ToInt32(txt_cus_id.Value); crm_sta_c._SID = txt_s_id.Value; crm_sta_c._CustStatus = Cus_Status.SelectedIndex; dt = DateTime.MinValue; DateTime.TryParse(txt_lastContactTime.Value, out dt); crm_sta_c._LastContactTime = dt; try { BLLTable <CRM_STAFF_CUSTOMER> .Factory(conn).Update(crm_sta_c, CRM_STAFF_CUSTOMER.Attribute.Cus_ID, CRM_STAFF_CUSTOMER.Attribute.SID); } catch { lit_Info.Text = "<a style=\"color:Red;\">提交失败!</a>"; return; } CRM_STAFF_CUSTOMER_CONTACTRECORDS csccval = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); csccval.ID = 0; CRM_STAFF_CUSTOMER_CONTACTRECORDS cscccon = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); csccval.Top(1); csccval.SID = crm_sta_c._SID; csccval.Cus_ID = crm_sta_c.Cus_ID; csccval.OrderBy(CRM_STAFF_CUSTOMER_CONTACTRECORDS.Attribute.ID, Order.Desc); CRM_STAFF_CUSTOMER_CONTACTRECORDS cscc = BLLTable <CRM_STAFF_CUSTOMER_CONTACTRECORDS> .Factory(conn).GetRowData(csccval, cscccon); if (cscc != null) { txt_ContactDetailID.Value = cscc.ID.ToString(); } txt_lastContactTime.Value = crm_sta_cc._ContactTime.ToString(); txt_lastnextContactTime.Value = _nextContactTime.ToString(); lit_Info.Text = "<a style=\"color:Green;\">提交成功!</a>"; }
protected void btnSub_Click(object sender, EventArgs e) { lit_AddInfo.Text = ""; lit_AddInfo.Visible = false; CRM_STAFF_CUSTOMER cscVal = new CRM_STAFF_CUSTOMER(); cscVal._Cus_ID = 0; CRM_STAFF_CUSTOMER cscCon = new CRM_STAFF_CUSTOMER(); cscCon._SID = hid_SID.Value; List <CRM_STAFF_CUSTOMER> cscList = BLLTable <CRM_STAFF_CUSTOMER> .Factory(conn).Select(cscVal, cscCon); if (cscList.Count >= 500) { lit_AddInfo.Visible = true; lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">添加失败!客户数达到上限500个。</a>"; return; } if (CheckTheSame()) { return; } CRM_CUSTOMER c_customer = new CRM_CUSTOMER(); if (!string.IsNullOrEmpty(txt_addComAddress.Value)) { c_customer.CompanyAddress = txt_addComAddress.Value.Trim().Replace(" ", ""); } c_customer._CustSex = txt_addCustSexMan.Checked ? 1 : 0; if (!string.IsNullOrEmpty(txt_addShopName.Value)) { c_customer._ShopName = txt_addShopName.Value.Trim().Replace(" ", ""); } if (!string.IsNullOrEmpty(txt_addShopUrl.Value)) { c_customer._ShopNameURL = txt_addShopUrl.Value.Trim().Replace(" ", ""); } if (!string.IsNullOrEmpty(txt_addWangWangId.Value)) { c_customer._WangWangId = txt_addWangWangId.Value.Trim().Replace(" ", ""); } if (!string.IsNullOrEmpty(txt_addComName.Value)) { c_customer._CompanyName = txt_addComName.Value.Trim().Replace(" ", ""); } else { c_customer._CompanyName = txt_addShopName.Value.Trim().Replace(" ", ""); } c_customer._LastEditors = hid_SID.Value; int count = BLLTable <CRM_CUSTOMER> .Factory(conn).Insert(c_customer); if (count < 1)//插入不成功 { lit_AddInfo.Visible = true; lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">添加失败!</a>"; return; } c_customer.OrderBy(CRM_CUSTOMER.Attribute.Cus_Id, Order.Desc); c_customer.Top(1); CRM_CUSTOMER c_customerval = new CRM_CUSTOMER(); c_customerval.Cus_Id = 0; List <CRM_CUSTOMER> c_customercusid = BLLTable <CRM_CUSTOMER> .Factory(conn).Select(c_customerval, c_customer); if (c_customercusid.Count < 1)//插入不成功? { lit_AddInfo.Visible = true; lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">添加失败!</a>"; return; } CRM_CUST c_cust = new CRM_CUST(); c_cust._Cus_ID = c_customercusid[0].Cus_Id; if (!string.IsNullOrEmpty(txt_addCustName.Value)) { c_cust._Cus_Name = txt_addCustName.Value.Trim().Replace(" ", ""); } if (!string.IsNullOrEmpty(txt_addEmail.Value)) { c_cust._Email = txt_addEmail.Value.Trim().Replace(" ", ""); } if (!string.IsNullOrEmpty(txt_addMobPhone.Value)) { c_cust._MobPhone = txt_addMobPhone.Value.Trim().Replace(" ", ""); } if (!string.IsNullOrEmpty(txt_addPhone.Value)) { c_cust._Phone = txt_addPhone.Value.Trim().Replace(" ", ""); } if (!string.IsNullOrEmpty(txt_addQQ.Value)) { c_cust._QQ = txt_addQQ.Value.Trim().Replace(" ", ""); } if (!string.IsNullOrEmpty(txt_addCustName.Value)) { c_cust._ContactName = txt_addCustName.Value.Trim().Replace(" ", ""); } c_cust._AddTime = DateTime.Now; c_cust._EditTime = DateTime.Now; count += BLLTable <CRM_CUST> .Factory(conn).Insert(c_cust); if (count < 2)//插入不成功 { lit_AddInfo.Visible = true; lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">添加失败!</a>"; return; } if (string.IsNullOrEmpty(hid_SID.Value)) { return; } DateTime lastConTime = DateTime.MinValue; if (!string.IsNullOrEmpty(txt_addConDailts.Value)) { CRM_STAFF_CUSTOMER_CONTACTRECORDS c_scc = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); c_scc._Cus_ID = c_customercusid[0].Cus_Id; c_scc._SID = hid_SID.Value; c_scc._NextContactTime = DateTime.Now; c_scc._ContactTime = DateTime.Now; lastConTime = c_scc._ContactTime; c_scc._ContactRecords = txt_addConDailts.Value; c_scc._CustStatus = ddl_CusStatus.SelectedIndex; BLLTable <CRM_STAFF_CUSTOMER_CONTACTRECORDS> .Factory(conn).Insert(c_scc); } CRM_STAFF_CUSTOMER_CONTACTRECORDS c_sccNext = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); c_sccNext._Cus_ID = c_customercusid[0].Cus_Id; c_sccNext._SID = hid_SID.Value; c_sccNext._NextContactTime = DateTime.Now.AddDays(1); c_sccNext._CustStatus = ddl_CusStatus.SelectedIndex; count += BLLTable <CRM_STAFF_CUSTOMER_CONTACTRECORDS> .Factory(conn).Insert(c_sccNext); if (count < 3)//插入不成功 { lit_AddInfo.Visible = true; lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">添加失败!</a>"; return; } CRM_STAFF_CUSTOMER c_sc = new CRM_STAFF_CUSTOMER(); c_sc._Cus_ID = c_customercusid[0].Cus_Id; c_sc._SID = hid_SID.Value; c_sc._CustStatus = ddl_CusStatus.SelectedIndex; if (lastConTime != DateTime.MinValue) { c_sc._LastContactTime = lastConTime; } count += BLLTable <CRM_STAFF_CUSTOMER> .Factory(conn).Insert(c_sc); if (count < 4)//插入不成功 { lit_AddInfo.Visible = true; lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">添加失败!</a>"; return; } lit_AddInfo.Visible = true; lit_AddInfo.Text = "<a style=\"color:green; font-size:12px;\">添加成功!</a>"; ClearForm(); }
protected void btnDistribution_Click(object sender, EventArgs e) { lit_CustInfo.Visible = false; lit_CustInfo.Text = ""; int count = 0; CRM_STAFF_CUSTOMER cscVal = new CRM_STAFF_CUSTOMER(); cscVal._Cus_ID = 0; CRM_STAFF_CUSTOMER cscCon = new CRM_STAFF_CUSTOMER(); cscCon._SID = ddl_Staf.SelectedItem.Value; List <CRM_STAFF_CUSTOMER> cscList = BLLTable <CRM_STAFF_CUSTOMER> .Factory(conn).Select(cscVal, cscCon); if (cscList.Count >= 500) { lit_CustInfo.Visible = true; lit_CustInfo.Text = "<a style=\"color:red\">改员工客户数达到上限500个,不能再分配!</a>"; return; } string msg = ""; foreach (Control c in repList.Controls) { if (cscList.Count + count >= 500) { break; } RepeaterItem ri = c as RepeaterItem; foreach (Control cc in c.Controls) { if (cc.GetType() == typeof(HtmlInputCheckBox)) { HtmlInputCheckBox hc = cc as HtmlInputCheckBox; if (hc.Checked) { string[] cus = hc.Value.Split(new string[] { "*|*9527*|*" }, StringSplitOptions.None); if (cus.Length < 2) { break; } CRM_STAFF_CUSTOMER_CONTACTRECORDS csccCon = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); csccCon._Cus_ID = Convert.ToInt32(cus[0]); csccCon._SID = ddl_Staf.SelectedItem.Value; if (BLLTable <CRM_STAFF_CUSTOMER_CONTACTRECORDS> .Exists(csccCon)) { msg += ddl_Staf.SelectedItem.Text == "自己" ? "你" : ddl_Staf.SelectedItem.Text; msg += "曾经拥有过客户" + cus[1] + ",不能分配\n"; break; } CRM_STAFF_CUSTOMER csc = new CRM_STAFF_CUSTOMER(); csc.SID = ddl_Staf.SelectedItem.Value; csc.Cus_ID = Convert.ToInt32(cus[0]); csc.CustStatus = 1; BLLTable <CRM_STAFF_CUSTOMER> .Factory(conn).Insert(csc); CRM_STAFF_CUSTOMER_CONTACTRECORDS cscc = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); cscc.SID = csc.SID; cscc.Cus_ID = csc.Cus_ID; cscc.NextContactTime = DateTime.Now.AddDays(1); cscc.CustStatus = 1; BLLTable <CRM_STAFF_CUSTOMER_CONTACTRECORDS> .Factory(conn).Insert(cscc); count++; c.Controls.Remove(c); break; } } } } lit_CustInfo.Visible = true; lit_CustInfo.Text = "<a style=\"color:green\">成功分配:" + count + "个客户到" + ddl_Staf.SelectedItem.Text + "</a>"; if (!string.IsNullOrEmpty(msg)) { ScriptHelper.Alert(Page, msg); } V_CUSTHIGHSEAS con = new V_CUSTHIGHSEAS(); if (hidHighSeas.Value != "") { //wcp zlg? 转换回来时转换错了,造成翻页时绑定数据报错。 con = JsonServiceBase.FromJson <V_CUSTHIGHSEAS>(hidHighSeas.Value); } //ContactRecords.Value = hidCondition.Value; BindData(con, aspPager.CurrentPageIndex); }
protected void btnClientToHighSeas_Click(object sender, EventArgs e) { CRM_STAFF_CUSTOMER con = new CRM_STAFF_CUSTOMER(); con._Cus_ID = Convert.ToInt32(txt_cus_id.Value); con._SID = txt_s_id.Value; int count = BLLTable<CRM_STAFF_CUSTOMER>.Factory(conn).Delete(con); CRM_STAFF_CUSTOMER_CONTACTRECORDS cval = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); cval.ID = Convert.ToDecimal(txt_ContactDetailID.Value); cval.ContactTime = DateTime.Now; cval.ContactRecords = "被" + userBase.RealName + "(" + userBase.UserID + ")抛入公海"; count += BLLTable<CRM_STAFF_CUSTOMER_CONTACTRECORDS>.Factory(conn).Update(cval, CRM_STAFF_CUSTOMER_CONTACTRECORDS.Attribute.ID); CRM_CUSTOMER ccVal = new CRM_CUSTOMER(); ccVal._Cus_Id = con._Cus_ID; ccVal._LoadHighSeasTime = DateTime.Now; count += BLLTable<CRM_CUSTOMER>.Factory(conn).Update(ccVal, CRM_CUSTOMER.Attribute.Cus_Id);//更新加入公海时间 if (count > 2) { //丢入公海成功 AgileFrame.Core.ScriptHelper.Alert(Page, "投入公海成功!"); AgileFrame.Core.ScriptHelper.CloseMe(Page); } else { //丢入公海失败 AgileFrame.Core.ScriptHelper.Alert(Page, "投入公海失败!"); return; } addCustConnDailt.Visible = false; Cus_Status.Enabled = false; Cus_Status.SelectedIndex = Convert.ToInt32(txt_cus_status.Value); btnClientToHighSeas.Visible = false; //UpdatePanel3.UpdateMode = UpdatePanelUpdateMode.Always; //UpdatePanel3.Update(); }
protected void btnOk_Click(object sender, EventArgs e) { if (Cus_Status.SelectedIndex == 0) { lit_Info.Text = "<a style=\"color:Red;\">请选择客户状态!</a>"; return; } if (string.IsNullOrEmpty(ContactRecords.Value)) { lit_Info.Text = "<a style=\"color:Red;\">请输入联系记录!</a>"; return; } DateTime _nextContactTime = DateTime.MinValue; if (!DateTime.TryParse(NextContactTime.Value, out _nextContactTime) && Cus_Status.SelectedItem.Value != "5") { lit_Info.Text = "<a style=\"color:Red;\">请输入下次联系时间!</a>"; return; } if (_nextContactTime.AddDays(1).AddSeconds(-1) <= DateTime.Now && Cus_Status.SelectedItem.Value != "5") { lit_Info.Text = "<a style=\"color:Red;\">请输入一个等于或晚于今天的下次联系时间!</a>"; return; } DateTime dt = DateTime.MinValue; CRM_STAFF_CUSTOMER_CONTACTRECORDS crm_sta_cc = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); crm_sta_cc._Cus_ID = Convert.ToInt32(txt_cus_id.Value); crm_sta_cc._SID = txt_s_id.Value; crm_sta_cc._CustStatus = Cus_Status.SelectedIndex; crm_sta_cc._NextContactTime = _nextContactTime; txt_cus_status.Value = crm_sta_cc._CustStatus.ToString(); try { int count = 0; if (Cus_Status.SelectedItem.Value != "5") { count = BLLTable<CRM_STAFF_CUSTOMER_CONTACTRECORDS>.Factory(conn).Insert(crm_sta_cc); if (count < 1) { lit_Info.Text = "<a style=\"color:Red;\">提交失败!存在重复的记录!</a>"; return; } } //ContactDetailID.Value crm_sta_cc.ID = decimal.Parse(txt_ContactDetailID.Value); crm_sta_cc._ContactRecords = ContactRecords.Value; crm_sta_cc._ContactTime = DateTime.Now; dt = DateTime.MinValue; DateTime.TryParse(txt_lastnextContactTime.Value, out dt); crm_sta_cc._NextContactTime = dt; count = 0; count = BLLTable<CRM_STAFF_CUSTOMER_CONTACTRECORDS>.Factory(conn).Update(crm_sta_cc, CRM_STAFF_CUSTOMER_CONTACTRECORDS.Attribute.ID); if (count < 1) { lit_Info.Text = "<a style=\"color:Red;\">提交失败!</a>"; return; } } catch { lit_Info.Text = "<a style=\"color:Red;\">提交失败!存在重复的记录!</a>"; return; } CRM_STAFF_CUSTOMER crm_sta_c = new CRM_STAFF_CUSTOMER(); crm_sta_c._Cus_ID = Convert.ToInt32(txt_cus_id.Value); crm_sta_c._SID = txt_s_id.Value; crm_sta_c._CustStatus = Cus_Status.SelectedIndex; crm_sta_c._LastContactTime = crm_sta_cc._ContactTime; try { BLLTable<CRM_STAFF_CUSTOMER>.Factory(conn).Update(crm_sta_c, CRM_STAFF_CUSTOMER.Attribute.Cus_ID, CRM_STAFF_CUSTOMER.Attribute.SID); } catch { lit_Info.Text = "<a style=\"color:Red;\">提交失败!</a>"; return; } CRM_STAFF_CUSTOMER_CONTACTRECORDS csccval = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); csccval.ID = 0; CRM_STAFF_CUSTOMER_CONTACTRECORDS cscccon = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); csccval.Top(1); csccval.SID = crm_sta_c._SID; csccval.Cus_ID = crm_sta_c.Cus_ID; csccval.OrderBy(CRM_STAFF_CUSTOMER_CONTACTRECORDS.Attribute.ID, Order.Desc); CRM_STAFF_CUSTOMER_CONTACTRECORDS cscc = BLLTable<CRM_STAFF_CUSTOMER_CONTACTRECORDS>.Factory(conn).GetRowData(csccval, cscccon); if (cscc!= null) txt_ContactDetailID.Value = cscc.ID.ToString(); txt_lastContactTime.Value = crm_sta_cc._ContactTime.ToString(); txt_lastnextContactTime.Value = _nextContactTime.ToString(); lit_Info.Text = "<a style=\"color:Green;\">提交成功!</a>"; AgileFrame.Core.ScriptHelper.Alert(Page, "提交成功!"); AgileFrame.Core.ScriptHelper.CloseMe(Page); }
protected void btnDistribution_Click(object sender, EventArgs e) { lit_CustInfo.Visible = false; lit_CustInfo.Text = ""; int count = 0; CRM_STAFF_CUSTOMER cscVal = new CRM_STAFF_CUSTOMER(); cscVal._Cus_ID = 0; CRM_STAFF_CUSTOMER cscCon = new CRM_STAFF_CUSTOMER(); cscCon._SID = ddl_Staf.SelectedItem.Value; List<CRM_STAFF_CUSTOMER> cscList = BLLTable<CRM_STAFF_CUSTOMER>.Factory(conn).Select(cscVal, cscCon); if (cscList.Count >= 500) { lit_CustInfo.Visible = true; lit_CustInfo.Text = "<a style=\"color:red\">改员工客户数达到上限500个,不能再分配!</a>"; return; } string msg = ""; foreach (Control c in repList.Controls) { if (cscList.Count + count >= 500) break; RepeaterItem ri = c as RepeaterItem; foreach (Control cc in c.Controls) { if (cc.GetType() == typeof(HtmlInputCheckBox)) { HtmlInputCheckBox hc = cc as HtmlInputCheckBox; if (hc.Checked) { string[] cus = hc.Value.Split(new string[]{"*|*9527*|*"},StringSplitOptions.None); if(cus.Length<2) break; CRM_STAFF_CUSTOMER_CONTACTRECORDS csccCon = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); csccCon._Cus_ID = Convert.ToInt32(cus[0]); csccCon._SID = ddl_Staf.SelectedItem.Value; if (BLLTable<CRM_STAFF_CUSTOMER_CONTACTRECORDS>.Exists(csccCon)) { msg += ddl_Staf.SelectedItem.Text == "自己" ? "你" : ddl_Staf.SelectedItem.Text; msg += "曾经拥有过客户" + cus[1] + ",不能分配\n"; break; } CRM_STAFF_CUSTOMER csc = new CRM_STAFF_CUSTOMER(); csc.SID = ddl_Staf.SelectedItem.Value; csc.Cus_ID = Convert.ToInt32(cus[0]); csc.CustStatus = 1; BLLTable<CRM_STAFF_CUSTOMER>.Factory(conn).Insert(csc); CRM_STAFF_CUSTOMER_CONTACTRECORDS cscc = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); cscc.SID = csc.SID; cscc.Cus_ID = csc.Cus_ID; cscc.NextContactTime = DateTime.Now.AddDays(1); cscc.CustStatus = 1; BLLTable<CRM_STAFF_CUSTOMER_CONTACTRECORDS>.Factory(conn).Insert(cscc); count++; c.Controls.Remove(c); break; } } } } lit_CustInfo.Visible = true; lit_CustInfo.Text = "<a style=\"color:green\">成功分配:" + count + "个客户到" + ddl_Staf.SelectedItem.Text + "</a>"; if (!string.IsNullOrEmpty(msg)) ScriptHelper.Alert(Page, msg); V_CUSTHIGHSEAS con = new V_CUSTHIGHSEAS(); if (hidHighSeas.Value != "") { //wcp zlg? 转换回来时转换错了,造成翻页时绑定数据报错。 con = JsonServiceBase.FromJson<V_CUSTHIGHSEAS>(hidHighSeas.Value); } //ContactRecords.Value = hidCondition.Value; BindData(con, aspPager.CurrentPageIndex); }
protected void btnClientToHighSeas_Click(object sender, EventArgs e) { CRM_STAFF_CUSTOMER con = new CRM_STAFF_CUSTOMER(); con._Cus_ID = Convert.ToInt32(txt_cus_id.Value); con._SID = txt_s_id.Value; int count = BLLTable<CRM_STAFF_CUSTOMER>.Factory(conn).Delete(con); CRM_STAFF_CUSTOMER_CONTACTRECORDS ccon = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); ccon.ID = Convert.ToDecimal(txt_ContactDetailID.Value); count += BLLTable<CRM_STAFF_CUSTOMER_CONTACTRECORDS>.Factory(conn).Delete(ccon); if (count > 1) { //丢入公海成功 } else { //丢入公海失败 return; } showEditStr = "<div style=\"display:none\">"; showEditEnd = "</div>"; Cus_Status.Enabled = false; Cus_Status.SelectedIndex = Convert.ToInt32(txt_cus_status.Value); btnClientToHighSeas.Visible = false; //UpdatePanel3.UpdateMode = UpdatePanelUpdateMode.Always; //UpdatePanel3.Update(); }
protected void btnSub_Click(object sender, EventArgs e) { lit_AddInfo.Text = ""; lit_AddInfo.Visible = false; CRM_STAFF_CUSTOMER cscVal = new CRM_STAFF_CUSTOMER(); cscVal._Cus_ID = 0; CRM_STAFF_CUSTOMER cscCon = new CRM_STAFF_CUSTOMER(); cscCon._SID = hid_SID.Value; List<CRM_STAFF_CUSTOMER> cscList = BLLTable<CRM_STAFF_CUSTOMER>.Factory(conn).Select(cscVal, cscCon); if (cscList.Count >= 500) { lit_AddInfo.Visible = true; lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">添加失败!客户数达到上限500个。</a>"; return; } if (CheckTheSame()) { return; } CRM_CUSTOMER c_customer = new CRM_CUSTOMER(); if (!string.IsNullOrEmpty(txt_addComAddress.Value)) c_customer.CompanyAddress = txt_addComAddress.Value.Trim().Replace(" ", ""); c_customer._CustSex = txt_addCustSexMan.Checked ? 1 : 0; if (!string.IsNullOrEmpty(txt_addShopName.Value)) c_customer._ShopName = txt_addShopName.Value.Trim().Replace(" ", ""); if (!string.IsNullOrEmpty(txt_addShopUrl.Value)) c_customer._ShopNameURL = txt_addShopUrl.Value.Trim().Replace(" ", ""); if (!string.IsNullOrEmpty(txt_addWangWangId.Value)) c_customer._WangWangId = txt_addWangWangId.Value.Trim().Replace(" ", ""); if (!string.IsNullOrEmpty(txt_addComName.Value)) c_customer._CompanyName = txt_addComName.Value.Trim().Replace(" ", ""); else c_customer._CompanyName = txt_addShopName.Value.Trim().Replace(" ", ""); c_customer._LastEditors = hid_SID.Value; int count = BLLTable<CRM_CUSTOMER>.Factory(conn).Insert(c_customer); if (count < 1)//插入不成功 { lit_AddInfo.Visible = true; lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">添加失败!</a>"; return; } c_customer.OrderBy(CRM_CUSTOMER.Attribute.Cus_Id, Order.Desc); c_customer.Top(1); CRM_CUSTOMER c_customerval = new CRM_CUSTOMER(); c_customerval.Cus_Id = 0; List<CRM_CUSTOMER> c_customercusid = BLLTable<CRM_CUSTOMER>.Factory(conn).Select(c_customerval, c_customer); if (c_customercusid.Count < 1)//插入不成功? { lit_AddInfo.Visible = true; lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">添加失败!</a>"; return; } CRM_CUST c_cust = new CRM_CUST(); c_cust._Cus_ID = c_customercusid[0].Cus_Id; if (!string.IsNullOrEmpty(txt_addCustName.Value)) c_cust._Cus_Name = txt_addCustName.Value.Trim().Replace(" ", ""); if (!string.IsNullOrEmpty(txt_addEmail.Value)) c_cust._Email = txt_addEmail.Value.Trim().Replace(" ", ""); if (!string.IsNullOrEmpty(txt_addMobPhone.Value)) c_cust._MobPhone = txt_addMobPhone.Value.Trim().Replace(" ", ""); if (!string.IsNullOrEmpty(txt_addPhone.Value)) c_cust._Phone = txt_addPhone.Value.Trim().Replace(" ", ""); if (!string.IsNullOrEmpty(txt_addQQ.Value)) c_cust._QQ = txt_addQQ.Value.Trim().Replace(" ", ""); if (!string.IsNullOrEmpty(txt_addCustName.Value)) c_cust._ContactName = txt_addCustName.Value.Trim().Replace(" ", ""); c_cust._AddTime = DateTime.Now; c_cust._EditTime = DateTime.Now; count += BLLTable<CRM_CUST>.Factory(conn).Insert(c_cust); if (count < 2)//插入不成功 { lit_AddInfo.Visible = true; lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">添加失败!</a>"; return; } if (string.IsNullOrEmpty(hid_SID.Value)) return; DateTime lastConTime = DateTime.MinValue; if (!string.IsNullOrEmpty(txt_addConDailts.Value)) { CRM_STAFF_CUSTOMER_CONTACTRECORDS c_scc = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); c_scc._Cus_ID = c_customercusid[0].Cus_Id; c_scc._SID = hid_SID.Value; c_scc._NextContactTime = DateTime.Now; c_scc._ContactTime = DateTime.Now; lastConTime = c_scc._ContactTime; c_scc._ContactRecords = txt_addConDailts.Value; c_scc._CustStatus = ddl_CusStatus.SelectedIndex; BLLTable<CRM_STAFF_CUSTOMER_CONTACTRECORDS>.Factory(conn).Insert(c_scc); } CRM_STAFF_CUSTOMER_CONTACTRECORDS c_sccNext = new CRM_STAFF_CUSTOMER_CONTACTRECORDS(); c_sccNext._Cus_ID = c_customercusid[0].Cus_Id; c_sccNext._SID = hid_SID.Value; c_sccNext._NextContactTime = DateTime.Now.AddDays(1); c_sccNext._CustStatus = ddl_CusStatus.SelectedIndex; count += BLLTable<CRM_STAFF_CUSTOMER_CONTACTRECORDS>.Factory(conn).Insert(c_sccNext); if (count < 3)//插入不成功 { lit_AddInfo.Visible = true; lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">添加失败!</a>"; return; } CRM_STAFF_CUSTOMER c_sc = new CRM_STAFF_CUSTOMER(); c_sc._Cus_ID = c_customercusid[0].Cus_Id; c_sc._SID = hid_SID.Value; c_sc._CustStatus = ddl_CusStatus.SelectedIndex; if (lastConTime != DateTime.MinValue) c_sc._LastContactTime = lastConTime; count += BLLTable<CRM_STAFF_CUSTOMER>.Factory(conn).Insert(c_sc); if (count < 4)//插入不成功 { lit_AddInfo.Visible = true; lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">添加失败!</a>"; return; } lit_AddInfo.Visible = true; lit_AddInfo.Text = "<a style=\"color:green; font-size:12px;\">添加成功!</a>"; ClearForm(); }