private void btnFiltration_Click(object sender, System.EventArgs e) { try { equip = new clsEquipment(); equip.EnableDefaultFiltration = false; equip.iOrgId = OrgId; equip.iTypeId = Convert.ToInt32(ddlEquipTypes.SelectedValue); equip.iDeptId = Convert.ToInt32(ddlDepartments.SelectedValue); equip.iLocId = Convert.ToInt32(ddlLocations.SelectedValue); equip.iOrderId = OrderId; equip.sEquipId_Filter = _functions.ConvertToSQLFilter(tbEquipId.Text); dtMain = equip.GetEquipList_ForSpare(); ShowList(); } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "wo_selectSpareEquip.aspx?id=" + OrderId.ToString() + "&equipid=" + EquipId.ToString(); 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 { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); if (Request.QueryString["id"] == null) { Session["lastpage"] = "main.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { OrderId = Convert.ToInt32(Request.QueryString["id"]); } catch (FormatException fex) { Session["lastpage"] = "main.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } if (Request.QueryString["equipid"] != null) { EquipId = Convert.ToInt32(Request.QueryString["equipid"]); } else { EquipId = 0; } if (Request.QueryString["back"] == null) { tblMain.Rows[0].Visible = false; tblMain.Rows[1].Visible = false; sBack = ""; this.PageTitle = "Select Spare Equipment"; //Header.PageTitle = PageTitle; if (Request.QueryString["select"] == null) { NextBackControl.BackPage = "wo_editAddInfo.aspx?id=" + OrderId.ToString() + "&equipid=0"; NextBackControl.BackVisible = true; NextBackControl.CausesValidation = false; m_sLastPage = "wo_editAddInfo.aspx?id=" + OrderId.ToString() + "&equipid=0"; } else { ViewState["Operation"] = "AddRoadside"; NextBackControl.BackPage = "wo_selectOperator.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString(); NextBackControl.BackVisible = true; NextBackControl.CausesValidation = false; NextBackControl.NextText = "<< Finish >>"; m_sLastPage = "wo_selectOperator.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString(); } } else { sBack = Request.QueryString["back"]; if (Request.Cookies.Count > 0 && Request.Cookies["bfp_navigate"] != null) { Header.BrdCrumbsSerialization = Request.Cookies["bfp_navigate"].Value; } switch (sBack) { case "open": // getting the Bread Crumbs from Cookie and add last item Header.AddBreadCrumb("Work Order Detail", "/wo_viewWorkOrder.aspx?id=" + OrderId.ToString()); Header.AddBreadCrumb("Work Order Opening", "/wo_openWorkOrder.aspx?id=" + OrderId.ToString()); m_sLastPage = "wo_openWorkOrder.aspx?id=" + OrderId.ToString(); break; case "checkin": Header.AddBreadCrumb("Work Order Detail", "/wo_viewWorkOrder.aspx?id=" + OrderId.ToString()); Header.AddBreadCrumb("Check-In Equipment", "/wo_viewCheckIn.aspx?id=" + OrderId.ToString()); m_sLastPage = "wo_viewCheckIn.aspx?id=" + OrderId.ToString(); break; case "edit": Header.AddBreadCrumb("Work Order Detail", "/wo_viewWorkOrder.aspx?id=" + OrderId.ToString()); Header.AddBreadCrumb("Work Order Edit", "/wo_editWorkOrder.aspx?id=" + OrderId.ToString()); m_sLastPage = "wo_editWorkOrder.aspx?id=" + OrderId.ToString(); break; default: Header.AddBreadCrumb("Work Order Detail", "/wo_viewWorkOrder.aspx?id=" + OrderId.ToString()); Header.AddBreadCrumb("Work Order Edit", "/wo_editWorkOrder.aspx?id=" + OrderId.ToString()); m_sLastPage = "wo_editWorkOrder.aspx?id=" + OrderId.ToString(); break; } this.PageTitle = "Select Spare Equipment"; NextBackControl.BackVisible = false; NextBackControl.NextText = " Back "; NextBackControl.CausesValidation = false; } if (!IsPostBack) { equip = new clsEquipment(); // showing the spare equipment list loc = new clsLocations(); dep = new clsDepartments(); equip.cAction = "S"; equip.iOrgId = OrgId; ddlEquipTypes.DataSource = new DataView(equip.GetEquipTypesList()); ddlEquipTypes.DataBind(); ddlEquipTypes.Items.Insert(0, new ListItem("All", "0")); dep.iOrgId = OrgId; ddlDepartments.DataSource = new DataView(dep.GetDepartmentsList()); ddlDepartments.DataBind(); ddlDepartments.Items.Insert(0, new ListItem("All", "0")); loc.iOrgId = OrgId; ddlLocations.DataSource = new DataView(loc.GetLocationsList()); ddlLocations.DataBind(); ddlLocations.Items.Insert(0, new ListItem("All", "0")); equip.EnableDefaultFiltration = true; equip.iTypeId = Convert.ToInt32(ddlEquipTypes.SelectedValue); equip.iDeptId = Convert.ToInt32(ddlDepartments.SelectedValue); equip.iLocId = Convert.ToInt32(ddlLocations.SelectedValue); equip.iOrderId = OrderId; equip.sEquipId_Filter = _functions.ConvertToSQLFilter(tbEquipId.Text); dtMain = equip.GetEquipList_ForSpare(); ddlEquipTypes.SelectedValue = equip.iTypeId.Value.ToString(); ShowList(); } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = m_sLastPage; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (loc != null) { loc.Dispose(); } if (dep != null) { dep.Dispose(); } if (order != null) { order.Dispose(); } if (equip != null) { equip.Dispose(); } } }