Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (Page.User.Identity.Name == null || Page.User.Identity.Name.Trim() == "")
        //{
        //    Response.Redirect("../Login.aspx?ReturnUrl=" + Server.UrlEncode(Request.RawUrl));
        //}

        //if (Page.User.IsInRole("MT1004"))
        //    Response.Redirect("GovernmentRegisterResult.aspx");

        //buSend.Attributes.Add("onclick", "return chkPost();");
        //if (Page.User.IsInRole("MT1001"))
        //{
        //    Tz888.Common.MessageBox.ShowAndRedirect(this.Page, "对不起,您是个人会员,不能进行公司登记", "/index.aspx");

        //    Response.Flush();
        //    Response.End();
        //    return;
        //}

        //if (Page.User.IsInRole("GT1001"))
        //{
        //    ImageUploadControl1.Count = 5;
        //    ImageUploadControl1.NoneCount = 3;
        //}
        //else
        //{
        //    ImageUploadControl1.Count = 5;
        //    ImageUploadControl1.NoneCount = 5;
        //}


        if (!Page.IsPostBack)
        {
            this.ViewState["MemberLoginName"] = Page.User.Identity.Name;   //

            //展厅
            System.Collections.Generic.IList <SelfCreateWeb.Model.MSelfCreateWebInfo> finduser = new SelfCreateWeb.BLL.BSelfCreateWebInfo().GetSelfCreateWebInfo(1, 100, new string[] { "LoginName" }, new string[] { this.ViewState["MemberLoginName"].ToString() });

            if (finduser.Count > 0)
            {
                string url = finduser[0].Domain.Trim();
                tbExhibitionHall.Text    = url;
                tbExhibitionHall.Enabled = false;
                finduser.Clear();
                this.ViewState["WebInfo"] = 0;
            }
            else
            {
                tbExhibitionHall.Text     = "";
                tbExhibitionHall.Enabled  = true;
                this.ViewState["WebInfo"] = 1;
            }

            //联系信息加载
            List <Tz888.Model.Register.OrgContactMan> contactMans  = new List <Tz888.Model.Register.OrgContactMan>(); //联系人实体列表
            Tz888.Model.Register.OrgContactModel      orgContact   = new Tz888.Model.Register.OrgContactModel();      //创建信息联系方式主体
            List <Tz888.Model.MemberResourceModel>    infoResource = new List <Tz888.Model.MemberResourceModel>();    //图片资料

            Tz888.BLL.Register.common com = new common();

            orgContact = com.getContactModel(this.ViewState["MemberLoginName"].ToString());
            try
            {
                contactMans = com.GetOrgContactMan(this.ViewState["MemberLoginName"].ToString());
            }
            catch
            {
                contactMans = null;
            }
            ///0 公司介绍(多图片)

            ///1营业执照
            ///2税务登记证(国税)
            ///3税务登记证(地税)
            ///4荣誉和证书


            ///5其它*/
            try
            {
                infoResource = com.GetMemberResourceModel(this.ViewState["MemberLoginName"].ToString(), 0);
            }
            catch
            {
                infoResource = null;
            }

            OrgContactControl1.OrgContact  = orgContact;  //联系信息
            OrgContactControl1.ContactMans = contactMans; //联系人

            ImageUploadControl1.InfoList = infoResource;


            //企业性质
            obj = new EnterpriseRegisterBLL();
            ddManageType.DataSource     = obj.getEnterpriceManageType();
            ddManageType.DataTextField  = "SetComTypeName";
            ddManageType.DataValueField = "SetComTypeID";
            ddManageType.DataBind();


            //判断操作性质:添加,修改
            Tz888.BLL.Register.EnterpriseRegisterBLL obj2 = new EnterpriseRegisterBLL();
            DataTable dt = obj2.getEnterpriseModel(this.ViewState["MemberLoginName"].ToString());
            this.ViewState["Domain"]       = "Add";
            this.ViewState["EnterpriseID"] = 0;

            if (dt != null && dt.Rows.Count > 0) //修改
            {
                this.ViewState["EnterpriseID"] = dt.Rows[0]["EnterpriseID"].ToString();;
                //基本信息
                tbEnterpriseName.Text      = dt.Rows[0]["EnterpriseName"].ToString();
                ddManageType.SelectedValue = dt.Rows[0]["SetComTypeID"].ToString();
                tbRegisterDate.Text        = dt.Rows[0]["RegisterDate"].ToString();

                //网上展厅(按LoginName读取展厅地址)
                if (dt.Rows[0]["ExhibitionHall"].ToString() != "")
                {
                    // tbExhibitionHall.Text = dt.Rows[0]["ExhibitionHall"].ToString();
                    // tbExhibitionHall.Enabled = false;
                    Hidden1.Value            = "不可修改";
                    this.ViewState["Domain"] = "不可修改";
                }
                else
                {
                    // tbExhibitionHall.Enabled = true;
                }

                // 地区
                ZoneSelectControl1.CountryID  = dt.Rows[0]["CountryCode"].ToString().Trim();
                ZoneSelectControl1.ProvinceID = dt.Rows[0]["ProvinceID"].ToString().Trim();
                ZoneSelectControl1.CityID     = dt.Rows[0]["CityID"].ToString().Trim();
                ZoneSelectControl1.CountyID   = dt.Rows[0]["CountyID"].ToString().Trim();


                ddlCapitalCurrency.SelectedValue = dt.Rows[0]["currency"].ToString();
                tbRegCapital.Text = dt.Rows[0]["RegCapital"].ToString();

                //行业
                SelectIndustryControl1.IndustryString = dt.Rows[0]["Industrylist"].ToString();

                ContentPlaceHolder content = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");
                string             mp      = dt.Rows[0]["MainProduct"].ToString();
                string[]           Product = null;
                Product = mp.Split(',');
                if (mp != "" || mp != null)
                {
                    Product = mp.Split(',');
                    for (int i = 0; i < mp.Length; i++)
                    {
                        try
                        {
                            string value = Product[i].ToString();
                            int    j     = i + 1;
                            System.Web.UI.WebControls.TextBox tb = (TextBox)content.FindControl("tbMainProduct" + j.ToString());
                            tb.Text = value;
                        }
                        catch { }
                    }
                }

                tbComAbout.Text = Tz888.Common.Utility.PageValidate.HtmlToTxt(dt.Rows[0]["ComAbout"].ToString());
            }//添加
            else
            {
                //读取注册信息
                //Tz888.BLL.Conn obCon = new Tz888.BLL.Conn();
                //DataTable dtContact = obCon.GetList("OrgContactTab", "*", "LoginName", 1, 1, 0, 1, "LoginName='" + Page.User.Identity.Name + "'");
                //if (dtContact != null)
                //{
                //    tbEnterpriseName.Text = dtContact.Rows[0]["OrganizationName"].ToString();
                //}
                this.ViewState["EnterpriseID"] = 0;
            }
        }

        AjaxPro.Utility.RegisterTypeForAjax(typeof(Tz888.Common.Ajax.AjaxMethod));
        tbExhibitionHall.Attributes.Add("onblur", "CheckDomain(this.value,'" + this.ViewState["MemberLoginName"].ToString() + "');");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.User.Identity.Name == null || Page.User.Identity.Name.Trim() == "")
        {
            Response.Redirect("../Login.aspx?ReturnUrl=" + Server.UrlEncode(Request.RawUrl));
            return;
        }
        if (Page.User.IsInRole("MT1003"))
        {
            Response.Redirect("EnterpriseRegisterResult.aspx");
        }

        if (Page.User.IsInRole("MT1001"))
        {
            Tz888.Common.MessageBox.Show(this.Page, "对不起,您是个人会员,不能进行机构登记!");
            return;
        }

        //buSend.Attributes.Add("onclick", "return chkPost();");

        if (Page.User.IsInRole("GT1001"))
        {
            ImageUploadControl1.Count     = 5;
            ImageUploadControl1.NoneCount = 3;
        }
        else
        {
            ImageUploadControl1.Count     = 5;
            ImageUploadControl1.NoneCount = 5;
        }

        this.ImageUploadControl1.InfoType    = "GovernmentRegister";
        this.ImageUploadControl1.IsTopfoUser = (Page.User.IsInRole("GT1002"));

        if (!Page.IsPostBack)
        {
            //展厅

            System.Collections.Generic.IList <SelfCreateWeb.Model.MSelfCreateWebInfo> finduser = new SelfCreateWeb.BLL.BSelfCreateWebInfo().GetSelfCreateWebInfo(1, 100, new string[] { "LoginName" }, new string[] { Page.User.Identity.Name });
            if (finduser.Count > 0)
            {
                string url = finduser[0].Domain.Trim();
                tbExhibitionHall.Text    = url;
                tbExhibitionHall.Enabled = false;
                finduser.Clear();
                this.ViewState["WebInfo"] = 0;
            }
            else
            {
                tbExhibitionHall.Text     = "";
                tbExhibitionHall.Enabled  = true;
                this.ViewState["WebInfo"] = 1;
            }

            this.ViewState["MemberLoginName"] = Page.User.Identity.Name;
            //页面信息加载
            List <Tz888.Model.Register.OrgContactMan> contactMans  = new List <Tz888.Model.Register.OrgContactMan>(); //联系人实体列表
            Tz888.Model.Register.OrgContactModel      orgContact   = new Tz888.Model.Register.OrgContactModel();      //创建信息联系方式主体
            List <Tz888.Model.MemberResourceModel>    infoResource = new List <Tz888.Model.MemberResourceModel>();    //图片资料

            Tz888.BLL.Register.common com = new common();

            try
            {
                contactMans = com.GetOrgContactMan(Page.User.Identity.Name);
                orgContact  = com.getContactModel(Page.User.Identity.Name);

                ///0 公司介绍(多图片)


                ///1营业执照
                ///2税务登记证(国税)
                ///3税务登记证(地税)
                ///4荣誉和证书


                ///5其它*/
                infoResource = com.GetMemberResourceModel(this.ViewState["MemberLoginName"].ToString(), 0);
            }
            catch { }

            OrgContactControl1.OrgContact  = orgContact;  //联系信息
            OrgContactControl1.ContactMans = contactMans; //联系人


            ImageUploadControl1.InfoList = infoResource;
            //机构主体
            obj = new GovernmentRegisterBLL();
            ddlSubjectType.DataSource     = obj.getMerchantTypeTab();
            ddlSubjectType.DataTextField  = "MerchantTypeName";
            ddlSubjectType.DataValueField = "MerchantTypeID";
            ddlSubjectType.DataBind();

            //文件上传
            string GM = "1001";
            switch (GM)
            {
            case "1001":
                fileDiv.Style.Add("display", "none");
                break;

            case "1002":
                fileDiv.Style.Add("display", "none");
                break;
            }

            //判断操作性质:添加,修改
            Tz888.BLL.Register.GovernmentRegisterBLL obj2 = new GovernmentRegisterBLL();
            DataTable dt = obj2.getGovernmentModel(Page.User.Identity.Name);
            this.ViewState["Domain"]      = "Add";
            this.ViewState["GovermentID"] = 0;

            if (dt != null && dt.Rows.Count > 0)//修改
            {
                ViewState["GovermentID"] = Convert.ToInt32(dt.Rows[0]["GovernmentID"]);
                //基本信息
                tbGovernmentName.Text        = dt.Rows[0]["GovernmentName"].ToString();
                ddlSubjectType.SelectedValue = dt.Rows[0]["SubjectType"].ToString();

                //网上展厅(按LoginName读取展厅地址)
                if (dt.Rows[0]["ExhibitionHall"].ToString() != "")
                {
                    // tbExhibitionHall.Text = dt.Rows[0]["ExhibitionHall"].ToString();
                    //  tbExhibitionHall.Enabled = false;
                    Hidden1.Value            = "不可修改";
                    this.ViewState["Domain"] = "不可修改";
                }
                else
                {
                    // tbExhibitionHall.Enabled = true;
                }
                // 地区
                ZoneSelectControl1.CountryID  = dt.Rows[0]["CountryCode"].ToString().Trim();
                ZoneSelectControl1.ProvinceID = dt.Rows[0]["ProvinceID"].ToString().Trim();
                ZoneSelectControl1.CityID     = dt.Rows[0]["CityID"].ToString().Trim();
                ZoneSelectControl1.CountyID   = dt.Rows[0]["CountyID"].ToString().Trim();

                tbGovAbout.Text = Tz888.Common.Utility.PageValidate.HtmlToTxt(dt.Rows[0]["GovAbout"].ToString());

                //上传文件(暂未开发)
            }//添加
            else
            {
                //Tz888.BLL.Conn obCon = new Tz888.BLL.Conn();
                //DataTable dtContact = obCon.GetList("OrgContactTab", "*", "LoginName", 1, 1, 0, 1, "LoginName='" + Page.User.Identity.Name + "'");
                //if (dtContact != null &&dtContact.Rows.Count>0)
                //{
                //    tbGovernmentName.Text = dtContact.Rows[0]["OrganizationName"].ToString();
                //}
                this.ViewState["GovernmentID"] = 0;
            }
        }


        string loginName = this.ViewState["MemberLoginName"].ToString();

        AjaxPro.Utility.RegisterTypeForAjax(typeof(Tz888.Common.Ajax.AjaxMethod));
        tbExhibitionHall.Attributes.Add("onblur", "CheckDomain(this.value,'" + this.ViewState["MemberLoginName"].ToString() + "');");
    }