示例#1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                if (Request.QueryString["id"] == null)
                {
                    Session["lastpage"] = "admin_inspections.aspx";
                    Session["error"]    = _functions.ErrorMessage(104);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                try
                {
                    InspectId = Convert.ToInt32(Request.QueryString["id"]);
                }
                catch (FormatException fex)
                {
                    Session["lastpage"] = "admin_inspections.aspx";
                    Session["error"]    = _functions.ErrorMessage(105);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                Header.AddBreadCrumb("Home", "/selectMode.aspx");
                Header.AddBreadCrumb("Administration", "/admin.aspx");
                Header.AddBreadCrumb("Inspections Manager", "/admin_inspections.aspx");
                Header.LeftBarHtml = "View Inspection Items";
                this.PageTitle     = "Inspection Items Manager";

                lblBack.Text = "<input type=button value=\" Back \" onclick=\"document.location='admin_inspections.aspx'\">";
                if (!IsPostBack)
                {
                    inspect                   = new clsInspections();
                    inspect.iOrgId            = OrgId;
                    inspect.iId               = InspectId;
                    repInspections.DataSource = new DataView(inspect.GetInspectionItemsList());
                    repInspections.DataBind();
                    lblInspectionName.Text          = inspect.sInspectionName.Value;
                    hlAddCategory.NavigateUrl       = "admin_inspection_category_edit.aspx?id=" + InspectId.ToString() + "&catid=0";
                    hlAddInspectionItem.NavigateUrl = "admin_inspection_item_edit.aspx?id=" + InspectId.ToString() + "&itemid=0";
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = this.ParentPageURL;
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (inspect != null)
                {
                    inspect.Dispose();
                }
            }
        }