Exemple #1
0
 /// <summary>
 /// 获取公司信息集合,列表以公司联系人信息为行集
 /// </summary>
 /// <param name="pageSize">每页记录数</param>
 /// <param name="pageIndex">当前页索引</param>
 /// <param name="recordCount">总记录数</param>
 /// <param name="searchInfo">查询信息</param>
 /// <returns></returns>
 public IList <EyouSoft.Model.PoolStructure.ContacterInfo> GetCompanysItemByContacter(int pageSize, int pageIndex, ref int recordCount, EyouSoft.Model.PoolStructure.CompanySearchInfo searchInfo)
 {
     return(dal.GetCompanysItemByContacter(pageSize, pageIndex, ref recordCount, searchInfo));
 }
Exemple #2
0
        /// <summary>
        /// 获取公司信息集合,列表以公司联系人信息为行集
        /// </summary>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="pageIndex">当前页索引</param>
        /// <param name="recordCount">总记录数</param>
        /// <param name="searchInfo">查询信息</param>
        /// <returns></returns>
        public virtual IList <EyouSoft.Model.PoolStructure.ContacterInfo> GetCompanysItemByContacter(int pageSize, int pageIndex, ref int recordCount, EyouSoft.Model.PoolStructure.CompanySearchInfo searchInfo)
        {
            IList <EyouSoft.Model.PoolStructure.ContacterInfo> contacters = new List <EyouSoft.Model.PoolStructure.ContacterInfo>();
            StringBuilder cmdText       = new StringBuilder();
            string        tableName     = "view_Company_ItemsByContacter";
            string        primaryKey    = "ContactId";
            string        orderByString = "CreateTime DESC";
            string        fields        = "ContactId,CompanyId,CompanyName,Fullname,Mobile,JobTitle,Birthday";

            #region 拼接查询
            cmdText.Append(" 1=1 ");

            if (searchInfo.CityId.HasValue)
            {
                cmdText.AppendFormat(" AND CityId={0} ", searchInfo.CityId.Value);
            }

            if (!string.IsNullOrEmpty(searchInfo.CompanyName))
            {
                cmdText.AppendFormat(" AND CompanyName LIKE '%{0}%' ", searchInfo.CompanyName);
            }

            if (searchInfo.CountyId.HasValue)
            {
                cmdText.AppendFormat(" AND CountyId={0} ", searchInfo.CountyId.Value);
            }

            if (searchInfo.ProvinceId.HasValue)
            {
                cmdText.AppendFormat(" AND ProvinceId={0} ", searchInfo.ProvinceId.Value);
            }

            if (!string.IsNullOrEmpty(searchInfo.ContacterFullname))
            {
                cmdText.AppendFormat(" AND Fullname LIKE '%{0}%' ", searchInfo.ContacterFullname);
            }

            if (!string.IsNullOrEmpty(searchInfo.ContacterMobile))
            {
                cmdText.AppendFormat(" AND Mobile='{0}' ", searchInfo.ContacterMobile);
            }

            if (searchInfo.CustomerTypeId.HasValue)
            {
                cmdText.AppendFormat(" AND EXISTS(SELECT 1 FROM tbl_CompanyCustomerTypeConfig WHERE CompanyId=view_Company_ItemsByContacter.CompanyId AND TypeId={0}) ", searchInfo.CustomerTypeId.Value);
            }

            if (searchInfo.SuitProductId.HasValue)
            {
                cmdText.AppendFormat(" AND EXISTS(SELECT 1 FROM tbl_CompanySuitProductConfig WHERE CompanyId=view_Company_ItemsByContacter.CompanyId AND SuitProductId={0}) ", searchInfo.SuitProductId.Value);
            }

            if (searchInfo.UserCitys != null && searchInfo.UserCitys.Length > 0)
            {
                cmdText.Append(" AND CityId IN( ");
                cmdText.Append(searchInfo.UserCitys[0].ToString());

                for (int i = 1; i < searchInfo.UserCitys.Length; i++)
                {
                    cmdText.AppendFormat(",{0}", searchInfo.UserCitys[i].ToString());
                }

                cmdText.Append(" ) ");
            }

            if (searchInfo.UserCustomerTypes != null && searchInfo.UserCustomerTypes.Count > 0)
            {
                cmdText.Append(" AND EXISTS(SELECT 1 FROM tbl_CompanyCustomerTypeConfig WHERE CompanyId=view_Company_ItemsByContacter.CompanyId AND TypeId IN( ");
                cmdText.Append(searchInfo.UserCustomerTypes[0].ToString());

                for (int i = 1; i < searchInfo.UserCustomerTypes.Count; i++)
                {
                    cmdText.AppendFormat(",{0}", searchInfo.UserCustomerTypes[i].ToString());
                }

                cmdText.Append(" )) ");
            }
            #endregion

            using (IDataReader rdr = DbHelper.ExecuteReader(this._db, pageSize, pageIndex, ref recordCount, tableName, primaryKey, fields, cmdText.ToString(), orderByString))
            {
                while (rdr.Read())
                {
                    EyouSoft.Model.PoolStructure.ContacterInfo contacter = new EyouSoft.Model.PoolStructure.ContacterInfo();

                    contacter.CompanyId   = rdr.GetString(rdr.GetOrdinal("CompanyId"));
                    contacter.CompanyName = rdr["CompanyName"].ToString();
                    contacter.ContacterId = rdr.GetInt32(rdr.GetOrdinal("ContactId"));
                    contacter.Fullname    = rdr["Fullname"].ToString();
                    contacter.Mobile      = rdr["Mobile"].ToString();
                    contacter.JobTitle    = rdr["JobTitle"].ToString();

                    if (!rdr.IsDBNull(rdr.GetOrdinal("Birthday")))
                    {
                        contacter.Birthday = rdr.GetDateTime(rdr.GetOrdinal("Birthday"));
                    }

                    contacters.Add(contacter);
                }
            }

            return(contacters);
        }
