private void btnNO_Click(object sender, System.EventArgs e) { try { ViewState["SelectedWorkOrderId"] = null; pnlNoneEquipment.Visible = false; pnlOneEquipment.Visible = false; pnlManyEquipment.Visible = true; equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iUserId = 6; //op.Id; dtEquipments = equip.GetEquipListForCheckOut(); repEquipments.DataSource = new DataView(dtEquipments); repEquipments.DataBind(); } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "ok_selectWorkOrder.aspx"; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (equip != null) { equip.Dispose(); } } }
private void Page_Load(object sender, System.EventArgs e) { try { if (Request.QueryString["id"] == null) { Session["lastpage"] = "ok_mainMenu.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); 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; } op = new OperatorInfo(Request.Cookies["bfp_operator"].Value); if (!IsPostBack) { lblFirstName1.Text = lblFirstName2.Text = lblFirstName3.Text = op.FirstName; equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iUserId = op.Id; dtEquipments = equip.GetEquipListForCheckOut(); if (dtEquipments.Rows.Count < 1) { // none equipments mode pnlNoneEquipment.Visible = true; } else if (dtEquipments.Rows.Count == 1) { // one equipment mode pnlOneEquipment.Visible = true; lblEquipId.Text = dtEquipments.Rows[0]["EquipId"].ToString(); lblEquipType.Text = dtEquipments.Rows[0]["TypeName"].ToString(); ViewState["SelectedWorkOrderId"] = dtEquipments.Rows[0]["Id"].ToString(); } else if (dtEquipments.Rows.Count > 1) { // manu equipments mode pnlManyEquipment.Visible = true; repEquipments.DataSource = new DataView(dtEquipments); repEquipments.DataBind(); } if (OrderId != 0) { pnlNoneEquipment.Visible = false; pnlManyEquipment.Visible = false; pnlOneEquipment.Visible = true; order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; if (order.GetEquipInfo() == -1) { Session["lastpage"] = "ok_authCredentials.aspx?op=CheckOut&orderid=" + OrderId.ToString(); Session["error"] = _functions.ErrorMessage(120); Response.Redirect("error.aspx", false); } else { lblEquipId.Text = order.sEquipId.Value; lblEquipType.Text = order.sEquipTypeName.Value; ViewState["SelectedWorkOrderId"] = OrderId.ToString(); } } } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "ok_authCredentials.aspx?op=CheckOut&orderid=" + OrderId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } if (equip != null) { equip.Dispose(); } } }