protected void BindData(V_CUSTHIGHSEAS con, int curPage) { hidHighSeas.Value = JsonServiceBase.ToJson<V_CUSTHIGHSEAS>(con); con.af_PageBy(V_CUSTHIGHSEAS.Attribute.Cus_ID, Order.Desc); int recount = -1; V_CUSTHIGHSEAS val = new V_CUSTHIGHSEAS(); val.Cus_ID = 0; val.CompanyName = ""; val.ShopName = ""; val.Cus_Name = ""; val.CustQQ = ""; val.WangWangId = ""; val.Phone = ""; val.MobPhone = ""; val._LoadHighSeasTime = DateTime.MinValue; List<V_CUSTHIGHSEAS> listObj = BLLTable<V_CUSTHIGHSEAS>.Factory(conn).SelectByPage(val, con, aspPager.PageSize, curPage, ref recount); if (listObj.Count > 0) { FormHelper.Bind(Page, listObj[0].DicAttrValues); } repList.DataSource = listObj; repList.DataBind(); aspPager.CurrentPageIndex = curPage; aspPager.RecordCount = recount; //hidCondition.Value = con.ToJson(200); }
protected void BindData(V_CUSTHIGHSEAS con, int curPage) { hidHighSeas.Value = JsonServiceBase.ToJson <V_CUSTHIGHSEAS>(con); con.af_PageBy(V_CUSTHIGHSEAS.Attribute.Cus_ID, Order.Desc); int recount = -1; V_CUSTHIGHSEAS val = new V_CUSTHIGHSEAS(); val.Cus_ID = 0; val.CompanyName = ""; val.ShopName = ""; val.Cus_Name = ""; val.CustQQ = ""; val.WangWangId = ""; val.Phone = ""; val.MobPhone = ""; val._LoadHighSeasTime = DateTime.MinValue; List <V_CUSTHIGHSEAS> listObj = BLLTable <V_CUSTHIGHSEAS> .Factory(conn).SelectByPage(val, con, aspPager.PageSize, curPage, ref recount); if (listObj.Count > 0) { FormHelper.Bind(Page, listObj[0].DicAttrValues); } repList.DataSource = listObj; repList.DataBind(); aspPager.CurrentPageIndex = curPage; aspPager.RecordCount = recount; //hidCondition.Value = con.ToJson(200); }
protected void aspPager_PageChanged(object sender, EventArgs e) { 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 aspPager_PageChanged(object sender, EventArgs e) { 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 btnSearch_Click(object sender, EventArgs e) { V_CUSTHIGHSEAS con = new V_CUSTHIGHSEAS(); if (!string.IsNullOrEmpty(txt_ComName.Value)) { con.Like(V_CUSTHIGHSEAS.Attribute.CompanyName, txt_ComName.Value); } if (!string.IsNullOrEmpty(txt_ShopName.Value)) { con.Like(V_CUSTHIGHSEAS.Attribute.ShopName, txt_ShopName.Value); } if (!string.IsNullOrEmpty(txt_MobPhone.Value)) { con.Like(V_CUSTHIGHSEAS.Attribute.MobPhone, txt_MobPhone.Value); } if (!string.IsNullOrEmpty(txt_Phone.Value)) { con.Like(V_CUSTHIGHSEAS.Attribute.Phone, txt_Phone.Value); } if (!string.IsNullOrEmpty(txt_QQ.Value)) { con.Like(V_CUSTHIGHSEAS.Attribute.CustQQ, txt_QQ.Value); } if (!string.IsNullOrEmpty(txt_WW.Value)) { con.Like(V_CUSTHIGHSEAS.Attribute.WangWangId, txt_WW.Value); } if (!string.IsNullOrEmpty(time_Staf.Value) && string.IsNullOrEmpty(time_End.Value)) { con.Where("{0} > '{1}'", V_CUSTHIGHSEAS.Attribute.LoadHighSeasTime.FieldName, time_Staf.Value); } else if (string.IsNullOrEmpty(time_Staf.Value) && !string.IsNullOrEmpty(time_End.Value)) { con.Where("{0} < '{1}'", V_CUSTHIGHSEAS.Attribute.LoadHighSeasTime.FieldName, time_End.Value); } else if (!string.IsNullOrEmpty(time_Staf.Value) && !string.IsNullOrEmpty(time_End.Value)) { con.Where("{0} Between '{1}' And '{2}'", V_CUSTHIGHSEAS.Attribute.LoadHighSeasTime.FieldName, time_Staf.Value, time_End.Value); } BindData(con, 1); }
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 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 btnSearch_Click(object sender, EventArgs e) { V_CUSTHIGHSEAS con = new V_CUSTHIGHSEAS(); if (!string.IsNullOrEmpty(txt_ComName.Value)) con.Like(V_CUSTHIGHSEAS.Attribute.CompanyName, txt_ComName.Value); if (!string.IsNullOrEmpty(txt_ShopName.Value)) con.Like(V_CUSTHIGHSEAS.Attribute.ShopName, txt_ShopName.Value); if (!string.IsNullOrEmpty(txt_MobPhone.Value)) con.Like(V_CUSTHIGHSEAS.Attribute.MobPhone, txt_MobPhone.Value); if (!string.IsNullOrEmpty(txt_Phone.Value)) con.Like(V_CUSTHIGHSEAS.Attribute.Phone, txt_Phone.Value); if (!string.IsNullOrEmpty(txt_QQ.Value)) con.Like(V_CUSTHIGHSEAS.Attribute.CustQQ, txt_QQ.Value); if (!string.IsNullOrEmpty(txt_WW.Value)) con.Like(V_CUSTHIGHSEAS.Attribute.WangWangId, txt_WW.Value); if (!string.IsNullOrEmpty(time_Staf.Value) && string.IsNullOrEmpty(time_End.Value)) { con.Where("{0} > '{1}'",V_CUSTHIGHSEAS.Attribute.LoadHighSeasTime.FieldName, time_Staf.Value); } else if (string.IsNullOrEmpty(time_Staf.Value) && !string.IsNullOrEmpty(time_End.Value)) { con.Where("{0} < '{1}'", V_CUSTHIGHSEAS.Attribute.LoadHighSeasTime.FieldName, time_End.Value); } else if (!string.IsNullOrEmpty(time_Staf.Value) && !string.IsNullOrEmpty(time_End.Value)) { con.Where("{0} Between '{1}' And '{2}'", V_CUSTHIGHSEAS.Attribute.LoadHighSeasTime.FieldName, time_Staf.Value, time_End.Value); } BindData(con, 1); }