Exemple #3
0
        /// <summary>
        /// 初始话客户信息列表
        /// </summary>
        protected void BindCustomerList()
        {
            int recordCount = 0;
            int ProvinceId  = EyouSoft.Common.Function.StringValidate.GetIntValue(Request.QueryString["ProvinceId"]);
            int CityId      = EyouSoft.Common.Function.StringValidate.GetIntValue(Request.QueryString["CityId"]);

            int CustomerTypeaId = Utils.GetInt(Request.QueryString["CustomerTypeId"]);
            int SuitProductId   = Utils.GetInt(Request.QueryString["SuitProductId"]);

            string CustomerName      = Utils.InputText(Request.QueryString["CustomerName"]);
            string ContacterFullname = Utils.InputText(Request.QueryString["ContacterFullname"]);
            string ContacterMobile   = Utils.InputText(Request.QueryString["ContacterMobile"]);

            EyouSoft.Model.PoolStructure.CompanySearchInfo SearchModel = new EyouSoft.Model.PoolStructure.CompanySearchInfo();

            if (ProvinceId != 0)
            {
                SearchModel.ProvinceId = ProvinceId;
                SearchModel.CityId     = CityId;
            }
            SearchModel.CompanyName       = CustomerName;
            SearchModel.ContacterFullname = ContacterFullname;
            SearchModel.ContacterMobile   = ContacterMobile;
            if (CustomerTypeaId != 0)
            {
                SearchModel.CustomerTypeId = CustomerTypeaId;
            }
            if (SuitProductId != 0)
            {
                SearchModel.SuitProductId = SuitProductId;
            }

            SearchModel.UserCitys         = MasterUserInfo.AreaId;                                                                                                                              //用户分管的城市类型
            SearchModel.UserCustomerTypes = MasterUserInfo.CustomerTypeIds;                                                                                                                     //用户分管的客户类型

            IList <EyouSoft.Model.PoolStructure.CompanyInfo> CustomerList = EyouSoft.BLL.PoolStructure.Company.CreateInstance().GetCompanys(PageSize, PageIndex, ref recordCount, SearchModel); //查询

            if (CustomerList != null && CustomerList.Count > 0)
            {
                this.ExportPageInfo1.intPageSize    = PageSize;
                this.ExportPageInfo1.intRecordCount = recordCount;
                this.ExportPageInfo1.CurrencyPage   = PageIndex;
                this.ExportPageInfo1.PageLinkURL    = Request.ServerVariables["SCRIPT_NAME"].ToString() + "?";
                this.ExportPageInfo1.UrlParams      = Request.QueryString;
                this.repCustomerList.DataSource     = CustomerList;
                this.repCustomerList.DataBind();
            }
            else
            {
                System.Text.StringBuilder strEmptyText = new System.Text.StringBuilder();
                strEmptyText.Append("<table width=\"100%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"1\" class=\"kuang\">");
                strEmptyText.Append("<tr background=\"" + ImageServerUrl + "/images/yunying/hangbg.gif\" class=\"white\" height=\"23\">");
                strEmptyText.AppendFormat("<td width=\"5%\" height=\"23\" align=\"center\" valign=\"middle\" background=\"{0}/images/yunying/hangbg.gif\"> <strong>序号</strong> </td> <td width=\"7%\" align=\"center\" valign=\"middle\" background=\"{0}/images/yunying/hangbg.gif\"> <strong>单位名称</strong></td>", ImageServerUrl);
                strEmptyText.AppendFormat("<td width=\"18%\" align=\"center\" valign=\"middle\" background=\"{0}/images/yunying/hangbg.gif\"><strong>联系人</strong></td><td width=\"10%\" align=\"center\" background=\"{0}/images/yunying/hangbg.gif\"> <strong>生日</strong></td>", ImageServerUrl);
                strEmptyText.AppendFormat("<td width=\"12%\" align=\"center\" background=\"{0}/images/yunying/hangbg.gif\"><strong>职务</strong></td><td width=\"13%\" align=\"center\" background=\"{0}/images/yunying/hangbg.gif\">  <strong>手机</strong></td>", ImageServerUrl);
                strEmptyText.AppendFormat("<td width=\"13%\" align=\"center\" background=\"{0}/images/yunying/hangbg.gif\">  <strong>查看</strong></td>", ImageServerUrl);
                strEmptyText.Append("<tr class=\"huanghui\" ><td  align='center' colspan='7' height='100px'>暂无客户信息</td></tr>");
                strEmptyText.Append("</tr>");
                strEmptyText.Append("<tr background=\"" + ImageServerUrl + "/images/yunying/hangbg.gif\" class=\"white\" height=\"23\">");
                strEmptyText.AppendFormat("<td width=\"5%\" height=\"23\" align=\"center\" valign=\"middle\" background=\"{0}/images/yunying/hangbg.gif\"> <strong>序号</strong> </td> <td width=\"7%\" align=\"center\" valign=\"middle\" background=\"{0}/images/yunying/hangbg.gif\"> <strong>单位名称</strong></td>", ImageServerUrl);
                strEmptyText.AppendFormat("<td width=\"18%\" align=\"center\" valign=\"middle\" background=\"{0}/images/yunying/hangbg.gif\"><strong>联系人</strong></td><td width=\"10%\" align=\"center\" background=\"{0}/images/yunying/hangbg.gif\"> <strong>生日</strong></td>", ImageServerUrl);
                strEmptyText.AppendFormat("<td width=\"12%\" align=\"center\" background=\"{0}/images/yunying/hangbg.gif\"><strong>职务</strong></td><td width=\"13%\" align=\"center\" background=\"{0}/images/yunying/hangbg.gif\">  <strong>手机</strong></td>", ImageServerUrl);
                strEmptyText.AppendFormat("<td width=\"13%\" align=\"center\" background=\"{0}/images/yunying/hangbg.gif\">  <strong>查看</strong></td>", ImageServerUrl);
                strEmptyText.Append("</tr>");
                strEmptyText.Append("</table>");
                this.repCustomerList.EmptyText = strEmptyText.ToString();
            }

            if (SearchModel.ProvinceId.HasValue)
            {
                this.ProvinceAndCityList1.SetProvinceId = SearchModel.ProvinceId.Value;
            }
            if (SearchModel.CityId.HasValue)
            {
                this.ProvinceAndCityList1.SetCityId = SearchModel.CityId.Value;
            }
            if (SearchModel.CustomerTypeId.HasValue)
            {
                this.ddlCustomerType.SelectedIndex = SearchModel.CustomerTypeId.Value;
            }
            if (SearchModel.SuitProductId.HasValue)
            {
                this.ddlSuitProduct.SelectedIndex = SearchModel.SuitProductId.Value;
            }

            this.txtCompanyName.Value       = SearchModel.CompanyName;
            this.txtContacterFullname.Value = SearchModel.ContacterFullname;
            this.txtContacterMobile.Value   = SearchModel.ContacterMobile;

            SearchModel  = null;
            CustomerList = null;
        }