Exemple #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"] = "ok_mainMenu.aspx";
                    Session["error"]    = _functions.ErrorMessage(104);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                try
                {
                    OrderId = Convert.ToInt32(Request.QueryString["id"]);
                }
                catch (FormatException fex)
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"]    = _functions.ErrorMessage(105);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                NextBackControl.BackText  = "<< Back";
                NextBackControl.BackPage  = "ok_reopenWorkOrder.aspx?id=" + OrderId.ToString() + "&op=Issue";
                NextBackControl.NextText  = "  Finish  ";
                NextBackControl.sCSSClass = "ok_input_button";

                op = new OperatorInfo(Request.Cookies["bfp_operator"].Value);

                if (!IsPostBack)
                {
                    lblFirstName.Text = op.FirstName;
                    order             = new clsWorkOrders();
                    order.iOrgId      = OrgId;
                    order.iId         = OrderId;
                    if (order.GetEquipInfo() != -1)
                    {
                        lblEquipId.Text   = order.sEquipId.Value;
                        lblEquipType.Text = order.sEquipTypeName.Value;

                        dtInstructions             = order.GetInstructionByReOpen();
                        repInstructions.DataSource = new DataView(dtInstructions);
                        repInstructions.DataBind();
                    }
                    else
                    {
                        Session["lastpage"] = "ok_reopenWorkOrder.aspx?id=" + OrderId.ToString() + "&op=Issue";
                        Session["error"]    = _functions.ErrorMessage(102);
                        Response.Redirect("error.aspx", false);
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = "ok_reopenWorkOrder.aspx?id=" + OrderId.ToString() + "&op=Issue";
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (order != null)
                {
                    order.Dispose();
                }
            }
        }