예제 #1
0
        protected void LoadData()
        {
            //2010-12-17 修改客户类型-lihc
            BindCustomerCate();


            string custId = Utils.GetQueryStringValue("custid");

            if (custId != "")
            {
                EyouSoft.Model.SMSStructure.CustomerInfo customerModel = customerBll.GetCustomerInfo(custId);
                if (customerModel != null)
                {
                    isAdd                    = "update";
                    customerId               = custId;
                    ce_selUserClass.Value    = customerModel.CategoryId.ToString();
                    ce_txtCompanyName.Value  = customerModel.CustomerCompanyName;
                    ce_txtMoible.Value       = customerModel.Mobile;
                    ce_txtUserName.Value     = customerModel.CustomerContactName;
                    ce_txtRemark.Value       = customerModel.Remark;
                    PAC_Select.SetProvinceId = customerModel.ProvinceId;
                    PAC_Select.SetCityId     = customerModel.CityId;
                }
            }
        }
예제 #2
0
        /// <summary>
        /// 获取客户信息
        /// </summary>
        /// <param name="customerId">客户编号</param>
        /// <returns></returns>
        public virtual EyouSoft.Model.SMSStructure.CustomerInfo GetCustomerInfo(string customerId)
        {
            EyouSoft.Model.SMSStructure.CustomerInfo customerInfo = null;
            DbCommand cmd = base.SMSStore.GetSqlStringCommand(SQL_SELECT_GETCUSTOMERINFO);

            base.SMSStore.AddInParameter(cmd, "CUSTOMERID", DbType.AnsiStringFixedLength, customerId);

            using (IDataReader rdr = DbHelper.ExecuteReader(cmd, base.SMSStore))
            {
                if (rdr.Read())
                {
                    customerInfo = new EyouSoft.Model.SMSStructure.CustomerInfo(rdr.GetString(rdr.GetOrdinal("ID"))
                                                                                , rdr.GetString(rdr.GetOrdinal("CompanyID"))
                                                                                , rdr.GetString(rdr.GetOrdinal("UserID"))
                                                                                , rdr["CustomerCompanyName"].ToString()
                                                                                , rdr["CustomerContactName"].ToString()
                                                                                , rdr.GetInt32(rdr.GetOrdinal("ClassID"))
                                                                                , string.Empty
                                                                                , rdr["ReMark"].ToString()
                                                                                , rdr["MobileNumber"].ToString()
                                                                                , rdr.GetDateTime(rdr.GetOrdinal("IssueTime"))
                                                                                , rdr.GetInt32(rdr.GetOrdinal("ProvinceId"))
                                                                                , rdr.GetInt32(rdr.GetOrdinal("CityId"))
                                                                                );
                }
            }

            return(customerInfo);
        }
예제 #3
0
        /// <summary>
        /// 更新客户信息
        /// </summary>
        /// <param name="customerInfo">客户信息业务实体</param>
        /// <returns>返回处理结果</returns>
        public bool UpdateCustomer(EyouSoft.Model.SMSStructure.CustomerInfo customerInfo)
        {
            if (dal.IsExistsCustomerMobile(customerInfo.CompanyId, customerInfo.Mobile, customerInfo.CustomerId))
            {
                return(false);
            }

            return(dal.UpdateCustomer(customerInfo));
        }
예제 #4
0
        /// <summary>
        /// 插入客户信息
        /// </summary>
        /// <param name="customerInfo">客户信息业务实体</param>
        /// <returns>返回处理结果</returns>
        public bool InsertCustomer(EyouSoft.Model.SMSStructure.CustomerInfo customerInfo)
        {
            if (dal.IsExistsCustomerMobile(customerInfo.CompanyId, customerInfo.Mobile, null))
            {
                return(false);
            }

            customerInfo.CustomerId = Guid.NewGuid().ToString();
            return(dal.InsertCustomer(customerInfo));
        }
