protected void Page_Load(object sender, EventArgs e) { #region//默认隐藏的列 //hideTableColumnList = new List<AttributeItem>(); //hideTableColumnList.Add(CRM_CUSTOMER.Attribute.EXP1); //hideTableColumnList.Add(CRM_CUSTOMER.Attribute.EXP2); //hideTableColumnList.Add(CRM_CUSTOMER.Attribute.EXP3); //valObj.LoadAllAttributes(true);//暂时加此代码,以后框架更新将不需要 //valObj.Remove(hideTableColumnList); //hideFindColumnList = new List<AttributeItem>(); //hideFindColumnList.Add(CRM_CUSTOMER.Attribute.EXP1); //hideFindColumnList.Add(CRM_CUSTOMER.Attribute.EXP2); //hideFindColumnList.Add(CRM_CUSTOMER.Attribute.EXP3); #endregion valObj.OrderBy(CRM_CUSTOMER.Attribute.Cus_Id, Order.Desc); if (!IsPostBack) { btnFind.Text = LanguageService.GetLanguageString("btnFind", "查询"); aspPager.PageSize = 10; aspPager.CurrentPageIndex = 1; if (!string.IsNullOrEmpty(Request["ids"])) { CRM_CUSTOMER roleOld = new CRM_CUSTOMER(); roleOld.Where(CRM_CUSTOMER.Attribute.Cus_Id, Request["ids"].ToString()); listObj = BLLTable <CRM_CUSTOMER> .Factory(conn).Select(valObj, roleOld); for (int i = 0; i < listObj.Count; i++) { if (i > 0) { hidOld.Value += ","; hidInitIDS.Value += ","; } hidOld.Value += "{ID:'" + listObj[i].Cus_Id + "',Name:'" + listObj[i].Cus_Id + "'}";//这里的Name用于显示在列表中,请自行重定义。 hidInitIDS.Value += listObj[i].Cus_Id; } } try { listObj = BLLTable <CRM_CUSTOMER> .Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount); repList.DataSource = listObj; repList.DataBind(); aspPager.RecordCount = recount; } catch (Exception ex) { litWarn.Text = ex.Message; } } }
protected bool CheckTheSame() { if (string.IsNullOrEmpty(txt_addMobPhone.Value) && string.IsNullOrEmpty(txt_addPhone.Value) && string.IsNullOrEmpty(txt_addQQ.Value) && string.IsNullOrEmpty(txt_addEmail.Value)) { lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">联系方式至少要填一项!</a>"; lit_AddInfo.Visible = true; return(true); } CRM_CUSTOMER cctomer = new CRM_CUSTOMER(); CRM_CUST cct = new CRM_CUST(); string cctomerLike = " 1<>1 "; string cctLike = " 1<>1 "; if (!string.IsNullOrEmpty(txt_addWangWangId.Value)) { cctomerLike += " or " + CRM_CUSTOMER.Attribute.WangWangId.FieldName + " like '" + txt_addWangWangId.Value.Trim().Replace(" ", "") + "'"; } if (!string.IsNullOrEmpty(txt_addShopUrl.Value)) { txt_addShopUrl.Value = txt_addShopUrl.Value.Trim().Replace(" ", "").ToLower(); if (!txt_addShopUrl.Value.Contains(".com")) { lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">网店地址错误!</a>"; lit_AddInfo.Visible = true; return(true); } int end = txt_addShopUrl.Value.IndexOf(".com") + 4; if (txt_addShopUrl.Value.Contains("://")) { int start = txt_addShopUrl.Value.IndexOf("://"); if (end - start <= 0) { lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">网店地址错误!</a>"; lit_AddInfo.Visible = true; return(true); } string url = txt_addShopUrl.Value.Substring(start, end - start); cctomerLike += " or " + CRM_CUSTOMER.Attribute.ShopNameURL.FieldName + " like '%" + url + "%'"; //cctomerLike += CRM_CUSTOMER.Attribute.ShopNameURL.FieldName + " like 'http://" + txt_addShopUrl.Value.Trim().Replace(" ", "") + "%' or "; } else { string url = txt_addShopUrl.Value.Substring(0, end); cctomerLike += " or " + CRM_CUSTOMER.Attribute.ShopNameURL.FieldName + " like '" + url + "%'"; //cctomerLike += CRM_CUSTOMER.Attribute.ShopNameURL.FieldName + " like 'http://" + txt_addShopUrl.Value.Trim().Replace(" ", "") + "%' or "; } } if (!string.IsNullOrEmpty(txt_addComName.Value)) { cctomerLike += " or " + CRM_CUSTOMER.Attribute.CompanyName.FieldName + " like '" + txt_addComName.Value.Trim().Replace(" ", "") + "'"; } cctomer.Where(cctomerLike); if (!string.IsNullOrEmpty(txt_addQQ.Value)) { cctLike += " or " + CRM_CUST.Attribute.QQ.FieldName + " like '" + txt_addQQ.Value.Trim().Replace(" ", "") + "'"; } if (!string.IsNullOrEmpty(txt_addPhone.Value)) { cctLike += " or " + CRM_CUST.Attribute.Phone.FieldName + " like '" + txt_addPhone.Value.Trim().Replace(" ", "") + "'"; } if (!string.IsNullOrEmpty(txt_addMobPhone.Value)) { cctLike += " or " + CRM_CUST.Attribute.MobPhone.FieldName + " like '" + txt_addMobPhone.Value.Trim().Replace(" ", "") + "'"; } if (!string.IsNullOrEmpty(txt_addEmail.Value)) { cctLike += " or " + CRM_CUST.Attribute.Email.FieldName + " like '" + txt_addEmail.Value.Trim().Replace(" ", "") + "'"; } cct.Where(cctLike); if (BLLTable <CRM_CUSTOMER> .Exists(cctomer) || BLLTable <CRM_CUST> .Exists(cct)) { lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">添加失败!系统中存在该用户!</a>"; lit_AddInfo.Visible = true; return(true); } return(false); }
protected void Page_Load(object sender, EventArgs e) { #region//Ĭ�����ص��� //hideTableColumnList = new List<AttributeItem>(); //hideTableColumnList.Add(CRM_CUSTOMER.Attribute.EXP1); //hideTableColumnList.Add(CRM_CUSTOMER.Attribute.EXP2); //hideTableColumnList.Add(CRM_CUSTOMER.Attribute.EXP3); //valObj.LoadAllAttributes(true);//��ʱ�Ӵ˴��룬�Ժ��ܸ��½�����Ҫ //valObj.Remove(hideTableColumnList); //hideFindColumnList = new List<AttributeItem>(); //hideFindColumnList.Add(CRM_CUSTOMER.Attribute.EXP1); //hideFindColumnList.Add(CRM_CUSTOMER.Attribute.EXP2); //hideFindColumnList.Add(CRM_CUSTOMER.Attribute.EXP3); #endregion condObj.OrderBy(CRM_CUSTOMER.Attribute.Cus_Id, Order.Desc); if (!IsPostBack) { btnFind.Text = LanguageService.GetLanguageString("btnFind", "��ѯ"); aspPager.PageSize = 10; aspPager.CurrentPageIndex = 1; if (!string.IsNullOrEmpty(Request["ids"])) { CRM_CUSTOMER roleOld = new CRM_CUSTOMER(); roleOld.Where(CRM_CUSTOMER.Attribute.Cus_Id, Request["ids"].ToString()); listObj = BLLTable<CRM_CUSTOMER>.Factory(conn).Select(valObj, roleOld); for (int i = 0; i < listObj.Count; i++) { if (i > 0) { hidOld.Value += ","; hidInitIDS.Value += ","; } hidOld.Value += "{ID:'" + listObj[i].Cus_Id + "',Name:'" + listObj[i].Cus_Id + "'}";//�����Name������ʾ���б��У��������ض��塣 hidInitIDS.Value += listObj[i].Cus_Id; } } try { listObj = BLLTable<CRM_CUSTOMER>.Factory(conn).SelectByPage(valObj, condObj, aspPager.PageSize, 1, ref recount); repList.DataSource = listObj; repList.DataBind(); aspPager.RecordCount = recount; } catch (Exception ex) { litWarn.Text = ex.Message; } } }
protected bool CheckTheSame() { if (string.IsNullOrEmpty(txt_addMobPhone.Value) && string.IsNullOrEmpty(txt_addPhone.Value) && string.IsNullOrEmpty(txt_addQQ.Value) && string.IsNullOrEmpty(txt_addEmail.Value)) { lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">联系方式至少要填一项!</a>"; lit_AddInfo.Visible = true; return true; } CRM_CUSTOMER cctomer = new CRM_CUSTOMER(); CRM_CUST cct = new CRM_CUST(); string cctomerLike = " 1<>1 "; string cctLike = " 1<>1 "; if (!string.IsNullOrEmpty(txt_addWangWangId.Value)) { cctomerLike += " or " + CRM_CUSTOMER.Attribute.WangWangId.FieldName + " like '" + txt_addWangWangId.Value.Trim().Replace(" ", "") + "'"; } if (!string.IsNullOrEmpty(txt_addShopUrl.Value)) { txt_addShopUrl.Value = txt_addShopUrl.Value.Trim().Replace(" ", "").ToLower(); if (!txt_addShopUrl.Value.Contains(".com")) { lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">网店地址错误!</a>"; lit_AddInfo.Visible = true; return true; } int end = txt_addShopUrl.Value.IndexOf(".com") + 4; if (txt_addShopUrl.Value.Contains("://")) { int start = txt_addShopUrl.Value.IndexOf("://"); if (end - start <= 0) { lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">网店地址错误!</a>"; lit_AddInfo.Visible = true; return true; } string url = txt_addShopUrl.Value.Substring(start, end - start); cctomerLike += " or " + CRM_CUSTOMER.Attribute.ShopNameURL.FieldName + " like '%" + url + "%'"; //cctomerLike += CRM_CUSTOMER.Attribute.ShopNameURL.FieldName + " like 'http://" + txt_addShopUrl.Value.Trim().Replace(" ", "") + "%' or "; } else { string url = txt_addShopUrl.Value.Substring(0, end); cctomerLike += " or " + CRM_CUSTOMER.Attribute.ShopNameURL.FieldName + " like '" + url + "%'"; //cctomerLike += CRM_CUSTOMER.Attribute.ShopNameURL.FieldName + " like 'http://" + txt_addShopUrl.Value.Trim().Replace(" ", "") + "%' or "; } } if (!string.IsNullOrEmpty(txt_addComName.Value)) { cctomerLike += " or " + CRM_CUSTOMER.Attribute.CompanyName.FieldName + " like '" + txt_addComName.Value.Trim().Replace(" ", "") + "'"; } cctomer.Where(cctomerLike); if (!string.IsNullOrEmpty(txt_addQQ.Value)) { cctLike += " or " + CRM_CUST.Attribute.QQ.FieldName + " like '" + txt_addQQ.Value.Trim().Replace(" ", "") + "'"; } if (!string.IsNullOrEmpty(txt_addPhone.Value)) { cctLike += " or " + CRM_CUST.Attribute.Phone.FieldName + " like '" + txt_addPhone.Value.Trim().Replace(" ", "") + "'"; } if (!string.IsNullOrEmpty(txt_addMobPhone.Value)) { cctLike += " or " + CRM_CUST.Attribute.MobPhone.FieldName + " like '" + txt_addMobPhone.Value.Trim().Replace(" ", "") + "'"; } if (!string.IsNullOrEmpty(txt_addEmail.Value)) { cctLike += " or " + CRM_CUST.Attribute.Email.FieldName + " like '" + txt_addEmail.Value.Trim().Replace(" ", "") + "'"; } cct.Where(cctLike); if (BLLTable<CRM_CUSTOMER>.Exists(cctomer) || BLLTable<CRM_CUST>.Exists(cct)) { lit_AddInfo.Text = "<a style=\"color:red; font-size:12px;\">添加失败!系统中存在该用户!</a>"; lit_AddInfo.Visible = true; return true; } return false; }