Exemplo n.º 1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (Request.QueryString["id"] == null)
                {
                    Session["lastpage"] = "ok_selectWorkOrder.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_selectWorkOrder.aspx";
                    Session["error"]    = _functions.ErrorMessage(105);
                    Response.Redirect("error.aspx", false);
                    return;
                }

                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                if (Request.UrlReferrer != null)
                {
                    m_sBack = Request.UrlReferrer.AbsoluteUri;
                    m_sBack = m_sBack.Remove(0, m_sBack.LastIndexOf("/") + 1);
                }
                else
                {
                    m_sBack = "ok_viewIssues.aspx?id=" + OrderId.ToString();
                }

                NextBackControl.BackText  = "<< Back";
                NextBackControl.BackPage  = m_sBack;
                NextBackControl.NextText  = "  Yes  ";
                NextBackControl.sCSSClass = "ok_input_button";

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

                if (!IsPostBack)
                {
                    lblFirstName1.Text = op.FirstName;
                    equip          = new clsEquipment();
                    equip.iOrgId   = OrgId;
                    equip.iOrderId = OrderId;
                    if (equip.GetSpareEquip() == 0)
                    {
                        lblEquipId.Text   = equip.sEquipId.Value;
                        lblEquipType.Text = equip.sType.Value;
                    }
                    else
                    {
                        Response.Redirect("ok_viewNotes.aspx?id=" + OrderId.ToString(), false);
                    }
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = m_sBack;
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (equip != null)
                {
                    equip.Dispose();
                }
            }
        }