예제 #5
0
        /// <summary>
        /// 更新客户信息
        /// </summary>
        /// <param name="customerInfo">客户信息业务实体</param>
        /// <returns>返回处理结果</returns>
        public virtual bool UpdateCustomer(EyouSoft.Model.SMSStructure.CustomerInfo customerInfo)
        {
            DbCommand cmd = base.SMSStore.GetSqlStringCommand(SQL_UPDATE_UpdateCustomer);

            base.SMSStore.AddInParameter(cmd, "CUSTOMERCOMPANYNAME", DbType.String, customerInfo.CustomerCompanyName);
            base.SMSStore.AddInParameter(cmd, "CUSTOMERCONTACTNAME", DbType.String, customerInfo.CustomerContactName);
            base.SMSStore.AddInParameter(cmd, "CLASSID", DbType.Int32, customerInfo.CategoryId);
            base.SMSStore.AddInParameter(cmd, "REMARK", DbType.String, customerInfo.Remark);
            base.SMSStore.AddInParameter(cmd, "MOBILE", DbType.String, customerInfo.Mobile);
            base.SMSStore.AddInParameter(cmd, "CUSTOMERID", DbType.String, customerInfo.CustomerId);
            base.SMSStore.AddInParameter(cmd, "COMPANYID", DbType.String, customerInfo.CompanyId);
            base.SMSStore.AddInParameter(cmd, "ProvinceId", DbType.Int32, customerInfo.ProvinceId);
            base.SMSStore.AddInParameter(cmd, "CityId", DbType.Int32, customerInfo.CityId);

            return(DbHelper.ExecuteSql(cmd, base.SMSStore) > 0 ? true : false);
        }
예제 #6
0
        protected void btn_ImportInfo_Click(object sender, EventArgs e)
        {
            if (!IsCompanyCheck)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "<script type='text/javascript'>alert('对不起,你尚未审核通过!');</script>");
                return;
            }
            EyouSoft.IBLL.SMSStructure.ICustomer     cus_Bll   = EyouSoft.BLL.SMSStructure.Customer.CreateInstance();
            EyouSoft.Model.SMSStructure.CustomerInfo cus_Model = null;

            int    CusTypeID    = 0;
            string TelPhone     = "";
            string CompanyName  = "";
            string CustomerName = "";
            string Remark       = "";

            string[] TelPhoneList     = null;
            string[] CompanyNameList  = null;
            string[] CustomerNameList = null;

            TelPhone     = Utils.GetFormValue("hidTel");
            TelPhoneList = Utils.Split(TelPhone, "{~@}");


            CompanyName     = Utils.GetFormValue("hidCompany");
            CompanyNameList = Utils.Split(CompanyName, "{~@}");


            CustomerName     = Utils.GetFormValue("hidName");
            CustomerNameList = Utils.Split(CustomerName, "{~@}");

            for (int i = 0; i < TelPhoneList.Length; i++)
            {
                cus_Model            = new  EyouSoft.Model.SMSStructure.CustomerInfo();
                cus_Model.CategoryId = CusTypeID;
                cus_Model.CompanyId  = SiteUserInfo.CompanyID;
                if (CompanyNameList != null)
                {
                    cus_Model.CustomerCompanyName = CompanyNameList[i].ToString();
                }
                else
                {
                    cus_Model.CustomerCompanyName = "";
                }
                if (CustomerNameList != null)
                {
                    cus_Model.CustomerContactName = CustomerNameList[i].ToString();
                }
                else
                {
                    cus_Model.CustomerContactName = "";
                }
                if (TelPhoneList != null)
                {
                    cus_Model.Mobile = TelPhoneList[i].ToString();
                }
                else
                {
                    cus_Model.Mobile = "";
                }
                cus_Model.Remark = Remark;
                cus_Model.UserId = SiteUserInfo.ID;
                cus_Bll.InsertCustomer(cus_Model);
            }
            cus_Model = null;
            cus_Bll   = null;
            Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "<script type='text/javascript'>alert('导入成功,若存在重复手机号码,将不会被导入!');window.parent.Boxy.getIframeDialog('" + Request.QueryString["iframeId"] + "').hide();for(var i in window.parent.searchParam){window.parent.searchParam[i]=''};window.parent.CustomerList.search();</script>");
        }
