private void btnBackInt_Click(object sender, System.EventArgs e) { try { pnlViewQuestion.Visible = true; pnlSelectSpare.Visible = false; pnlNoSpare.Visible = false; lblFirstName.Text = op.FirstName; equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iId = EquipId; if (equip.GetEquipInfo() != -1) { lblEquipType.Text = equip.sType.Value; } else { Session["lastpage"] = CurrentPage; 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"] = CurrentPage; 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["orderid"] == null) { Session["lastpage"] = "ok_mainMenu.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { EquipId = Convert.ToInt32(Request.QueryString["equipid"]); OrderId = Convert.ToInt32(Request.QueryString["orderid"]); sBackPage = Request.QueryString["back"]; } catch (FormatException fex) { Session["lastpage"] = "ok_mainMenu.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); sBackURL = "ok_mainMenu.aspx"; if (sBackPage == "maindetails") { sBackURL = "ok_mainDetails.aspx?id=" + OrderId.ToString(); } if (sBackPage == "mainmenu2") { sBackURL = "ok_mainMenu2.aspx"; } btnBack.Attributes.Add("onclick", "javascript:document.location='" + sBackURL + "'"); if (!IsPostBack) { OperatorInfo op = new OperatorInfo(Request.Cookies["bfp_operator"].Value); lblFirstName1.Text = lblFirstName2.Text = lblFirstName3.Text = op.FirstName; equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iUserId = op.Id; dtEquipments = equip.GetEquipListByOperator(); if (dtEquipments.Rows.Count < 1) { // none equipments mode pnlFindEquipment.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(); lblMakeModel.Text = dtEquipments.Rows[0]["MakeName"].ToString() + "/" + dtEquipments.Rows[0]["ModelName"].ToString(); lblYear.Text = dtEquipments.Rows[0]["Year"].ToString(); ViewState["SelectedEqiupId"] = 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) { pnlFindEquipment.Visible = false; pnlManyEquipment.Visible = false; pnlOneEquipment.Visible = true; order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; if (order.GetEquipInfo() == -1) { Session["lastpage"] = sBackURL; Session["error"] = _functions.ErrorMessage(120); Response.Redirect("error.aspx", false); } else { lblEquipId.Text = order.sEquipId.Value; lblEquipType.Text = order.sEquipTypeName.Value; lblMakeModel.Text = order.sEquipMakeModel.Value; lblYear.Text = order.sEquipYear.Value; ViewState["SelectedEqiupId"] = order.iEquipId.Value.ToString(); } } else { if (EquipId != 0) { pnlFindEquipment.Visible = false; pnlManyEquipment.Visible = false; pnlOneEquipment.Visible = true; equip.iId = EquipId; if (equip.GetEquipInfo() == -1) { Session["lastpage"] = sBackURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); } else { lblEquipId.Text = equip.sEquipId.Value; lblEquipType.Text = equip.sType.Value; lblMakeModel.Text = equip.sMakeModelName.Value; lblYear.Text = equip.iYear.Value.ToString(); ViewState["SelectedEqiupId"] = EquipId.ToString(); } } } } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = sBackURL; 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(); } } }
private void Page_Load(object sender, System.EventArgs e) { int l_iMileage; try { if ((Request.QueryString["equipid"] == null) && (Request.QueryString["orderid"] == null)) { Session["lastpage"] = "ok_mainMenu.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { OrderId = Convert.ToInt32(Request.QueryString["orderid"]); EquipId = Convert.ToInt32(Request.QueryString["equipid"]); } catch (FormatException fex) { Session["lastpage"] = "ok_mainMenu.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); NextBackControl.BackText = "<< Back"; NextBackControl.BackPage = "ok_selectEquipment.aspx?orderid=" + OrderId.ToString(); NextBackControl.NextText = "Continue >>"; NextBackControl.sCSSClass = "ok_input_button"; op = new OperatorInfo(Request.Cookies["bfp_operator"].Value); if (!IsPostBack) { equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iId = EquipId; if (equip.GetEquipInfo() != -1) { if (0 == Decimal.Compare(Decimal.Floor(equip.dmCurrentUnits.Value), equip.dmCurrentUnits.Value)) { lblCurrentUnits.Text = Decimal.Floor(equip.dmCurrentUnits.Value).ToString() + " " + equip.sMeasure.Value; } else { lblCurrentUnits.Text = equip.dmCurrentUnits.Value.ToString("F") + " " + equip.sMeasure.Value; } //mileage lblMeasure.Text = equip.sMeasure.Value; lblMeasure2.Text = equip.sMeasure.Value; lblMeasure3.Text = equip.sMeasure.Value; lblEquipId.Text = equip.sEquipId.Value; lblEquipType.Text = equip.sType.Value; rvUnits.MinimumValue = equip.dmCurrentUnits.Value.ToString(); rvUnits.ErrorMessage = "Value must be greater than was " + equip.dmCurrentUnits.Value.ToString("F"); } else { Session["lastpage"] = "ok_selectEquipment.aspx?orderid=" + OrderId.ToString(); 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_selectEquipment.aspx?orderid=" + OrderId.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"] = "e_list.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { EquipId = Convert.ToInt32(Request.QueryString["id"]); } catch (FormatException fex) { Session["lastpage"] = "e_list.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } Header.AddBreadCrumb("Home", "/main.aspx"); Header.AddBreadCrumb("Equipment List", "/e_list.aspx"); Header.AddBreadCrumb("Equipment Detail", "/e_view.aspx?id=" + EquipId.ToString()); Header.LeftBarHtml = "View Operators Assignments of Equipment"; if (!IsPostBack) { dtCurrentDate = DateTime.Now; adtEndDate.Date = dtCurrentDate; adtStartDate.Date = dtCurrentDate.AddDays(-365); equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iId = EquipId; if (equip.GetEquipInfo() == -1) { Session["lastpage"] = "e_view.aspx?id=" + EquipId.ToString(); Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); } lblEquipId.Text = equip.sEquipId.Value; } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "e_view.aspx?id=" + 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 { if ((Request.QueryString["equipid"] == null) && (Request.QueryString["orderid"] == null)) { Session["lastpage"] = "ok_mainMenu.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { OrderId = Convert.ToInt32(Request.QueryString["orderid"]); EquipId = Convert.ToInt32(Request.QueryString["equipid"]); } catch (FormatException fex) { Session["lastpage"] = "ok_mainMenu.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); NextBackControl.BackText = "<< Back"; NextBackControl.BackPage = "ok_editNote.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString(); NextBackControl.NextText = " Finish "; NextBackControl.sCSSClass = "ok_input_button"; op = new OperatorInfo(Request.Cookies["bfp_operator"].Value); if (!IsPostBack) { lblFirstName.Text = op.FirstName; equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iId = EquipId; if (equip.GetEquipInfo() != -1) { lblEquipId.Text = equip.sEquipId.Value; lblEquipType.Text = equip.sType.Value; } else { Session["lastpage"] = "ok_editNote.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString(); Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); return; } order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; repInstructions.DataSource = new DataView(order.GetInstructionByCheckIn()); repInstructions.DataBind(); if (order.bPrint.Value) { hlPrint.Visible = true; string Url = Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.LastIndexOf("/")).Replace("/", "%2f"); Url = Url.Replace(":", "%3a"); hlPrint.Attributes.Add("onclick", "javascript:window.open('ReportViewer.aspx?Report=" + _functions.GetValueFromConfig("SQLRS.Folder") + "%2fCheckInReceipt&OrderId=" + OrderId.ToString() + "&OrgId=" + OrgId.ToString() + "&URL=" + Url + "', 'popupcal', 'toolbars=0');"); } else { hlPrint.Visible = false; } } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "ok_editNote.aspx?orderid=" + 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(); } if (order != null) { order.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; } // getting the Bread Crumbs from Cookie and add last item if (Request.Cookies.Count > 0 && Request.Cookies["bfp_navigate"] != null) { Header.BrdCrumbsSerialization = Request.Cookies["bfp_navigate"].Value; } Header.AddBreadCrumb("Work Order Detail", "/wo_viewWorkOrder.aspx?id=" + OrderId.ToString()); NextBackControl.BackPage = ParentPageURL; NextBackControl.BackVisible = true; NextBackControl.CausesValidation = true; if (!IsPostBack) { order = new clsWorkOrders(); user = new clsUsers(); order.cAction = "S"; order.iOrgId = OrgId; order.iId = OrderId; user.iOrgId = OrgId; user.iTypeId = (int)UserTypes.Technician; ddlTech.DataSource = new DataView(user.GetUserListByType()); ddlTech.DataBind(); if (order.WorkOrderDetails() == -1) { Session["lastpage"] = this.ParentPageURL; Session["error"] = _functions.ErrorMessage(120); Response.Redirect("error.aspx", false); return; } if (!user.IsTechnician(_functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true))) { Session["lastpage"] = this.ParentPageURL; Session["error"] = _functions.ErrorMessage(131); Response.Redirect("error.aspx", false); return; } lblWorkOrderId.Text = order.daCreated.Value.ToString("yyyy-MM-dd") + "-" + order.iWorkOrderNumber.Value.ToString(); hlEquipId.Text = order.sEquipId.Value; hlEquipId.NavigateUrl = "e_view.aspx?id=" + order.iEquipId.Value.ToString(); hlSpareEquipId.Text = order.sSpareEquipId.Value; if (order.iSpareEquipId.Value > 0) { hlSpareEquipId.NavigateUrl = "e_view.aspx?id=" + order.iSpareEquipId.Value.ToString(); } lblOperator.Text = order.sOperatorName.Value; lblScheduledDate.Text = order.daScheduled.Value.ToLongDateString() + " " + order.daScheduled.Value.ToLongTimeString(); if (order.bStaying.Value) { lblStaying.Text = "Yes"; } else { lblStaying.Text = "No"; } if (ddlTech.Items.FindByValue(order.iTechId.Value.ToString()) != null) { ddlTech.SelectedValue = order.iTechId.Value.ToString(); } else { ddlTech.SelectedIndex = 0; } tbDroppedOffBy.Text = order.sDropedOffBy.Value; if (order.iStatusId.Value == (int)WorkOrderStatus.Scheduled && order.iOperatorStatusId.Value == (int)WorkOrderOperatorStatus.Checked_In) { lblArrivalDate.Text = order.daArrival.IsNull?"":order.daArrival.Value.ToLongDateString(); } else { NextBackControl.NextEnabled = false; tbMileage.Enabled = false; ddlTech.Enabled = false; tbDroppedOffBy.Enabled = false; tbNotes.Enabled = false; Header.ErrorMessage = _functions.ErrorMessage(137); } if (order.daOpened.IsNull) { adtOpened.Date = DateTime.Now; } else { adtOpened.Date = order.daOpened.Value; } equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iId = order.iEquipId; if (equip.GetEquipInfo() == -1) { Session["lastpage"] = this.ParentPageURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); return; } tbMileage.Text = equip.dmCurrentUnits.Value.ToString("F"); valRangeUnits.MinimumValue = equip.dmCurrentUnits.Value.ToString(); valRangeUnits.ErrorMessage = "Value must be greater than was " + equip.dmCurrentUnits.Value.ToString("F") + "<br>"; lblMeasure.Text = equip.sMeasure.Value; order.iNoteId = 0; order.iNoteTypeId = (int)NoteTypes.CreationNote; order.iItemId = OrderId; if (order.NoteDetails() != -1) { lblClerkNote.Text = order.sNote.Value; } ShowCustomFields(); } } 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 (user != null) { user.Dispose(); } if (order != null) { order.Dispose(); } 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["equipid"] == null) && (Request.QueryString["orderid"] == null)) { Session["lastpage"] = "ok_mainMenu.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { OrderId = Convert.ToInt32(Request.QueryString["orderid"]); EquipId = Convert.ToInt32(Request.QueryString["equipid"]); } catch (FormatException fex) { Session["lastpage"] = "ok_mainMenu.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } if (Request.QueryString["op"] == null) { Operation = "CheckIn"; BackPage = "ok_addIssues.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString(); CurrentPage = "ok_selectSpareEquip.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString(); } else { Operation = "CheckOutSpare"; BackPage = "ok_mainMenu.aspx"; CurrentPage = "ok_selectSpareEquip.aspx?op=CheckOutSpare&orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString(); } NextBackControl.BackPage = BackPage; NextBackControl.sCSSClass = "ok_input_button"; op = new OperatorInfo(Request.Cookies["bfp_operator"].Value); if (!IsPostBack) { pnlViewQuestion.Visible = true; pnlSelectSpare.Visible = false; pnlNoSpare.Visible = false; lblFirstName.Text = op.FirstName; equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iId = EquipId; if (equip.GetEquipInfo() != -1) { lblEquipType.Text = equip.sType.Value.ToLower(); } else { Session["lastpage"] = BackPage; 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"] = BackPage; 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; } // getting the Bread Crumbs from Cookie and add last item if (Request.Cookies.Count > 0 && Request.Cookies["bfp_navigate"] != null) { Header.BrdCrumbsSerialization = Request.Cookies["bfp_navigate"].Value; } Header.AddBreadCrumb("Work Order Detail", "/wo_viewWorkOrder.aspx?id=" + OrderId.ToString()); SaveCancelControl.ParentPageURL = this.ParentPageURL; SaveCancelControl.IsCancel = true; SaveCancelControl.CausesValidation = true; SaveCancelControl.ButtonText = " Check-In/Sign "; if (!IsPostBack) { order = new clsWorkOrders(); order.cAction = "S"; order.iOrgId = OrgId; order.iId = OrderId; if (order.WorkOrderDetails() == -1) { Session["lastpage"] = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString(); Session["error"] = _functions.ErrorMessage(120); Response.Redirect("error.aspx", false); return; } WorkOrderStatus status = (WorkOrderStatus)order.iStatusId.Value; WorkOrderOperatorStatus opstatus = order.iOperatorStatusId.IsNull?WorkOrderOperatorStatus.Null:(WorkOrderOperatorStatus)order.iOperatorStatusId.Value; if (status != WorkOrderStatus.Scheduled && opstatus != WorkOrderOperatorStatus.Null) { Signature.sError = _functions.ErrorMessage(136); tbDroppedOffBy.Enabled = false; tbMileage.Enabled = false; tbNotes.Enabled = false; rblStaying.Enabled = false; Signature.Enabled = false; SaveCancelControl.EnableSave = false; } lblWorkOrderId.Text = order.daCreated.Value.ToString("yyyy-MM-dd") + "-" + order.iWorkOrderNumber.Value.ToString(); hlEquipId.Text = order.sEquipId.Value; hlEquipId.NavigateUrl = "e_view.aspx?id=" + order.iEquipId.Value.ToString(); hlSpareEquipId.Text = order.sSpareEquipId.Value; hlChangeSpare.NavigateUrl = "wo_selectSpareEquip.aspx?id=" + OrderId.ToString() + "&back=checkin"; if (order.iOperatorId.Value == 6) { hlChangeSpare.Enabled = false; } if (order.iSpareEquipId.Value > 0) { hlSpareEquipId.NavigateUrl = "e_view.aspx?id=" + order.iSpareEquipId.Value.ToString(); } lblOperator.Text = order.sOperatorName.Value; if (order.bStaying.Value) { rblStaying.SelectedValue = "True"; } else { rblStaying.SelectedValue = "False"; } tbDroppedOffBy.Text = order.sDropedOffBy.Value; adtCheckIn.Date = DateTime.Now; equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iId = order.iEquipId; if (equip.GetEquipInfo() == -1) { Session["lastpage"] = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString(); Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); return; } tbMileage.Text = equip.dmCurrentUnits.Value.ToString("F"); valRangeUnits.MinimumValue = equip.dmCurrentUnits.Value.ToString(); valRangeUnits.ErrorMessage = "Value must be greater than was " + equip.dmCurrentUnits.Value.ToString("F") + "<br>"; lblMeasure.Text = equip.sMeasure.Value; } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "wo_viewWorkOrder.aspx?id=" + 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(); } } }