Esempio n. 1
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);
                }
            }
        }
Esempio n. 2
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;
        }
Esempio n. 3
0
        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;
                    }
                }
            }
        }
Esempio n. 4
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
        }