コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool _IsLogin = EyouSoft.Security.Membership.UserProvider.IsLogin(out SiteUserInfo);

            if (SiteUserInfo == null)
            {
                EyouSoft.Model.SysStructure.MSysDomain sysDomain = EyouSoft.Security.Membership.UserProvider.GetDomain();
                if (sysDomain != null)
                {
                    EyouSoft.BLL.SysStructure.BSys Customer = new EyouSoft.BLL.SysStructure.BSys();

                    CustomerConfig = new EyouSoft.BLL.CrmStructure.BCrm().GetInfo(sysDomain.CompanyId);

                    if (CustomerConfig != null)
                    {
                        DepartStamp  = "http://" + Request.Url.Authority + CustomerConfig.Seal;
                        PageHeadFile = "http://" + Request.Url.Authority + CustomerConfig.PrintHeader;
                        PageFootFile = "http://" + Request.Url.Authority + CustomerConfig.PrintFooter;
                    }
                }
            }
            else
            {
                CustomerConfig = new EyouSoft.BLL.CrmStructure.BCrm().GetInfo(SiteUserInfo.TourCompanyInfo.CompanyId);
                if (CustomerConfig != null)
                {
                    DepartStamp  = "http://" + Request.Url.Authority + CustomerConfig.Seal;
                    PageHeadFile = "http://" + Request.Url.Authority + CustomerConfig.PrintHeader;
                    PageFootFile = "http://" + Request.Url.Authority + CustomerConfig.PrintFooter;
                }
            }
            this.ibtnWord.Attributes.Add("onclick", "ReplaceInput();");
        }
コード例 #2
0
        /// <summary>
        /// 初始化页面信息
        /// </summary>
        private void PageInit()
        {
            EyouSoft.BLL.CrmStructure.BCrm   bCrm = new EyouSoft.BLL.CrmStructure.BCrm();
            EyouSoft.Model.CrmStructure.MCrm mCrm = bCrm.GetInfo(SiteUserInfo.TourCompanyInfo.CompanyId);
            if (null != mCrm)
            {
                if (!string.IsNullOrEmpty(mCrm.PrintHeader))
                {
                    this.lblPrintHeader.Text = string.Format("<span class='upload_filename'><a href='{0}'>打印页眉</a><a href=\"javascript:void(0)\" onclick=\"ConfigSettings.DelFile(this)\" title='删除附件'><img style='vertical-align:middle' src='/images/cha.gif'></a><input type=\"hidden\" name=\"PrintHeader\" value='{0}'/></span>", mCrm.PrintHeader);
                }

                if (!string.IsNullOrEmpty(mCrm.PrintFooter))
                {
                    this.lblPrintFooter.Text = string.Format("<span class='upload_filename'><a href='{0}'>打印页脚</a><a href=\"javascript:void(0)\" onclick=\"ConfigSettings.DelFile(this)\" title='删除附件'><img style='vertical-align:middle' src='/images/cha.gif'></a><input type=\"hidden\" name=\"PrintFooter\" value='{0}'/></span>", mCrm.PrintFooter);
                }

                if (!string.IsNullOrEmpty(mCrm.PrintTemplates))
                {
                    this.lblPrintTemplates.Text = string.Format("<span class='upload_filename'><a href='{0}' target='_blank'>打印模板</a><a href=\"javascript:void(0)\" onclick=\"ConfigSettings.DelFile(this)\" title='删除附件'><img style='vertical-align:middle' src='/images/cha.gif'></a><input type=\"hidden\" name=\"PrintTemplates\" value='{0}'/></span>", mCrm.PrintTemplates);
                }

                if (!string.IsNullOrEmpty(mCrm.Seal))
                {
                    this.lblSeal.Text = string.Format("<span class='upload_filename'><a href='{0}'>公司公章</a><a href=\"javascript:void(0)\" onclick=\"ConfigSettings.DelFile(this)\" title='删除附件'><img style='vertical-align:middle' src='/images/cha.gif'></a><input type=\"hidden\" name=\"Seal\" value='{0}'/></span>", mCrm.Seal);
                }
            }
        }
