private void btNext_FormSubmit(object sender, EventArgs e) { try { order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; CheckOutEquipment(); } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "ok_viewNotes.aspx?id=" + OrderId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } } }
private void btNext_FormSubmit(object sender, EventArgs e) { DateTime daCurrentDate; try { UserId = Convert.ToInt32(ddlTech.SelectedValue); daCurrentDate = DateTime.Now; order = new clsWorkOrders(); order.iOrgId = OrgId; order.iEquipId = EquipId; order.daCurrentDate = daCurrentDate; order.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); order.iId = OrderId; order.iTechId = UserId; order.SetRoadsideWorkOrder(); OrderId = order.iId.Value; Response.Redirect("wo_selectSpareEquip.aspx?select=AddRoadside&id=" + OrderId.ToString() + "&equipid=" + EquipId.ToString(), false); } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "wo_selectOperator.aspx?equipid=" + EquipId.ToString() + "&orderid=" + OrderId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } } }
private void dgRepairs_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { try { switch (e.CommandName) { case "Unassign": order = new clsWorkOrders(); order.cAction = "S"; order.iOrgId = OrgId; order.iReportedIssueId = Convert.ToInt32(e.Item.Cells[0].Text); if (order.WorkOrderReportedIssuesDetail() == -1) { Session["lastpage"] = m_sBackUrl; Session["error"] = _functions.ErrorMessage(121); Response.Redirect("error.aspx", false); return; } order.cAction = "U"; order.iLastWorkOrderId = order.iId; order.iId = SqlInt32.Null; order.WorkOrderReportedIssuesDetail(); ShowIssues(OrderId); break; case "Delete": order = new clsWorkOrders(); order.cAction = "D"; order.iOrgId = OrgId; order.iReportedIssueId = Convert.ToInt32(e.Item.Cells[0].Text); if (order.WorkOrderReportedIssuesDetail() == -1) { Session["lastpage"] = m_sBackUrl; Session["error"] = _functions.ErrorMessage(121); Response.Redirect("error.aspx", false); return; } ShowIssues(OrderId); break; default: break; } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = m_sBackUrl; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } } }
private void dgRepairs_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { try { dgRepairs.EditItemIndex = e.Item.ItemIndex; order = new clsWorkOrders(); order.iOrgId = OrgId; ShowIssues(OrderId); } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = m_sBackUrl; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } } }
/// <summary> /// Procedure is processing the PM Items on screen, i.e. to add or delete /// if them check boxes was selected/unselected /// </summary> private void ProcessingItems() { try { order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; foreach (DataGridItem item in dgPMServices.Items) { order.iPMItemId = Convert.ToInt32(item.Cells[2].Text);; order.iSchedDetailId = Convert.ToInt32(item.Cells[0].Text); order.bChecked = ((CheckBox)item.FindControl("chAdd")).Checked; order.UpdatePMItem(); } } catch (Exception ex) { throw new Exception(ex.Message, ex); } finally { 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 { EquipId = Convert.ToInt32(Request.QueryString["id"]); } catch (FormatException fex) { Session["lastpage"] = "main.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } hlNewOrder.NavigateUrl = "wo_editAddInfo.aspx?id=0&equipid=" + EquipId.ToString(); if (!IsPostBack) { order = new clsWorkOrders(); order.iOrgId = OrgId; order.iEquipId = EquipId; dtOrders = order.GetWOListFromEquip(); if (dtOrders.Rows.Count > 0) { dgMainList.DataSource = new DataView(dtOrders); dgMainList.DataBind(); } else { Response.Redirect("wo_editAddInfo.aspx?id=0&equipid=" + EquipId.ToString(), false); } } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "wo_existingWorkOrders.aspx?id=" + EquipId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } } }
private void Page_Load(object sender, System.EventArgs e) { try { Session["PathToViewOrder"] = null; OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); if (!IsPostBack) { order = new clsWorkOrders(); order.iOrgId = OrgId; order.daCurrentDate = DateTime.Now; repOrders.DataSource = new DataView(order.GetActivityWorkOrder()); repOrders.DataBind(); } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "selectMode.aspx"; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } } }
private void Page_Load(object sender, System.EventArgs e) { try { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); Session["PathToViewOrder"] = "EquipWOReport"; if (!IsPostBack) { dtCurrentDate = DateTime.Now; adtEndDate.Date = dtCurrentDate; adtStartDate.Date = dtCurrentDate.AddDays(-365); order = new clsWorkOrders(); order.iOrgId = OrgId; dsRepairItemsCats = order.GetRepairItemsAndCats(); ddlRepairCats.DataSource = dsRepairItemsCats; ddlRepairCats.DataBind(); ddlRepairCats.Items[0].Text = "All"; ddlWOTypes.DataSource = order.GetTypesList(); ddlWOTypes.DataBind(); ddlWOTypes.Items.Insert(0, new ListItem("All", "0")); user = new clsUsers(); user.iOrgId = OrgId; user.iTypeId = (int)UserTypes.Technician; ddlTech.DataSource = new DataView(user.GetUserListByType()); ddlTech.DataBind(); ddlTech.Items[0].Text = "All"; user.iTypeId = (int)UserTypes.Operator; ddlOperators.DataSource = new DataView(user.GetUserListByType()); ddlOperators.DataBind(); ddlOperators.Items[0].Text = "All"; } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "main.aspx"; 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(); } } }
/// <summary> /// Selecting or creating of the Work Order for /// current Equipment if for current equipment there aren't /// the scheduled work order then it will be created. /// If there are one work order then select him. /// If them more than one then we are selecting the one that has /// the scheduled time by closer to the current moment. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btNext_FormSubmit(object sender, EventArgs e) { try { order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; order.iEquipId = EquipId; order.daCurrentDate = DateTime.Now; order.dmMileage = Convert.ToDecimal(tbUnits.Text); order.iUserId = op.Id; order.SelectWorkOrder(); Response.Redirect("ok_addIssues.aspx?orderid=" + order.iId.Value.ToString() + "&equipid=" + EquipId.ToString(), false); } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "ok_editCurrentUnits.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } } }
private void Page_Load(object sender, System.EventArgs e) { try { Session["PathToViewOrder"] = "Scheduled"; if (!IsPostBack) { order = new clsWorkOrders(); order.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); dgUnassignedWorkOrders.DataSource = new DataView(order.GetWOUnassignedList()); dgUnassignedWorkOrders.DataBind(); } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "main.aspx"; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } } }
private void btnYES_Click(object sender, System.EventArgs e) { try { order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; order.bStaying = true; if (order.UpdateStayingWorkOrder() == -1) { Session["lastpage"] = "ok_editStaying.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString(); Session["error"] = _functions.ErrorMessage(120); Response.Redirect("error.aspx", false); } else { Response.Redirect("ok_editNote.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString(), false); } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "ok_editStaying.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } } }
/// <summary> /// Procedure is showing all work orders for current date /// </summary> private void ShowWorkOrders() { try { lblCurrentDate.Text = dtCurrentDate.ToLongDateString(); order = new clsWorkOrders(); order.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); order.daMaxDate = dtCurrentDate.AddDays(1); order.daMinDate = dtCurrentDate; dgWorkOrders.DataSource = new DataView(order.GetWOListForDate()); dgWorkOrders.DataBind(); Session["CurrentDay"] = dtCurrentDate; } catch (Exception ex) { throw new Exception(ex.Message, ex); } finally { if (order != null) { order.Dispose(); } } }
private void btnBack2_Click(object sender, System.EventArgs e) { try { pnlSelectCategory.Visible = true; pnlEnterIssue.Visible = false; pnlViewIssues.Visible = false; order = new clsWorkOrders(); order.iOrgId = OrgId; repCategories.DataSource = new DataView(order.GetCategoryList()); repCategories.DataBind(); } 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 (order != null) { order.Dispose(); } } }
private void btNext_FormSubmit(object sender, EventArgs e) { try { DateTime dtCurrentTime = DateTime.Now; order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; order.iOperatorId = op.Id; if (Operation == "AddIssueReOpen") { order.iReOpenCategoryId = 2; //Forgot to report an issue } else if (Operation == "AddCommentReOpen") { order.iReOpenCategoryId = 1; //Issue not resolved } else { Header.ErrorMessage = _functions.ErrorMessage(166); return; } order.daCurrentDate = dtCurrentTime; if (order.UpdateReOpenWorkOrder() == -1) { Session["lastpage"] = "ok_reopenWorkOrder.aspx?id=" + OrderId.ToString() + "&op=Issue"; Session["error"] = _functions.ErrorMessage(120); Response.Redirect("error.aspx", false); return; } order.iUserId = op.Id; if (order.SigningWorkOrderReOpen() == -1) { Session["lastpage"] = "ok_reopenWorkOrder.aspx?id=" + OrderId.ToString() + "&op=Issue"; Session["error"] = _functions.ErrorMessage(120); Response.Redirect("error.aspx", false); return; } Response.Redirect("ok_viewReOpen.aspx?id=" + OrderId.ToString(), false); } 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(); } } }
private void btnFind_Click(object sender, System.EventArgs e) { int EquipId, OrderId; DataView dwOrders; try { equip = new clsEquipment(); equip.iOrgId = OrgId; equip.sEquipId = tbEquipmentId.Text; if (equip.SearchEquipId() == 0) { Header.ErrorMessage = "<span style='FONT-SIZE:12pt;'>The specified equipment could not be located</span>"; tbEquipmentId.Text = ""; } else { EquipId = equip.iId.Value; order = new clsWorkOrders(); order.iOrgId = OrgId; order.daCurrentDate = DateTime.Now; dwOrders = new DataView(order.GetActivityWorkOrder()); dwOrders.RowFilter = "EquipId = " + EquipId.ToString(); if (dwOrders.Count > 0) { dwOrders.Sort = "StatusColor desc, OperatorStatusName asc"; OrderId = Convert.ToInt32(dwOrders[0]["Id"].ToString()); Response.Redirect("ok_mainDetails.aspx?id=" + OrderId.ToString() + "&back=mainmenu2", false); } else { Response.Redirect("ok_selectEquipment.aspx?orderid=0&equipid=" + EquipId.ToString() + "&back=mainmenu2", false); } } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "ok_mainMenu2.aspx"; 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 btnYes_Click(object sender, System.EventArgs e) { try { order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; order.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); order.daCurrentDate = DateTime.Now; if (order.DeleteWorkOrder() == -1) { Session["lastpage"] = "wo_deleteWorkOrder.aspx?id=" + OrderId.ToString(); Session["error"] = _functions.ErrorMessage(120); Response.Redirect("error.aspx", false); return; } // redirect to the finish screen BackFinishScreen finish = new BackFinishScreen(); finish.sMainText = "The Work Order has been successfully deleted!"; finish.bMainMenuVisible = true; finish.sMainMenuText = "[Return to Main Menu]"; finish.sMainMenuURL = "main.aspx"; finish.bContinueVisible = false; finish.bViewVisible = false; finish.bAdditionalVisible = false; finish.bPrintVisible = false; Session["BackFinish"] = finish; Response.Redirect("wo_finish.aspx", false); } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "wo_deleteWorkOrder.aspx?id=" + OrderId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { 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 (tbLastName.Text.Length > 0) { Header.BodyOnloadScript = "javascript:GetFocus('" + tbPIN.ClientID + "');"; } else { Header.BodyOnloadScript = "javascript:GetFocus('" + tbLastName.ClientID + "');"; } if (!IsPostBack) { user = new clsUsers(); user.cAction = "S"; user.iOrgId = OrgId; user.OrgDetails(); lblWelcome.Text = "Welcome to the " + user.sOrgName.Value + " Operator Kiosk"; order = new clsWorkOrders(); order.iOrgId = OrgId; order.daCurrentDate = DateTime.Now; dtOrders = order.GetActivityWorkOrder(); ViewState["ActivityOrders"] = dtOrders; repOrders.DataSource = new DataView(dtOrders); repOrders.DataBind(); } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "selectMode.aspx"; 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(); } } }
private void dgUnAssignedIssues_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { try { order = new clsWorkOrders(); equip = new clsEquipment(); equip.iId = EquipId; equip.iOrgId = OrgId; order.cAction = "S"; order.iOrgId = OrgId; order.iReportedIssueId = Convert.ToInt32(((Label)e.Item.FindControl("lblReportIssueId")).Text); if (order.WorkOrderReportedIssuesDetail() == -1) { Session["lastpage"] = sCurrentPage; Session["error"] = _functions.ErrorMessage(121); Response.Redirect("error.aspx", false); return; } order.cAction = "U"; order.sReportDesc = ((TextBox)e.Item.FindControl("tbIssueName")).Text; if (order.WorkOrderReportedIssuesDetail() == -1) { Session["lastpage"] = sCurrentPage; Session["error"] = _functions.ErrorMessage(121); Response.Redirect("error.aspx", false); return; } dgUnAssignedIssues.EditItemIndex = -1; ShowIssues(); } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = sCurrentPage; 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 btSave_FormSubmit(object sender, EventArgs e) { try{ OrderId = (int)ViewState["OrderId"]; RepairId = (int)ViewState["RepairId"]; InspectId = (int)ViewState["InspectId"]; order = new clsWorkOrders(); order.cAction = "U"; order.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); order.iId = OrderId; order.iRepairId = RepairId; order.sRepairDesc = tbNotes.Text; if (ddlRepairItems.SelectedValue != "0") { order.iRepairItemId = Convert.ToInt32(ddlRepairItems.SelectedValue); } if (order.RepairCommonDetails() == -1) { Session["lastpage"] = "wo_editPartsUsed.aspx?id=" + OrderId.ToString() + "&repairid=" + RepairId.ToString() + "&inspectid=" + InspectId.ToString(); Session["error"] = _functions.ErrorMessage(123); Response.Redirect("error.aspx", false); return; } if (InspectId != 0) { Response.Redirect("wo_viewCompleteInspection.aspx?id=" + OrderId.ToString() + "&inspectid=" + InspectId.ToString(), false); } else { Response.Redirect("wo_viewWorkOrder.aspx?id=" + OrderId.ToString(), false); } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "wo_editPartsUsed.aspx?id=" + OrderId.ToString() + "&repairid=" + RepairId.ToString() + "&inspectid=" + InspectId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } } }
private void btnAddRepair_Click(object sender, System.EventArgs e) { try { order = new clsWorkOrders(); equip = new clsEquipment(); equip.iId = EquipId; equip.iOrgId = OrgId; order.cAction = "U"; order.iOrgId = OrgId; order.iEquipId = EquipId; order.iReportedIssueId = 0; order.iRepairCatId = Convert.ToInt32(ddlCategory.SelectedValue); order.sReportDesc = tbDesc.Text; order.iId = SqlInt32.Null; order.iServiceResultId = SqlInt32.Null; order.iServiceCheckId = SqlInt32.Null; order.iRepairMultId = SqlInt32.Null; if (order.WorkOrderReportedIssuesDetail() == -1) { Session["lastpage"] = sCurrentPage; Session["error"] = _functions.ErrorMessage(121); Response.Redirect("error.aspx", false); } tbDesc.Text = ""; ddlCategory.SelectedIndex = 0; ShowIssues(); } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = sCurrentPage; 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(); } } }
/// <summary> /// Saving the history for current PM item /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, System.EventArgs e) { try { order = new clsWorkOrders(); order.cAction = "U"; order.iPMHistoryId = HistoryId; order.iOrgId = OrgId; order.iSchedDetailId = SchedDetailId; order.iId = OrderId; order.iEquipId = (Int32)ViewState["EquipId"]; if (tblMain.Rows[4].Visible == false) { order.daDateHistory = DateTime.Now; } else { order.daDateHistory = adtLastTime.Date; } if (tblMain.Rows[5].Visible == false) { order.dmUnitsHistory = (SqlDecimal)0; } else { order.dmUnitsHistory = Convert.ToDecimal(tbUnits.Text); } if (order.PMHistoryDetail() != -1) { // closing current window and relaod parent window sOnLoad = "window.close();opener.document.formAddPMItems.submit();"; Session["reload"] = true; } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); } finally { if (order != null) { order.Dispose(); } } }
private void btnNO_Click(object sender, System.EventArgs e) { try { // check-in the current equipment into curreòå work order // next screen if (Operation == "CheckIn") { order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; order.daCurrentDate = DateTime.Now; order.iUserId = op.Id; if (order.UpdateCheckInWorkOrder() == -1) { Session["lastpage"] = CurrentPage; Session["error"] = _functions.ErrorMessage(120); Response.Redirect("error.aspx", false); return; } else { Response.Redirect("ok_viewCheckIn.aspx?orderid=" + OrderId.ToString() + "&equipid=" + EquipId.ToString(), false); } } else { Response.Redirect(BackPage, false); } } 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 (order != null) { order.Dispose(); } } }
private void Page_Load(object sender, System.EventArgs e) { try { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); Session["PathToViewOrder"] = "Today"; if (!IsPostBack) { order = new clsWorkOrders(); order.iOrgId = OrgId; order.daCurrentDate = DateTime.Now; dsWorkOrders = order.GetWOListForToday(); dgWorkOrders_Past.DataSource = new DataView(dsWorkOrders.Tables[0]); dgWorkOrders_Past.DataBind(); dgWorkOrders_Today.DataSource = new DataView(dsWorkOrders.Tables[1]); dgWorkOrders_Today.DataBind(); dgWorkOrders_Tomorrow.DataSource = new DataView(dsWorkOrders.Tables[2]); dgWorkOrders_Tomorrow.DataBind(); dgWorkOrders_Future.DataSource = new DataView(dsWorkOrders.Tables[3]); dgWorkOrders_Future.DataBind(); } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "main.aspx"; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } } }
private void btnAddPart_Click(object sender, System.EventArgs e) { try { OrderId = (int)ViewState["OrderId"]; RepairId = (int)ViewState["RepairId"]; InspectId = (int)ViewState["InspectId"]; order = new clsWorkOrders(); order.cAction = "U"; order.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); order.iPartUsedId = 0; order.iRepairId = RepairId; order.iPartUsedQty = Convert.ToInt32(tbQty.Text); order.sPartUsedStock = tbStock.Text; order.sPartUsedDesc = tbDesc.Text; if (tbCost.Text.Length > 0) { order.dmPartUsedCost = Convert.ToDecimal(tbCost.Text); } order.PartsUsedDetails(); tbQty.Text = ""; tbStock.Text = ""; tbDesc.Text = ""; tbCost.Text = ""; dgParts.DataSource = new DataView(order.GetPartsUsedList()); dgParts.DataBind(); } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "wo_editPartsUsed.aspx?id=" + OrderId.ToString() + "&repairid=" + RepairId.ToString() + "&inspectid=" + InspectId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } } }
private void Page_Load(object sender, System.EventArgs e) { try { SourcePageName = "wo_openWorkOrder.aspx.cs"; 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; } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = ""; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } } }
private void SelectXmlTimeSheet() { XslTransform trans = null; XmlDocument doc = null; XsltArgumentList agr = null; string _input; TimeSpan times; int iTime = 0; try { GetTimeFromRS(ref iTime); times = Cal.SelectedDate.Subtract(new DateTime(1970, 1, 1)); order = new clsWorkOrders(); order.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); order.daCurrentDate = Cal.SelectedDate; doc = new XmlDocument(); doc.LoadXml(order.GetWOListForTime()); trans = new XslTransform(); trans.Load(Server.MapPath("ShowTime.xsl")); agr = new XsltArgumentList(); agr.AddParam("selected", "", ((long)(times.Ticks / 10000)).ToString()); agr.AddParam("formname", "", (string)ViewState["formname"]); agr.AddParam("id", "", (string)ViewState["id"]); agr.AddParam("postBack", "", (string)ViewState["postBack"]); agr.AddParam("TimeSelected", "", iTime); xmlTimeSheet.Document = doc; xmlTimeSheet.Transform = trans; xmlTimeSheet.TransformArgumentList = agr; } catch (Exception ex) { throw new Exception(ex.Message, ex); } finally { if (order != null) { order.Dispose(); } } }
/// <summary> /// Procedure is showing completed work orders on screen /// </summary> private void ShowCompletedOrders() { try { order = new clsWorkOrders(); order.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); order.sEquipId = ""; //tbEquipId.Text; order.iOperatorId = 0; //Convert.ToInt32(ddlDrivers.SelectedValue); dgCompletedWorkOrders.DataSource = new DataView(order.GetWOCompletedList()); dgCompletedWorkOrders.DataBind(); } catch(Exception ex) { throw new Exception(ex.Message, ex); } finally { if(order != null) order.Dispose(); } }
private void btnReport_Click(object sender, System.EventArgs e) { try { order = new clsWorkOrders(); order.iOrgId = OrgId; order.sEquipId = tbEquipId.Text; order.daMinDate = adtStartDate.Date; order.daMaxDate = adtEndDate.Date; order.iTypeId = Convert.ToInt32(ddlWOTypes.SelectedValue); order.iRepairCatId = Convert.ToInt32(ddlRepairCats.SelectedValue); order.iTechId = Convert.ToInt32(ddlTech.SelectedValue); order.iOperatorId = Convert.ToInt32(ddlOperators.SelectedValue); DataTable dtReport = order.GetEquipWorkOrderReport(); repWorkOrders.DataSource = new DataView(dtReport); repWorkOrders.DataBind(); double dmTotalCost = 0.0; foreach (DataRow _row in dtReport.Rows) { dmTotalCost += Convert.ToDouble(_row["TotalCost"]); } lblTotalCost.Text = "$" + dmTotalCost.ToString(); } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "wo_viewEquipWorkOrderReport.aspx"; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } } }
private void t_calOrders_PreRender(object sender, System.EventArgs e) { try { // Procedure is showing all work orders for current date lblCurrentDate.Text = t_calOrders.TodaysDate.ToString("y"); order = new clsWorkOrders(); order.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); order.daMinDate = ((Acme.CalendarDayCell)t_calOrders.Controls[0].Controls[1].Controls[0]).Date.Date; order.daMaxDate = ((Acme.CalendarDayCell)t_calOrders.Controls[0].Controls[t_calOrders.Controls[0].Controls.Count - 1].Controls[6]).Date.Date.AddDays(1); dwWorkOrders = new DataView(order.GetWOListForDate()); for (int i = 1; i < t_calOrders.Controls[0].Controls.Count; i++) { for (int j = 0; j < 7; j++) { dwWorkOrders.RowFilter = "[Date] = '" + ((Acme.CalendarDayCell)t_calOrders.Controls[0].Controls[i].Controls[j]).Date.ToString() + "'"; ((Repeater)t_calOrders.Controls[0].Controls[i].Controls[j].FindControl("repOrders")).DataSource = dwWorkOrders; ((Repeater)t_calOrders.Controls[0].Controls[i].Controls[j].FindControl("repOrders")).DataBind(); } } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "main.aspx"; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } } }
/// <summary> /// Procedure is processing the inspections on screen, i.e. to add or delete /// if them check boxes was selected/unselected /// </summary> private void ProcessingItems() { try { order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; foreach (DataGridItem item in dgInspections.Items) { if (((CheckBox)item.FindControl("chAdd")).Enabled) { if (IsPast) { order.daCurrentDate = ((DateTime)ViewState["WorkOrderCreatedDate"]); } else { order.daCurrentDate = DateTime.Now; } order.iInspectSchedDetailId = Convert.ToInt32(item.Cells[0].Text); order.iWOInspectionId = Convert.ToInt32(item.Cells[1].Text); order.bChecked = ((CheckBox)item.FindControl("chAdd")).Checked; order.UpdateInspection(); } } } catch (Exception ex) { throw new Exception(ex.Message, ex); } finally { if (order != null) { order.Dispose(); } } }