예제 #7
0
        protected void AddOrUpdateCustomer(string method)
        {
            if (!IsCompanyCheck)//是否审核
            {
                Utils.ResponseMegError();
                return;
            }
            string moible      = Utils.InputText(Server.UrlDecode(Request.QueryString["moible"] ?? ""));      //手机号
            string companyName = Utils.InputText(Server.UrlDecode(Request.QueryString["companyname"] ?? "")); //单位名称
            string userName    = Utils.InputText(Server.UrlDecode(Request.QueryString["username"] ?? ""));    //姓名
            string remark      = Utils.InputText(Server.UrlDecode(Request.QueryString["remark"] ?? ""));      //备注
            string cateName    = Utils.InputText(Server.UrlDecode(Request.QueryString["catename"] ?? ""));    //类别名称
            int    cateId      = Utils.GetInt(Request.QueryString["cateid"]);                                 //类别Id
            string custid      = Utils.GetQueryStringValue("custid");
            //省份|城市
            int provinceId = Utils.GetInt(Request.QueryString["provinceId"]);
            int cityId     = Utils.GetInt(Request.QueryString["cityid"]);

            EyouSoft.Model.SMSStructure.CustomerInfo customerModel = new EyouSoft.Model.SMSStructure.CustomerInfo();
            if (method == "update")
            {
                if (customerBll.IsExistsCustomerMobile(SiteUserInfo.CompanyID, moible, custid))//判断客户号码是否已经存在
                {
                    Utils.ResponseMeg(false, "该号码已经存在!");
                    return;
                }
                customerModel = customerBll.GetCustomerInfo(custid);
            }
            else if (method == "add")
            {
                if (customerBll.IsExistsCustomerMobile(SiteUserInfo.CompanyID, moible))//判断客户号码是否已经存在
                {
                    Utils.ResponseMeg(false, "该号码已经存在!");
                    return;
                }
            }
            //省份|城市
            customerModel.ProvinceId          = provinceId;
            customerModel.CityId              = cityId;
            customerModel.UserId              = SiteUserInfo.ID;
            customerModel.Remark              = remark;
            customerModel.Mobile              = moible;
            customerModel.CategoryId          = cateId;
            customerModel.CustomerContactName = userName;
            customerModel.CompanyId           = SiteUserInfo.CompanyID;
            customerModel.CustomerCompanyName = companyName;
            customerModel.CategoryName        = cateName;
            bool isSuccess = true;

            if (method == "update")
            {
                isSuccess = customerBll.UpdateCustomer(customerModel);//执行修改操作
                if (isSuccess)
                {
                    Utils.ResponseMeg(true, "修改成功");
                }
                else
                {
                    Utils.ResponseMeg(true, "修改失败");
                }
            }
            else if (method == "add")
            {
                isSuccess = customerBll.InsertCustomer(customerModel);//执行添加造作
                if (isSuccess)
                {
                    Utils.ResponseMeg(true, "添加成功");
                }
                else
                {
                    Utils.ResponseMeg(true, "添加失败");
                }
            }
        }