コード例 #3
0
ファイル: DCrm.cs プロジェクト: windygu/XiaZhou
        /// <summary>
        /// 添加客户单位,返回1成功
        /// </summary>
        /// <param name="info">客户单位信息业务实体</param>
        /// <returns></returns>
        public int Insert(EyouSoft.Model.CrmStructure.MCrm info)
        {
            DbCommand cmd = _db.GetStoredProcCommand("proc_Crm_Insert");

            _db.AddOutParameter(cmd, "RetCode", DbType.Int32, 4);
            _db.AddInParameter(cmd, "CrmId", DbType.AnsiStringFixedLength, info.CrmId);
            _db.AddInParameter(cmd, "CompanyId", DbType.AnsiStringFixedLength, info.CompanyId);
            _db.AddInParameter(cmd, "AttachXML", DbType.String, CreateHeZuoXieYiXML(info.AttachModel));
            _db.AddInParameter(cmd, "BanksXML", DbType.String, CreateBanksXML(info.BankList));
            _db.AddInParameter(cmd, "LxrsXML", DbType.String, CreateLxrsXML(info.LinkManList));
            _db.AddInParameter(cmd, "CountryId", DbType.Int32, info.CountryId);
            _db.AddInParameter(cmd, "ProvinceId", DbType.Int32, info.ProvinceId);
            _db.AddInParameter(cmd, "CityId", DbType.Int32, info.CityId);
            _db.AddInParameter(cmd, "DistrictId", DbType.Int32, info.CountyId);
            _db.AddInParameter(cmd, "CrmName", DbType.String, info.Name);
            _db.AddInParameter(cmd, "Address", DbType.String, info.Address);
            _db.AddInParameter(cmd, "JGCode", DbType.String, info.OrganizationCode);
            _db.AddInParameter(cmd, "DengJiBH", DbType.Int32, info.LevId);
            _db.AddInParameter(cmd, "FaRen", DbType.String, info.LegalRepresentative);
            _db.AddInParameter(cmd, "FaRenTelephone", DbType.String, info.LegalRepresentativePhone);
            _db.AddInParameter(cmd, "FaRenMobile", DbType.String, info.LegalRepresentativeMobile);
            _db.AddInParameter(cmd, "LicenseCode", DbType.String, info.License);
            _db.AddInParameter(cmd, "CaiWu", DbType.String, info.FinancialName);
            _db.AddInParameter(cmd, "CaiWuTelephone", DbType.String, info.FinancialPhone);
            _db.AddInParameter(cmd, "CaiWuMobile", DbType.String, info.FinancialMobile);
            _db.AddInParameter(cmd, "FanLiZehngCe", DbType.String, info.RebatePolicy);
            _db.AddInParameter(cmd, "ZeRenXiaoShouBH", DbType.AnsiStringFixedLength, info.SellerId);
            _db.AddInParameter(cmd, "BriefCode", DbType.String, info.BrevityCode);
            _db.AddInParameter(cmd, "QianKuanEDu", DbType.Decimal, info.AmountOwed);
            _db.AddInParameter(cmd, "ZhangLingQiXian", DbType.Int32, info.Deadline);
            _db.AddInParameter(cmd, "IsXieYi", DbType.AnsiStringFixedLength, info.IsSignContract ? "1" : "0");
            _db.AddInParameter(cmd, "OperatorId", DbType.AnsiStringFixedLength, info.OperatorId);
            _db.AddInParameter(cmd, "XieYiFuJianType", DbType.Byte, EyouSoft.Model.EnumType.ComStructure.AttachItemType.客户合作协议);
            _db.AddInParameter(cmd, "LxrType", DbType.Byte, EyouSoft.Model.EnumType.ComStructure.LxrType.客户单位);
            _db.AddInParameter(cmd, "CrmType", DbType.Byte, info.Type);

            int sqlExceptionCode = 0;

            try
            {
                DbHelper.RunProcedure(cmd, _db);
            }
            catch (System.Data.SqlClient.SqlException e)
            {
                sqlExceptionCode = 0 - e.Number;
            }

            if (sqlExceptionCode < 0)
            {
                return(sqlExceptionCode);
            }
            else
            {
                return(Convert.ToInt32(_db.GetParameterValue(cmd, "RetCode")));
            }
        }
