Example #1
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public int Update(Entities.DealerInfo model)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@RecID",        SqlDbType.Int,          4),
                new SqlParameter("@CustID",       SqlDbType.VarChar,     20),
                new SqlParameter("@MemberCode",   SqlDbType.VarChar,     50),
                new SqlParameter("@Name",         SqlDbType.NVarChar,   300),
                new SqlParameter("@CityScope",    SqlDbType.Int,          4),
                new SqlParameter("@MemberType",   SqlDbType.Int,          4),
                new SqlParameter("@CarType",      SqlDbType.Int,          4),
                new SqlParameter("@MemberStatus", SqlDbType.Int,          4),
                new SqlParameter("@Remark",       SqlDbType.NVarChar,  2000),
                new SqlParameter("@Status",       SqlDbType.Int,          4),
                new SqlParameter("@CreateTime",   SqlDbType.DateTime),
                new SqlParameter("@CreateUserID", SqlDbType.Int, 4)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.CustID;
            parameters[2].Value     = model.MemberCode;
            parameters[3].Value     = model.Name;
            parameters[4].Value     = model.CityScope;
            parameters[5].Value     = model.MemberType;
            parameters[6].Value     = model.CarType;
            parameters[7].Value     = model.MemberStatus;
            parameters[8].Value     = model.Remark;
            parameters[9].Value     = model.Status;
            parameters[10].Value    = model.CreateTime;
            parameters[11].Value    = model.CreateUserID;

            SqlHelper.ExecuteNonQuery(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_DEALERINFO_UPDATE, parameters);
            return((int)parameters[0].Value);
        }
        private void GetDealerInfoModel(string CustID)
        {
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            if (!string.IsNullOrEmpty(CustID))
            {
                Entities.DealerInfo DealerInfoModel = null;
                DealerInfoModel = BLL.DealerInfo.Instance.GetDealerInfo(CustID);

                if (DealerInfoModel != null)
                {
                    MemberName           = DealerInfoModel.Name.Trim();
                    hid_MemberName.Value = MemberName;
                    MemberCode           = DealerInfoModel.MemberCode;
                    Remark = DealerInfoModel.Remark;
                }
            }
            else if (!string.IsNullOrEmpty(RequestSYSType))
            {
                if (RequestSYSType.Contains("isIM"))
                {
                    MemberName           = RequestMemberName;
                    hid_MemberName.Value = MemberName;
                    MemberCode           = RequestMemberCode;
                }
            }

            logmsg = "(已" + sw.Elapsed.TotalSeconds.ToString("0.00") + "s);";
            sw.Stop();
        }
Example #3
0
        private void GetDealerInfoModel(string CustID)
        {
            if (!string.IsNullOrEmpty(CustID))
            {
                Entities.DealerInfo DealerInfoModel = null;
                DealerInfoModel = BLL.DealerInfo.Instance.GetDealerInfo(CustID);

                if (DealerInfoModel != null)
                {
                    this.lblMemberName.Text = DealerInfoModel.Name;
                    this.lblMemberID.Text   = DealerInfoModel.MemberCode;
                    this.lblRemark.Text     = DealerInfoModel.Remark;

                    DataTable            dt    = null;
                    QueryDealerBrandInfo query = new QueryDealerBrandInfo();
                    query.CustID = CustID;
                    int totalCount = 0;
                    dt = BLL.DealerBrandInfo.Instance.GetDealerBrandInfo(query, "", 1, 1, out totalCount);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            lblBrand.Text += dt.Rows[i]["Name"].ToString() + ",";
                        }
                        if (lblBrand.Text != "")
                        {
                            lblBrand.Text = lblBrand.Text.Substring(0, lblBrand.Text.Length - 1);
                        }
                    }
                    if (DealerInfoModel.CityScope > 0)
                    {
                        lblCityScope.Text = BLL.Util.GetEnumOptText(typeof(CityScope), Convert.ToInt32(DealerInfoModel.CityScope));
                    }
                    if (DealerInfoModel.CarType > 0)
                    {
                        lblCarType.Text = BLL.Util.GetEnumOptText(typeof(CarType), Convert.ToInt32(DealerInfoModel.CarType));
                    }
                    if (DealerInfoModel.MemberStatus > 0)
                    {
                        lblMemberStatus.Text = BLL.Util.GetEnumOptText(typeof(MemberStatus), Convert.ToInt32(DealerInfoModel.MemberStatus));
                    }
                    if (DealerInfoModel.MemberType > 0)
                    {
                        lblMemberType.Text = BLL.Util.GetEnumOptText(typeof(DealerCategory), Convert.ToInt32(DealerInfoModel.MemberType));
                    }
                }
            }
        }