예제 #8
0
        /// <summary>
        /// 根据指定条件获取客户信息
        /// </summary>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="pageIndex">当前页索引</param>
        /// <param name="recordCount">总记录数</param>
        /// <param name="companyId">公司编号</param>
        /// <param name="customerCompanyName">客户公司名称 为空时不做为查询条件</param>
        /// <param name="customerUserFullName">客户联系人姓名 为空时不做为查询条件</param>
        /// <param name="mobile">手机号码 为空时不做为查询条件</param>
        /// <param name="categoryId">客户类型编号 -1时不做为查询条件</param>
        /// <param name="source">客户来源</param>
        /// <param name="provinceId">省份ID</param>
        /// <param name="cityId">城市ID</param>
        /// <returns></returns>
        public virtual IList <EyouSoft.Model.SMSStructure.CustomerInfo> GetCustomers(int pageSize, int pageIndex, ref int recordCount, string companyId, string customerCompanyName, string customerUserFullName, string mobile, int categoryId, EyouSoft.Model.SMSStructure.CustomerInfo.CustomerSource source, int provinceId, int cityId)
        {
            IList <EyouSoft.Model.SMSStructure.CustomerInfo> customers = new List <EyouSoft.Model.SMSStructure.CustomerInfo>();

            StringBuilder cmdQuery      = new StringBuilder();
            string        tableName     = "view_SMS_Customers";
            string        primaryKey    = "Id";
            string        orderByString = "IssueTime DESC";
            string        fields        = " ID, CompanyID, UserID, CustomerCompanyName, CustomerContactName, ClassID, ReMark, MobileNumber, IssueTime, ClassName,TongYCompanyId, ProvinceId, CityId, ProvinceName, CityName";

            cmdQuery.Append(" 1=1 ");

            switch (source)
            {
            case EyouSoft.Model.SMSStructure.CustomerInfo.CustomerSource.所有客户:      //注意TongYCompanyId<>companyId是用来排除自己的
                cmdQuery.AppendFormat(" AND (CompanyID='{0}' OR CompanyID='0') AND TongYCompanyId <> '{0}' ", companyId);
                break;

            case EyouSoft.Model.SMSStructure.CustomerInfo.CustomerSource.我的客户:
                cmdQuery.AppendFormat(" AND CompanyID='{0}' ", companyId);
                break;

            case EyouSoft.Model.SMSStructure.CustomerInfo.CustomerSource.平台组团社客户:    //注意TongYCompanyId<>companyId是用来排除自己的
                cmdQuery.AppendFormat(" AND CompanyID='0' AND TongYCompanyId <> '{0}' ", companyId);
                break;
            }

            if (provinceId > 0)
            {
                cmdQuery.AppendFormat(" AND ProvinceId={0}", provinceId);
            }

            if (cityId > 0)
            {
                cmdQuery.AppendFormat(" AND CityId={0}", cityId);
            }

            if (!string.IsNullOrEmpty(customerCompanyName))
            {
                cmdQuery.AppendFormat(" AND (CustomerCompanyName LIKE '%{0}%')", customerCompanyName);
            }

            if (!string.IsNullOrEmpty(customerUserFullName))
            {
                cmdQuery.AppendFormat(" AND (CustomerContactName LIKE '%{0}%')", customerUserFullName);
            }

            if (!string.IsNullOrEmpty(mobile))
            {
                cmdQuery.AppendFormat(" AND (MobileNumber LIKE '%{0}%')", mobile);
            }

            if (categoryId != -1 && categoryId != 0)
            {
                cmdQuery.AppendFormat(" AND ClassID={0}", categoryId.ToString());
            }

            using (IDataReader rdr = DbHelper.ExecuteReader(base.SMSStore, pageSize, pageIndex, ref recordCount, tableName, primaryKey, fields, cmdQuery.ToString(), orderByString))
            {
                EyouSoft.Model.SMSStructure.CustomerInfo model = null;

                while (rdr.Read())
                {
                    model = new EyouSoft.Model.SMSStructure.CustomerInfo();

                    model.CustomerId          = rdr.GetString(rdr.GetOrdinal("ID"));
                    model.CompanyId           = rdr.GetString(rdr.GetOrdinal("CompanyID"));
                    model.UserId              = rdr.GetString(rdr.GetOrdinal("UserID"));
                    model.CustomerCompanyName = rdr["CustomerCompanyName"].ToString();
                    model.CustomerContactName = rdr["CustomerContactName"].ToString();
                    model.CategoryId          = rdr.GetInt32(rdr.GetOrdinal("ClassID"));
                    model.CategoryName        = rdr["ClassName"].ToString();
                    model.Remark              = rdr["ReMark"].ToString();
                    model.Mobile              = rdr["MobileNumber"].ToString();
                    model.IssueTime           = rdr.GetDateTime(rdr.GetOrdinal("IssueTime"));
                    model.RetailersCompanyId  = rdr.GetString(rdr.GetOrdinal("TongYCompanyId"));
                    model.ProvinceId          = rdr.GetInt32(rdr.GetOrdinal("ProvinceId"));
                    model.ProvinceName        = rdr.IsDBNull(rdr.GetOrdinal("ProvinceName")) ? "" : rdr.GetString(rdr.GetOrdinal("ProvinceName"));
                    model.CityId              = rdr.GetInt32(rdr.GetOrdinal("CityId"));
                    model.CityName            = rdr.IsDBNull(rdr.GetOrdinal("CityName")) ? "" : rdr.GetString(rdr.GetOrdinal("CityName"));

                    customers.Add(model);
                }
            }

            return(customers);
        }