示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string companyPost    = string.Empty;
            string companyBrandId = string.Empty;

            if (companyID < 0)
            {
                companyID = CompanyBLL.SystemCompanyId;
            }
            if (!this.Page.IsPostBack)
            {
                if (companyID > 0)
                {
                    base.CheckAdminPower("ReadCompany", PowerCheckType.Single);
                    CompanyInfo CompanyModel = CompanyBLL.ReadCompany(companyID);
                    companyPost      = CompanyModel.Post;
                    CompanyType.Text = CompanyModel.GroupId.ToString();

                    //如果是子集团或或者是集团下的子公司,都需调出上级单位
                    if (CompanyModel.GroupId > 1)
                    {
                        GroupListId.Value = CompanyModel.ParentId;
                        foreach (string Item in CompanyModel.ParentId.Split(','))
                        {
                            GroupNameList.InnerHtml += "<li id=\"li_" + Item + "\" style=\"float:none;\">" + CompanyBLL.ReadCompany(int.Parse(Item)).CompanyName + "<a onclick=\"javascript:DelGroup(" + Item + ");\"><img src=\"Style/Images/delete.gif\"></a></li>";
                        }

                        CompanyInfo Model = new CompanyInfo();
                        Model.GroupIdCondition = "1,2";
                        Model.CompanyId        = companyID;
                        GroupId.DataSource     = CompanyBLL.ReadCompanyList(Model);
                        GroupId.DataTextField  = "CompanyName";
                        GroupId.DataValueField = "CompanyId";
                        GroupId.DataBind();
                        GroupId.Items.Insert(0, new ListItem("请选择隶属公司", "-1"));
                        GroupBrand.Style["display"] = "";
                    }

                    CompanyName.Text       = CompanyModel.CompanyName;
                    CompanySimpleName.Text = CompanyModel.CompanySimpleName;
                    companyBrandId         = CompanyModel.BrandId;
                    CompanyTel.Text        = CompanyModel.CompanyTel;
                    CompanyPost.Text       = CompanyModel.CompanyPost;
                    CompanyAddress.Text    = CompanyModel.CompanyAddress;
                    PostStartDate.Text     = CompanyModel.PostStartDate.ToString().Split(' ')[0];
                    if (CompanyModel.EndDate != null)
                    {
                        EndDate.Text = CompanyModel.EndDate.ToString().Split(' ')[0];
                    }
                    Sort.Text      = CompanyModel.Sort.ToString();
                    State.Text     = CompanyModel.State.ToString();
                    UserNum.Text   = CompanyModel.UserNum.ToString();
                    IsTest.Checked = CompanyModel.IsTest;
                }

                //品牌设置
                BrandHtml.AppendLine("<dl class=\"carbrand\">");
                foreach (ProductBrandInfo info in ProductBrandBLL.ReadProductBrandCacheList())
                {
                    BrandHtml.AppendLine("<dd><input name=\"BrandId\" type=\"checkbox\" value=\"" + info.ID + "\"");
                    if (StringHelper.CompareString(companyBrandId, info.ID.ToString()))
                    {
                        BrandHtml.Append(" checked");
                    }
                    BrandHtml.Append(">" + info.Name + "</dd>");
                }
                BrandHtml.AppendLine("</dl>");

                PostHtml.Append(CreatePostHtml(companyPost, 0));
            }
        }