Example #4
0
        private Entities.DealerInfo LoadSingleDealerInfo(DataRow row)
        {
            Entities.DealerInfo model = new Entities.DealerInfo();

            if (row["RecID"].ToString() != "")
            {
                model.RecID = int.Parse(row["RecID"].ToString());
            }
            model.CustID     = row["CustID"].ToString();
            model.MemberCode = row["MemberCode"].ToString();
            model.Name       = row["Name"].ToString();
            if (row["CityScope"].ToString() != "")
            {
                model.CityScope = int.Parse(row["CityScope"].ToString());
            }
            if (row["MemberType"].ToString() != "")
            {
                model.MemberType = int.Parse(row["MemberType"].ToString());
            }
            if (row["CarType"].ToString() != "")
            {
                model.CarType = int.Parse(row["CarType"].ToString());
            }
            if (row["MemberStatus"].ToString() != "")
            {
                model.MemberStatus = int.Parse(row["MemberStatus"].ToString());
            }
            model.Remark = row["Remark"].ToString();
            if (row["Status"].ToString() != "")
            {
                model.Status = int.Parse(row["Status"].ToString());
            }
            if (row["CreateTime"].ToString() != "")
            {
                model.CreateTime = DateTime.Parse(row["CreateTime"].ToString());
            }
            if (row["CreateUserID"].ToString() != "")
            {
                model.CreateUserID = int.Parse(row["CreateUserID"].ToString());
            }
            return(model);
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(Entities.DealerInfo model)
 {
     return(Dal.DealerInfo.Instance.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Insert(Entities.DealerInfo model)
 {
     return(Dal.DealerInfo.Instance.Insert(model));
 }
Example #7
0
        /// <summary>
        /// 提交经销商信息
        /// </summary>
        /// <param name="msg"></param>
        public void SubDealerInfo(out string msg)
        {
            msg = string.Empty;
            Entities.DealerInfo Model = new Entities.DealerInfo();
            Model.Name = MemberName;
            BitAuto.YanFa.Crm2009.Entities.QueryDMSMember query = new YanFa.Crm2009.Entities.QueryDMSMember();
            query.Name = Model.Name;
            int DMSCount = 0;
            //在提交时根据经销商名称判断会员编号是否存在
            DataTable dtMember = BitAuto.YanFa.Crm2009.BLL.DMSMember.Instance.GetDMSMember(query, "", 1, 100000, out DMSCount);

            if (dtMember != null && dtMember.Rows.Count > 0)
            {
                Model.MemberCode = dtMember.Rows[0]["MemberCode"].ToString();
            }
            else
            {
                Model.MemberCode = "";
            }
            Model.Remark       = Remark;
            Model.CustID       = CustID;
            Model.Status       = 0;
            Model.CreateTime   = System.DateTime.Now;
            Model.CreateUserID = (int?)BLL.Util.GetLoginUserID();
            Model.CarType      = CarType;
            Model.CityScope    = CityScope;
            Model.MemberStatus = MemberStatus;
            Model.MemberType   = MemberType;
            try
            {
                //判断是否有已购车,未购车记录
                if (BLL.BuyCarInfo.Instance.IsExistsByCustID(Model.CustID))
                {
                    BLL.BuyCarInfo.Instance.Delete(Model.CustID);
                    //BLL.Util.InsertUserLog("删除客户id为" + Model.CustID + ",的已购车未购车。");
                }
                int DealerID = 0;
                //判断是否存在经销商信息
                if (BLL.DealerInfo.Instance.IsExistsByCustID(Model.CustID))
                {
                    DealerID = BLL.DealerInfo.Instance.Update(Model);
                    BLL.Util.InsertUserLog("更新客户id为" + Model.CustID + ",的经销商信息。");
                }
                else
                {
                    DealerID = BLL.DealerInfo.Instance.Insert(Model);
                    BLL.Util.InsertUserLog("插入客户id为" + Model.CustID + ",的经销商信息。");
                }
                BLL.DealerBrandInfo.Instance.Delete(Model.CustID);
                //BLL.Util.InsertUserLog("删除客户id为" + Model.CustID + ",的经销商品牌信息。");
                if (BrandID != string.Empty)
                {
                    string[] brandids = BrandID.Split(',');
                    if (brandids != null && brandids.Length > 0)
                    {
                        for (int i = 0; i < brandids.Length; i++)
                        {
                            DealerBrandInfo Brandmodel = new DealerBrandInfo();
                            Brandmodel.CustID   = CustID;
                            Brandmodel.DealerID = DealerID;
                            if (brandids[i] != "")
                            {
                                Brandmodel.BrandID = Convert.ToInt32(brandids[i]);
                            }
                            BLL.DealerBrandInfo.Instance.Insert(Brandmodel);
                        }
                        BLL.Util.InsertUserLog("插入客户id为" + Model.CustID + ",的经销商品牌信息。");
                    }
                }
                msg = "success";
            }
            catch (Exception ex)
            {
                msg = "经销商信息保存失败,失败原因:" + ex.Message.ToString();
            }
        }
        public EnumResult InsertCustData(string Verifycode, string jsonDataStr)
        {
            BLL.Loger.Log4Net.Info("准备验证:");
            string msg = string.Empty;

            if (BLL.CallRecord_ORIG_Authorizer.Instance.Verify(Verifycode, 0, ref msg, "插入话务与任务关联数据,授权失败。"))
            {
                BLL.Loger.Log4Net.Info("验证通过");
                JavaScriptSerializer serializer = new JavaScriptSerializer();
                CustBussiness        info       = null;
                try
                {
                    BLL.Loger.Log4Net.Info("Json串:" + jsonDataStr);
                    info = serializer.Deserialize <CustBussiness>(jsonDataStr);
                    BLL.Loger.Log4Net.Info("Json格式转换成功");
                }
                catch (Exception ex)
                {
                    BLL.Loger.Log4Net.Info("Json格式转换失败,失败原因:" + ex.Message);
                    return(EnumResult.JsonPatternError);
                }

                Entities.CallRecord_ORIG orig;
                BitAuto.YanFa.Crm2009.Entities.DMSMember member;
                EnumResult vefiyResult = VefiyCustData(info, out orig, out member);
                if (vefiyResult == EnumResult.Success)
                {
                    try
                    {
                        //0 获取分组分类
                        SetBGIDAndSCID(info);
                        //1 插入个人信息表
                        string custId       = string.Empty;
                        string errMsg       = string.Empty;
                        int    custCategory = 4;
                        if (!string.IsNullOrEmpty(info.MemberCode))
                        {
                            //3-经销商;4-个人
                            custCategory = 3;
                        }
                        if (BLL.CustBasicInfo.Instance.InsertCustInfo(info.CustName, info.Tels, CommonFunction.ObjectToInteger(info.Sex), (int)orig.CreateUserID, custCategory, null, null, out errMsg, out custId))
                        {
                            BLL.Loger.Log4Net.Info("插入客户成功");
                            //删除经销商
                            BLL.DealerInfo.Instance.Delete(custId);

                            if (!string.IsNullOrEmpty(info.MemberCode))
                            {
                                //插入
                                Entities.DealerInfo model_Dealer = new Entities.DealerInfo();
                                model_Dealer.CustID       = custId;
                                model_Dealer.MemberCode   = info.MemberCode;
                                model_Dealer.Name         = member.Name;
                                model_Dealer.Status       = 0;
                                model_Dealer.CreateTime   = DateTime.Now;
                                model_Dealer.CreateUserID = (int)orig.CreateUserID;
                                BLL.DealerInfo.Instance.Insert(model_Dealer);
                                BLL.Loger.Log4Net.Info("插入经销商信息成功");
                            }

                            //2 插入访问记录
                            string tel          = BLL.Util.HaoMaProcess(orig.ANI);
                            long   callid       = CommonFunction.ObjectToLong(info.CallID, -2);
                            int    businesstype = (int)VisitBusinessTypeEnum.S0_其他系统;
                            int    tasksource   = orig.CallStatus == 2 ? 2 : 1;
                            BitAuto.ISDC.CC2012.Web.AjaxServers.CustBaseInfo.OperPopCustBasicInfo.OperCustVisitBusiness(custId, info.BusinessID, callid, businesstype, tasksource, (int)orig.CreateUserID, tel);

                            //3 插入话务业务表
                            UpdateBusinessDataByCallID(info);

                            //插入来去电表
                            CallRecordInfoInfo recordInfo = new CallRecordInfoInfo();
                            recordInfo.CallID     = long.Parse(info.CallID);
                            recordInfo.SCID       = int.Parse(info.SCID);
                            recordInfo.TaskID     = info.BusinessID;
                            recordInfo.TaskTypeID = (int)ProjectSource.None;
                            recordInfo.BGID       = int.Parse(info.BGID);
                            recordInfo.CustID     = custId;
                            recordInfo.CustName   = info.CustName;
                            recordInfo.Contact    = info.CustName;
                            long recId = 0;
                            BLL.CallRecordInfo.Instance.InsertCallRecordInfoToHuiMaiChe(recordInfo, orig, out recId);
                            return(EnumResult.Success);
                        }
                        else
                        {
                            return(EnumResult.Fail);
                        }
                    }
                    catch (Exception ex)
                    {
                        BLL.Loger.Log4Net.Error("【插入客户信息+话务】", ex);
                        return(EnumResult.Fail);
                    }
                }
                else
                {
                    BLL.Loger.Log4Net.Info("Json验证失败:msg=" + vefiyResult.ToString());
                    return(vefiyResult);
                }
            }
            else
            {
                BLL.Loger.Log4Net.Info("验证失败!msg=" + msg);
                return(EnumResult.VerifyError);
            }
        }
Example #9
0
        /// 保存个人信息:弹屏,老版工单
        /// <summary>
        /// 保存个人信息:弹屏,老版工单
        /// </summary>
        /// <param name="info"></param>
        /// <param name="msg"></param>
        public void InsertCustInfo(CustBasicInfo info, out string msg)
        {
            msg = string.Empty;
            try
            {
                if (info.CustName == string.Empty || info.Tel == string.Empty)
                {
                    msg = "'result':'false','errorMsg':'数据格式错误!'";
                    return;
                }
                validateData(info.CustName, info.Sex, info.Tel, info.CustCategoryID, out msg);
                if (msg != "")
                {
                    msg = "'result':'false','errorMsg':'" + msg + "'";
                    return;
                }
                //获取个人用户ID
                ccCustID = BLL.CustBasicInfo.Instance.GetMaxNewCustBasicInfoByTel(info.Tel);
                if (!string.IsNullOrEmpty(ccCustID))
                {
                    # region 更新操作
                    Entities.CustBasicInfo model = BLL.CustBasicInfo.Instance.GetCustBasicInfo(ccCustID);
                    model.CustName = info.CustName;

                    int _sex      = CommonFunction.ObjectToInteger(info.Sex, -1);            //1男 2女
                    int _category = CommonFunction.ObjectToInteger(info.CustCategoryID, -1); //3经销商 4个人
                    if (_sex > 0)
                    {
                        model.Sex = _sex;
                    }
                    if (_category > 0)
                    {
                        model.CustCategoryID = _category;//3-经销商;4-个人;
                    }
                    int pID = 0, cID = 0;
                    BLL.PhoneNumDataDict.GetAreaId(info.Tel, out pID, out cID);
                    model.ProvinceID   = pID == 0 ? -2 : pID;
                    model.CityID       = cID == 0 ? -2 : cID;
                    model.CountyID     = -1;
                    model.AreaID       = "";//新增 更新时 自动计算
                    model.CallTime     = 0;
                    model.Status       = 0;
                    model.ModifyUserID = info.OperID;
                    model.ModifyTime   = info.OperTime;
                    BLL.CustBasicInfo.Instance.Update(model);
                    #endregion
                    BLL.Util.InsertUserLog("个人用户表【修改记录】【修改电话信息】成功【电话】" + info.Tel + "【姓名】" + info.CustName + "【客户分类】" + info.CustCategoryID + "【省份ID】" + pID + "【城市ID】" + cID + "【大区】" + model.AreaID + "【操作人】" + info.OperID + "【操作时间】" + info.OperTime);
                    msg = "'result':'true','CustID':'" + ccCustID + "'";
                    return;
                }
                else
                {
                    int _sex      = CommonFunction.ObjectToInteger(info.Sex, 1);            //1男 2女
                    int _category = CommonFunction.ObjectToInteger(info.CustCategoryID, 4); //3经销商 4个人

                    if (_sex <= 0 || _category <= 0)
                    {
                        msg = "'result':'false','errorMsg':'Sex:" + info.Sex + ",CustCategoryID:" + info.CustCategoryID + ",数据格式出现错误,无法操作!'";
                        return;
                    }

                    #region 插入个人信息表CustBasicInfo
                    Entities.CustBasicInfo model = new Entities.CustBasicInfo();
                    model.CustName       = info.CustName;
                    model.Sex            = _sex;
                    model.CustCategoryID = _category;//3-经销商;4-个人;
                    int pID = 0, cID = 0;
                    BLL.PhoneNumDataDict.GetAreaId(info.Tel, out pID, out cID);
                    model.ProvinceID   = pID == 0 ? -2 : pID;
                    model.CityID       = cID == 0 ? -2 : cID;
                    model.CountyID     = -1;
                    model.AreaID       = "";//新增 更新时 自动计算
                    model.CallTime     = 0;
                    model.Status       = 0;
                    model.CreateUserID = model.ModifyUserID = info.OperID;
                    model.CreateTime   = model.ModifyTime = info.OperTime;
                    //插入个人用户库
                    ccCustID = BLL.CustBasicInfo.Instance.Insert(model);
                    #endregion

                    #region 插入电话信息CustTel
                    Entities.CustTel model_Tel = new Entities.CustTel();
                    model_Tel.CustID       = ccCustID;
                    model_Tel.CreateTime   = info.OperTime;
                    model_Tel.CreateUserID = info.OperID;
                    model_Tel.Tel          = info.Tel;
                    BLL.CustTel.Instance.Insert(model_Tel);
                    #endregion

                    #region 如果客户分类为3-经销商,且经销商ID存在,则插入客户与经销商关联表
                    if (info.CustCategoryID == "3" && !string.IsNullOrEmpty(info.MemberID) && !string.IsNullOrEmpty(info.MemberName))
                    {
                        Entities.DealerInfo model_Dealer = new Entities.DealerInfo();
                        model_Dealer.CustID       = ccCustID;
                        model_Dealer.MemberCode   = info.MemberID;
                        model_Dealer.Name         = info.MemberName;
                        model_Dealer.Status       = 0;
                        model_Dealer.CreateTime   = info.OperTime;
                        model_Dealer.CreateUserID = info.OperID;
                        BLL.DealerInfo.Instance.Insert(model_Dealer);
                    }
                    #endregion

                    msg = "'result':'true','CustID':'" + ccCustID + "'";
                    BLL.Util.InsertUserLog("个人用户表【新增记录】【插入电话信息】成功【电话】" + info.Tel + "【姓名】" + info.CustName + "【客户分类】" + info.CustCategoryID + "【省份ID】" + pID + "【城市ID】" + cID + "【大区】" + model.AreaID + "【操作人】" + info.OperID + "【操作时间】" + info.OperTime);
                }
            }
        /// 保存个人信息
        /// <summary>
        /// 保存个人信息
        /// </summary>
        /// <param name="jsondata"></param>
        public void SaveCustBasicInfo(WOrderJsonData jsondata, int loginuserid)
        {
            //构造个人主表数据
            Entities.CustBasicInfo model = new Entities.CustBasicInfo();
            model.CustName       = jsondata.CustBaseInfo.CBName_Out;
            model.Sex            = jsondata.CustBaseInfo.CBSex_Out;
            model.CustCategoryID = (int)jsondata.CustBaseInfo.CustTypeID_Out;
            model.ProvinceID     = jsondata.CustBaseInfo.ProvinceID_Out;
            model.CityID         = jsondata.CustBaseInfo.CityID_Out;
            model.CountyID       = jsondata.CustBaseInfo.CountyID_Out;
            //废弃字段
            model.Address    = null;
            model.DataSource = null;
            model.CallTime   = null;
            model.Status     = 0;

            //查询数据库
            string cbid = BLL.CustBasicInfo.Instance.GetMaxNewCustBasicInfoByTel(jsondata.CustBaseInfo.Phone_Out);

            if (!string.IsNullOrEmpty(cbid))
            {
                //更新
                model.CustID       = cbid;
                model.ModifyTime   = DateTime.Now;
                model.ModifyUserID = loginuserid;
                BLL.CustBasicInfo.Instance.Update(model);
            }
            else
            {
                //新增
                model.CreateTime   = DateTime.Now;
                model.CreateUserID = loginuserid;
                model.ModifyTime   = null;
                model.ModifyUserID = null;
                cbid = BLL.CustBasicInfo.Instance.Insert(model);

                //插入电话信息
                Entities.CustTel model_Tel = new Entities.CustTel();
                model_Tel.CustID       = cbid;
                model_Tel.Tel          = jsondata.CustBaseInfo.Phone_Out;
                model_Tel.CreateTime   = DateTime.Now;
                model_Tel.CreateUserID = loginuserid;
                BLL.CustTel.Instance.Insert(model_Tel);
            }
            //存储
            jsondata.CBID = cbid;
            //删除经销商信息
            BLL.DealerInfo.Instance.Delete(cbid);
            //存储经销商信息
            if (jsondata.CustBaseInfo.CustTypeID_Out == CustTypeEnum.T02_经销商)
            {
                //插入经销商信息
                Entities.DealerInfo model_Dealer = new Entities.DealerInfo();
                model_Dealer.CustID       = cbid;
                model_Dealer.MemberCode   = jsondata.CustBaseInfo.MemberCode_Out;
                model_Dealer.Name         = jsondata.CustBaseInfo.MemberName_Out;
                model_Dealer.Status       = 0;
                model_Dealer.CreateTime   = DateTime.Now;
                model_Dealer.CreateUserID = loginuserid;
                BLL.DealerInfo.Instance.Insert(model_Dealer);
            }
        }
        /// 保存个人信息
        /// <summary>
        /// 保存个人信息
        /// </summary>
        /// <param name="jsondata"></param>
        /// <param name="loginuserid"></param>
        public string SaveCustBasicInfo(string phone, PageDataInfo pagedata, int loginuserid)
        {
            //查询数据库
            string cbid = BLL.CustBasicInfo.Instance.GetMaxNewCustBasicInfoByTel(phone);

            if (string.IsNullOrEmpty(cbid))
            {
                //新增
                Entities.CustBasicInfo model = new Entities.CustBasicInfo();
                model.CustName       = pagedata.CBName_Out != "" ? pagedata.CBName_Out : "未知";
                model.Sex            = pagedata.CBSex_Out > 0 ? pagedata.CBSex_Out : 1;
                model.CustCategoryID = (int)pagedata.CustType_Out;
                int pID = 0, cID = 0;
                BLL.PhoneNumDataDict.GetAreaId(phone, out pID, out cID);
                model.ProvinceID = pID == 0 ? -2 : pID;
                model.CityID     = cID == 0 ? -2 : cID;
                model.CountyID   = -1;
                //废弃字段
                model.Address    = null;
                model.DataSource = null;
                model.CallTime   = null;
                model.Status     = 0;
                //基础字段
                model.CreateTime   = DateTime.Now;
                model.CreateUserID = loginuserid;
                model.ModifyTime   = null;
                model.ModifyUserID = null;
                cbid = BLL.CustBasicInfo.Instance.Insert(model);

                //插入电话信息
                Entities.CustTel model_Tel = new Entities.CustTel();
                model_Tel.CustID       = cbid;
                model_Tel.Tel          = phone;
                model_Tel.CreateTime   = DateTime.Now;
                model_Tel.CreateUserID = loginuserid;
                BLL.CustTel.Instance.Insert(model_Tel);
            }
            else
            {
                //修改( 值有效才更新 )
                Entities.CustBasicInfo model = BLL.CustBasicInfo.Instance.GetCustBasicInfo(cbid);
                if (!string.IsNullOrEmpty(pagedata.CBName_Out))
                {
                    model.CustName = pagedata.CBName_Out;
                }
                if (pagedata.CBSex_Out > 0)
                {
                    model.Sex = pagedata.CBSex_Out;
                }
                model.CustCategoryID = (int)pagedata.CustType_Out;
                //废弃字段
                model.Address    = null;
                model.DataSource = null;
                model.CallTime   = null;
                model.Status     = 0;
                //基础字段
                model.ModifyTime   = DateTime.Now;
                model.ModifyUserID = loginuserid;
                BLL.CustBasicInfo.Instance.Update(model);
            }
            //删除经销商信息(个人类型 或者 有值)
            if (!string.IsNullOrEmpty(pagedata.CBMemberName_Out) ||
                pagedata.CustType_Out == Entities.CustTypeEnum.T01_个人)
            {
                BLL.DealerInfo.Instance.Delete(cbid);
            }
            //更新经销商(经销商类型 且 有值)
            if (!string.IsNullOrEmpty(pagedata.CBMemberName_Out) &&
                pagedata.CustType_Out == Entities.CustTypeEnum.T02_经销商)
            {
                //插入经销商信息
                Entities.DealerInfo model_Dealer = new Entities.DealerInfo();
                model_Dealer.CustID       = cbid;
                model_Dealer.MemberCode   = pagedata.CBMemberCode_Out;
                model_Dealer.Name         = pagedata.CBMemberName_Out;
                model_Dealer.Status       = 0;
                model_Dealer.CreateTime   = DateTime.Now;
                model_Dealer.CreateUserID = loginuserid;
                BLL.DealerInfo.Instance.Insert(model_Dealer);
            }
            return(cbid);
        }