private void btNext_FormSubmit(object sender, EventArgs e) { try { ProcessingItems(); if (IsPast) { BackFinishScreen finish = new BackFinishScreen(); finish.sMainText = "The Past Work Order " + ((DateTime)ViewState["WorkOrderCreatedDate"]).ToString("yyyy-MM-dd") + "-" + ViewState["WorkOrderNumber"].ToString() + " has been created successfully."; finish.bMainMenuVisible = true; finish.sMainMenuText = "[Return to Main Menu]"; finish.sMainMenuURL = "main.aspx"; finish.bContinueVisible = true; finish.sContinueText = "[Continue to Check-In Equipment by Technician]"; finish.sContinueURL = "wo_viewCheckIn.aspx?id=" + OrderId.ToString(); finish.bViewVisible = true; finish.sViewText = "[View the Scheduled Work Order]"; finish.sViewURL = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString(); finish.bAdditionalVisible = true; finish.sAdditionalText = "[Create a New Work Order]"; finish.sAdditionalURL = "wo_default.aspx"; finish.bPrintVisible = false; Session["BackFinish"] = finish; Response.Redirect("wo_finish.aspx", false); } else { Response.Redirect("wo_preview.aspx?id=" + OrderId.ToString(), false); } } 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 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(); } } }
/// <summary> /// Updating the user information /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btSave_FormSubmit(object sender, EventArgs e) { bool bSavePassword = false, bSavePIN = false; string salt; try { user = new clsUsers(); user.cAction = "U"; user.iOrgId = OrgId; user.iId = UserId; if (tbNewPassword.Text.Length > 0 && tbConfirmPassword.Text.Length > 0) { if (tbNewPassword.Text != tbConfirmPassword.Text) { lblComfirmPassword.Visible = true; if (tbNewPIN.Text != tbConfirmPIN.Text) { lblConfirmPIN.Visible = true; } return; } else { bSavePassword = true; lblConfirmPIN.Visible = false; } } if (tbNewPIN.Text.Length > 0 && tbConfirmPIN.Text.Length > 0) { if (tbNewPIN.Text != tbConfirmPIN.Text) { lblConfirmPIN.Visible = true; return; } else { bSavePIN = true; lblConfirmPIN.Visible = false; } } user.sFirstName = tbFirstName.Text; user.sLastName = tbLastName.Text; user.sInitials = tbInitial.Text.ToUpper(); user.sTypeName = ddlType.SelectedValue; user.sEmail = tbEmail.Text; user.iLoginId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); user.daCreated = DateTime.Now; user.dmHourlyRate = Convert.ToDecimal(tbHourlyRate.Text); if (user.UserDetails() == -1) { Session["lastpage"] = "admin_user_detail_edit.aspx?id=" + UserId.ToString(); Session["error"] = _functions.ErrorMessage(134); Response.Redirect("error.aspx", false); return; } if (bSavePassword || UserId == 0) { // set a new password salt = _functions.CreateSalt(5); string passwordHash = _functions.CreatePasswordHash(tbNewPassword.Text, salt); user.sPass = passwordHash; user.sSalt = salt; if (user.SetPassword() == -1) { Header.ErrorMessage = _functions.ErrorMessage(134); return; } } if (bSavePIN || UserId == 0) { // set a new PIN code user.sPIN = tbNewPIN.Text; if (user.SetPIN() == -1) { Header.ErrorMessage = _functions.ErrorMessage(134); return; } } bool bRedirect = false; string sText = ""; if (UserId == 0) { bRedirect = true; sText = "A new user has been added successfully!"; // adding group to user user.cAction = "I"; user.iGroupId = Convert.ToInt32(ddlGroup.SelectedValue); if (user.UsersGroupsDetail() == -1) { Session["lastpage"] = "admin_user_detail_edit.aspx?id=" + UserId.ToString(); Session["error"] = _functions.ErrorMessage(117); Response.Redirect("error.aspx", false); return; } } else { if (bSavePassword || bSavePIN) { bRedirect = true; if (bSavePassword && bSavePIN) { sText = "The user's password and PIN Code have been sucessfully updated."; } else if (bSavePassword && !bSavePIN) { sText = "The user's password have been sucessfully updated."; } else if (!bSavePassword && bSavePIN) { sText = "The PIN Code have been sucessfully updated."; } } else { bRedirect = false; } } if (bRedirect) { // redirect to the finish screen BackFinishScreen finish = new BackFinishScreen(); finish.sMainText = sText; finish.bMainMenuVisible = true; finish.sMainMenuText = "[Return to Main Menu]"; finish.sMainMenuURL = "selectMode.aspx"; finish.bContinueVisible = false; finish.bViewVisible = true; finish.sViewText = "[View the User Detail]"; finish.sViewURL = "admin_user_detail.aspx?id=" + user.iId.Value.ToString(); finish.bAdditionalVisible = false; finish.bPrintVisible = false; Session["BackFinish"] = finish; Response.Redirect("wo_finish.aspx", false); } else { Response.Redirect("admin_user_detail.aspx?id=" + user.iId.Value.ToString(), false); } } catch (FormatException fex) { Header.ErrorMessage = _functions.ErrorMessage(108); } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "admin_user_detail_edit.aspx?id=" + UserId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (user != null) { user.Dispose(); } } }
/// <summary> /// Procedure is adding a new work order into database and redirecting to finish screen /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btNext_FormSubmit(object sender, EventArgs e) { string sDataGridName; DBFieldType FieldType; DateTime daTmpForFixBug, daCurrent; try { daCurrent = DateTime.Now; if (adtScheduled.Date < daCurrent) { lblErrorScheduled.Text = "The Scheduled date must be in future"; return; } order = new clsWorkOrders(); order.iOrgId = OrgId; order.iEquipId = EquipId; if (adtScheduled.Date.Hour == 0 || adtScheduled.Date.Hour == 12) { daTmpForFixBug = adtScheduled.Date; if (daTmpForFixBug.Hour == 0) { daTmpForFixBug = daTmpForFixBug.AddHours(12); } else { daTmpForFixBug = daTmpForFixBug.AddHours(-12); } } else { daTmpForFixBug = adtScheduled.Date; } order.daScheduled = daTmpForFixBug; order.iInspectSchedDetailId = InspectSchedDetailId; order.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); order.daCurrentDate = daCurrent; order.SetInspectWorkOrder(); if (tbNotes.Text.Length > 0) { order.cAction = "U"; order.iNoteId = 0; order.iNoteTypeId = (int)NoteTypes.CreationNote; order.iItemId = order.iId; order.daCreated = daCurrent; order.sNote = tbNotes.Text; order.NoteDetails(); } BackFinishScreen finish = new BackFinishScreen(); finish.sMainText = "The Work Order with Inspection has been created successfully."; finish.bMainMenuVisible = true; finish.sMainMenuText = "[Return to Main Menu]"; finish.sMainMenuURL = "main.aspx"; finish.bContinueVisible = true; finish.sContinueText = "[Create a New Future Work Order with Inspection]"; finish.sContinueURL = "wo_showEquipsForInspect.aspx"; finish.bViewVisible = true; finish.sViewText = "[View a new Work Order with Inspection]"; finish.sViewURL = "wo_viewWorkOrder.aspx?id=" + order.iId.Value.ToString(); 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_addInspectForecast.aspx?equipid=" + EquipId.ToString() + "&sid=" + InspectSchedDetailId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } } }
/// <summary> /// Procedure close the work order detail /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btSave_FormSubmit(object sender, EventArgs e) { DateTime daCurrentDate; try { daCurrentDate = DateTime.Now; order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; order.sInitials = Signature.sInitials; order.sPIN = Signature.sPIN; order.sReleasedTo = tbReleasedTo.Text; order.daCurrentDate = _functions.CorrectDate(adtCheckOut.Date); // signing the Check-Out of Equipment by Technician if (order.SigningEquipmentCheckOut() == -1) { Signature.sError = _functions.ErrorMessage(140); } else { equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iUserId = order.iUserId; equip.iOrderId = OrderId; equip.iId = System.Data.SqlTypes.SqlInt32.Null; equip.sNote = ""; equip.EquipSpareTo(false); // redirect to the finish screen BackFinishScreen finish = new BackFinishScreen(); finish.sMainText = "The Equipment has been checked-out successfully!"; finish.bMainMenuVisible = true; finish.sMainMenuText = "[Return to Main Menu]"; finish.sMainMenuURL = "main.aspx"; finish.bContinueVisible = false; finish.bViewVisible = true; finish.sViewText = "[Return to Work Order Detail]"; finish.sViewURL = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString(); 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_viewCheckOut.aspx?id=" + OrderId.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 btNext_FormSubmit(object sender, EventArgs e) { try { order = new clsWorkOrders(); if (ddlCategory.SelectedIndex != 0 && tbDesc.Text.Length != 0) { order.cAction = "U"; order.iOrgId = OrgId; order.iReportedIssueId = 0; order.iRepairCatId = Convert.ToInt32(ddlCategory.SelectedValue); order.sReportDesc = tbDesc.Text; order.iId = OrderId; order.iServiceResultId = SqlInt32.Null; order.iServiceCheckId = SqlInt32.Null; order.iRepairMultId = SqlInt32.Null; if (order.WorkOrderReportedIssuesDetail() == -1) { Session["lastpage"] = m_sBackUrl; Session["error"] = _functions.ErrorMessage(121); Response.Redirect("error.aspx", false); return; } } if (m_sBack == "open") { Response.Redirect("wo_addPreventiveMaintenance.aspx?id=" + OrderId.ToString(), false); } else { // redirect to finish screen order.iOrgId = OrgId; order.iId = OrderId; if (order.GetWorkOrderId() == -1) { Session["lastpage"] = m_sBackUrl; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); return; } BackFinishScreen finish = new BackFinishScreen(); finish.sMainText = "The Work Order " + order.daCreated.Value.ToString("yyyy-MM-dd") + "-" + order.iWorkOrderNumber.Value.ToString() + " has been created successfully!"; finish.bMainMenuVisible = true; finish.sMainMenuText = "[Return to Main Menu]"; finish.sMainMenuURL = "main.aspx"; finish.bContinueVisible = true; finish.sContinueText = "[Continue to Check-In Equipment by Technician]"; finish.sContinueURL = "wo_viewCheckIn.aspx?id=" + OrderId.ToString(); finish.bViewVisible = true; finish.sViewText = "[View the Scheduled Work Order]"; finish.sViewURL = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString(); finish.bAdditionalVisible = true; finish.sAdditionalText = "[Create a New Work Order]"; finish.sAdditionalURL = "wo_default.aspx"; 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"] = m_sBackUrl; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } } }
/// <summary> /// Procedure close and sign the work order /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btSave_FormSubmit(object sender, EventArgs e) { string sDataGridName; DBFieldType FieldType; DateTime daCurrentDate; try { daCurrentDate = DateTime.Now; order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; order.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); order.sInitials = Signature.sInitials; order.sPIN = Signature.sPIN; order.sCleanliness = tbCleanliness.Text; order.daCurrentDate = _functions.CorrectDate(adtClosed.Date); if (order.SigningWorkOrderClose() == -1) { Signature.sError = _functions.ErrorMessage(140); } else { order.cAction = "U"; order.iNoteId = 0; order.iItemId = OrderId; order.daCreated = daCurrentDate; if (tbTechNote.Text.Length > 0) { order.iNoteTypeId = (int)NoteTypes.TechnicianNote; order.sNote = tbTechNote.Text; order.NoteDetails(); } if (tbCheckOutNote.Text.Length > 0) { order.iNoteTypeId = (int)NoteTypes.CheckOutNote; order.sNote = tbCheckOutNote.Text; order.NoteDetails(); } #region saving cutom fields if (ViewState["CustomFields"] != null) { order.iId = OrderId; dtCustomFields = (DataTable)ViewState["CustomFields"]; sDataGridName = repCustomFields.ClientID; // getting data from Form and changing the dtCustomFields datatable for (int i = 0; i < dtCustomFields.Rows.Count; i++) { for (int j = 0; j < Request.Form.Count; j++) { if ((string)dtCustomFields.Rows[i]["TypeName"] == Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":inputTypeName"]) { FieldType = _functions.TypeNameParser((string)dtCustomFields.Rows[i]["TypeName"]); // nvarchar1...n, ... switch (FieldType) { case DBFieldType._nvarchar: dtCustomFields.Rows[i]["Value_String"] = Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":tbValue"]; break; case DBFieldType._int: dtCustomFields.Rows[i]["Value_String"] = Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":tbValue"]; break; case DBFieldType._float: dtCustomFields.Rows[i]["Value_String"] = Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":tbValue"]; break; case DBFieldType._datetime: dtCustomFields.Rows[i]["Value_String"] = new SqlDateTime(Convert.ToInt32(Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":adtValue_year"]), Convert.ToInt32(Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":adtValue_month"]), Convert.ToInt32(Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":adtValue_day"])); break; case DBFieldType._bit: if (Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":chValue"] != null) { dtCustomFields.Rows[i]["Value_String"] = "True"; } else { dtCustomFields.Rows[i]["Value_String"] = "False"; } break; case DBFieldType._ntext: dtCustomFields.Rows[i]["Value_String"] = Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":tbValue"]; break; case DBFieldType._sql_variant: dtCustomFields.Rows[i]["Value_String"] = Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":tbValue"]; break; case DBFieldType._lookup: dtCustomFields.Rows[i]["Value_String"] = Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":ddlValue"]; break; default: dtCustomFields.Rows[i]["Value_String"] = Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":tbValue"]; break; } } } } // saving data to database order.WorkOrderDetail_CustomFields(_functions.SetDataToParameters(dtCustomFields)); } #endregion // redirect to the finish screen BackFinishScreen finish = new BackFinishScreen(); finish.sMainText = "The Work Order closed successfully!"; finish.bMainMenuVisible = true; finish.sMainMenuText = "[Return to Main Menu]"; finish.sMainMenuURL = "main.aspx"; finish.bContinueVisible = true; finish.sContinueText = "[Continue to Check-Out Equipment by Technician]"; finish.sContinueURL = "wo_viewCheckOut.aspx?id=" + OrderId.ToString(); finish.bViewVisible = true; finish.sViewText = "[Return to Work Order Detail]"; finish.sViewURL = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString(); finish.bAdditionalVisible = false; finish.bPrintVisible = true; finish.sPrintText = "[Print the Closed Work Order]"; finish.sPrintURL = "ReportViewer.aspx?Report=FleetProReports%2fCompletedOrder&OrderId=" + OrderId.ToString() + "&OrgId=" + OrgId.ToString(); Session["BackFinish"] = finish; Response.Redirect("wo_finish.aspx", false); } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "wo_closeWorkOrder.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 dgMainList_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { try { if (e.CommandName == "Select") { SpareId = Convert.ToInt32(e.CommandArgument); equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); equip.iId = SpareId; equip.iOrderId = OrderId; equip.sNote = "checking out the spare equipment"; if (equip.EquipSpareTo(false) == -1) { Session["lastpage"] = m_sLastPage; Session["error"] = _functions.ErrorMessage(120); Response.Redirect("error.aspx", false); } else { if (ViewState["Operation"] == null) { switch (sBack) { case "open": Response.Redirect("wo_openWorkOrder.aspx?id=" + OrderId.ToString(), false); break; case "edit": Response.Redirect("wo_editWorkOrder.aspx?id=" + OrderId.ToString(), false); break; case "checkin": Response.Redirect("wo_viewCheckIn.aspx?id=" + OrderId.ToString(), false); break; default: Response.Redirect("wo_addRepairs.aspx?id=" + OrderId.ToString(), false); break; } } else { BackFinishScreen finish = new BackFinishScreen(); finish.sMainText = "The Roadside Repair Work Order has been created successfully!"; finish.bMainMenuVisible = true; finish.sMainMenuText = "[Return to Main Menu]"; finish.sMainMenuURL = "main.aspx"; finish.bContinueVisible = true; finish.sContinueText = "[Continue to Check-In Equipment by Technician]"; finish.sContinueURL = "wo_viewCheckIn.aspx?id=" + OrderId.ToString(); finish.bViewVisible = true; finish.sViewText = "[View the Scheduled Work Order]"; finish.sViewURL = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString(); finish.bAdditionalVisible = true; finish.sAdditionalText = "[Create a New Work Order]"; finish.sAdditionalURL = "wo_default.aspx?select=AddRoadside"; 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_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 { if (!IsPostBack) { if (Session["BackFinish"] == null) { Session["lastpage"] = "main.aspx"; Session["error"] = _functions.ErrorMessage(130); Response.Redirect("error.aspx", false); return; } finish = (BackFinishScreen)Session["BackFinish"]; lblMainText.Text = finish.sMainText; if (finish.bMainMenuVisible) { hlHome.Text = finish.sMainMenuText; hlHome.NavigateUrl = finish.sMainMenuURL; } else { tblMain.Rows[1].Visible = false; } if (finish.bContinueVisible) { hlContinue.Text = finish.sContinueText; hlContinue.NavigateUrl = finish.sContinueURL; } else { tblMain.Rows[2].Visible = false; } if (finish.bViewVisible) { hlView.Text = finish.sViewText; hlView.NavigateUrl = finish.sViewURL; } else { tblMain.Rows[3].Visible = false; } if (finish.bAdditionalVisible) { hlAdditional.Text = finish.sAdditionalText; hlAdditional.NavigateUrl = finish.sAdditionalURL; } else { tblMain.Rows[4].Visible = false; } if (finish.bPrintVisible) { hlPrint.Text = finish.sPrintText; hlPrint.NavigateUrl = finish.sPrintURL; } else { tblMain.Rows[5].Visible = false; } } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "wo_finish.aspx"; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } }
private void btNext_FormSubmit(object sender, EventArgs e) { try { if (ViewState["Operation"] == null) { switch (sBack) { case "open": Response.Redirect("wo_openWorkOrder.aspx?id=" + OrderId.ToString(), false); break; case "edit": Response.Redirect("wo_editWorkOrder.aspx?id=" + OrderId.ToString(), false); break; case "checkin": Response.Redirect("wo_viewCheckIn.aspx?id=" + OrderId.ToString(), false); break; default: Response.Redirect("wo_addRepairs.aspx?id=" + OrderId.ToString(), false); break; } } else { BackFinishScreen finish = new BackFinishScreen(); finish.sMainText = "The Roadside Repair Work Order has been created successfully!"; finish.bMainMenuVisible = true; finish.sMainMenuText = "[Return to Main Menu]"; finish.sMainMenuURL = "main.aspx"; finish.bContinueVisible = true; finish.sContinueText = "[Continue to Check-In Equipment by Technician]"; finish.sContinueURL = "wo_viewCheckIn.aspx?id=" + OrderId.ToString(); finish.bViewVisible = true; finish.sViewText = "[View the Scheduled Work Order]"; finish.sViewURL = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString(); finish.bAdditionalVisible = true; finish.sAdditionalText = "[Create a New Work Order]"; finish.sAdditionalURL = "wo_default.aspx?select=AddRoadside"; 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_selectSpareEquip.aspx?id=" + OrderId.ToString() + "&equipid=" + EquipId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { } }
/// <summary> /// Activating/Inactivating the user account /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btSave_FormSubmit(object sender, EventArgs e) { try { equip = new clsEquipment(); equip.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); foreach (RepeaterItem _item in repOperatorEquipments.Items) { DropDownList ddlOperators = (DropDownList)_item.FindControl("ddlOperators"); bool IsNobody = Convert.ToBoolean(ddlOperators.Attributes["IsNobody"]); if (!IsNobody && ddlOperators.SelectedValue == "0") { Header.ErrorMessage = "Operator is required"; return; } equip.iOrgId = OrgId; equip.iId = Convert.ToInt32(ddlOperators.Attributes["EquipId"]); equip.iEquipOperatorId = Convert.ToInt32(ddlOperators.SelectedValue); equip.sNote = "Deactivated Operator - Reassigned New Operator"; equip.EquipAssignedTo(); } user = new clsUsers(); user.iOrgId = OrgId; user.daCreated = DateTime.Now; user.iLoginId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); foreach (RepeaterItem _item in repWorkOrders.Items) { DropDownList ddlTechs = (DropDownList)_item.FindControl("ddlTechs"); bool IsNobody = Convert.ToBoolean(ddlTechs.Attributes["IsNobody"]); if (!IsNobody && ddlTechs.SelectedValue == "0") { Header.ErrorMessage = "Technician is required"; return; } user.iOrderId = Convert.ToInt32(ddlTechs.Attributes["OrderId"]); user.iId = Convert.ToInt32(ddlTechs.SelectedValue); user.SetNewTechToWorkOrder(); } user = new clsUsers(); user.iOrgId = OrgId; user.iId = UserId; user.bActiveStatus = (bool)ViewState["Active"]; if (user.UserActive() == -1) { Session["lastpage"] = "admin_user_detail_active.aspx?id=" + UserId.ToString(); Session["error"] = _functions.ErrorMessage(134); Response.Redirect("error.aspx", false); return; } if (UserId == _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true)) { Response.Redirect("default.aspx", false); } else { // redirect to the finish screen BackFinishScreen finish = new BackFinishScreen(); if (((bool)ViewState["Active"])) { finish.sMainText = "The user has been activated successfully"; } else { finish.sMainText = "The user has been deactivated successfully"; } finish.bMainMenuVisible = true; finish.sMainMenuText = "[Return to Main Menu]"; finish.sMainMenuURL = "selectMode.aspx"; finish.bContinueVisible = false; finish.bViewVisible = true; finish.sViewText = "[View the User Detail]"; finish.sViewURL = "admin_user_detail.aspx?id=" + UserId.ToString(); 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"] = "admin_user_detail_active.aspx?id=" + UserId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (user != null) { user.Dispose(); } if (equip != null) { equip.Dispose(); } } }
private void btSave_FormSubmit(object sender, EventArgs e) { string sDomenName; int l_iResult; try { SaveChangedItems(); order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; order.iInspectionId = InspectId; order.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); order.iTechId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); order.sInitials = tbInitial.Text; order.sPIN = tbPIN.Text; order.daCurrentDate = _functions.CorrectDate(adtInspection.Date); switch (order.SigningInspectionList()) { case 0: if (cbAutoCreateWO.Checked) { order.iInspectSchedDetailId = (int)ViewState["InspectSchedDetailId"]; order.iEquipId = (int)ViewState["EquipId"]; order.daCurrentDate = _functions.CorrectDate(adtInspection.Date); l_iResult = order.GetDateTimeOfForecastInspection(); if (l_iResult == -1) { // error Header.ErrorMessage = _functions.ErrorMessage(order.iErrorCode.Value); } else { if (l_iResult == 2) { // sent email contain that inspection has been created but The Minimum through Maximum Date range is too small or the Holiday/No Service Date Ranges are too wide and the system is unable to identify any service dates available } order.SetInspectWorkOrder(); // redirect to the finish screen BackFinishScreen finish = new BackFinishScreen(); if (l_iResult == 1) { finish.sMainText = "The Inspection has been completed successfully. <br>" + _functions.ErrorMessage(order.iErrorCode.Value); } else { finish.sMainText = "The Inspection has been completed successfully. <br>Next Inspection has been scheduled by " + order.daScheduled.Value.ToString() + " of work order"; } finish.bMainMenuVisible = true; finish.sMainMenuText = "[Return to Main Menu]"; finish.sMainMenuURL = "main.aspx"; if (l_iResult == 1) { finish.bContinueVisible = false; } else { finish.bContinueVisible = true; finish.sContinueText = "[View the Work Order of Next Inspection]"; finish.sContinueURL = "wo_viewWorkOrder.aspx?id=" + order.iId.Value.ToString(); } finish.bViewVisible = true; finish.sViewText = "[Return to Work Order Detail]"; finish.sViewURL = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString(); finish.bAdditionalVisible = false; finish.bPrintVisible = false; Session["BackFinish"] = finish; Response.Redirect("wo_finish.aspx", false); } } else { Response.Redirect("wo_viewWorkOrder.aspx?id=" + OrderId.ToString() + "&#Issues", false); } return; case -1: Header.ErrorMessage = _functions.ErrorMessage(140); break; case -2: Header.ErrorMessage = _functions.ErrorMessage(139); break; default: break; } repInspectItems.DataSource = new DataView(order.GetWorkOrderInspectItems()); repInspectItems.DataBind(); } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "wo_viewCompleteInspection.aspx?id=" + OrderId.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 btNext_FormSubmit(object sender, EventArgs e) { try { order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; order.sInitials = Signature.sInitials; order.sPIN = Signature.sPIN; order.daCurrentDate = DateTime.Now; switch (order.SigningWorkOrderOpen()) { case -1: Signature.sError = _functions.ErrorMessage(140); break; case -2: Session["lastpage"] = "wo_preview.aspx?id=" + OrderId.ToString(); Session["error"] = _functions.ErrorMessage(120); Response.Redirect("error.aspx", false); return; case 0: // redirect to the finish screen BackFinishScreen finish = new BackFinishScreen(); finish.sMainText = "The Work Order opened successfully!"; finish.bMainMenuVisible = true; finish.sMainMenuText = "[Return to Main Menu]"; finish.sMainMenuURL = "main.aspx"; finish.bContinueVisible = false; finish.bViewVisible = true; finish.sViewText = "[View the Opened Work Order]"; finish.sViewURL = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString(); finish.bAdditionalVisible = false; finish.bPrintVisible = true; finish.sPrintText = "[Print the Opened Work Order]"; finish.sPrintURL = "ReportViewer.aspx?Report=FleetProReports%2fWorkOrderRequest&rs:Command=Render&rc:Parameters=false&OrderId=" + OrderId.ToString() + "&OrgId=" + OrgId.ToString(); Session["BackFinish"] = finish; Response.Redirect("wo_finish.aspx", false); break; } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "wo_preview.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 btSave_FormSubmit(object sender, EventArgs e) { DateTime daCurrentDate; try { daCurrentDate = DateTime.Now; order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; order.sInitials = Signature.sInitials; order.sPIN = Signature.sPIN; order.dmMileage = Convert.ToDecimal(tbMileage.Text); order.bStaying = Convert.ToBoolean(rblStaying.SelectedValue); order.sDropedOffBy = tbDroppedOffBy.Text; order.daCurrentDate = _functions.CorrectDate(adtCheckIn.Date); if (order.SigningEquipmentCheckIn() == -1) { Signature.sError = _functions.ErrorMessage(140); } else { order.cAction = "U"; order.iNoteId = 0; order.iItemId = OrderId; order.daCreated = daCurrentDate; if (tbNotes.Text.Length > 0) { order.iNoteTypeId = (int)NoteTypes.OperatorNote; order.sNote = tbNotes.Text; order.NoteDetails(); } // redirect to the finish screen BackFinishScreen finish = new BackFinishScreen(); finish.sMainText = "The Equipment has been checked-in successfully!"; finish.bMainMenuVisible = true; finish.sMainMenuText = "[Return to Main Menu]"; finish.sMainMenuURL = "main.aspx"; finish.bContinueVisible = true; finish.sContinueText = "[Continue to Open Work Order]"; finish.sContinueURL = "wo_openWorkOrder.aspx?id=" + OrderId.ToString(); finish.bViewVisible = true; finish.sViewText = "[Return to Work Order Detail]"; finish.sViewURL = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString(); 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_viewCheckIn.aspx?id=" + OrderId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (order != null) { order.Dispose(); } } }