⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 regcompany2.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
字号:
namespace PowerEasy.WebSite.User
{
    using PowerEasy.Common;
    using PowerEasy.Components;
    using PowerEasy.Controls;
    using PowerEasy.Crm;
    using PowerEasy.Enumerations;
    using PowerEasy.Model.Crm;
    using PowerEasy.Model.UserManage;
    using PowerEasy.UserManage;
    using PowerEasy.Web.UI;
    using PowerEasy.WebSite.Controls;
    using System;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class RegCompany2 : DynamicPage
    {
        protected Button BtnAppend;
        protected Button BtnRegister;
        protected CompanyControl Company1;
        protected HtmlForm form1;
        protected Label Label1;
        protected Label LblAddress;
        protected Label LblCity;
        protected Label LblCompanyName;
        protected Label LblCountry;
        protected Label LblName;
        protected Label LblProvince;
        protected Label LblTitle;
        protected Label LblZipCode;
        private int m_ClickId;
        private string m_UserName;
        protected Panel PnlDifferent;
        protected Panel PnlSame;
        protected ScriptManager SmgeRegion;
        protected UserNavigation UserCenterNavigation;
        protected ExtendedSiteMapPath YourPosition;

        protected void BtnAppend_Click(object sender, EventArgs e)
        {
            this.m_ClickId = DataConverter.CLng(this.ViewState["ClientId"]);
            CompanyInfo companyInfo = new CompanyInfo();
            this.Company1.Action = "add";
            this.Company1.CompanyClientId = this.m_ClickId;
            companyInfo = this.Company1.CompanyInfo;
            bool flag = false;
            if (Company.Add(companyInfo))
            {
                flag = Users.UpdateForCompany(companyInfo.CompanyId, this.m_UserName, UserType.Creator, 0);
                if (flag && (this.m_ClickId > 0))
                {
                    flag = Client.UpdateForCompany(this.m_ClickId, companyInfo.CompanyName);
                }
            }
            if (flag)
            {
                DynamicPage.WriteSuccessMsg("已经成功注册企业:" + companyInfo.CompanyName + "<br>从现在起,您是这家企业的创建人,拥有这家企业的管理权限(如审核批准其他人的申请)。同时您成为了我们的企业会员,可以享受更多服务!", "../Default.aspx");
            }
            else
            {
                DynamicPage.WriteSuccessMsg("<li>添加不成功!</li>");
            }
        }

        protected void BtnRegister_Click(object sender, EventArgs e)
        {
            CompanyInfo byCompanyName = Company.GetByCompanyName(this.LblCompanyName.Text);
            if (byCompanyName.IsNull)
            {
                DynamicPage.WriteErrMsg("<li>您要加入的企业不存在!</li>");
            }
            else if (Users.UpdateForCompany(byCompanyName.CompanyId, this.m_UserName, UserType.AuditingLeaguer, 0))
            {
                DynamicPage.WriteSuccessMsg("已经向" + byCompanyName.CompanyName + "的企业创建人发送了加入请求!请等待他(她)的审核批准。", "../Default.aspx");
            }
            else
            {
                DynamicPage.WriteErrMsg("<li>添加不成功!</li>");
            }
        }

        private void CheckUserInfo()
        {
            UserInfo usersByUserName = Users.GetUsersByUserName(this.m_UserName);
            if (usersByUserName.IsNull)
            {
                DynamicPage.WriteErrMsg("<li>未找到对应会员信息</li>");
            }
            if (usersByUserName.CompanyId > 0)
            {
                DynamicPage.WriteErrMsg("<li>您已经是企业会员,不允许重复注册!</li>");
            }
            this.ViewState["ClientId"] = usersByUserName.ClientId;
            if (Contacter.GetContacterByUserName(this.m_UserName).IsNull)
            {
                DynamicPage.WriteErrMsg("<li>您必须先填写好详细的联系信息后才能注册企业!</li>");
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.m_UserName = PEContext.Current.User.UserName;
            if (!this.Page.IsPostBack && (base.PreviousPage != null))
            {
                RegCompany previousPage = base.PreviousPage as RegCompany;
                string companyName = previousPage.CompanyName;
                if (string.IsNullOrEmpty(companyName))
                {
                    DynamicPage.WriteErrMsg("<li>请输入企业名称!</li>");
                }
                this.CheckUserInfo();
                CompanyInfo byCompanyName = Company.GetByCompanyName(companyName);
                if (byCompanyName.IsNull)
                {
                    this.PnlDifferent.Visible = true;
                    this.Company1.CompanyName = companyName;
                }
                else
                {
                    this.PnlSame.Visible = true;
                    this.LblName.Text = companyName;
                    this.LblCompanyName.Text = byCompanyName.CompanyName;
                    this.LblAddress.Text = byCompanyName.Address;
                    this.LblCountry.Text = byCompanyName.Country;
                    this.LblProvince.Text = byCompanyName.Province;
                    this.LblCity.Text = byCompanyName.City;
                }
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -