/// <summary> /// 初始化 /// </summary> void DataInit() { pageIndex = UtilsCommons.GetPadingIndex(); EyouSoft.Model.EnumType.CrmStructure.CrmType crmType = EyouSoft.Model.EnumType.CrmStructure.CrmType.行客户; if (Menu2Type == Menu2.客户管理_单位直客) { crmType = EyouSoft.Model.EnumType.CrmStructure.CrmType.单位直客; } var items = new EyouSoft.BLL.CrmStructure.BCrm().GetCrms(CurrentUserCompanyID, pageSize, pageIndex, ref recordCount, crmType, GetSearchInfo()); if (items != null && items.Count > 0) { rptList.DataSource = items; rptList.DataBind(); } BindPage(); }
/// <summary> /// 获取客户单位信息集合 /// </summary> /// <param name="companyId">公司编号</param> /// <param name="pageSize">每页记录数</param> /// <param name="pageIndex">页索引</param> /// <param name="recordCount">总记录数</param> /// <param name="crmType">客户单位类型</param> /// <param name="searchInfo">查询信息</param> /// <returns></returns> public IList <Model.CrmStructure.MLBCrmInfo> GetCrms(string companyId, int pageSize, int pageIndex, ref int recordCount, EyouSoft.Model.EnumType.CrmStructure.CrmType crmType, EyouSoft.Model.CrmStructure.MLBCrmSearchInfo searchInfo) { if (string.IsNullOrEmpty(companyId)) { return(null); } if (crmType == EyouSoft.Model.EnumType.CrmStructure.CrmType.个人会员) { return(null); } bool isOnlySelf = false; int[] depts = null; if (crmType == EyouSoft.Model.EnumType.CrmStructure.CrmType.单位直客) { depts = GetDataPrivs(EyouSoft.Model.EnumType.PrivsStructure.Menu2.客户管理_单位直客, out isOnlySelf); } else if (crmType == EyouSoft.Model.EnumType.CrmStructure.CrmType.行客户) { depts = GetDataPrivs(EyouSoft.Model.EnumType.PrivsStructure.Menu2.客户管理_同行客户, out isOnlySelf); } var items = dal.GetCrms(companyId, LoginUserId, depts, pageSize, pageIndex, ref recordCount, crmType, searchInfo); if (items != null && items.Count > 0) { var citybll = new EyouSoft.BLL.ComStructure.BComCity(); foreach (var item in items) { item.CPCD = citybll.GetCPCD(companyId, item.CountryId, item.ProvinceId, item.CityId, item.DistrictId); } } return(items); }
/// <summary> /// 保存按钮点击事件执行方法 /// </summary> void Save() { string editid = Utils.GetQueryStringValue("crmId"); EyouSoft.Model.CrmStructure.MCrm info = new EyouSoft.Model.CrmStructure.MCrm(); if (IsEdit) { info = new EyouSoft.BLL.CrmStructure.BCrm().GetInfo(editid); } #region 客户信息 //客户信息 info.Address = Utils.GetFormValue(txtAddress.UniqueID); //地址 info.CityId = Utils.GetInt(Utils.GetFormValue(ddlCity.UniqueID), 0); //城市 info.CompanyId = CurrentUserCompanyID; //公司编号 info.IssueTime = DateTime.Now; //添加时间 info.LegalRepresentative = Utils.GetFormValue(txtLegalRepresentative.UniqueID); //法人代表 info.LegalRepresentativePhone = Utils.GetFormValue(txtLegalRepresentativePhone.UniqueID); //法人代表电话 info.LevId = Utils.GetInt(Utils.GetFormValue(ddlLevId.UniqueID), 0); //客户等级 info.License = Utils.GetFormValue(txtLicense.UniqueID); //许可证号 info.Name = Utils.GetFormValue(txtName.UniqueID); //单位名称 info.OperatorId = SiteUserInfo.UserId; //操作人 info.OrganizationCode = Utils.GetFormValue(txtOrganizationCode.UniqueID); //机构代码 info.ProvinceId = Utils.GetInt(Utils.GetFormValue(ddlProvice.UniqueID), 0); //省份 //info.RebatePolicy = Utils.GetFormValue(txtRebatePolicy.UniqueID);//返利政策 EyouSoft.Model.EnumType.CrmStructure.CrmType crmType = EyouSoft.Model.EnumType.CrmStructure.CrmType.行客户; if (Menu2Type == EyouSoft.Model.EnumType.PrivsStructure.Menu2.客户管理_单位直客) { crmType = EyouSoft.Model.EnumType.CrmStructure.CrmType.单位直客; } info.Type = crmType; info.BrevityCode = Utils.GetFormValue(txtBrevityCode.UniqueID); //简码 info.CountryId = Utils.GetInt(Utils.GetFormValue(ddlCountry.UniqueID), 0); //国家 info.CountyId = Utils.GetInt(Utils.GetFormValue(ddlCounty.UniqueID), 0); //县区 info.DeptId = SiteUserInfo.DeptId; //操作人部门 info.LegalRepresentativeMobile = Utils.GetFormValue(txtLegalRepresentativeMobile.UniqueID); //法人代表手机 #endregion #region 客户信息 特殊权限控制部分 //客户信息 特殊权限控制部分 if (IsEdit) { if (IsSetZeRenXiaoShou) { info.SellerId = Utils.GetFormValue(Seller1.SellsIDClient); } if (IsSetChangYong) { info.AmountOwed = Utils.GetDecimal(Utils.GetFormValue("txtAmountOwed"), 5000); info.Deadline = Utils.GetInt(Utils.GetFormValue("txtDeadline"), 10); info.IsSignContract = Utils.GetFormValue(rbtnIsSignContractYes.GroupName) == "rbtnIsSignContractYes"; info.AttachModel = GetAttach(); if (info.AttachModel != null) { info.AttachModel.ItemId = info.CrmId; } info.BankList = GetBanks(); info.FinancialMobile = Utils.GetFormValue(txtFinancialMobile.UniqueID); info.FinancialName = Utils.GetFormValue(txtFinancialName.UniqueID); info.FinancialPhone = Utils.GetFormValue(txtFinancialPhone.UniqueID); } } if (IsAdd) { if (IsSetZeRenXiaoShou) { info.SellerId = Utils.GetFormValue(Seller1.SellsIDClient); } else { info.SellerId = SiteUserInfo.UserId; } if (IsSetChangYong) { info.AmountOwed = Utils.GetDecimal(Utils.GetFormValue("txtAmountOwed"), 5000); info.Deadline = Utils.GetInt(Utils.GetFormValue("txtDeadline"), 10); info.IsSignContract = Utils.GetFormValue(rbtnIsSignContractYes.UniqueID) == "rbtnIsSignContractYes"; info.AttachModel = GetAttach(); if (info.AttachModel != null) { info.AttachModel.ItemId = info.CrmId; } info.BankList = GetBanks(); } else { info.AmountOwed = 5000; info.Deadline = 10; info.IsSignContract = false; info.AttachModel = null; info.BankList = null; } info.FinancialMobile = Utils.GetFormValue(txtFinancialMobile.UniqueID); info.FinancialName = Utils.GetFormValue(txtFinancialName.UniqueID); info.FinancialPhone = Utils.GetFormValue(txtFinancialPhone.UniqueID); } #endregion info.LinkManList = GetLxrs();//联系人 //表单验证 int retcode = 0; if (IsEdit) { retcode = new EyouSoft.BLL.CrmStructure.BCrm().Update(info); } if (IsAdd) { retcode = new EyouSoft.BLL.CrmStructure.BCrm().Insert(info); } AjaxResponse(UtilsCommons.AjaxReturnJson(retcode == 1 ? "1" : "0")); }
/// <summary> /// 获取导入客户管理号码集合 /// </summary> /// <param name="companyId">公司编号</param> /// <param name="pageSize">页记录数</param> /// <param name="pageIndex">页索引</param> /// <param name="recordCount">总记录数</param> /// <param name="searchInfo">查询信息</param> /// <returns></returns> public IList <EyouSoft.Model.SmsStructure.MLBDaoRuLxrInfo> GetLxrs(string companyId, int pageSize, int pageIndex, ref int recordCount, EyouSoft.Model.SmsStructure.MLBDaoRuLxrSearchInfo searchInfo) { IList <EyouSoft.Model.SmsStructure.MLBDaoRuLxrInfo> items = new List <EyouSoft.Model.SmsStructure.MLBDaoRuLxrInfo>(); string tableName = "view_Crm_Source_Sms_Lxr"; string fields = "CountryId,ProvinceId,CityId,DistrictId,DanWeiName,LxrName,DanWeiType,MingXiType,Mobile"; string orderByString = "IssueTime DESC"; StringBuilder query = new StringBuilder(); #region SQL query.AppendFormat(" CompanyId='{0}' ", companyId); if (searchInfo != null) { if (searchInfo.CityId.HasValue) { query.AppendFormat(" AND CityId={0} ", searchInfo.CityId.Value); } if (searchInfo.CountryId.HasValue) { query.AppendFormat(" AND CountryId={0} ", searchInfo.CountryId.Value); } if (searchInfo.DanWeiType.HasValue) { int _danWeiType = -1; int _mingXiType = -1; switch (searchInfo.DanWeiType.Value) { case EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.餐馆: _danWeiType = 1; _mingXiType = (int)EyouSoft.Model.EnumType.SourceStructure.SourceType.餐馆; break; case EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.车队: _danWeiType = 1; _mingXiType = (int)EyouSoft.Model.EnumType.SourceStructure.SourceType.车队; break; case EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.单位直客: _danWeiType = 0; _mingXiType = (int)EyouSoft.Model.EnumType.CrmStructure.CrmType.单位直客; break; case EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.地接社: _danWeiType = 1; _mingXiType = (int)EyouSoft.Model.EnumType.SourceStructure.SourceType.地接社; break; case EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.个人会员: _danWeiType = 0; _mingXiType = (int)EyouSoft.Model.EnumType.CrmStructure.CrmType.个人会员; break; case EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.购物: _danWeiType = 1; _mingXiType = (int)EyouSoft.Model.EnumType.SourceStructure.SourceType.购物; break; case EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.景点: _danWeiType = 1; _mingXiType = (int)EyouSoft.Model.EnumType.SourceStructure.SourceType.景点; break; case EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.酒店: _danWeiType = 1; _mingXiType = (int)EyouSoft.Model.EnumType.SourceStructure.SourceType.酒店; break; case EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.票务: _danWeiType = 1; _mingXiType = (int)EyouSoft.Model.EnumType.SourceStructure.SourceType.票务; break; case EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.其他: _danWeiType = 1; _mingXiType = (int)EyouSoft.Model.EnumType.SourceStructure.SourceType.其他; break; case EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.行客户: _danWeiType = 0; _mingXiType = (int)EyouSoft.Model.EnumType.CrmStructure.CrmType.行客户; break; case EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.游轮: _danWeiType = 1; _mingXiType = (int)EyouSoft.Model.EnumType.SourceStructure.SourceType.游轮; break; default: break; case EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.系统用户: _danWeiType = 2; break; } if (_danWeiType > -1) { query.AppendFormat(" AND DanWeiType={0} ", _danWeiType); } if (_mingXiType > -1) { query.AppendFormat(" AND MingXiType={0} ", _mingXiType); } } if (searchInfo.DistrictId.HasValue) { query.AppendFormat(" AND DistrictId={0} ", searchInfo.DistrictId.Value); } if (searchInfo.ProvinceId.HasValue) { query.AppendFormat(" AND ProvinceId={0} ", searchInfo.ProvinceId.Value); } } #endregion using (IDataReader rdr = DbHelper.ExecuteReader(_db, pageSize, pageIndex, ref recordCount, tableName, string.Empty, fields, query.ToString(), orderByString)) { while (rdr.Read()) { EyouSoft.Model.SmsStructure.MLBDaoRuLxrInfo item = new EyouSoft.Model.SmsStructure.MLBDaoRuLxrInfo(); item.CityId = rdr.GetInt32(rdr.GetOrdinal("CityId")); item.CountryId = rdr.GetInt32(rdr.GetOrdinal("CountryId")); item.CPCD = null; item.DanWeiName = rdr["DanWeiName"].ToString(); item.DanWeiType = EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.系统用户; item.DistrictId = rdr.GetInt32(rdr.GetOrdinal("DistrictId")); item.LxrName = rdr["LxrName"].ToString(); item.Mobile = rdr["Mobile"].ToString().Trim(); item.ProvinceId = rdr.GetInt32(rdr.GetOrdinal("ProvinceId")); //类型转换 int _danWeiType = rdr.GetInt32(rdr.GetOrdinal("DanWeiType")); int _mingXiType = rdr.GetByte(rdr.GetOrdinal("MingXiType")); if (_danWeiType == 0) { EyouSoft.Model.EnumType.CrmStructure.CrmType crmType = (EyouSoft.Model.EnumType.CrmStructure.CrmType)_mingXiType; switch (crmType) { case EyouSoft.Model.EnumType.CrmStructure.CrmType.单位直客: item.DanWeiType = EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.单位直客; break; case EyouSoft.Model.EnumType.CrmStructure.CrmType.个人会员: item.DanWeiType = EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.个人会员; break; case EyouSoft.Model.EnumType.CrmStructure.CrmType.行客户: item.DanWeiType = EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.行客户; break; } } else if (_danWeiType == 1) { EyouSoft.Model.EnumType.SourceStructure.SourceType sourceType = (EyouSoft.Model.EnumType.SourceStructure.SourceType)_mingXiType; switch (sourceType) { case EyouSoft.Model.EnumType.SourceStructure.SourceType.餐馆: item.DanWeiType = EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.餐馆; break; case EyouSoft.Model.EnumType.SourceStructure.SourceType.车队: item.DanWeiType = EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.车队; break; case EyouSoft.Model.EnumType.SourceStructure.SourceType.地接社: item.DanWeiType = EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.地接社; break; case EyouSoft.Model.EnumType.SourceStructure.SourceType.购物: item.DanWeiType = EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.购物; break; case EyouSoft.Model.EnumType.SourceStructure.SourceType.景点: item.DanWeiType = EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.景点; break; case EyouSoft.Model.EnumType.SourceStructure.SourceType.酒店: item.DanWeiType = EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.酒店; break; case EyouSoft.Model.EnumType.SourceStructure.SourceType.票务: item.DanWeiType = EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.票务; break; case EyouSoft.Model.EnumType.SourceStructure.SourceType.其他: item.DanWeiType = EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.其他; break; case EyouSoft.Model.EnumType.SourceStructure.SourceType.游轮: item.DanWeiType = EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.游轮; break; } } else if (_danWeiType == 2) { item.DanWeiType = EyouSoft.Model.EnumType.SmsStructure.DaoRuKeHuType.系统用户; } items.Add(item); } } return(items); }