protected override void OnLoad(EventArgs e) { try { SourcePageName = "wo_addInspectForecast.aspx"; this.PageTitle = "Create Future Work Order with Inspection"; Header.AddBreadCrumb("Home", "/main.aspx"); Header.AddBreadCrumb("Select Equipment with Inspections", "/wo_showEquipsForInspect.aspx"); Header.AddJavaScriptFile("/OpenWindows.js"); Header.LeftBarHtml = "Select Schedule Date and Create Future Work Order with Inspection"; base.OnLoad(e); } 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); } }
protected override void OnLoad(EventArgs e) { try { SourcePageName = "wo_showEquipsForInspect.aspx.cs"; this.PageTitle = "Select Equipment with Inspections"; Header.AddBreadCrumb("Home", "/main.aspx"); Header.AddJavaScriptFile("/Focus.js"); Header.BodyOnloadScript = "javascript:GetFocus('" + tbEquipId.ClientID + "');"; Header.LeftBarHtml = "Select/Search Equipment for the Creation of Work Order with Inspections"; base.OnLoad(e); } 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); } }
protected override void OnLoad(EventArgs e) { try { SourcePageName = "admin_kiosk_customtext.aspx.cs"; Header.MainMenuSelectedItem = "Administration"; this.PageTitle = "Kiosk Instruction Texts Manager"; Header.AddBreadCrumb("Home", "/selectMode.aspx"); Header.AddBreadCrumb("Administration", "/admin.aspx"); Header.LeftBarHtml = "Add/Edit/Delete Instruction Texts"; base.OnLoad(e); } 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); } }
protected override void OnLoad(EventArgs e) { try { SourcePageName = "wo_viewEquipWorkOrderReport.aspx.cs"; this.PageTitle = "Equipment Work Order Report"; Header.AddBreadCrumb("Home", "/main.aspx"); Header.AddJavaScriptFile("/e_viewTempOperatorReport.js"); Header.BodyOnloadScript = "javascript:GetFocus('" + tbEquipId.ClientID + "');"; Header.LeftBarHtml = "View the Work Orders during selected date range for current Equipment"; base.OnLoad(e); } 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); } }
protected override void OnLoad(EventArgs e) { try { SourcePageName = "admin_holidays.aspx.cs"; Header.MainMenuSelectedItem = "Administration"; this.PageTitle = "Holidays Date Manage"; Header.AddJavaScriptFile("/OpenWindows.js"); Header.AddBreadCrumb("Home", "/selectMode.aspx"); Header.AddBreadCrumb("Administration", "/admin.aspx"); Header.LeftBarHtml = "Add/Edit/Delete Holidays"; base.OnLoad(e); } 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); } }
protected override void OnLoad(EventArgs e) { try { SourcePageName = "admin_pmschedule_detail.aspx.cs"; Header.MainMenuSelectedItem = "Administration"; Header.AddBreadCrumb("Home", "/selectMode.aspx"); Header.AddBreadCrumb("Administration", "/admin.aspx"); Header.AddBreadCrumb("Preventive Maintenances Schedules Manager", "/admin_pmschedules.aspx"); this.PageTitle = "Preventive Maintenance Schedule Detail"; Header.LeftBarHtml = "View Preventive Maintenance Schedule"; base.OnLoad(e); } 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); } }
private void Page_Load(object sender, System.EventArgs e) { try { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); if (Request.QueryString["id"] == null || Request.QueryString["itemid"] == null) { Session["lastpage"] = "admin_inspections.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { InspectionId = Convert.ToInt32(Request.QueryString["id"]); ItemId = Convert.ToInt32(Request.QueryString["itemid"]); } catch (FormatException fex) { Session["lastpage"] = "admin_inspections.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } sLastPage = "admin_inspections_items.aspx?id=" + InspectionId.ToString(); sCurrentPage = "admin_inspection_item_edit.aspx?id=" + InspectionId.ToString() + "&itemid=" + ItemId.ToString(); Header.AddBreadCrumb("Home", "/selectMode.aspx"); Header.AddBreadCrumb("Administration", "/admin.aspx"); Header.AddBreadCrumb("Inspections Manager", "/admin_inspections.aspx"); Header.AddBreadCrumb("Inspection Items Manager", "/" + sLastPage); Header.LeftBarHtml = "Add/Edit/Delete Inspection Item and Add/Delete relationship to PM Items"; this.PageTitle = "Inspection Item Edit"; SaveCancelControl.CancelText = " Back "; SaveCancelControl.ParentPageURL = sLastPage; if (!IsPostBack) { inspect = new clsInspections(); inspect.cAction = "S"; inspect.iOrgId = OrgId; inspect.iId = InspectionId; inspect.iInspectItemId = ItemId; ddlCategories.DataSource = new DataView(inspect.GetInspectCategoriesList()); ddlCategories.DataBind(); if (inspect.InspectItemDetails() == -1) { Session["lastpage"] = sLastPage; Session["error"] = _functions.ErrorMessage(127); Response.Redirect("error.aspx", false); return; } lblInspectionName.Text = inspect.sInspectionName.Value; tbItemName.Text = inspect.sInspectItemName.Value; if (ItemId == 0) { tblMain.Rows[5].Visible = false; tblMain.Rows[6].Visible = false; tblMain.Rows[7].Visible = false; tblMain.Rows[8].Visible = false; tblMain.Rows[9].Visible = false; tblMain.Rows[10].Visible = false; btnDelete.Visible = false; } else { ddlCategories.SelectedValue = inspect.iCategoryId.Value.ToString(); dgPMItems.DataSource = new DataView(inspect.GetPMServicesByInspectionItem()); dgPMItems.DataBind(); if (dgPMItems.Items.Count == 0) { dgPMItems.Visible = false; } ShowPMItems(); } } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = sLastPage; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (inspect != null) { inspect.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["id"] == null) { Session["lastpage"] = "e_list.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); 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 = "Edit Alternative Information of Equipment"; SaveCancelControl.ParentPageURL = this.ParentPageURL; if (!IsPostBack) { equip = new clsEquipment(); pm = new clsPMSchedService(); inspec = new clsInspections(); equip.cAction = "S"; equip.iOrgId = OrgId; equip.iId = EquipId; pm.iOrgId = OrgId; inspec.iOrgId = OrgId; ddPMScheduleId.DataTextField = "vchName"; ddPMScheduleId.DataValueField = "Id"; ddPMScheduleId.DataSource = new DataView(pm.GetPMSchedulesList()); ddPMScheduleId.DataBind(); ddInspectionId.DataTextField = "vchName"; ddInspectionId.DataValueField = "Id"; ddInspectionId.DataSource = new DataView(inspec.GetInspectSchedulesList()); ddInspectionId.DataBind(); // getting equipment's data if (equip.EquipmentDetail_Alt() != -1) { if (equip.iPMSched.IsNull) { ddPMScheduleId.SelectedValue = ""; } else { ddPMScheduleId.SelectedValue = equip.iPMSched.Value.ToString(); } if (equip.iInspectScheduleId.IsNull) { ddInspectionId.SelectedValue = ""; } else { ddInspectionId.SelectedValue = equip.iInspectScheduleId.Value.ToString(); } if (equip.dmCurrentUnits.IsNull) { tbCurrentUnits.Text = ""; } else { tbCurrentUnits.Text = Convert.ToDouble(equip.dmCurrentUnits.Value).ToString(); } } else { Session["lastpage"] = this.ParentPageURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); } } } 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 (inspec != null) { inspec.Dispose(); } if (pm != null) { pm.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["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.ButtonText = " Close & Sign "; if (!IsPostBack) { order = new clsWorkOrders(); user = new clsUsers(); 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; } if (!user.IsTechnician(_functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true))) { Session["lastpage"] = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString(); Session["error"] = _functions.ErrorMessage(131); Response.Redirect("error.aspx", false); return; } if (order.iTechId.Value == 0) { Signature.sError = _functions.ErrorMessage(143); SaveCancelControl.EnableSave = false; } if (order.GetCompleteAbleOrder() != 1) { Signature.sError = _functions.ErrorMessage(142); SaveCancelControl.EnableSave = false; } lblWorkOrderId.Text = order.daCreated.Value.ToString("yyyy-MM-dd") + "-" + order.iWorkOrderNumber.Value.ToString(); lblEquipId.Text = order.sEquipId.Value; lblSpareEquipId.Text = order.sSpareEquipId.Value; lblTech.Text = order.sTechName.Value; lblOperator.Text = order.sOperatorName.Value; tbCleanliness.Text = order.sCleanliness.Value; if (order.daClosed.IsNull) { adtClosed.Date = DateTime.Now; } else { adtClosed.Date = order.daClosed.Value; } if (order.iStatusId.Value == (int)WorkOrderStatus.Closed || order.iStatusId.Value == (int)WorkOrderStatus.Scheduled) { tbCleanliness.Enabled = false; tbTechNote.Enabled = false; tbCheckOutNote.Enabled = false; Signature.Enabled = false; SaveCancelControl.EnableSave = false; Signature.sError = _functions.ErrorMessage(141); } // show notes order.iItemId = OrderId; order.iNoteTypeId = (int)NoteTypes.TechnicianNote; repTechNotes.DataSource = new DataView(order.GetNotesList()); repTechNotes.DataBind(); order.iNoteId = 0; order.iNoteTypeId = (int)NoteTypes.CheckOutNote; if (order.NoteDetails() != -1) { tbCheckOutNote.Text = order.sNote.Value; } ShowCustomFields(); } } 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 (user != null) { user.Dispose(); } if (order != null) { order.Dispose(); } } }
private void Page_Load(object sender, System.EventArgs e) { string sDomenName, sReportPath; try { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); if (Session["reload"] != null) { if ((bool)Session["reload"] == true) { Session["reload"] = null; Response.Redirect((string)Session["RedirectPath"], false); Session["RedirectPath"] = null; return; } } if (Request.QueryString["id"] == null || Request.QueryString["inspectid"] == null) { Session["lastpage"] = "main.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { OrderId = Convert.ToInt32(Request.QueryString["id"]); InspectId = Convert.ToInt32(Request.QueryString["inspectid"]); } 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 = ParentPageURL; SaveCancelControl.EnableSave = true; SaveCancelControl.ButtonText = " Complete/Sign "; SaveCancelControl.CancelText = " Back "; if (!IsPostBack) { sReportPath = _functions.GetValueFromConfig("SQLRS.Folder"); hlPrintInspectRequest.NavigateUrl = "ReportViewer.aspx?Report=" + sReportPath + "%2fInspectionRequest&OrgId=" + OrgId.ToString() + "&OrderId=" + OrderId.ToString() + "&InspectId=" + InspectId.ToString(); hlPrintCompletedInstect.NavigateUrl = "ReportViewer.aspx?Report=" + sReportPath + "%2fCompletedInspection&OrgId=" + OrgId.ToString() + "&OrderId=" + OrderId.ToString() + "&InspectId=" + InspectId.ToString(); user = new clsUsers(); order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; order.iInspectionId = InspectId; order.iTechId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); switch (order.GetInfoForInspection()) { case 1: tableMain.Rows[19].Visible = false; tableMain.Rows[20].Visible = false; tableMain.Rows[21].Visible = false; tableMain.Rows[22].Visible = true; tableMain.Rows[23].Visible = true; tableMain.Rows[24].Visible = false; tableMain.Rows[25].Visible = false; SaveCancelControl.EnableSave = false; order.iDocumentId = InspectId; order.iDocumentTypeId = (int)DocumentTypes.InspectionCompleted; if (order.GetSignedDocument() != -1) { hlPrintInspectRequest.Enabled = false; hlPrintCompletedInstect.Enabled = true; lblSign.Text = order.sUserName.Value; lblSignDate.Text = order.daReportDate.Value.ToShortDateString() + " " + order.daReportDate.Value.ToShortTimeString(); } else { hlPrintInspectRequest.Enabled = true; hlPrintCompletedInstect.Enabled = false; lblSign.Text = " "; } break; case -1: Session["lastpage"] = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString(); Session["error"] = _functions.ErrorMessage(124); Response.Redirect("error.aspx", false); return; default: hlPrintCompletedInstect.Enabled = false; adtInspection.Date = DateTime.Now; tableMain.Rows[22].Visible = false; break; } if (!user.IsTechnician(_functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true))) { SaveCancelControl.EnableSave = false; } ViewState["EquipId"] = order.iEquipId.Value; ViewState["InspectSchedDetailId"] = order.iInspectSchedDetailId.Value; lblInspectName.Text = order.sInspectionName.Value; lblInspectSchedule.Text = order.sInspectSchedule.Value; lblTargetDaysOut.Text = order.iInspectTargetDays.Value.ToString() + " days"; lblEquipId.Text = order.sEquipId.Value; lblEquipMake.Text = order.sEquipMake.Value; lblEquipModel.Text = order.sEquipModel.Value; repInspectItems.DataSource = new DataView(order.GetWorkOrderInspectItems()); repInspectItems.DataBind(); } } 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 (user != null) { user.Dispose(); } if (order != null) { order.Dispose(); } } }
private void Page_Load(object sender, System.EventArgs e) { string sBack; bool bBack = false; try { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); if (Request.QueryString["id"] == null) { Session["lastpage"] = "wo_default.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { OrderId = Convert.ToInt32(Request.QueryString["id"]); } catch (FormatException fex) { Session["lastpage"] = "wo_default.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } if (Request.QueryString["back"] != null) { // see whence came user switch (Request.QueryString["back"]) { case "view": // from the work order detail screen m_sCurrentUrl = "wo_addPreventiveMaintenance.aspx?id=" + OrderId.ToString() + "&back=view"; m_sMainBackUrl = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString(); m_sNextUrl = m_sMainBackUrl; tblMain.Rows[4].Visible = false; tblMain.Rows[5].Visible = true; // 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() + "&#Issues"); SaveCancelControl.ParentPageURL = ParentPageURL; SaveCancelControl.ButtonText = " Save "; bBack = false; break; case "inspect": // from the Add Inpection screen m_sCurrentUrl = "wo_addPreventiveMaintenance.aspx?id=" + OrderId.ToString() + "&back=inspect"; m_sMainBackUrl = "wo_addInspections.aspx?id=" + OrderId.ToString(); m_sNextUrl = "wo_addRepairs.aspx?id=" + OrderId.ToString() + "&back=open"; bBack = true; break; case "preview": // from the Preview screen m_sCurrentUrl = "wo_addPreventiveMaintenance.aspx?id=" + OrderId.ToString() + "&back=preview"; m_sMainBackUrl = "wo_preview.aspx?id=" + OrderId.ToString(); m_sNextUrl = "wo_preview.aspx?id=" + OrderId.ToString(); bBack = true; break; default: // from the Add Issues screen m_sCurrentUrl = "wo_addPreventiveMaintenance.aspx?id=" + OrderId.ToString(); m_sMainBackUrl = "wo_addRepairs.aspx?id=" + OrderId.ToString() + "&back=open"; m_sNextUrl = "wo_addInspections.aspx?id=" + OrderId.ToString(); bBack = true; break; } } else { m_sCurrentUrl = "wo_addPreventiveMaintenance.aspx?id=" + OrderId.ToString(); m_sMainBackUrl = "wo_addRepairs.aspx?id=" + OrderId.ToString() + "&back=open"; m_sNextUrl = "wo_addInspections.aspx?id=" + OrderId.ToString(); bBack = true; } // if previos screen was from wizard screen then if (bBack) { tblMain.Rows[4].Visible = true; tblMain.Rows[5].Visible = false; // Header.PageTitle = PageTitle; NextBackControl.BackPage = "wo_addRepairs.aspx?id=" + OrderId.ToString() + "&back=open"; } // reloading if coming from the PM Item History screen if (Session["reload"] != null) { if ((bool)Session["reload"] == true) { Session["reload"] = null; Response.Redirect(m_sCurrentUrl, false); return; } } if (!IsPostBack) { order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; dtPMServices = order.GetPMServicesListForWorkOrder(); if (dtPMServices.Rows.Count > 0) { lblCurrentUnits.Text = "The current units for this Equipment is <b>" + (order.dmMileage.IsNull?"Unknown":Convert.ToDouble(order.dmMileage.Value).ToString()) + "</b>, date is <b>" + (order.daReportDate.IsNull?DateTime.Now.ToString("MM/dd/yyyy"):order.daReportDate.Value.ToString("MM/dd/yyyy")) + "</b>"; dgPMServices.DataSource = new DataView(dtPMServices); dgPMServices.DataBind(); dtFuturePMService = order.GetFuturePMItems(); if (dtFuturePMService.Rows.Count > 0) { dgFuturePMItems.DataSource = new DataView(dtFuturePMService); dgFuturePMItems.DataBind(); } else { tblMain.Rows[2].Visible = false; tblMain.Rows[3].Visible = false; } } else { Response.Redirect(m_sNextUrl, false); } } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = m_sMainBackUrl; 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 (Request.QueryString["id"] == null) { Session["lastpage"] = "wo_default.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { OrderId = Convert.ToInt32(Request.QueryString["id"]); } catch (FormatException fex) { Session["lastpage"] = "wo_default.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } Header.AddJavaScriptFile("/OpenWindows.js"); // if the coming was from order detail screen or for the past work order creating if (Request.QueryString["back"] != null) { if (Request.QueryString["back"] == "past") { IsPast = true; tblMain.Rows[4].Visible = true; tblMain.Rows[5].Visible = false; m_sBackUrl = "wo_addInspections.aspx?back=past&id=" + OrderId.ToString(); m_sLastPage = "wo_editAddInfo.aspx?back=past&id=" + OrderId.ToString() + "&equipid=0"; NextBackControl.BackPage = m_sLastPage; } else { tblMain.Rows[4].Visible = false; tblMain.Rows[5].Visible = true; m_sBackUrl = "wo_addInspections.aspx?id=" + OrderId.ToString() + "&back=view"; m_sLastPage = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString(); // 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() + "&#Issues"); SaveCancelControl.ParentPageURL = this.ParentPageURL; SaveCancelControl.ButtonText = " Save "; } } else { // the coming was usual from previous wizard screen is the Add Preventive Maintenance tblMain.Rows[4].Visible = true; tblMain.Rows[5].Visible = false; m_sBackUrl = "wo_addInspections.aspx?id=" + OrderId.ToString(); m_sLastPage = "wo_addPreventiveMaintenance.aspx?id=" + OrderId.ToString() + "&back=inspect"; NextBackControl.BackPage = "wo_addPreventiveMaintenance.aspx?id=" + OrderId.ToString() + "&back=inspect"; } // reloading if coming from the Inspection History screen if (Session["reload"] != null) { if ((bool)Session["reload"] == true) { Session["reload"] = null; Response.Redirect(m_sBackUrl, false); return; } } if (!IsPostBack) { order = new clsWorkOrders(); order.iOrgId = OrgId; order.iId = OrderId; if (order.GetWorkOrderId() == -1) { Session["lastpage"] = m_sLastPage; Session["error"] = _functions.ErrorMessage(120); Response.Redirect("error.aspx", false); } ViewState["WorkOrderCreatedDate"] = order.daCreated.Value; ViewState["WorkOrderNumber"] = order.iWorkOrderNumber.Value; if (IsPast) { order.daCurrentDate = order.daCreated; } else { order.daCurrentDate = DateTime.Now; } dgInspections.DataSource = new DataView(order.GetInspectionsListForWorkOrder()); dgInspections.DataBind(); dtFutureInspections = order.GetFutureInspections(); if (dtFutureInspections.Rows.Count > 0) { dgFutureInspections.DataSource = new DataView(dtFutureInspections); dgFutureInspections.DataBind(); } else { tblMain.Rows[2].Visible = false; tblMain.Rows[3].Visible = false; } } } 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 (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()); html_btnNo.Attributes.Add("onclick", "javascript:document.location='wo_viewWorkOrder.aspx?id=" + OrderId.ToString() + "'"); 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; } lblEquipId.Text = order.sEquipId.Value; lblWorkOrderId.Text = order.daCreated.Value.ToString("yyyy-MM-dd") + "-" + order.iWorkOrderNumber.Value.ToString(); lblTech.Text = order.sTechName.Value; lblOperator.Text = order.sOperatorName.Value; if ((WorkOrderStatus)order.iStatusId.Value != WorkOrderStatus.Closed) { if (order.GetDeleteAbleOrder() == 1) { btnYes.Enabled = true; } else { btnYes.Enabled = false; Header.ErrorMessage = _functions.ErrorMessage(146); } } else { btnYes.Enabled = false; Header.ErrorMessage = _functions.ErrorMessage(145); } } } 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(); } } }
private void Page_Load(object sender, System.EventArgs e) { try { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); if (Request.QueryString["id"] == null || Request.QueryString["detailid"] == null) { Session["lastpage"] = "admin_pmschedules.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { PMSchedId = Convert.ToInt32(Request.QueryString["id"]); DetailId = Convert.ToInt32(Request.QueryString["detailid"]); } catch (FormatException fex) { Session["lastpage"] = "admin_pmschedules.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } sLastPage = "admin_pmschedule_detail.aspx?id=" + PMSchedId.ToString(); sCurrentPage = "admin_pmschedule_detail_edit.aspx?id=" + PMSchedId.ToString() + "&detailid=" + DetailId.ToString(); Header.AddBreadCrumb("Home", "/selectMode.aspx"); Header.AddBreadCrumb("Administration", "/admin.aspx"); Header.AddBreadCrumb("Preventive Maintenances Schedules Manager", "/admin_pmschedules.aspx"); Header.AddBreadCrumb("Preventive Maintenance Schedule Detail", "/" + sLastPage); this.PageTitle = "PM Schedule Detail Edit"; Header.LeftBarHtml = "Edit Preventive Maintenance Schedule"; SaveCancelControl.CancelText = " Back "; SaveCancelControl.ParentPageURL = sLastPage; if (!IsPostBack) { pmitem = new clsPMSchedService(); pmitem.cAction = "S"; pmitem.iOrgId = OrgId; pmitem.iPMSchedId = PMSchedId; pmitem.iPMSchedDetailId = DetailId; ddlPMServices.DataSource = pmitem.GetPMServicesList(); ddlPMServices.DataBind(); ddlMeasures.DataSource = pmitem.GetUnitMeasureList(); ddlMeasures.DataBind(); if (pmitem.PMScheduleDetails() == -1) { Header.ErrorMessage = _functions.ErrorMessage(169); return; } lblScheduleName.Text = pmitem.sPMSchedName.Value; if (DetailId != 0) { if (pmitem.PMSchedServiceDetails() == -1) { Header.ErrorMessage = _functions.ErrorMessage(174); return; } ddlPMServices.SelectedValue = pmitem.iPMServiceId.Value.ToString(); ddlMeasures.SelectedValue = pmitem.iUnitMeasureId.Value.ToString(); tbDays.Text = pmitem.iDays.IsNull?"":pmitem.iDays.Value.ToString(); tbUnits.Text = pmitem.dmUnits.IsNull?"":Convert.ToDouble(pmitem.dmUnits.Value).ToString(); } else { btnDelete.Visible = false; } } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = sLastPage; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (pmitem != null) { pmitem.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"] = "admin_users.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { UserId = Convert.ToInt32(Request.QueryString["id"]); } catch (FormatException fex) { Session["lastpage"] = "admin_users.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } Header.AddBreadCrumb("Home", "/selectMode.aspx"); Header.AddBreadCrumb("Administration", "/admin.aspx"); Header.AddBreadCrumb("User Search", "/admin_users.aspx"); Header.AddBreadCrumb("User Detail", "/admin_user_detail.aspx?id=" + UserId.ToString()); Header.AddBreadCrumb("User Detail Edit", "/admin_user_detail_edit.aspx?id=" + UserId.ToString()); this.PageTitle = "User Detail Activate"; Header.LeftBarHtml = "User Activating/Deactivating"; SaveCancelControl.ParentPageURL = this.ParentPageURL; if (!IsPostBack) { user = new clsUsers(); user.cAction = "S"; user.iOrgId = OrgId; user.iId = UserId; if (user.UserDetails() == -1) { Session["lastpage"] = "admin_user_detail.aspx?id=" + UserId.ToString(); Session["error"] = _functions.ErrorMessage(134); Response.Redirect("error.aspx", false); return; } lblFirstName.Text = user.sFirstName.Value; lblLastName.Text = user.sLastName.Value; lblEmail.Text = user.sEmail.Value; lblType.Text = user.sTypeName.Value; lblCreatedDate.Text = user.daCreated.Value.ToLongDateString() + " " + user.daCreated.Value.ToLongTimeString(); if (user.bActiveStatus.Value) { ViewState["Active"] = false; lblUserActivateStatus.Text = "Activated"; SaveCancelControl.ButtonText = "Deactivate"; user.iTypeId = (int)UserTypes.Operator; dtOperators = user.GetUserListByType(); ViewState["Operators"] = dtOperators; user.iTypeId = (int)UserTypes.Technician; dtTechnicians = user.GetUserListByType(); ViewState["Technicians"] = dtTechnicians; equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iUserId = UserId; DataTable dtEquipOrders = equip.GetEquipListByOperatorActivate(); if (dtEquipOrders.Rows.Count > 0) { repOperatorEquipments.DataSource = new DataView(dtEquipOrders); repOperatorEquipments.DataBind(); } else { tblMain.Rows[8].Visible = false; tblMain.Rows[9].Visible = false; tblMain.Rows[10].Visible = false; } DataTable dtTechOrders = equip.GetOrderListByTechnicianActivate(); if (dtTechOrders.Rows.Count > 0) { repWorkOrders.DataSource = new DataView(dtTechOrders); repWorkOrders.DataBind(); } else { tblMain.Rows[11].Visible = false; tblMain.Rows[12].Visible = false; tblMain.Rows[13].Visible = false; } } else { ViewState["Active"] = true; lblUserActivateStatus.Text = "Deactivated"; SaveCancelControl.ButtonText = "Activate"; tblMain.Rows[8].Visible = false; tblMain.Rows[9].Visible = false; tblMain.Rows[10].Visible = false; tblMain.Rows[11].Visible = false; tblMain.Rows[12].Visible = false; tblMain.Rows[13].Visible = false; } } } 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(); } 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() + "&#Main"); SaveCancelControl.ParentPageURL = this.ParentPageURL; 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; rblWOTypes.DataSource = order.GetTypesList(); rblWOTypes.DataBind(); ddlTech.DataSource = new DataView(user.GetUserListByType()); ddlTech.DataBind(); if (order.WorkOrderDetails() == -1) { Session["lastpage"] = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString(); Session["error"] = _functions.ErrorMessage(120); Response.Redirect("error.aspx", false); return; } status = (WorkOrderStatus)order.iStatusId.Value; opstatus = order.iOperatorStatusId.IsNull?WorkOrderOperatorStatus.Null:(WorkOrderOperatorStatus)order.iOperatorStatusId.Value; ViewState["StatusId"] = status; lblWorkOrderId.Text = order.daCreated.Value.ToString("yyyy-MM-dd") + "-" + order.iWorkOrderNumber.Value.ToString(); rblWOTypes.SelectedValue = order.iTypeId.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=edit"; if (order.iSpareEquipId.Value > 0) { hlSpareEquipId.NavigateUrl = "e_view.aspx?id=" + order.iSpareEquipId.Value.ToString(); } if (order.iTechId.Value != 0) { ddlTech.Items.Remove(ddlTech.Items[0]); if (ddlTech.Items.FindByValue(order.iTechId.Value.ToString()) != null) { ddlTech.SelectedValue = order.iTechId.Value.ToString(); } else { Header.ErrorMessage = "Cannot find the assigned technician in the technician list"; } } lblOperator.Text = order.sOperatorName.Value; if (order.bStaying.Value) { rblStaying.SelectedValue = "True"; } else { rblStaying.SelectedValue = "False"; } tbDroppedOffBy.Text = order.sDropedOffBy.Value; tbReleasedTo.Text = order.sReleasedTo.Value; tbCleanliness.Text = order.sCleanliness.Value; adtScheduled.Date = order.daScheduled.Value; lblCreatedDate.Text = order.daCreated.Value.ToLongDateString(); switch (status) { case WorkOrderStatus.Scheduled: // Scheduled status hlChangeSpare.Enabled = false; ddlTech.Enabled = false; rblStaying.Enabled = false; tbDroppedOffBy.Enabled = false; tbCleanliness.Enabled = false; tbReleasedTo.Enabled = false; adtScheduled.Enabled = true; html_ScheduledDate.Visible = true; SaveCancelControl.EnableSave = true; if (opstatus == WorkOrderOperatorStatus.Checked_In) { hlChangeSpare.Enabled = true; trCheckInDate.Visible = true; adtCheckIn.Date = order.daArrival.Value; } else { trCheckInDate.Visible = false; } trCheckOutDate.Visible = false; trClosedDate.Visible = false; trOpenedDate.Visible = false; break; case WorkOrderStatus.Open: // Opened status ViewState["ScheduledDate"] = order.daScheduled.Value; adtScheduled.Enabled = false; html_ScheduledDate.Visible = false; SaveCancelControl.EnableSave = true; trCheckInDate.Visible = true; adtCheckIn.Date = order.daArrival.Value; trOpenedDate.Visible = true; adtOpened.Date = order.daOpened.Value; trCheckOutDate.Visible = false; trClosedDate.Visible = false; break; case WorkOrderStatus.ReOpened: // Opened status ViewState["ScheduledDate"] = order.daScheduled.Value; adtScheduled.Enabled = false; html_ScheduledDate.Visible = false; SaveCancelControl.EnableSave = true; trCheckInDate.Visible = true; adtCheckIn.Date = order.daArrival.Value; trOpenedDate.Visible = true; adtOpened.Date = order.daOpened.Value; trCheckOutDate.Visible = false; trClosedDate.Visible = false; break; case WorkOrderStatus.Closed: // Closed Status ViewState["ScheduledDate"] = order.daScheduled.Value; hlChangeSpare.Enabled = false; ddlTech.Enabled = false; rblStaying.Enabled = false; tbDroppedOffBy.Enabled = true; adtScheduled.Enabled = false; html_ScheduledDate.Visible = false; tbCleanliness.Enabled = true; tbReleasedTo.Enabled = true; SaveCancelControl.EnableSave = true; trCheckInDate.Visible = true; adtCheckIn.Date = order.daArrival.Value; trOpenedDate.Visible = true; adtOpened.Date = order.daOpened.Value; trClosedDate.Visible = true; adtClosed.Date = order.daClosed.Value; if (opstatus == WorkOrderOperatorStatus.Checked_Out) { trCheckOutDate.Visible = true; adtCheckOut.Date = order.daDeparture.Value; } else { trCheckOutDate.Visible = false; } break; } if (order.iOperatorId.Value == 6) { hlChangeSpare.Enabled = false; } 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(); } } }
private void Page_Load(object sender, System.EventArgs e) { try { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); if (Request.QueryString["repairid"] != null && !string.IsNullOrEmpty(Request.QueryString["repairid"])) { RepairId = Convert.ToInt32(Request.QueryString["repairid"]); } if (Request.QueryString["mode"] == null || Request.QueryString["id"] == null || Request.QueryString["repairid"] == null) { Session["lastpage"] = "main.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { if (Request.QueryString["mode"] == "Add") { Mode = true; } else { Mode = false; } OrderId = Convert.ToInt32(Request.QueryString["id"]); if (Request.QueryString["inspectid"] != null) { InspectId = Convert.ToInt32(Request.QueryString["inspectid"]); } else { InspectId = 0; } if (Request.QueryString["itemid"] != null) { ItemId = Convert.ToInt32(Request.QueryString["itemid"]); } else { ItemId = 0; } if (Request.QueryString["type"] != null) { sType = Request.QueryString["type"]; //RI, PMI, II, FREE } else { sType = ""; } if (Request.QueryString["op"] != null) { ServiceResult = Request.QueryString["op"]; //Repair, Replace } else { ServiceResult = ""; } sCurrentPage = "wo_updateRepair.aspx?mode=" + (Mode ? "Add" : "Edit") + "&id=" + OrderId.ToString() + "&repairid=" + RepairId.ToString() + "&inspectid=" + InspectId.ToString() + "&itemid=" + ItemId.ToString() + "&type=" + sType + "&op=" + ServiceResult; } 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() + "&#Repairs"); if (sType == "II") // if came from Inspetion screen { Header.AddBreadCrumb("Inspection Detail", "/wo_viewCompleteInspection.aspx?id=" + OrderId.ToString() + "&inspectid=" + InspectId.ToString()); sLastPage = "wo_viewCompleteInspection.aspx?id=" + OrderId.ToString() + "&inspectid=" + InspectId.ToString(); } else { sLastPage = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString() + "&#Repairs"; } if (Mode) { this.PageTitle = "Update Repair"; } else if (sType == "FREE") { this.PageTitle = "Add Repair"; } else { this.PageTitle = "Edit Repair"; } Header.AddJavaScriptFile("/wo_updateRepair.js"); Header.BodyOnloadScript = "javascript:CheckEditMode();"; SaveCancelControl.CausesValidation = false; SaveCancelControl.ButtonText = " Save & Back "; SaveCancelControl.IsCancel = false; ddlRepairCats.Attributes.Add("onchange", "javascript:ValidRepairItems();"); ddlRepairItems.Attributes.Add("onchange", "javascript:ValidRepairItems();"); clsWorkOrders orders = new clsWorkOrders(); string key = orders.GetIntegrationKey(this.OrgId); clsUsers user = new clsUsers(); user.cAction = "S"; user.iOrgId = OrgId; user.iId = _functions.GetUserOrgId(Context.User.Identity.Name, true); user.UserDetails(); if (RepairId == 0) { preRepairId = orders.GetRepairPreId(); preRepairId++; } WarehousePanel.Visible = false; //if (string.IsNullOrEmpty(key)) // WarehousePanel.Visible = false; //else //{ // string url = String.Format(_functions.GetValueFromConfig("WarehouseListnerPage") + "?action=create&key={0}&app=fleet&roid={1}&riid={2}&rufn={3}&ruln={4}&rue={5}&ron={6}&rofn={7}&shipto={8}&shiploc={9}", key, RepairId > 0 ? RepairId.ToString() : preRepairId.ToString(), string.Empty, user.sFirstName.Value, user.sLastName.Value, user.sEmail.Value, "Work Order", OrderId.ToString(), user.sFirstName.Value + " " + user.sLastName.Value, string.Empty); // string windowOpenScript = "function openWindow() { window.open('" + url + "','Warehouse','height=600,width=900,toolbar=0,status=1,location=0,menubar=0,scrollbars=1,resizable=1'); }"; // if (!Page.ClientScript.IsClientScriptBlockRegistered("openWindow")) // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "openWindow", windowOpenScript, true); //} if (!IsPostBack) { order = new clsWorkOrders(); order.cAction = "S"; order.iOrgId = OrgId; order.iId = OrderId; order.iRepairId = RepairId; dsRepairItemsCats = order.GetRepairItemsAndCats(); dsRepairItemsCats.Relations.Add(new DataRelation("Cats_Items", dsRepairItemsCats.Tables["Table"].Columns["Id"], dsRepairItemsCats.Tables["Table1"].Columns["CatId"])); ddlRepairCats.DataSource = dsRepairItemsCats; ddlRepairCats.DataBind(); ddlRepairItems.DataSource = dsRepairItemsCats; ddlRepairItems.DataBind(); ListLink.DataBind(); if (Mode) // Add Mode { order.sTypeService = sType; order.iItemId = ItemId; if (sType == "II") { lblTableTitle.Text = "Please check the following to update any reported issues associated with this Inspection item"; DataTable dtReportedIssues = order.GetReportedIssuesListUpdate(); if (dtReportedIssues.Rows.Count > 0) { repReportedIssues.DataSource = new DataView(dtReportedIssues); repReportedIssues.DataBind(); } else { lblTableTitle.Text = "Serviced Repairs"; repReportedIssues.Visible = false; } } else { lblTableTitle.Text = "Serviced Repairs"; repReportedIssues.Visible = false; } // showing all repaires with associations repRepairs.DataSource = new DataView(order.GetRepairsListUpdate()); repRepairs.DataBind(); order.GetIssueInfo(); lblSourceType.Text = order.sTypeService.Value; lblRepairCategory.Text = order.sRepairCatName.Value; lblIssue.Text = order.sServiceName.Value; } else // Edit Mode { // hidding the controls for Edit mode tblSource.Visible = false; lblTableTitle.Text = "Repair"; repRepairs.Visible = false; html_chNewRepair.Visible = false; lblTableFooter.Visible = false; RepairLogsLinksPanel.Visible = false; // getting repair's info order.RepairCommonDetails(); ddlRepairCats.SelectedValue = order.iRepairCatId.Value.ToString(); ddlRepairItems.SelectedValue = order.iRepairItemId.Value.ToString(); tbNotes.Text = order.sRepairDesc.Value; } dtParts = order.GetPartsUsedList(); ViewState["PartsUsed"] = dtParts; dwParts = new DataView(dtParts); dwParts.RowFilter = "IsDeleted=0"; repParts.DataSource = dwParts; repParts.DataBind(); } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = sLastPage; 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 (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 = "Edit Aquisition Information of Equipment"; SaveCancelControl.ParentPageURL = this.ParentPageURL; if (!IsPostBack) { equip = new clsEquipment(); equip.cAction = "S"; equip.iOrgId = OrgId; equip.iId = EquipId; // getting equipment's data if (equip.EquipmentDetail_Aquis() != -1) { if (equip.daInService.IsNull) { adtInService.Date = new DateTime(adtInService.MinYear, 1, 1); } else { adtInService.Date = equip.daInService.Value; } if (equip.daAquired.IsNull) { adtAquired.Date = new DateTime(adtAquired.MinYear, 1, 1); } else { adtAquired.Date = equip.daAquired.Value; } if (equip.curPurAmount.IsNull) { tbAmount.Text = ""; } else { tbAmount.Text = String.Format("{0:0.00}", equip.curPurAmount.Value); } if (equip.dmPurUnits.IsNull) { tbUnits.Text = ""; } else { tbUnits.Text = Convert.ToDouble(equip.dmPurUnits.Value).ToString(); } if (equip.sPurOrgContact.IsNull) { tbOrgContact.Text = ""; } else { tbOrgContact.Text = equip.sPurOrgContact.Value; } if (equip.sPurNotes.IsNull) { tbNotes.Text = ""; } else { tbNotes.Text = equip.sPurNotes.Value; } } else { Session["lastpage"] = ParentPageURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); } } } 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 (equip != null) { equip.Dispose(); } } }
private void Page_Load(object sender, System.EventArgs e) { try { if (Request.QueryString["id"] == null) { Session["lastpage"] = "e_list.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); 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 = "Edit Main Information of Equipment"; SaveCancelControl.ParentPageURL = this.ParentPageURL; if (!IsPostBack) { equip = new clsEquipment(); loc = new clsLocations(); dep = new clsDepartments(); equip.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); equip.iOrgId = OrgId; equip.iId = EquipId; equip.cAction = "S"; dep.iOrgId = OrgId; ddlDepts.DataValueField = "Id"; ddlDepts.DataTextField = "vchName"; ddlDepts.DataSource = new DataView(dep.GetDepartmentsList()); ddlDepts.DataBind(); loc.iOrgId = OrgId; ddlLocs.DataValueField = "Id"; ddlLocs.DataTextField = "vchName"; ddlLocs.DataSource = new DataView(loc.GetLocationsList()); ddlLocs.DataBind(); // showing a Equipment's main data from fixed fields if (equip.EquipmentDetail() == -1) { Session["lastpage"] = this.ParentPageURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); return; } ViewState["EquipType"] = equip.iTypeId.Value; lblEquipOperator.Text = equip.sEquipOperator.Value; lblTempOperator.Text = equip.sTempOperator.Value; if (equip.sEquipId.IsNull) { tbEquipId.Text = ""; } else { tbEquipId.Text = equip.sEquipId.Value; } if (equip.iYear.IsNull) { tbYear.Text = ""; } else { tbYear.Text = equip.iYear.Value.ToString(); } if (equip.sVinSerial.IsNull) { tbVinSerial.Text = ""; } else { tbVinSerial.Text = equip.sVinSerial.Value; } if (equip.sFuelCode.IsNull) { tbFuelCode.Text = ""; } else { tbFuelCode.Text = equip.sFuelCode.Value; } if (equip.sPlateNumber.IsNull) { tbPlateNumber.Text = ""; } else { tbPlateNumber.Text = equip.sPlateNumber.Value; } if (equip.bSpare.IsNull) { chSpare.Checked = false; } else { chSpare.Checked = equip.bSpare.Value; } if (equip.iModelId.IsNull) { mmValue.IsComponent = false; mmValue.TypeId = equip.iTypeId.Value; mmValue.DataBind(); } else { mmValue.IsComponent = false; mmValue.TypeId = equip.iTypeId.Value; mmValue.ModelId = equip.iModelId.Value; mmValue.DataBind(); } if (!equip.iDeptId.IsNull) { ddlDepts.SelectedValue = equip.iDeptId.Value.ToString(); } if (!equip.iLocId.IsNull) { ddlLocs.SelectedValue = equip.iLocId.Value.ToString(); } } } 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 (loc != null) { loc.Dispose(); } if (dep != null) { dep.Dispose(); } if (equip != null) { equip.Dispose(); } } }
private void Page_Load(object sender, System.EventArgs e) { try { if (Request.QueryString["id"] == null) { Session["lastpage"] = "wo_default.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { OrderId = Convert.ToInt32(Request.QueryString["id"]); OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); } catch (FormatException fex) { Session["lastpage"] = "wo_default.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } if (Request.QueryString["repairid"] != null) { RepairId = Convert.ToInt32(Request.QueryString["repairid"]); } else { RepairId = 0; } html_btnBack.Attributes.Add("onclick", "document.location='wo_viewWorkOrder.aspx?id=" + OrderId.ToString() + "&#TimeLog';"); 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()); dtNow = DateTime.Now; if (!IsPostBack) { rdiStartTime.SelectedDate = dtNow; rdiStopTime.SelectedDate = dtNow; order = new clsWorkOrders(); user = new clsUsers(); order.cAction = "S"; order.iOrgId = OrgId; order.iId = OrderId; user.iOrgId = OrgId; user.iOrderId = OrderId; user.iTypeId = (int)UserTypes.Technician; DataTable dtTechList = user.GetUserListByType(); dtTechList.Rows[0].Delete(); ddlTechnicians.DataSource = new DataView(dtTechList); ddlTechnicians.DataBind(); DataTable dtRepairList = order.GetRepairsShortList(); dtRepairList.Rows[0].Delete(); ddlRepairs.DataSource = new DataView(dtRepairList); ddlRepairs.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(); lblEquipId.Text = order.sEquipId.Value; lblOperator.Text = order.sOperatorName.Value; lblTech.Text = order.sTechName.Value; if (user.GetTechnicianInfo() != -1) { tbHourlyRate.Text = user.dmHourlyRate.Value.ToString("F"); if (!user.bTechCanViewHourlyRate.Value) { ViewState["HourlyRate"] = user.dmHourlyRate.Value; html_tblMain.Rows[12].Visible = false; html_trTotalCosts.Visible = false; } else { ViewState["HourlyRate"] = null; html_tblMain.Rows[12].Visible = true; html_trTotalCosts.Visible = true; } } else { html_trTotalCosts.Visible = true; html_tblMain.Rows[12].Visible = true; tbHourlyRate.Text = "0.0"; ViewState["HourlyRate"] = null; } if (ddlTechnicians.Items.FindByValue(order.iTechId.Value.ToString()) != null) { ddlTechnicians.SelectedValue = order.iTechId.Value.ToString(); } else { ddlTechnicians.SelectedIndex = 0; } if (ddlRepairs.Items.FindByValue(RepairId.ToString()) != null) { ddlRepairs.SelectedValue = RepairId.ToString(); } else { ddlRepairs.SelectedIndex = 0; } order.iTechId = 0; dtTimeLog = order.GetTimeLogList(); if (dtTimeLog.Rows.Count > 0) { repTimeLog.DataSource = new DataView(dtTimeLog); repTimeLog.DataBind(); html_tblNoneTimeLog.Visible = false; lblTotalHours.Text = order.sReportDesc.Value; lblTotalCosts.Text = order.sDecs.Value; } else { html_tblNoneTimeLog.Visible = true; repTimeLog.Visible = false; html_trTotalHours.Visible = false; html_trTotalCosts.Visible = false; } } } 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(); } } }
private void Page_Load(object sender, System.EventArgs e) { int j; string sTypeName; object oItem; try { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); if (Request.QueryString["id"] == null) { Session["lastpage"] = "e_view.aspx?id=" + Session["EquipId"].ToString(); Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { ComponentId = Convert.ToInt32(Request.QueryString["id"]); } catch (FormatException fex) { Session["lastpage"] = "e_view.aspx?id=" + Session["EquipId"].ToString(); Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } Header.AddBreadCrumb("Home", "/main.aspx"); Header.AddBreadCrumb("Equipment List", "/e_list.aspx"); if (Session["EquipId"] != null) { Header.AddBreadCrumb("Equipment Detail", "/e_view.aspx?id=" + Session["EquipId"].ToString()); } else { Header.AddBreadCrumb("Equipment Detail", "/e_list.aspx"); } Header.LeftBarHtml = "Edit Component of Equipment"; SaveCancelControl.ParentPageURL = this.ParentPageURL; if (!IsPostBack) { comp = new clsComponents(); dtCustomFields = new DataTable(); dtCustomFields.Columns.Add("TypeName"); dtCustomFields.Columns.Add("ValueName"); dtCustomFields.Columns.Add("Value_String"); dtCustomFields.Columns.Add("Value_Boolean"); dtCustomFields.Columns.Add("Value_Int"); dtCustomFields.Columns.Add("Value_DateTime"); dtCustomFields.Columns.Add("TB_Visible"); dtCustomFields.Columns.Add("DDL_Visible"); dtCustomFields.Columns.Add("CB_Visible"); dtCustomFields.Columns.Add("MM_Visible"); dtCustomFields.Columns.Add("DT_Visible"); dtCustomFields.Columns.Add("Help"); dtCustomFields.Columns.Add("RFV_Visible"); dtCustomFields.Columns.Add("Val_Visible"); dtCustomFields.Columns.Add("ErrorMessage"); dtCustomFields.Columns.Add("Exp"); if (ComponentId == 0) { // adding a component lblLastUpdate.Text = ""; ddlStatus.SelectedValue = "1"; ViewState["ComponentTypeId"] = Convert.ToInt32(Request.QueryString["typeid"]); btnRemove.Visible = false; } else { // editing a component comp.iOrgId = OrgId; comp.iId = ComponentId; comp.cAction = "S"; btnRemove.Visible = true; dtCustomFieldsFromDB = comp.ComponentDetail_CustomFields(null); lblLastUpdate.Text = dtCustomFieldsFromDB.Rows[0]["UserName"].ToString() + " " + Convert.ToDateTime(dtCustomFieldsFromDB.Rows[0]["dtUpdated"]).ToString(); if ((bool)dtCustomFieldsFromDB.Rows[0]["btActive"]) { ddlStatus.SelectedValue = "1"; } else { ddlStatus.SelectedValue = "0"; } ViewState["ComponentTypeId"] = Convert.ToInt32(dtCustomFieldsFromDB.Rows[0]["TypeId"]); } #region Show Custom Fields // showing the Custom Fields for Component arrCFD = _functions.GetCustomFields(CFDataType.Component, (int)ViewState["ComponentTypeId"], HttpContext.Current.User.Identity.Name); if (arrCFD.Count > 0) { // filling custom fields in the dtCustomFields table for (j = 0; j < arrCFD.Count; j++) { cfd = (clsCustomFieldsDef)arrCFD[j]; sTypeName = _functions.GetFieldTypeText(cfd.FieldTypeId) + cfd.NumberColumn.ToString(); if (ComponentId == 0) { oItem = DBNull.Value; } else { oItem = dtCustomFieldsFromDB.Rows[0][sTypeName]; } switch (cfd.FieldTypeId) { case DBFieldType._nvarchar: if (oItem != DBNull.Value) { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, oItem, "False", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "False", "", "" }); } else { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "False", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "False", "", "" }); } break; case DBFieldType._int: if (oItem != DBNull.Value) { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, oItem, "False", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "True", cfd.NameText + " must be numeric", "^\\d{0,10}?$" }); } else { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "False", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "True", cfd.NameText + " must be numeric", "^\\d{0,10}?$" }); } break; case DBFieldType._float: if (oItem != DBNull.Value) { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, oItem, "False", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "True", cfd.NameText + " must be decimal numeric", "^\\d{0,8}(?:\\.\\d{0,8})?$" }); } else { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "False", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "True", cfd.NameText + " must be decimal numeric", "^\\d{0,8}(?:\\.\\d{0,8})?$" }); } break; case DBFieldType._datetime: if (oItem != DBNull.Value) { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "False", 0, ((SqlDateTime)oItem).Value.ToShortDateString(), "False", "False", "False", "False", "True", cfd.Help, "False", "False", "", "" }); } else { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "False", 0, "", "False", "False", "False", "False", "True", cfd.Help, "False", "False", "", "" }); } break; case DBFieldType._bit: if (oItem != DBNull.Value) { if (((SqlBoolean)oItem) == SqlBoolean.True) { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "True", 0, "2000-01-01", "False", "False", "True", "False", "False", cfd.Help, "False", "False", "", "" }); } else { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "False", 0, "2000-01-01", "False", "False", "True", "False", "False", cfd.Help, "False", "False", "", "" }); } break; } else { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "False", 0, "2000-01-01", "False", "False", "True", "False", "False", cfd.Help, "False", "False", "", "" }); } break; case DBFieldType._ntext: if (oItem != DBNull.Value) { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, oItem, "2000-01-01", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "False", "", "" }); } else { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "2000-01-01", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "False", "", "" }); } break; case DBFieldType._sql_variant: dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, (string)dtCustomFieldsFromDB.Rows[0][sTypeName], "2000-01-01", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "False", "", "" }); break; case DBFieldType._lookup: if (oItem != DBNull.Value) { if (cfd.NameLookupTable == "EquipModels") { // adding data into DropDownList controls both Make and Model dtCustomFields.Rows.Add(new object [] { sTypeName, "Make/Model", "", "False", Convert.ToInt32(oItem), "2000-01-01", "False", "False", "False", "True", "False", cfd.Help, "False", "False", "", "" }); } else { dtCustomFields.Rows.Add(new object [] { sTypeName, "Make/Model", "", "False", "0", "2000-01-01", "False", "False", "False", "True", "False", cfd.Help, "False", "False", "", "" }); } } else { dtCustomFields.Rows.Add(new object [] { sTypeName, "Make/Model", "", "False", "0", "2000-01-01", "False", "False", "False", "True", "False", cfd.Help, "False", "False", "", "" }); } break; default: break; } cfd = null; } // binding main datalist ViewState["CustomFields"] = dtCustomFields; repCustomFields.DataSource = new DataView(dtCustomFields); repCustomFields.DataBind(); } else { Session["lastpage"] = ParentPageURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); } #endregion } } 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 (comp != null) { comp.Dispose(); } } }
private void Page_Load(object sender, System.EventArgs e) { string [,] arrBrdCrumbs; try { if (Request.QueryString["id"] == null) { Session["lastpage"] = "wo_default.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { OrderId = Convert.ToInt32(Request.QueryString["id"]); OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); } catch (FormatException fex) { Session["lastpage"] = "wo_default.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } // if the coming was from order detail screen m_sBack = Request.QueryString["back"]; switch (m_sBack) { case "view": // from View Work Order Detial screen m_sBackUrl = "wo_addRepairs.aspx?id=" + OrderId.ToString() + "&back=view"; m_sLastPage = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString() + "&#Issues"; tblMain.Rows[9].Visible = false; tblMain.Rows[10].Visible = true; // 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", "/" + m_sLastPage); SaveCancelControl.CausesValidation = false; SaveCancelControl.ParentPageURL = ParentPageURL; SaveCancelControl.ButtonText = " Save "; break; case "open": // from Open Work Order screen m_sBackUrl = "wo_addRepairs.aspx?id=" + OrderId.ToString() + "&back=open"; m_sLastPage = "wo_openWorkOrder.aspx?id=" + OrderId.ToString(); tblMain.Rows[9].Visible = true; tblMain.Rows[10].Visible = false; NextBackControl.BackPage = m_sLastPage; NextBackControl.BackVisible = true; NextBackControl.CausesValidation = false; break; case "past": m_sBackUrl = "wo_addRepairs.aspx?back=past&id=" + OrderId.ToString(); m_sLastPage = "wo_editAddInfo.aspx?back=past&id=" + OrderId.ToString() + "&equipid=0"; tblMain.Rows[9].Visible = true; tblMain.Rows[10].Visible = false; NextBackControl.BackPage = m_sLastPage; NextBackControl.BackVisible = true; NextBackControl.CausesValidation = false; break; default: // from Create Work Order screen m_sBackUrl = "wo_addRepairs.aspx?id=" + OrderId.ToString(); m_sLastPage = "wo_editAddInfo.aspx?id=" + OrderId.ToString() + "&equipid=0"; tblMain.Rows[9].Visible = true; tblMain.Rows[10].Visible = false; NextBackControl.BackPage = m_sLastPage; NextBackControl.BackVisible = true; NextBackControl.CausesValidation = false; break; } if (!IsPostBack) { order = new clsWorkOrders(); order.iOrgId = OrgId; dtCategory = order.GetCategoryList(); ddlCategory.DataSource = new DataView(dtCategory); ddlCategory.DataBind(); ddlCategory.Items.Insert(0, ""); ShowIssues(OrderId); } } 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 (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"] = "admin_users.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { UserId = Convert.ToInt32(Request.QueryString["id"]); } catch (FormatException fex) { Session["lastpage"] = "admin_users.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } if (UserId == 0) { Header.AddBreadCrumb("Home", "/selectMode.aspx"); Header.AddBreadCrumb("Administration", "/admin.aspx"); Header.AddBreadCrumb("User Search", "/admin_users.aspx"); this.PageTitle = "Add a New User"; } else { Header.AddBreadCrumb("Home", "/selectMode.aspx"); Header.AddBreadCrumb("Administration", "/admin.aspx"); Header.AddBreadCrumb("User Search", "/admin_users.aspx"); Header.AddBreadCrumb("User Detail", "/admin_user_detail.aspx?id=" + UserId.ToString()); this.PageTitle = "User Detail Edit"; } Header.LeftBarHtml = "View User Detail"; Header.AddJavaScriptFile("/admin_user_detail_edit.js"); SaveCancelControl.ParentPageURL = this.ParentPageURL; if (!IsPostBack) { user = new clsUsers(); user.cAction = "S"; user.iOrgId = OrgId; user.iId = UserId; if (UserId != 0) { if (user.UserDetails() == -1) { Session["lastpage"] = "admin_user_detail.aspx?id=" + UserId.ToString(); Session["error"] = _functions.ErrorMessage(134); Response.Redirect("error.aspx", false); return; } tbFirstName.Text = user.sFirstName.Value; tbLastName.Text = user.sLastName.Value; tbInitial.Text = user.sInitials.Value.Trim(); ddlType.SelectedValue = user.sTypeName.Value; tbEmail.Text = user.sEmail.Value; lblCreatedDate.Text = user.daCreated.Value.ToLongDateString() + " " + user.daCreated.Value.ToLongTimeString(); tbHourlyRate.Text = user.dmHourlyRate.Value.ToString("F"); if (user.bActiveStatus.Value) { lblUserActivateStatus.Text = "Activated"; hlInactive.Text = "[Deactivate]"; } else { lblUserActivateStatus.Text = "Deactivated"; hlInactive.Text = "[Activate]"; } hlInactive.NavigateUrl = "admin_user_detail_active.aspx?id=" + UserId.ToString(); dgGroups.DataSource = new DataView(user.GetUserGroupsList()); dgGroups.DataBind(); ddlGroup.DataSource = new DataView(user.GetGroupsListByNotUser()); ddlGroup.DataBind(); if (ddlGroup.Items.Count == 0) { ddlGroup.Enabled = false; btnAddGroup.Enabled = false; } else { ddlGroup.Enabled = true; btnAddGroup.Enabled = true; } rfvNewPass.Enabled = false; rfvNewPIN.Enabled = false; rfvConfirmPassword.Enabled = false; rfvConfirmPIN.Enabled = false; } else { ddlGroup.DataSource = new DataView(user.GetGroupsListByNotUser()); ddlGroup.DataBind(); tblMain.Rows[11].Visible = false; tblMain.Rows[12].Visible = false; tblMain.Rows[13].Visible = false; tblMain.Rows[14].Visible = false; tblMain.Rows[15].Visible = false; tblMain.Rows[16].Visible = false; btnAddGroup.Visible = false; } } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "admin_user_detail.aspx?id=" + UserId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (user != null) { user.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 = ParentPageURL; SaveCancelControl.IsCancel = true; SaveCancelControl.CausesValidation = true; SaveCancelControl.ButtonText = " Check-Out/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; } if (order.iStatusId.Value != (int)WorkOrderStatus.Closed) { Signature.sError = _functions.ErrorMessage(138); Signature.Enabled = false; tbReleasedTo.Enabled = false; SaveCancelControl.EnableSave = false; } lblWorkOrderId.Text = order.daCreated.Value.ToString("yyyy-MM-dd") + "-" + order.iWorkOrderNumber.Value.ToString(); lblEquipId.Text = order.sEquipId.Value; lblSpareEquipId.Text = order.sSpareEquipId.Value; lblTech.Text = order.sTechName.Value; lblOperator.Text = order.sOperatorName.Value; lblDroppedOffBy.Text = order.sDropedOffBy.Value; tbReleasedTo.Text = order.sReleasedTo.Value; lblCleanliness.Text = order.sCleanliness.Value; lblScheduledDate.Text = order.daScheduled.IsNull?"":order.daScheduled.Value.ToLongDateString(); if (order.daDeparture.IsNull) { adtCheckOut.Date = DateTime.Now; } else { adtCheckOut.Date = order.daDeparture.Value; } order.iItemId = OrderId; order.iNoteTypeId = (int)NoteTypes.CheckOutNote; repCheckOutNotes.DataSource = new DataView(order.GetNotesList()); repCheckOutNotes.DataBind(); } } 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(); } } }
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 = "Reassign Equipment Operator"; SaveCancelControl.ParentPageURL = this.ParentPageURL; if (!IsPostBack) { equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iId = EquipId; equip.cAction = "S"; dtUsers = equip.GetEquipAssignTo(); if (dtUsers.Rows.Count < 1) { Session["lastpage"] = ParentPageURL; Session["error"] = _functions.ErrorMessage(111); Response.Redirect("error.aspx", false); return; } ddAssignTo.DataTextField = "vchName"; ddAssignTo.DataValueField = "id"; ddAssignTo.DataSource = new DataView(dtUsers); ddAssignTo.DataBind(); ddAssignTo.Items.Insert(0, new ListItem("Nobody", "0")); // getting equipment's data if (equip.EquipmentDetail() != 0) { Session["lastpage"] = ParentPageURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); return; } lblEquipment.Text = equip.sEquipId.Value; lblType.Text = equip.sType.Value; lblMakeModel.Text = equip.sMakeModelName.Value; lblYear.Text = equip.iYear.Value.ToString(); lblSerial.Text = equip.sVinSerial.Value; lblFuelCode.Text = equip.sFuelCode.Value; lblDepartment.Text = equip.sDeptName.Value; lblLocation.Text = equip.sLocName.Value; lblSpare.Text = equip.bSpare.Value?"Yes":"No"; lbAssignFrom.Text = equip.sEquipOperator.Value; } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = ParentPageURL; 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 (mm != null) { mm.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["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(); } } }
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 { if (Request.QueryString["id"] == null) { Session["lastpage"] = "e_list.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); 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 = "Edit Disposal Information of Equipment"; SaveCancelControl.ParentPageURL = ParentPageURL; if (!IsPostBack) { equip = new clsEquipment(); equip.cAction = "S"; equip.iOrgId = OrgId; equip.iId = EquipId; ddMethod.DataTextField = "vchName"; ddMethod.DataValueField = "Id"; ddMethod.DataSource = new DataView(equip.GetEquipDispMethodsList()); ddMethod.DataBind(); // getting equipment's data if (equip.EquipmentDetail_Disp() != -1) { if (equip.daDisposed.IsNull) { adtDisposed.Date = new DateTime(adtDisposed.MinYear, 1, 1); } else { adtDisposed.Date = equip.daDisposed.Value; } if (equip.daOutOfService.IsNull) { adtOutOfService.Date = new DateTime(adtOutOfService.MinYear, 1, 1); } else { adtOutOfService.Date = equip.daOutOfService.Value; } if (equip.sDispOrgContact.IsNull) { tbOrgContact.Text = ""; } else { tbOrgContact.Text = equip.sDispOrgContact.Value; } if (equip.curDispAmount.IsNull) { tbAmount.Text = ""; } else { tbAmount.Text = equip.curDispAmount.Value.ToString("0.00"); } if (equip.dmDispUnits.IsNull) { tbUnits.Text = ""; } else { tbUnits.Text = Convert.ToDouble(equip.dmDispUnits.Value).ToString(); } if (equip.sDispNotes.IsNull) { tbNotes.Text = ""; } else { tbNotes.Text = equip.sDispNotes.Value; } if (equip.iDispMethod.IsNull) { ddMethod.SelectedIndex = 0; } else { ddMethod.SelectedValue = equip.iDispMethod.Value.ToString(); } } else { Session["lastpage"] = ParentPageURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); } } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = ParentPageURL; 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) { int j; string sTypeName; 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 = "Edit Custom Information of Equipment"; this.PageTitle = "Edit Custom Fields"; SaveCancelControl.ParentPageURL = this.ParentPageURL; if (!IsPostBack) { equip = new clsEquipment(); dtCustomFields = new DataTable(); #region Creating Column dtCustomFields.Columns.Add("TypeName"); dtCustomFields.Columns.Add("ValueName"); dtCustomFields.Columns.Add("Value_String"); dtCustomFields.Columns.Add("Value_Boolean"); dtCustomFields.Columns.Add("Value_Int"); dtCustomFields.Columns.Add("Value_DateTime"); dtCustomFields.Columns.Add("TB_Visible"); dtCustomFields.Columns.Add("DDL_Visible"); dtCustomFields.Columns.Add("CB_Visible"); dtCustomFields.Columns.Add("MM_Visible"); dtCustomFields.Columns.Add("DT_Visible"); dtCustomFields.Columns.Add("Help"); dtCustomFields.Columns.Add("RFV_Visible"); dtCustomFields.Columns.Add("Val_Visible"); dtCustomFields.Columns.Add("ErrorMessage"); dtCustomFields.Columns.Add("Exp"); #endregion equip.iOrgId = OrgId; equip.iId = EquipId; equip.cAction = "S"; dtCustomFieldsFromDB = equip.EquipmentDetail_CustomFields(null); if (equip.iId == -1) { Session["lastpage"] = ParentPageURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); return; } #region Show Custom Fields if (dtCustomFieldsFromDB.Rows.Count > 0) { // adding data into DropDownList controls // parsing the custom fields in the dtCustomFieldsFromDB table arrCFD = _functions.GetCustomFields(CFDataType.Equipment, Convert.ToInt32(dtCustomFieldsFromDB.Rows[0]["TypeId"]), HttpContext.Current.User.Identity.Name); ViewState["EquipTypeId"] = dtCustomFieldsFromDB.Rows[0]["TypeId"]; if (arrCFD == null) { Session["lastpage"] = ParentPageURL; Session["error"] = _functions.ErrorMessage(114); Response.Redirect("error.aspx", false); return; } // filling custom fields in the dtCustomFields table for (j = 0; j < arrCFD.Count; j++) { cfd = (clsCustomFieldsDef)arrCFD[j]; sTypeName = _functions.GetFieldTypeText(cfd.FieldTypeId) + cfd.NumberColumn.ToString(); switch (cfd.FieldTypeId) { case DBFieldType._nvarchar: if (dtCustomFieldsFromDB.Rows[0][sTypeName] == DBNull.Value) { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "False", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "False", "", "" }); } else { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, dtCustomFieldsFromDB.Rows[0][sTypeName], "False", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "False", "", "" }); } break; case DBFieldType._int: if (dtCustomFieldsFromDB.Rows[0][sTypeName] == DBNull.Value) { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "False", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "True", cfd.NameText + " must be numeric", "^\\d{0,10}?$" }); } else { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, dtCustomFieldsFromDB.Rows[0][sTypeName], "False", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "True", cfd.NameText + " must be numeric", "^\\d{0,10}?$" }); } break; case DBFieldType._float: if (dtCustomFieldsFromDB.Rows[0][sTypeName] == DBNull.Value) { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "False", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "True", cfd.NameText + " must be decimal numeric", "^\\d{0,8}(?:\\.\\d{0,8})?$" }); } else { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, dtCustomFieldsFromDB.Rows[0][sTypeName], "False", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "True", cfd.NameText + " must be decimal numeric", "^\\d{0,8}(?:\\.\\d{0,8})?$" }); } break; case DBFieldType._datetime: if (dtCustomFieldsFromDB.Rows[0][sTypeName] == DBNull.Value) { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "False", 0, "1970-01-01", "False", "False", "False", "False", "True", cfd.Help, "False", "False", "", "" }); } else { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "False", 0, dtCustomFieldsFromDB.Rows[0][sTypeName], "False", "False", "False", "False", "True", cfd.Help, "False", "False", "", "" }); } break; case DBFieldType._bit: if (dtCustomFieldsFromDB.Rows[0][sTypeName] == DBNull.Value) { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "False", 0, "2000-01-01", "False", "False", "True", "False", "False", cfd.Help, "False", "False", "", "" }); } else { if (((bool)dtCustomFieldsFromDB.Rows[0][sTypeName]) == true) { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "True", 0, "2000-01-01", "False", "False", "True", "False", "False", cfd.Help, "False", "False", "", "" }); } else { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "False", 0, "2000-01-01", "False", "False", "True", "False", "False", cfd.Help, "False", "False", "", "" }); } } break; case DBFieldType._ntext: if (dtCustomFieldsFromDB.Rows[0][sTypeName] == DBNull.Value) { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "2000-01-01", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "False", "", "" }); } else { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, (string)dtCustomFieldsFromDB.Rows[0][sTypeName], "2000-01-01", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "False", "", "" }); } break; case DBFieldType._sql_variant: if (dtCustomFieldsFromDB.Rows[0][sTypeName] == DBNull.Value) { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, "", "2000-01-01", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "False", "", "" }); } else { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, (string)dtCustomFieldsFromDB.Rows[0][sTypeName], "2000-01-01", 0, "2000-01-01", "True", "False", "False", "False", "False", cfd.Help, cfd.Required.ToString(), "False", "", "" }); } break; case DBFieldType._lookup: if (cfd.NameLookupTable == "EquipModels") { // adding data into DropDownList controls both Make and Model if (dtCustomFieldsFromDB.Rows[0][sTypeName] == DBNull.Value) { dtCustomFields.Rows.Add(new object [] { sTypeName, "Make/Model", "", "False", 0, "2000-01-01", "False", "False", "False", "True", "False", cfd.Help, "False", "False", "", "" }); } else { dtCustomFields.Rows.Add(new object [] { sTypeName, "Make/Model", "", "False", Convert.ToInt32(dtCustomFieldsFromDB.Rows[0][sTypeName]), "2000-01-01", "False", "False", "False", "True", "False", cfd.Help, "False", "False", "", "" }); } } else { if (dtCustomFieldsFromDB.Rows[0][sTypeName] == DBNull.Value) { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, 0, "False", 0, "2000-01-01", "False", "True", "False", "False", "False", cfd.Help, "False", "False", "", "" }); } else { dtCustomFields.Rows.Add(new object [] { sTypeName, cfd.NameText, dtCustomFieldsFromDB.Rows[0][sTypeName], "False", 0, "2000-01-01", "False", "True", "False", "False", "False", cfd.Help, "False", "False", "", "" }); } } break; default: break; } cfd = null; } // binding main datalist ViewState["CustomFields"] = dtCustomFields; repCustomFields.DataSource = new DataView(dtCustomFields); repCustomFields.DataBind(); } else { Session["lastpage"] = ParentPageURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); } #endregion } } 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 (loc != null) { loc.Dispose(); } if (dep != null) { dep.Dispose(); } if (mm != null) { mm.Dispose(); } if (equip != null) { equip.Dispose(); } } }