コード例 #4
0
        /// <summary>
        /// 绑定数据源
        /// </summary>
        private void BindSource()
        {
            EyouSoft.BLL.CrmStructure.BCrm   bCrm = new EyouSoft.BLL.CrmStructure.BCrm();
            EyouSoft.Model.CrmStructure.MCrm mCrm = bCrm.GetInfo(SiteUserInfo.TourCompanyInfo.CompanyId);
            //查询国家、省市区域的
            EyouSoft.BLL.ComStructure.BComCity bComCity = new EyouSoft.BLL.ComStructure.BComCity();
            EyouSoft.Model.ComStructure.MCPCC  m        = bComCity.GetCPCD(CurrentUserCompanyID, mCrm.CountryId, mCrm.ProvinceId, mCrm.CityId, mCrm.CountyId);
            if (m != null)
            {
                this.lblCountry.Text = m.CountryName;
                this.lblProvice.Text = m.ProvinceName;
                this.lblCity.Text    = m.CityName;
                this.lblCounty.Text  = m.CountyName;
            }

            this.lblName.Text                      = mCrm.Name;
            this.lblAddress.Text                   = mCrm.Address;
            this.lblOrganizationCode.Text          = mCrm.OrganizationCode;
            this.lblLegalRepresentative.Text       = mCrm.LegalRepresentative;
            this.lblLegalRepresentativeMobile.Text = mCrm.LegalRepresentativeMobile;
            this.lblLegalRepresentativePhone.Text  = mCrm.LegalRepresentativePhone;
            this.lblLicense.Text                   = mCrm.License;
            this.lblFinancialName.Text             = mCrm.FinancialName;
            this.lblFinancialPhone.Text            = mCrm.FinancialPhone;
            this.lblFinancialMobile.Text           = mCrm.FinancialMobile;

            //查询销售员
            EyouSoft.BLL.ComStructure.BComUser   bUser = new EyouSoft.BLL.ComStructure.BComUser();
            EyouSoft.Model.ComStructure.MComUser user  = bUser.GetModel(mCrm.SellerId, SiteUserInfo.CompanyId);
            if (null != user)
            {
                this.lblSeller.Text = user.UserName;
            }

            this.lblBrevityCode.Text  = mCrm.BrevityCode;
            this.lblRebatePolicy.Text = mCrm.RebatePolicy;
        }
コード例 #5
0
ファイル: Edit.aspx.cs プロジェクト: windygu/XiaZhou
        /// <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"));
        }
