/// <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 Page_Load(object sender, EventArgs e) { //在列表里点击删除按钮,通过AJAX执行这里的后台代码,删除一条记录 if (Request["DelCus_Id"] != null) { int re = BLLTable <CRM_CUSTOMER> .Factory(conn).Delete(CRM_CUSTOMER.Attribute.Cus_Id, Request["DelCus_Id"]); if (re > 0) { Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示 } else { Response.Write("删除失败!"); } } //在列表顶部点击删除按钮,通过AJAX执行这里的后台代码,删除多条记录 if (Request["DelKeyIDS"] != null) { CRM_CUSTOMER cond = new CRM_CUSTOMER(); cond.In(CRM_CUSTOMER.Attribute.Cus_Id, Request["DelKeyIDS"]); int re = BLLTable <CRM_CUSTOMER> .Factory(conn).Delete(cond); if (re > 0) { Response.Write("1");//可以输出数字 大于0 表示操作成功,也可以直接输出 字符串,客户端将弹出此字符串信息作为提示 } else { Response.Write("删除失败!"); } } //在用户详细信息查看编辑页面,点保存时,通过AJAX执行这里的后台代码,实现部门字段的更新 if (Request["saveInfo"] != null) { CRM_CUSTOMER val = new CRM_CUSTOMER(); val.Cus_Id = int.Parse(Request["FieldKeyID"]); List <AttributeItem> lstCol = val.af_AttributeItemList; for (int i = 0; i < lstCol.Count; i++) { if (!string.IsNullOrEmpty(Request["txt" + lstCol[i].FieldName])) { val.SetValue(lstCol[i].FieldName, Request["txt" + lstCol[i].FieldName]); } } BLLTable <CRM_CUSTOMER> .Factory(conn).Update(val, CRM_CUSTOMER.Attribute.Cus_Id); Response.Write("修改用户信息成功"); } Response.End(); }
protected void Page_Load(object sender, EventArgs e) { //���б�����ɾ����ť��ͨ��AJAXִ������ĺ�̨���룬ɾ��һ����¼ if (Request["DelCus_Id"] != null) { int re = BLLTable<CRM_CUSTOMER>.Factory(conn).Delete(CRM_CUSTOMER.Attribute.Cus_Id, Request["DelCus_Id"]); if (re > 0) { Response.Write("1");//����������� ����0 ��ʾ�����ɹ���Ҳ����ֱ����� �ַ������ͻ��˽��������ַ�����Ϣ��Ϊ��ʾ } else { Response.Write("ɾ��ʧ�ܣ�"); } } //���б�������ɾ����ť��ͨ��AJAXִ������ĺ�̨���룬ɾ��������¼ if (Request["DelKeyIDS"] != null) { CRM_CUSTOMER cond = new CRM_CUSTOMER(); cond.In(CRM_CUSTOMER.Attribute.Cus_Id, Request["DelKeyIDS"]); int re = BLLTable<CRM_CUSTOMER>.Factory(conn).Delete(cond); if (re > 0) { Response.Write("1");//����������� ����0 ��ʾ�����ɹ���Ҳ����ֱ����� �ַ������ͻ��˽��������ַ�����Ϣ��Ϊ��ʾ } else { Response.Write("ɾ��ʧ�ܣ�"); } } //���û���ϸ��Ϣ�鿴�༭ҳ�棬�㱣��ʱ��ͨ��AJAXִ������ĺ�̨���룬ʵ�ֲ����ֶεĸ��� if (Request["saveInfo"] != null) { CRM_CUSTOMER val = new CRM_CUSTOMER(); val.Cus_Id = int.Parse(Request["FieldKeyID"]); List<AttributeItem> lstCol = val.af_AttributeItemList; for (int i = 0; i < lstCol.Count; i++) { if (!string.IsNullOrEmpty(Request["txt" + lstCol[i].FieldName])) { val.SetValue(lstCol[i].FieldName,Request["txt" + lstCol[i].FieldName]); } } BLLTable<CRM_CUSTOMER>.Factory(conn).Update(val, CRM_CUSTOMER.Attribute.Cus_Id); Response.Write("���û���Ϣ�ɹ�"); } Response.End(); }
/// <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);//更新加入公海时间 }