Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //权限验证
            var loginUser = new LoginUser();
            if (!loginUser.userRole.CompanySetup)
            {
                Response.Redirect("../Unauthorize.aspx");
                return;
            }

            #region Bind the regions list

            // 获取Region列表
            DataSet dsRegions = _bllRegions.GetList(0, string.Empty, "Name ASC");

            // 如果没有Region,加重空页面)
            if (dsRegions == null || dsRegions.Tables.Count == 0 || dsRegions.Tables[0].Rows.Count == 0)
            {
                return;
            }

            ddlRegions.DataSource = dsRegions;
            ddlRegions.DataBind();

            #endregion  Bind the regions list

            int regionId = int.Parse(dsRegions.Tables[0].Rows[0]["RegionID"].ToString());

            if (this.Request.QueryString["RegionID"] != null) // 如果有RegionID
            {
                string parRegionId = this.Request.QueryString["RegionID"].ToString();
                if (PageCommon.IsID(parRegionId) == false)
                {
                    PageCommon.WriteJsEnd(this, sErrorMsg, "window.location.href='" + sReturnPage + "'");
                }
                regionId = int.Parse(parRegionId);
            }

            ddlRegions.SelectedValue = regionId.ToString();//设置默认选中

            RefreshBindPages(regionId);
        }
    }
Exemplo n.º 2
0
        /// <summary>
        /// Get Region data
        /// </summary>
        /// <returns></returns>
        private DataTable GetRegionData()
        {
            DataTable dtRegion;

            try
            {
                Regions regionManager = new Regions();
                //Binding Region
                dtRegion = regionManager.GetList(" Enabled='true'").Tables[0];

                DataRow drNewRegion = dtRegion.NewRow();
                drNewRegion["RegionId"] = 0;
                drNewRegion["Name"]     = "All Regions";
                dtRegion.Rows.InsertAt(drNewRegion, 0);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(dtRegion);
        }