コード例 #6
0
ファイル: Details.aspx.cs プロジェクト: windygu/XiaZhou
        private void Bind()
        {
            if (!string.IsNullOrEmpty(EyouSoft.Common.Utils.GetQueryStringValue("crmId")))
            {
                EyouSoft.Model.CrmStructure.MCrm crmModel = crmBll.GetInfo(EyouSoft.Common.Utils.GetQueryStringValue("crmId"));
                if (crmBll != null)
                {
                    lblAddress.Text     = crmModel.Address;
                    lblBrevityCode.Text = crmModel.BrevityCode;
                    lblAmountOwed.Text  = crmModel.AmountOwed.ToString("C");
                    EyouSoft.Model.ComStructure.MCPCC cpccModel = cityBll.GetCPCD(crmModel.CompanyId, crmModel.CountryId, crmModel.ProvinceId, crmModel.CityId, crmModel.CountyId);
                    lblCity.Text                      = cpccModel.CityName;
                    lblCountry.Text                   = cpccModel.CountryName;
                    lblCounty.Text                    = cpccModel.CountyName;
                    lblProvince.Text                  = cpccModel.ProvinceName;
                    lblDeadline.Text                  = crmModel.Deadline.ToString();
                    lblFinancialMobile.Text           = crmModel.FinancialMobile;
                    lblFinancialName.Text             = crmModel.FinancialName;
                    lblFinancialPhone.Text            = crmModel.FinancialPhone;
                    lblIsSignContract.Text            = (!crmModel.IsSignContract) ? "否" : "是";
                    lblLegalRepresentative.Text       = crmModel.LegalRepresentative;
                    lblLegalRepresentativeMobile.Text = crmModel.LegalRepresentativeMobile;
                    lblLegalRepresentativePhone.Text  = crmModel.LegalRepresentativePhone;
                    lblLicense.Text                   = crmModel.License;
                    lblName.Text                      = crmModel.Name;
                    lblOrganizationCode.Text          = crmModel.OrganizationCode;
                    //lblRebatePolicy.Text = crmModel.RebatePolicy;
                    lblSellerId.Text = crmModel.SellerName;
                    if (crmModel.BankList != null && crmModel.BankList.Count > 0)
                    {
                        rptBank.DataSource = crmModel.BankList;
                        rptBank.DataBind();
                    }
                    else
                    {
                        phYinHangZhangHuEmpty.Visible = true;
                    }

                    if (crmModel.LinkManList != null && crmModel.LinkManList.Count > 0)
                    {
                        for (int i = 0; i < crmModel.LinkManList.Count; i++)
                        {
                            EyouSoft.Model.ComStructure.MComUser userModel = userBll.GetModel(crmModel.LinkManList[i].UserId, base.SiteUserInfo.CompanyId);
                            string html = string.Empty;
                            if (userModel != null)
                            {
                                html = string.Format("<table cellspacing='0' cellpadding='0' border='0' width='100%' class='pp-tableclass'><tr class='pp-table-title'><th height='23' align='center'>帐号</th><th align='center'>密码</th><th height='23' align='center'>状态</th></tr><tr ><td align='center'>{0}</td><td align='center'>{1}</td><td align='center'>{2}</td></tr></table>", userModel.UserName, userModel.Password, userModel.UserStatus.ToString());
                                userListString.Add(crmModel.LinkManList[i].UserId, html);
                            }
                        }

                        rptLinkMan.DataSource = crmModel.LinkManList;
                        rptLinkMan.DataBind();
                    }
                    if (crmModel.AttachModel != null)
                    {
                        filename = crmModel.AttachModel.Name;
                        filepath = crmModel.AttachModel.FilePath;
                    }
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// 保存按钮点击事件执行方法
        /// </summary>
        protected string PageSave()
        {
            EyouSoft.Model.CrmStructure.MCrm crmModel = new EyouSoft.Model.CrmStructure.MCrm();
            if (!string.IsNullOrEmpty(Utils.GetQueryStringValue("crmId")))
            {
                crmModel = crmBll.GetInfo(EyouSoft.Common.Utils.GetQueryStringValue("crmId"));
            }
            #region 客户主体信息
            //获取form参数
            int    Country          = Utils.GetInt(Utils.GetFormValue(ddlCountry.UniqueID), 0);           //国家
            int    Provice          = Utils.GetInt(Utils.GetFormValue(ddlProvice.UniqueID), 0);           //省份
            int    City             = Utils.GetInt(Utils.GetFormValue(ddlCity.UniqueID), 0);              //城市
            int    County           = Utils.GetInt(Utils.GetFormValue(ddlCounty.UniqueID), 0);            //县区
            int    Type             = (int)EyouSoft.Model.EnumType.CrmStructure.CrmType.行客户;              //客户类型
            string Name             = Utils.GetFormValue(txtName.UniqueID);                               //单位名称
            string Address          = Utils.GetFormValue(txtAddress.UniqueID);                            //地址
            string OrganizationCode = Utils.GetFormValue(txtOrganizationCode.UniqueID);                   //机构代码
            //string VouchersCode = Utils.GetFormValue("txtVouchersCode");//凭证代码
            int    LevId                     = Utils.GetInt(Utils.GetFormValue(ddlLevId.UniqueID), 0);    //客户等级
            string License                   = Utils.GetFormValue(txtLicense.UniqueID);                   //许可证号
            string LegalRepresentative       = Utils.GetFormValue(txtLegalRepresentative.UniqueID);       //法人代表
            string LegalRepresentativePhone  = Utils.GetFormValue(txtLegalRepresentativePhone.UniqueID);  //法人代表电话
            string LegalRepresentativeMobile = Utils.GetFormValue(txtLegalRepresentativeMobile.UniqueID); //法人代表手机
            string FinancialName             = Utils.GetFormValue(txtFinancialName.UniqueID);             //财务姓名
            string FinancialPhone            = Utils.GetFormValue(txtFinancialPhone.UniqueID);            //财务电话
            string FinancialMobile           = Utils.GetFormValue(txtFinancialMobile.UniqueID);           //财务手机

            //decimal PreDeposits =Utils.GetDecimal(Utils.GetFormValue("txtPreDeposits"));//预存款
            string RebatePolicy = Utils.GetFormValue(txtRebatePolicy.UniqueID); //返利政策
            string BrevityCode  = Utils.GetFormValue(txtBrevityCode.UniqueID);  //简码
            //string UserAccount = Utils.GetFormValue("txtUserAccount");//分销账号

            crmModel.Address = Address;

            crmModel.CityId    = City;
            crmModel.CompanyId = base.SiteUserInfo.CompanyId;

            crmModel.IssueTime                = DateTime.Now;
            crmModel.LegalRepresentative      = LegalRepresentative;
            crmModel.LegalRepresentativePhone = LegalRepresentativePhone;
            crmModel.LevId            = LevId;
            crmModel.License          = License;
            crmModel.Name             = Name;
            crmModel.OperatorId       = base.SiteUserInfo.UserId;
            crmModel.OrganizationCode = OrganizationCode;
            crmModel.ProvinceId       = Provice;
            crmModel.RebatePolicy     = RebatePolicy;
            if (this.CheckGrant(EyouSoft.Model.EnumType.PrivsStructure.Privs.客户管理_单位直客_修改责任销售))
            {
                crmModel.SellerId = Utils.GetFormValue(Seller1.SellsIDClient);
            }
            crmModel.Type                      = (EyouSoft.Model.EnumType.CrmStructure.CrmType)(Type);
            crmModel.BrevityCode               = BrevityCode;
            crmModel.CountryId                 = Country;
            crmModel.CountyId                  = County;
            crmModel.DeptId                    = base.SiteUserInfo.DeptId;
            crmModel.FinancialMobile           = FinancialMobile;
            crmModel.FinancialName             = FinancialName;
            crmModel.FinancialPhone            = FinancialPhone;
            crmModel.LegalRepresentativeMobile = LegalRepresentativeMobile;

            #endregion

            #region 常用联系人
            IList <EyouSoft.Model.CrmStructure.MCrmLinkman> linkManList = new List <EyouSoft.Model.CrmStructure.MCrmLinkman>();
            string[] BirthdayArray    = Utils.GetFormValues("txtlBirthday");
            string[] DepartmentArray  = Utils.GetFormValues("txtlDepartment");
            string[] FaxArray         = Utils.GetFormValues("txtlFax");
            string[] MobilePhoneArray = Utils.GetFormValues("txtlMobilePhone");
            string[] NameArray        = Utils.GetFormValues("txtllinkManName");
            string[] QQArray          = Utils.GetFormValues("txtlQQ");
            string[] TelephoneArray   = Utils.GetFormValues("txtlTel");
            string[] AddressArray     = Utils.GetFormValues("txtlAddress");
            string[] IsRemindArray    = Utils.GetFormValues("hidIsRemind");
            string[] LinkManId        = Utils.GetFormValues("hidlLinkManId");
            string[] UserId           = Utils.GetFormValues("hidlUserId");
            for (int j = 0; j < DepartmentArray.Length; j++)
            {
                EyouSoft.Model.CrmStructure.MCrmLinkman model = new EyouSoft.Model.CrmStructure.MCrmLinkman();
                if (LinkManId.Length == 0)
                {
                    model.Id = string.Empty;
                }
                model.Id = LinkManId[j] == string.Empty ? string.Empty : LinkManId[j];
                if (UserId.Length == 0)
                {
                    model.UserId = string.Empty;
                }
                else
                {
                    model.UserId = UserId[j] == string.Empty ? string.Empty : UserId[j];
                }
                model.Birthday    = !string.IsNullOrEmpty(BirthdayArray[j]) ? (DateTime?)(DateTime.Parse(BirthdayArray[j])) : null;
                model.CompanyId   = base.SiteUserInfo.CompanyId;
                model.Department  = !string.IsNullOrEmpty(DepartmentArray[j]) ? DepartmentArray[j] : string.Empty;
                model.Fax         = !string.IsNullOrEmpty(FaxArray[j]) ? FaxArray[j] : string.Empty;
                model.MobilePhone = !string.IsNullOrEmpty(MobilePhoneArray[j]) ? MobilePhoneArray[j] : string.Empty;
                model.Name        = !string.IsNullOrEmpty(NameArray[j]) ? NameArray[j] : string.Empty;
                model.QQ          = !string.IsNullOrEmpty(QQArray[j]) ? QQArray[j] : string.Empty;
                model.Telephone   = !string.IsNullOrEmpty(TelephoneArray[j]) ? TelephoneArray[j] : string.Empty;
                model.Type        = (EyouSoft.Model.EnumType.ComStructure.LxrType)(Type);
                if (IsRemindArray.Length == 0)
                {
                    model.IsRemind = false;
                }
                else
                {
                    model.IsRemind = IsRemindArray[j] == string.Empty ? false : true;
                }
                model.Address = !string.IsNullOrEmpty(AddressArray[j]) ? AddressArray[j] : string.Empty;
                if (string.IsNullOrEmpty(model.Birthday.ToString()) && string.IsNullOrEmpty(model.Department) && string.IsNullOrEmpty(model.Fax) && string.IsNullOrEmpty(model.MobilePhone) && string.IsNullOrEmpty(model.Name) && string.IsNullOrEmpty(model.QQ) && string.IsNullOrEmpty(model.Telephone) && string.IsNullOrEmpty(model.Address))
                {
                }
                else
                {
                    linkManList.Add(model);
                }
            }
            crmModel.LinkManList = linkManList != null || linkManList.Count != 0 ? linkManList : null;
            #endregion
            string filepath = string.Empty;
            string filename = string.Empty;
            #region 结算账户
            if (this.CheckGrant(EyouSoft.Model.EnumType.PrivsStructure.Privs.客户管理_单位直客_常用设置))
            {
                decimal AmountOwed = Utils.GetDecimal(Utils.GetFormValue("txtAmountOwed")); //欠款额度
                int     Deadline   = Utils.GetInt(Utils.GetFormValue("txtDeadline"));       //单团账龄期限
                crmModel.AmountOwed = AmountOwed;
                crmModel.Deadline   = Deadline;
                IList <EyouSoft.Model.CrmStructure.MCrmBank> bankList = new List <EyouSoft.Model.CrmStructure.MCrmBank>();
                string[] BankAccountArray = Utils.GetFormValues("txtBankAccount");
                string[] BankNameArray    = Utils.GetFormValues("txtBankName");
                string[] BankId           = Utils.GetFormValues("hidBankId");
                for (int j = 0; j < BankNameArray.Length; j++)
                {
                    EyouSoft.Model.CrmStructure.MCrmBank model = new EyouSoft.Model.CrmStructure.MCrmBank();
                    model.BankAccount = !string.IsNullOrEmpty(BankAccountArray[j]) ? BankAccountArray[j] : string.Empty;
                    model.BankName    = !string.IsNullOrEmpty(BankNameArray[j]) ? BankNameArray[j] : string.Empty;
                    model.BankId      = BankId[j] == string.Empty ? string.Empty : BankId[j];
                    if (string.IsNullOrEmpty(model.BankAccount) && string.IsNullOrEmpty(model.BankName))
                    {
                    }
                    else
                    {
                        bankList.Add(model);
                    }
                }

                if (rbtnIsSignContractYes.Checked)
                {
                    crmModel.IsSignContract = true;
                }
                else if (rbtnIsSignContractNo.Checked)
                {
                    crmModel.IsSignContract = false;
                }


                string[] path = Utils.GetFormValue(this.UploadControl1.ClientHideID).Split('|');
                if (path.Length > 1)
                {
                    filename = path[0];
                    filepath = path[1];
                    EyouSoft.Model.ComStructure.MComAttach attachModel = new EyouSoft.Model.ComStructure.MComAttach();
                    attachModel.Downloads = 0;
                    attachModel.FilePath  = filepath;
                    attachModel.Name      = System.IO.Path.GetFileName(filepath);
                    crmModel.AttachModel  = attachModel;
                }
                crmModel.BankList = bankList != null || bankList.Count != 0 ? bankList : null;
            }

            #endregion

            bool isAdd = Utils.GetQueryStringValue("isadd") == "false" ? false : true;
            #region 数据操作
            if (!string.IsNullOrEmpty(Utils.GetQueryStringValue("crmId")))
            {
                crmModel.CrmId = Utils.GetQueryStringValue("crmId");;

                int result = 0;//crmBll.UpdateUnitCustomerModel(crmModel, isAdd);

                switch (result)
                {
                case -1:
                    return(UtilsCommons.AjaxReturnJson("-1", "已经存在相同的银行卡号!"));

                case -4:
                    return(UtilsCommons.AjaxReturnJson("-4", "客户编号未赋值!"));

                case -2:
                    return(UtilsCommons.AjaxReturnJson("-2", "已经存在相同的分销商帐号!"));

                case -3:
                    return(UtilsCommons.AjaxReturnJson("-3", "客户必填信息不完善!"));

                case 0:
                    return(UtilsCommons.AjaxReturnJson("0", "事务回滚!"));

                case 1:
                    return(UtilsCommons.AjaxReturnJson("1", "修改成功!"));

                case -5:
                    return(UtilsCommons.AjaxReturnJson("-5", "已经存在相同的单位名称"));

                default:
                    return(UtilsCommons.AjaxReturnJson("-7", "数据操作失败!"));
                }
            }
            else
            {
                int result = 0; //crmBll.AddUnitCustomerModel(crmModel, isAdd);

                switch (result)
                {
                case -1:
                    return(UtilsCommons.AjaxReturnJson("-1", "已经存在相同的银行卡号!"));

                case -4:
                    return(UtilsCommons.AjaxReturnJson("-4", "公司编号未赋值!"));

                case -2:
                    return(UtilsCommons.AjaxReturnJson("-2", "已经存在相同的分销商帐号!"));

                case -3:
                    return(UtilsCommons.AjaxReturnJson("-3", "客户必填信息不完善!"));

                case 0:
                    return(UtilsCommons.AjaxReturnJson("0", "事务回滚!"));

                case 1:
                    return(UtilsCommons.AjaxReturnJson("1", "添加成功!"));

                case -5:
                    return(UtilsCommons.AjaxReturnJson("-5", "已经存在相同的单位名称"));

                default:
                    return(UtilsCommons.AjaxReturnJson("-7", "数据操作失败!"));
                }
            }
            #endregion
        }
コード例 #8
0
        private void BindListData(string crmId)
        {
            EyouSoft.Model.CrmStructure.MCrm model = crmBll.GetInfo(crmId);
            if (model != null)
            {
                txtAddress.Text = model.Address;


                txtLegalRepresentative.Text      = model.LegalRepresentative;
                txtLegalRepresentativePhone.Text = model.LegalRepresentativePhone;
                txtLicense.Text          = model.License;
                txtName.Text             = model.Name;
                txtOrganizationCode.Text = model.OrganizationCode;

                txtRebatePolicy.Text     = model.RebatePolicy;
                Seller1.SellsID          = model.SellerId;
                Seller1.SellsName        = userBll.GetModel(model.SellerId, base.SiteUserInfo.CompanyId).ContactName;
                ddlCity.SelectedValue    = model.CityId.ToString();
                ddlLevId.SelectedValue   = model.LevId.ToString();
                ddlProvice.SelectedValue = model.ProvinceId.ToString();



                Province                          = model.ProvinceId.ToString();
                City                              = model.CityId.ToString();
                Country                           = model.CountryId.ToString();
                County                            = model.CountyId.ToString();
                txtBrevityCode.Text               = model.BrevityCode;
                txtFinancialMobile.Text           = model.FinancialMobile;
                txtFinancialName.Text             = model.FinancialName;
                txtFinancialPhone.Text            = model.FinancialPhone;
                txtLegalRepresentativeMobile.Text = model.LegalRepresentativeMobile;


                txtAmountOwed.Text = model.AmountOwed.ToString("C");
                txtDeadline.Text   = model.Deadline.ToString();
                if (model.IsSignContract)
                {
                    rbtnIsSignContractYes.Checked = true;
                }
                else
                {
                    rbtnIsSignContractNo.Checked = true;
                }
                if (model.AttachModel != null)
                {
                    FilePath = model.AttachModel.FilePath;
                }
                #region 结算账户

                if (model.BankList.Count > 0)
                {
                    rptJSZHList.DataSource = model.BankList;
                    rptJSZHList.DataBind();
                }
                else
                {
                    IList <EyouSoft.Model.CrmStructure.MCrmBank> list = new List <EyouSoft.Model.CrmStructure.MCrmBank>();
                    list.Add(new EyouSoft.Model.CrmStructure.MCrmBank()
                    {
                        BankAccount = string.Empty, BankName = string.Empty
                    });
                    rptJSZHList.DataSource = list;
                    rptJSZHList.DataBind();
                }


                //修改责任销售权限
                if (!this.CheckGrant(EyouSoft.Model.EnumType.PrivsStructure.Privs.客户管理_单位直客_修改责任销售))
                {
                    this.Seller1.ReadOnly = true;
                }
                #endregion
            }


            #region 常用联系人绑定
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if (model.LinkManList.Count > 0)
            {
                rptCYLXRList.DataSource = model.LinkManList;
                rptCYLXRList.DataBind();
            }
            else
            {
                IList <EyouSoft.Model.CrmStructure.MCrmLinkman> list = new List <EyouSoft.Model.CrmStructure.MCrmLinkman>();
                list.Add(new EyouSoft.Model.CrmStructure.MCrmLinkman()
                {
                    Department = string.Empty, Name = string.Empty, Telephone = string.Empty, MobilePhone = string.Empty, Birthday = null, QQ = string.Empty, Fax = string.Empty, Address = string.Empty, IsRemind = false, UserId = string.Empty
                });
                rptCYLXRList.DataSource = list;
                rptCYLXRList.DataBind();
            }
            #endregion
        }
コード例 #9
0
ファイル: DCrm.cs プロジェクト: windygu/XiaZhou
        /// <summary>
        /// 获取客户单位信息业务实体
        /// </summary>
        /// <param name="crmId">客户单位编号</param>
        /// <returns></returns>
        public Model.CrmStructure.MCrm GetInfo(string crmId)
        {
            Model.CrmStructure.MCrm info = null;
            DbCommand cmd = _db.GetSqlStringCommand(SQL_SELECT_GetInfo);

            _db.AddInParameter(cmd, "CrmId", DbType.AnsiStringFixedLength, crmId);

            using (IDataReader rdr = DbHelper.ExecuteReader(cmd, _db))
            {
                if (rdr.Read())
                {
                    info = new EyouSoft.Model.CrmStructure.MCrm();

                    info.Address                   = rdr["Address"].ToString();
                    info.AmountOwed                = rdr.GetDecimal(rdr.GetOrdinal("AmountOwed"));
                    info.AttachModel               = null;
                    info.BankList                  = null;
                    info.BrevityCode               = rdr["BrevityCode"].ToString();
                    info.CityId                    = rdr.GetInt32(rdr.GetOrdinal("CityId"));
                    info.CompanyId                 = rdr.GetString(rdr.GetOrdinal("CompanyId"));
                    info.CountryId                 = rdr.GetInt32(rdr.GetOrdinal("CountryId"));
                    info.CountyId                  = rdr.GetInt32(rdr.GetOrdinal("CountyId"));
                    info.CrmId                     = crmId;
                    info.Deadline                  = rdr.GetInt32(rdr.GetOrdinal("Deadline"));
                    info.DeptId                    = rdr.GetInt32(rdr.GetOrdinal("DeptId"));
                    info.FinancialMobile           = rdr["FinancialMobile"].ToString();
                    info.FinancialName             = rdr["FinancialName"].ToString();
                    info.FinancialPhone            = rdr["FinancialPhone"].ToString();
                    info.IsDelete                  = rdr.GetString(rdr.GetOrdinal("IsDelete")) == "1";
                    info.IsSignContract            = rdr.GetString(rdr.GetOrdinal("IsSignContract")) == "1";
                    info.IssueTime                 = rdr.GetDateTime(rdr.GetOrdinal("IssueTime"));
                    info.LegalRepresentative       = rdr["LegalRepresentative"].ToString();
                    info.LegalRepresentativeMobile = rdr["LegalRepresentativeMobile"].ToString();
                    info.LegalRepresentativePhone  = rdr["LegalRepresentativePhone"].ToString();
                    info.LevId                     = rdr.GetInt32(rdr.GetOrdinal("LevId"));
                    info.License                   = rdr["License"].ToString();
                    info.LinkManList               = null;
                    info.Name             = rdr["Name"].ToString();
                    info.OperatorId       = rdr.GetString(rdr.GetOrdinal("OperatorId"));
                    info.OrganizationCode = rdr["OrganizationCode"].ToString();
                    info.PrintFooter      = rdr["PrintFooter"].ToString();
                    info.PrintHeader      = rdr["PrintHeader"].ToString();
                    info.PrintTemplates   = rdr["PrintTemplates"].ToString();
                    info.ProvinceId       = rdr.GetInt32(rdr.GetOrdinal("ProvinceId"));
                    info.RebatePolicy     = rdr["RebatePolicy"].ToString();
                    info.Seal             = rdr["Seal"].ToString();
                    info.SellerId         = rdr.GetString(rdr.GetOrdinal("SellerId"));
                    info.SellerName       = rdr["SellerName"].ToString();
                    info.Type             = (EyouSoft.Model.EnumType.CrmStructure.CrmType)rdr.GetByte(rdr.GetOrdinal("Type"));
                }
            }

            if (info == null)
            {
                return(info);
            }

            info.BankList    = GetCrmBanks(crmId);
            info.AttachModel = GetCrmXieYiFuJian(crmId);
            info.LinkManList = GetCrmLxrs(crmId);

            return(info);
        }