private void btnChangeType_Click(object sender, System.EventArgs e) { try { Session["EquipTypeId"] = ddlEquipType.SelectedValue; equip = new clsEquipment(); equip.cAction = "S"; equip.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); equip.iTypeId = Convert.ToInt32(ddlEquipType.SelectedValue); GenerateCustomFields(); } catch(Exception ex) { _functions.Log("Application error: \n" + ex.ToString()); Session["lastpage"] = "addEquip.aspx"; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if(equip != null) { equip.Dispose(); } } }
private void btSave_FormSubmit(object sender, EventArgs e) { try { equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iId = EquipId; equip.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); equip.iEquipOperatorId = Convert.ToInt32(ddAssignTo.SelectedValue); equip.sNote = tbNote.Text; equip.EquipAssignedTo(); Response.Redirect("e_view.aspx?id="+EquipId.ToString(), false); } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "e_reassign.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 btnNO_Click(object sender, System.EventArgs e) { try { ViewState["SelectedWorkOrderId"] = null; pnlNoneEquipment.Visible = false; pnlOneEquipment.Visible = false; pnlManyEquipment.Visible = true; equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iUserId = 6; //op.Id; dtEquipments = equip.GetEquipListForCheckOut(); repEquipments.DataSource = new DataView(dtEquipments); repEquipments.DataBind(); } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "ok_selectWorkOrder.aspx"; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if(equip != null) equip.Dispose(); } }
private void btnReport_Click(object sender, System.EventArgs e) { try { equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iId = EquipId; equip.daMinDate = adtStartDate.Date; equip.daMaxDate = adtEndDate.Date.AddHours(23).AddMinutes(59); dgAssignments.DataSource = new DataView(equip.GetEquipmentAssignmentList()); dgAssignments.DataBind(); lblEquipId.Text = equip.sEquipId.Value; } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "e_viewEquipAssignmentReport.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 { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); if(!IsPostBack) { dtCurrentDate = DateTime.Now; // adtEndDate.Date = dtCurrentDate; // adtStartDate.Date = dtCurrentDate.AddDays(-1); equip = new clsEquipment(); equip.iOrgId = OrgId; equip.daMinDate = dtCurrentDate; //adtStartDate.Date; equip.daMaxDate = dtCurrentDate; //adtEndDate.Date.AddHours(23).AddMinutes(59); dgAssignments.DataSource = new DataView(equip.GetTempOperatorsAssignmentList()); dgAssignments.DataBind(); } } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "main.aspx"; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { } }
private void btNext_FormSubmit(object sender, EventArgs e) { try { equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iUserId = op.Id; equip.iOrderId = OrderId; equip.iId = System.Data.SqlTypes.SqlInt32.Null; equip.sNote = "checking in the spare equipment"; equip.EquipSpareTo(true); Response.Redirect("ok_viewNotes.aspx?id=" + OrderId.ToString() ,false); } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "ok_updateSpare.aspx?id=" + OrderId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if(equip != null) equip.Dispose(); } }
/// <summary> /// Updating the equipment information /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btSave_FormSubmit(object sender, EventArgs e) { try { equip = new clsEquipment(); equip.cAction = "U"; equip.iId = EquipId; equip.iOrgId = OrgId; equip.iModelId = mmValue.ModelId; equip.iYear = Convert.ToInt32(tbYear.Text); equip.iDeptId = Convert.ToInt32(ddlDepts.SelectedValue); equip.iLocId = Convert.ToInt32(ddlLocs.SelectedValue); equip.bSpare = chSpare.Checked; equip.sFuelCode = tbFuelCode.Text; equip.sEquipId = tbEquipId.Text; equip.sVinSerial = tbVinSerial.Text; equip.sPlateNumber = tbPlateNumber.Text; equip.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); if(equip.EquipmentDetail() == -1) { Session["lastpage"] = "e_edit.aspx?id=" + EquipId.ToString(); Session["error"] = _functions.ErrorMessage(107); sURL_return = "error.aspx"; } else { if(cbReassign.Checked) { sURL_return = "e_reassign.aspx?id=" + EquipId.ToString(); } else { sURL_return = "e_view.aspx?id=" + EquipId.ToString(); } } } catch(FormatException fex) { Session["lastpage"] = "e_edit.aspx?id=" + EquipId.ToString(); Session["error"] = _functions.ErrorMessage(108); sURL_return = "error.aspx"; } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "e_edit.aspx?id=" + EquipId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); sURL_return = "error.aspx"; } finally { if(equip != null) { equip.Dispose(); } } Response.Redirect(sURL_return, true); }
/// <summary> /// Update the disposed data for current equipment /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btSave_FormSubmit(object sender, EventArgs e) { try { equip = new clsEquipment(); equip.cAction = "S"; equip.iOrgId = OrgId; equip.iId = EquipId; equip.cAction = "U"; equip.daDisposed = adtDisposed.Date; equip.daOutOfService = adtOutOfService.Date; equip.sDispOrgContact = tbOrgContact.Text; equip.curDispAmount = Convert.ToDecimal(tbAmount.Text); equip.dmDispUnits = Convert.ToDecimal(tbUnits.Text); equip.sDispNotes = tbNotes.Text; equip.iDispMethod = Convert.ToInt32(ddMethod.SelectedValue); if(equip.EquipmentDetail_Disp() != -1) { Response.Redirect("e_view.aspx?id="+EquipId.ToString(), false); } else { Session["lastpage"] = "e_editDisp.aspx?id=" + EquipId.ToString(); Session["error"] = _functions.ErrorMessage(107); Response.Redirect("error.aspx", false); } } catch(FormatException fex) { Session["lastpage"] = "e_editDisp.aspx?id=" + EquipId.ToString(); Session["error"] = _functions.ErrorMessage(108); Response.Redirect("error.aspx", false); } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "e_editDisp.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 btnFind_Click(object sender, System.EventArgs e) { int EquipId, OrderId; DataView dwOrders; try { equip = new clsEquipment(); equip.iOrgId = OrgId; equip.sEquipId = tbEquipmentId.Text; if(equip.SearchEquipId() == 0) { Header.ErrorMessage = "<span style='FONT-SIZE:12pt;'>The specified equipment could not be located</span>"; tbEquipmentId.Text = ""; } else { EquipId = equip.iId.Value; order = new clsWorkOrders(); order.iOrgId = OrgId; order.daCurrentDate = DateTime.Now; dwOrders = new DataView(order.GetActivityWorkOrder()); dwOrders.RowFilter = "EquipId = " + EquipId.ToString(); if(dwOrders.Count > 0) { dwOrders.Sort = "StatusColor desc, OperatorStatusName asc"; OrderId = Convert.ToInt32(dwOrders[0]["Id"].ToString()); Response.Redirect("ok_mainDetails.aspx?id=" + OrderId.ToString() + "&back=mainmenu2", false); } else Response.Redirect("ok_selectEquipment.aspx?orderid=0&equipid=" + EquipId.ToString() + "&back=mainmenu2", false); } } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "ok_mainMenu2.aspx"; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if(equip != null) equip.Dispose(); if(order != null) order.Dispose(); } }
private void btSave_FormSubmit(object sender, EventArgs e) { try { equip = new clsEquipment(); equip.cAction = "U"; equip.iOrgId = OrgId; equip.iId = EquipId; equip.daInService = adtInService.Date; equip.daAquired = adtAquired.Date; equip.curPurAmount = Convert.ToDecimal(tbAmount.Text); equip.sPurOrgContact = tbOrgContact.Text; equip.sPurNotes = tbNotes.Text; equip.dmPurUnits = Convert.ToDecimal(tbUnits.Text); if(equip.EquipmentDetail_Aquis() != -1) { Response.Redirect("e_view.aspx?id=" + EquipId.ToString(), false); return; } else { Session["lastpage"] = "e_editAquis.aspx?id=" + EquipId.ToString(); Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); } } catch(FormatException fex) { Session["lastpage"] = "e_editAquis.aspx?id=" + EquipId.ToString(); Session["error"] = _functions.ErrorMessage(108); Response.Redirect("error.aspx", false); } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "e_editAquis.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 btSave_FormSubmit(object sender, EventArgs e) { try { if(Request.QueryString["id"] == null) { Session["lastpage"] = "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"] = "list.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } equip = new clsEquipment(); equip.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); equip.iId = EquipId; equip.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); equip.iAssignedTo = Convert.ToInt32(ddAssignTo.SelectedValue); equip.sNote = tbNote.Text; equip.EquipAssignedTo(); Response.Redirect(ParentPageURL, false); } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "reassign.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 btSave_FormSubmit(object sender, EventArgs e) { try { equip = new clsEquipment(); equip.cAction = "U"; equip.iOrgId = OrgId; equip.iId = EquipId; equip.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); equip.iPMSched = Convert.ToInt32(ddPMScheduleId.SelectedValue); equip.iInspectScheduleId = Convert.ToInt32(ddInspectionId.SelectedValue); equip.dmCurrentUnits = Convert.ToDecimal(tbCurrentUnits.Text); if(equip.EquipmentDetail_Alt() == -1) { Session["lastpage"] = "e_edit2.aspx?id=" + EquipId.ToString(); Session["error"] = _functions.ErrorMessage(107); Response.Redirect("error.aspx", false); return; } else { Response.Redirect("e_view.aspx?id="+EquipId.ToString(), false); } } catch(FormatException fex) { Session["lastpage"] = "e_edit2.aspx?id=" + EquipId.ToString(); Session["error"] = _functions.ErrorMessage(108); Response.Redirect("error.aspx", false); } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "e_edit2.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 btnAddRepair_Click(object sender, System.EventArgs e) { try { order = new clsWorkOrders(); equip = new clsEquipment(); equip.iId = EquipId; equip.iOrgId = OrgId; order.cAction = "U"; order.iOrgId = OrgId; order.iEquipId = EquipId; order.iReportedIssueId = 0; order.iRepairCatId = Convert.ToInt32(ddlCategory.SelectedValue); order.sReportDesc = tbDesc.Text; order.iId = SqlInt32.Null; order.iServiceResultId = SqlInt32.Null; order.iServiceCheckId = SqlInt32.Null; order.iRepairMultId = SqlInt32.Null; if(order.WorkOrderReportedIssuesDetail() == -1) { Session["lastpage"] = sCurrentPage; Session["error"] = _functions.ErrorMessage(121); Response.Redirect("error.aspx", false); } tbDesc.Text = ""; ddlCategory.SelectedIndex = 0; ShowIssues(); } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = sCurrentPage; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if(equip != null) equip.Dispose(); if(order != null) order.Dispose(); } }
private void btnFiltration_Click(object sender, System.EventArgs e) { try { equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iTypeId = Convert.ToInt32(ddlEquipTypes.SelectedValue); equip.iDeptId = Convert.ToInt32(ddlDepartments.SelectedValue); equip.iLocId = Convert.ToInt32(ddlLocations.SelectedValue); equip.iIsSpare = Convert.ToInt32(ddlSpare.SelectedValue); equip.iUserId = Convert.ToInt32(ddlDrivers.SelectedValue); equip.sEquipId_Filter = _functions.ConvertToSQLFilter(tbEquipId.Text); eFilter = new EquipFilter(); eFilter.iTypeId = equip.iTypeId.Value; eFilter.iDeptId = equip.iDeptId.Value; eFilter.iLocId = equip.iLocId.Value; eFilter.iIsSpare = equip.iIsSpare.Value; eFilter.iOperatorId = equip.iUserId.Value; eFilter.sEquipId = equip.sEquipId_Filter.Value; Session["EquipFilter"] = eFilter; dgInspections.DataSource = new DataView(equip.GetEquipInspectList_Filter()); dgInspections.DataBind(); } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "wo_showEquipsForInspect.aspx"; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if(equip != null) { equip.Dispose(); } } }
private void btnFind_Click(object sender, System.EventArgs e) { try { equip = new clsEquipment(); equip.iOrgId = OrgId; equip.sEquipId = tbEquipId.Text; equip.GetEquipId(); if(equip.iId.Value == 0) { lblError.Visible = true; tbEquipId.Text = ""; } else { pnlFindEquipment.Visible = false; pnlManyEquipment.Visible = false; pnlOneEquipment.Visible = true; ViewState["SelectedEqiupId"] = equip.iId.Value.ToString(); lblEquipId.Text = tbEquipId.Text; lblEquipType.Text = equip.sType.Value; lblMakeModel.Text = equip.sMakeModelName.Value; lblYear.Text = equip.iYear.Value.ToString(); } } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "ok_selectEquipment.aspx?orderid=" + OrderId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if(equip != null) equip.Dispose(); } }
private void btnBackInt_Click(object sender, System.EventArgs e) { try { pnlViewQuestion.Visible = true; pnlSelectSpare.Visible = false; pnlNoSpare.Visible = false; lblFirstName.Text = op.FirstName; equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iId = EquipId; if(equip.GetEquipInfo() != -1) lblEquipType.Text = equip.sType.Value; else { Session["lastpage"] = CurrentPage; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); return; } } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = CurrentPage; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if(equip != null) equip.Dispose(); } }
private void Page_Load(object sender, System.EventArgs e) { int j; string sTypeName; try { if(Request.QueryString["id"] == null) { Session["lastpage"] = "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"] = "list.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } string [,] arrBrdCrumbs = new string [3,2]; arrBrdCrumbs[0,0]="main.aspx"; arrBrdCrumbs[0,1]="Home"; arrBrdCrumbs[1,0]="list.aspx"; arrBrdCrumbs[1,1]="Equipment List"; arrBrdCrumbs[2,0]="view.aspx?id=" + EquipId.ToString(); arrBrdCrumbs[2,1]="Equipment Detail"; PageTitle = "Equipment-Edit Custom Fields"; Header.BrdCrumbs=ParseBreadCrumbs(arrBrdCrumbs,PageTitle); Header.PageTitle=PageTitle; SaveCancelControl.ParentPageURL = ParentPageURL; SourcePageName = "editCustom.aspx.cs"; if(!IsPostBack) { equip = new clsEquipment(); 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("Val_Visible"); dtCustomFields.Columns.Add("ErrorMessage"); dtCustomFields.Columns.Add("Exp"); equip.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); 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; } 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, "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, "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, "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, "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, "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, "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", "", ""}); else dtCustomFields.Rows.Add(new object []{sTypeName, cfd.NameText, "", "False", 0, dtCustomFieldsFromDB.Rows[0][sTypeName], "False", "False", "False", "False", "True", cfd.Help, "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", "", ""}); 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", "", ""}); else dtCustomFields.Rows.Add(new object []{sTypeName, cfd.NameText, "", "False", 0, "2000-01-01", "False", "False", "True", "False", "False", cfd.Help, "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, "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, "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, "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, "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", "", ""}); 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", "", ""}); } 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", "", ""}); 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", "", ""}); } 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); } } } 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"] = "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 btSave_FormSubmit(object sender, EventArgs e) { try { if(Request.QueryString["id"] == null) { Session["lastpage"] = "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"] = "list.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } equip = new clsEquipment(); equip.cAction = "S"; equip.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); equip.iId = EquipId; if(equip.EquipmentDetail() != -1) { equip.cAction = "U"; equip.iStatusId = Convert.ToInt32(ddStatusId.SelectedValue); equip.iPMSched = Convert.ToInt32(ddPMScheduleId.SelectedValue) != 0 ? Convert.ToInt32(ddPMScheduleId.SelectedValue) : SqlInt32.Null; equip.iInspectId = Convert.ToInt32(ddInspectionId.SelectedValue) != 0 ? Convert.ToInt32(ddInspectionId.SelectedValue) : SqlInt32.Null; equip.iCurrentUnits = Convert.ToInt32(tbCurrentUnits.Text); switch(equip.EquipmentDetail()) { case -1: Session["lastpage"] = "edit2.aspx?id=" + EquipId.ToString(); Session["error"] = _functions.ErrorMessage(107); Response.Redirect("error.aspx", false); return; case 1: Session["lastpage"] = "edit2.aspx?id=" + EquipId.ToString(); Session["error"] = _functions.ErrorMessage(109); Response.Redirect("error.aspx", false); return; default: break; } } else { Session["lastpage"] = "edit2.aspx?id=" + EquipId.ToString(); Session["error"] = _functions.ErrorMessage(107); Response.Redirect("error.aspx", false); return; } Response.Redirect("view.aspx?id="+EquipId+"", false); } catch(FormatException fex) { Session["lastpage"] = "edit2.aspx?id=" + EquipId.ToString(); Session["error"] = _functions.ErrorMessage(108); Response.Redirect("error.aspx", false); } catch(Exception ex) { _functions.Log("Application error: \n" + ex.ToString()); Session["lastpage"] = "edit2.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"] = "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"] = "list.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } string [,] arrBrdCrumbs = new string [3,2]; arrBrdCrumbs[0,0]="main.aspx"; arrBrdCrumbs[0,1]="Home"; arrBrdCrumbs[1,0]="list.aspx"; arrBrdCrumbs[1,1]="Equipment List"; arrBrdCrumbs[2,0]="view.aspx?id="+EquipId+""; arrBrdCrumbs[2,1]="Equipment Detail"; PageTitle = "Equipment-Edit Alt"; Header.BrdCrumbs=ParseBreadCrumbs(arrBrdCrumbs,PageTitle); Header.PageTitle=PageTitle; SaveCancelControl.ParentPageURL= ParentPageURL; if(!IsPostBack) { equip = new clsEquipment(); pm = new clsPMSchedService(); inspec = new clsInspections(); equip.cAction = "S"; equip.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); equip.iId = EquipId; pm.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); inspec.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); ddStatusId.DataTextField = "vchName"; ddStatusId.DataValueField = "Id"; ddStatusId.DataSource = new DataView(equip.GetEquipStatusList()); ddStatusId.DataBind(); ddPMScheduleId.DataTextField = "vchName"; ddPMScheduleId.DataValueField = "Id"; ddPMScheduleId.DataSource = new DataView(pm.GetPMSchedulesList()); ddPMScheduleId.DataBind(); ddPMScheduleId.Items.Insert(0, new ListItem("", "0")); ddInspectionId.DataTextField = "vchName"; ddInspectionId.DataValueField = "Id"; ddInspectionId.DataSource = new DataView(inspec.GetInspectionsList()); ddInspectionId.DataBind(); ddInspectionId.Items.Insert(0, new ListItem("", "0")); // getting equipment's data if(equip.EquipmentDetail() != -1) { ddStatusId.SelectedValue = Convert.ToString(equip.iStatusId); ddPMScheduleId.SelectedValue = Convert.ToString(equip.iPMSched); ddInspectionId.SelectedValue = Convert.ToString(equip.iInspectId); tbCurrentUnits.Text = Convert.ToString(equip.iCurrentUnits); } else { Session["lastpage"] = ParentPageURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); } } } catch(Exception ex) { _functions.Log("Application error: \n" + ex.ToString()); Session["lastpage"] = 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(); } } }
/// <summary> /// Activating/Inactivating the user account /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btSave_FormSubmit(object sender, EventArgs e) { try { equip = new clsEquipment(); equip.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); foreach(RepeaterItem _item in repOperatorEquipments.Items) { DropDownList ddlOperators = (DropDownList)_item.FindControl("ddlOperators"); bool IsNobody = Convert.ToBoolean(ddlOperators.Attributes["IsNobody"]); if(!IsNobody && ddlOperators.SelectedValue == "0") { Header.ErrorMessage = "Operator is required"; return; } equip.iOrgId = OrgId; equip.iId = Convert.ToInt32(ddlOperators.Attributes["EquipId"]); equip.iEquipOperatorId = Convert.ToInt32(ddlOperators.SelectedValue); equip.sNote = "Deactivated Operator - Reassigned New Operator"; equip.EquipAssignedTo(); } user = new clsUsers(); user.iOrgId = OrgId; user.daCreated = DateTime.Now; user.iLoginId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); foreach(RepeaterItem _item in repWorkOrders.Items) { DropDownList ddlTechs = (DropDownList)_item.FindControl("ddlTechs"); bool IsNobody = Convert.ToBoolean(ddlTechs.Attributes["IsNobody"]); if(!IsNobody && ddlTechs.SelectedValue == "0") { Header.ErrorMessage = "Technician is required"; return; } user.iOrderId = Convert.ToInt32(ddlTechs.Attributes["OrderId"]); user.iId = Convert.ToInt32(ddlTechs.SelectedValue); user.SetNewTechToWorkOrder(); } user = new clsUsers(); user.iOrgId = OrgId; user.iId = UserId; user.bActiveStatus = (bool)ViewState["Active"]; if(user.UserActive() == -1) { Session["lastpage"] = "admin_user_detail_active.aspx?id=" + UserId.ToString(); Session["error"] = _functions.ErrorMessage(134); Response.Redirect("error.aspx", false); return; } if(UserId == _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true)) Response.Redirect("default.aspx", false); else { // redirect to the finish screen BackFinishScreen finish = new BackFinishScreen(); if(((bool)ViewState["Active"])) finish.sMainText = "The user has been activated successfully"; else finish.sMainText = "The user has been deactivated successfully"; finish.bMainMenuVisible = true; finish.sMainMenuText = "[Return to Main Menu]"; finish.sMainMenuURL = "selectMode.aspx"; finish.bContinueVisible = false; finish.bViewVisible = true; finish.sViewText = "[View the User Detail]"; finish.sViewURL = "admin_user_detail.aspx?id=" + UserId.ToString(); finish.bAdditionalVisible = false; finish.bPrintVisible = false; Session["BackFinish"] = finish; Response.Redirect("wo_finish.aspx", false); } } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "admin_user_detail_active.aspx?id=" + UserId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if(user != null) user.Dispose(); if(equip != null) equip.Dispose(); } }
private void 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) { int j; bool bVisibleLink; 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; } if(!IsPostBack) { hlEdit.NavigateUrl = "e_edit.aspx?id=" + EquipId.ToString(); hlEdit2.NavigateUrl = "e_edit2.aspx?id=" + EquipId.ToString(); hlEditCustom.NavigateUrl = "e_editCustom.aspx?id=" + EquipId.ToString(); hlEditAquis.NavigateUrl = "e_editAquis.aspx?id=" + EquipId.ToString(); hlEditDisp.NavigateUrl = "e_editDisp.aspx?id=" + EquipId.ToString(); hlReport.NavigateUrl = "e_viewEquipAssignmentReport.aspx?id=" + EquipId.ToString(); bVisibleLink = base.CheckPermission("e_editComponent.aspx"); trAddComponent.Visible = bVisibleLink; Session["EquipId"] = EquipId; equip = new clsEquipment(); comp = new clsComponents(); dtCustomFields = new DataTable(); dtCustomFields.Columns.Add("ValueName"); dtCustomFields.Columns.Add("Value"); equip.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); equip.iOrgId = OrgId; equip.iId = EquipId; equip.cAction = "S"; // showing a Equipment's main data from fixed fields if(equip.EquipmentDetail() == -1) { 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; lblPlateNumber.Text = equip.sPlateNumber.Value; lblDepartment.Text = equip.sDeptName.Value; lblLocation.Text = equip.sLocName.Value; lblSpare.Text = equip.bSpare.Value?"Yes":"No"; lblAssignedTo.Text = equip.sEquipOperator.Value; lblAssignTempTo.Text = equip.sTempOperator.Value; // showing a Equipment's Alt data from fixed fields if(equip.EquipmentDetail_Alt() == -1) { Session["lastpage"] = ParentPageURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); return; } lbPMSched.Text = equip.sPMSched.Value; lbInspection.Text = equip.sInspectSchedule.Value; if(!equip.dmCurrentUnits.IsNull) lbUnits.Text = Convert.ToDouble(equip.dmCurrentUnits.Value).ToString(); // showing an Aquisition information from fixed fields if(equip.EquipmentDetail_Aquis() == -1) { Session["lastpage"] = ParentPageURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); return; } if(!equip.daInService.IsNull) lbDtInService.Text = equip.daInService.Value.ToShortDateString(); if(!equip.daAquired.IsNull) lbDtAquired.Text = equip.daAquired.Value.ToShortDateString(); lbVchPurOrgContact.Text = equip.sPurOrgContact.Value; if(!equip.curPurAmount.IsNull) lbSmPurAmount.Text = equip.curPurAmount.Value.ToString(); if(!equip.dmPurUnits.IsNull) lbIntPurUnits.Text = Convert.ToDouble(equip.dmPurUnits.Value).ToString(); lbVchPurNotes.Text = equip.sPurNotes.Value; // showing a Disposal info from fixed fields if(equip.EquipmentDetail_Disp() == -1) { Session["lastpage"] = ParentPageURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); return; } if(!equip.daOutOfService.IsNull) lbDtOutOfService.Text = equip.daOutOfService.Value.ToShortDateString(); if(!equip.daDisposed.IsNull) lbDtDisposed.Text = equip.daDisposed.Value.ToShortDateString(); if(!equip.sDispMethod.IsNull) lbVchDispMethod.Text = equip.sDispMethod.Value; if(!equip.sDispOrgContact.IsNull) lbVchDispOrgContact.Text = equip.sDispOrgContact.Value; if(!equip.curDispAmount.IsNull) lbSmDispAmount.Text = equip.curDispAmount.Value.ToString(); if(!equip.dmDispUnits.IsNull) lbIntDispUnits.Text = Convert.ToDouble(equip.dmDispUnits.Value).ToString(); lbVchDispNotes.Text = equip.sDispNotes.Value; // getting all component's types to dropdownlist comp.iEquipId = EquipId; DataTable dtComponmentAdd = comp.GetComponentTypeList(); if(dtComponmentAdd.Rows.Count > 0) { ddlComponentTypes.DataTextField = "vchName"; ddlComponentTypes.DataValueField = "Id"; ddlComponentTypes.DataSource = new DataView(dtComponmentAdd); ddlComponentTypes.DataBind(); } else { ddlComponentTypes.Items.Add(new ListItem("<none>", "0")); lbAddComponent.Enabled = false; } #region Show Custom Fileds for current equipment // getting the custom fields in the DataList control equip.iId = EquipId; dtCustomFieldsFromDB = equip.EquipmentDetail_CustomFields(null); if(dtCustomFieldsFromDB.Rows.Count > 0) { arrCFD = _functions.GetCustomFields(CFDataType.Equipment, Convert.ToInt32(dtCustomFieldsFromDB.Rows[0]["TypeId"]), HttpContext.Current.User.Identity.Name); if(arrCFD.Count > 0) { // fill custom fields for(j = 0; j < arrCFD.Count; j++) { cfd = (clsCustomFieldsDef)arrCFD[j]; sTypeName = _functions.GetFieldTypeText(cfd.FieldTypeId) + cfd.NumberColumn.ToString(); switch(cfd.FieldTypeId) { case DBFieldType._lookup: switch(cfd.NameLookupTable) { case "EquipModels": if(dtCustomFieldsFromDB.Rows[0][sTypeName] == DBNull.Value) { dtCustomFields.Rows.Add(new object []{"Make/Model", ""}); } else { mm = new clsMakesModels(); mm.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); mm.iModelId = Convert.ToInt32(dtCustomFieldsFromDB.Rows[0][sTypeName]); mm.GetModelMakes(); dtCustomFields.Rows.Add(new object []{"Make/Model", mm.sMakeName + "/" + mm.sModelName}); } break; case "Departments": if(dtCustomFieldsFromDB.Rows[0][sTypeName] == DBNull.Value) { dtCustomFields.Rows.Add(new object []{cfd.NameText, ""}); } else { dep = new clsDepartments(); dep.cAction = "S"; dep.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); dep.iId = Convert.ToInt32(dtCustomFieldsFromDB.Rows[0][sTypeName]); if(dep.DepartmentDetail() == 0) { dtCustomFields.Rows.Add(new object []{cfd.NameText, dep.sName.Value}); } else { dtCustomFields.Rows.Add(new object []{cfd.NameText, ""}); } } break; case "Locations": if(dtCustomFieldsFromDB.Rows[0][sTypeName] == DBNull.Value) { dtCustomFields.Rows.Add(new object []{cfd.NameText, ""}); } else { loc = new clsLocations(); loc.cAction = "S"; loc.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); loc.iId = Convert.ToInt32(dtCustomFieldsFromDB.Rows[0][sTypeName]); if(loc.LocationDetail() == 0) { dtCustomFields.Rows.Add(new object []{cfd.NameText, loc.sName.Value}); } else { dtCustomFields.Rows.Add(new object []{cfd.NameText, ""}); } } break; default: break; } break; case DBFieldType._datetime: if(dtCustomFieldsFromDB.Rows[0][sTypeName] == DBNull.Value) { dtCustomFields.Rows.Add(new object []{cfd.NameText, ""}); } else { dtCustomFields.Rows.Add(new object []{cfd.NameText, ((DateTime)dtCustomFieldsFromDB.Rows[0][sTypeName]).ToShortDateString()}); } break; case DBFieldType._bit: if(dtCustomFieldsFromDB.Rows[0][sTypeName] == DBNull.Value) { dtCustomFields.Rows.Add(new object []{cfd.NameText, ""}); } else { if(((bool)dtCustomFieldsFromDB.Rows[0][sTypeName]) == true) dtCustomFields.Rows.Add(new object []{cfd.NameText, "Yes"}); else dtCustomFields.Rows.Add(new object []{cfd.NameText, "No"}); } break; default: if(dtCustomFieldsFromDB.Rows[0][sTypeName] == DBNull.Value) { dtCustomFields.Rows.Add(new object []{cfd.NameText, ""}); } else { dtCustomFields.Rows.Add(new object []{cfd.NameText, dtCustomFieldsFromDB.Rows[0][sTypeName]}); } break; } cfd = null; } // showing a Equipment's data from custom fields repCustomFields.DataSource = new DataView(dtCustomFields); repCustomFields.DataBind(); comp.iEquipId = EquipId; comp.iOrgId = OrgId; dtComponents = comp.GetComponentsList(); dtComponents.Columns.Add("VisibleLink"); foreach(DataRow _row in dtComponents.Rows) { if(bVisibleLink) { _row["VisibleLink"] = "True"; } else { _row["VisibleLink"] = "False"; } } ViewState["Components"] = dtComponents; repComponents.DataSource = new DataView(dtComponents); repComponents.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"] = ParentPageURL; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if(comp != null) { comp.Dispose(); } if(loc != null) { loc.Dispose(); } if(dep != null) { dep.Dispose(); } if(mm != null) { mm.Dispose(); } if(comp != null) { comp.Dispose(); } if(equip != null) { equip.Dispose(); } } }
private void Page_Load(object sender, System.EventArgs e) { int UserId; try { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); if(!IsPostBack) { equip = new clsEquipment(); loc = new clsLocations(); dep = new clsDepartments(); user = new clsUsers(); 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")); user.iOrgId = OrgId; user.iTypeId = (int)UserTypes.Operator; ddlDrivers.DataSource = new DataView(user.GetUserListByType()); ddlDrivers.DataBind(); ddlDrivers.Items[0].Text = "All"; if(Session["EquipFilter"] == null) { UserId = _functions.GetUserOrgId(Context.User.Identity.Name, true); // if(ddlDrivers.Items.FindByValue(UserId.ToString()) != null) // ddlDrivers.SelectedValue = UserId.ToString(); equip.iTypeId = Convert.ToInt32(ddlEquipTypes.SelectedValue); equip.iDeptId = Convert.ToInt32(ddlDepartments.SelectedValue); equip.iLocId = Convert.ToInt32(ddlLocations.SelectedValue); equip.iUserId = Convert.ToInt32(ddlDrivers.SelectedValue); equip.iIsSpare = Convert.ToInt32(ddlSpare.SelectedValue); equip.sEquipId_Filter = _functions.ConvertToSQLFilter(tbEquipId.Text); eFilter = new EquipFilter(); eFilter.iTypeId = equip.iTypeId.Value; eFilter.iDeptId = equip.iDeptId.Value; eFilter.iLocId = equip.iLocId.Value; eFilter.iIsSpare = equip.iIsSpare.Value; eFilter.iOperatorId = equip.iUserId.Value; eFilter.sEquipId = equip.sEquipId_Filter.Value; Session["EquipFilter"] = eFilter; } else { eFilter = (EquipFilter)Session["EquipFilter"]; ddlEquipTypes.Items.FindByValue(eFilter.iTypeId.ToString()).Selected = true; ddlSpare.Items.FindByValue(eFilter.iIsSpare.ToString()).Selected = true; ddlDepartments.Items.FindByValue(eFilter.iDeptId.ToString()).Selected = true; ddlLocations.Items.FindByValue(eFilter.iLocId.ToString()).Selected = true; ddlDrivers.Items.FindByValue(eFilter.iOperatorId.ToString()).Selected = true; tbEquipId.Text = _functions.ConvertFromSQLFilter(eFilter.sEquipId); equip.iTypeId = eFilter.iTypeId; equip.iDeptId = eFilter.iDeptId; equip.iLocId = eFilter.iLocId; equip.iIsSpare = eFilter.iIsSpare; equip.iUserId = eFilter.iOperatorId; equip.sEquipId_Filter = eFilter.sEquipId; } ShowList(); } } 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(); if(loc != null) loc.Dispose(); if(dep != null) dep.Dispose(); if(user != null) user.Dispose(); } }
private void btSave_FormSubmit(object sender, EventArgs e) { DBFieldType FieldType; string sDataGridName; try { if(Request.QueryString["id"] == null) { Session["lastpage"] = "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"] = "list.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } equip = new clsEquipment(); dtCustomFields = (DataTable)ViewState["CustomFields"]; equip.cAction = "U"; equip.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); equip.iId = EquipId; // editing a Equipment equip.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); equip.iTypeId = Convert.ToInt32(ViewState["EquipTypeId"]); sDataGridName = "repCustomFields"; // getting data from Form and changing the dtCustomFields datatable for(int i=0; i<dtCustomFields.Rows.Count; i++) { for(int j=0; j<Request.Form.Count; j++) { if((string)dtCustomFields.Rows[i]["TypeName"] == Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":inputTypeName"]) { FieldType = _functions.TypeNameParser((string)dtCustomFields.Rows[i]["TypeName"]); // nvarchar1...n, ... switch(FieldType) { case DBFieldType._nvarchar: dtCustomFields.Rows[i]["Value_String"] = Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":tbValue"]; break; case DBFieldType._int: dtCustomFields.Rows[i]["Value_String"] = Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":tbValue"]; break; case DBFieldType._float: dtCustomFields.Rows[i]["Value_String"] = Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":tbValue"]; break; case DBFieldType._datetime: dtCustomFields.Rows[i]["Value_String"] = new SqlDateTime(Convert.ToInt32(Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":adtValue_year"]), Convert.ToInt32(Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":adtValue_month"]), Convert.ToInt32(Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":adtValue_day"])); break; case DBFieldType._bit: if(Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":chValue"] != null) { dtCustomFields.Rows[i]["Value_String"] = "True"; } else { dtCustomFields.Rows[i]["Value_String"] = "False"; } break; case DBFieldType._ntext: dtCustomFields.Rows[i]["Value_String"] = Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":tbValue"]; break; case DBFieldType._sql_variant: dtCustomFields.Rows[i]["Value_String"] = Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":tbValue"]; break; case DBFieldType._lookup: if((string)dtCustomFields.Rows[i]["ValueName"] != "Make/Model") { dtCustomFields.Rows[i]["Value_String"] = Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":ddlValue"]; } else { dtCustomFields.Rows[i]["Value_String"] = Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":mmValue:ddlModels"]; } break; default: dtCustomFields.Rows[i]["Value_String"] = Request.Form[sDataGridName + ":_ctl" + j.ToString() + ":tbValue"]; break; } } } } // saving data to database equip.EquipmentDetail_CustomFields(_functions.SetDataToParameters(dtCustomFields)); if(equip.iId == 0) { Response.Redirect("view.aspx?id="+EquipId.ToString(), false); } else { Session["lastpage"] = "editCustom.aspx?id=" + EquipId.ToString(); Session["error"] = _functions.ErrorMessage(107); Response.Redirect("error.aspx", false); } } catch(FormatException fex) { Session["lastpage"] = "editCustom.aspx?id=" + EquipId.ToString(); Session["error"] = _functions.ErrorMessage(108); Response.Redirect("error.aspx", false); } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "editCustom.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 { string [,] arrBrdCrumbs = new string [2,2]; arrBrdCrumbs[0,0]="main.aspx"; arrBrdCrumbs[0,1]="Home"; arrBrdCrumbs[1,0]="list.aspx"; arrBrdCrumbs[1,1]="Equipment List"; PageTitle = "Add Equipment"; Header.BrdCrumbs=ParseBreadCrumbs(arrBrdCrumbs,PageTitle); Header.PageTitle=PageTitle; SaveCancelControl.ParentPageURL=ParentPageURL; SourcePageName = "addEquip.aspx.cs"; if(!IsPostBack) { loc = new clsLocations(); dep = new clsDepartments(); equip = new clsEquipment(); equip.iOrgId = _functions.GetUserOrgId(Context.User.Identity.Name, false); ddlTypes.DataValueField = "Id"; ddlTypes.DataTextField = "vchName"; ddlTypes.DataSource = new DataView(equip.GetEquipTypesList()); ddlTypes.DataBind(); dep.iOrgId = _functions.GetUserOrgId(Context.User.Identity.Name, false); ddlDepts.DataValueField = "Id"; ddlDepts.DataTextField = "vchName"; ddlDepts.DataSource = new DataView(dep.GetDepartmentsList()); ddlDepts.DataBind(); loc.iOrgId = _functions.GetUserOrgId(Context.User.Identity.Name, false); ddlLocs.DataValueField = "Id"; ddlLocs.DataTextField = "vchName"; ddlLocs.DataSource = new DataView(loc.GetLocationsList()); ddlLocs.DataBind(); mmValue.IsComponent = false; mmValue.TypeId = Convert.ToInt32(ddlTypes.SelectedValue); mmValue.DataBind(); } } 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(equip != null) { equip.Dispose(); } } }
private void Page_Load(object sender, System.EventArgs e) { try { string [,] arrBrdCrumbs = new string [2,2]; arrBrdCrumbs[0,0]="main.aspx"; arrBrdCrumbs[0,1]="Home"; arrBrdCrumbs[1,0]="list.aspx"; arrBrdCrumbs[1,1]="Equipment List"; PageTitle = "Add Equipment"; Header.BrdCrumbs=ParseBreadCrumbs(arrBrdCrumbs,PageTitle); Header.PageTitle=PageTitle; SaveCancelControl.ParentPageURL=ParentPageURL; if(!IsPostBack) { equip = new clsEquipment(); equip.cAction = "S"; equip.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); dtEquipTypes = equip.GetEquipTypesList(); if(dtEquipTypes.Rows.Count > 0) { ddlEquipType.DataSource = new DataView(dtEquipTypes); ddlEquipType.DataBind(); if(Session["EquipTypeId"] != null) { ddlEquipType.SelectedValue = Convert.ToString(Session["EquipTypeId"]); } else { ddlEquipType.SelectedIndex = 0; Session["EquipTypeId"] = ddlEquipType.SelectedValue; } equip.iTypeId = Convert.ToInt32(ddlEquipType.SelectedValue); GenerateCustomFields(); } else { Session["lastpage"] = ParentPageURL; Session["error"] = _functions.ErrorMessage(101); Response.Redirect("error.aspx", false); } } } catch(Exception ex) { _functions.Log("Application error: \n" + ex.ToString()); 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 EquipmentDetails() { try { if(OrderId != 0) { order = new clsWorkOrders(); order.cAction = "S"; order.iOrgId = OrgId; order.iId = OrderId; if(order.WorkOrderDetails() == -1) { Session["lastpage"] = "wo_default.aspx?select=AddRoadside"; Session["error"] = _functions.ErrorMessage(120); Response.Redirect("error.aspx", false); return; } if(ddlTech.Items.FindByValue(order.iTechId.Value.ToString()) != null) ddlTech.SelectedValue = order.iTechId.Value.ToString(); EquipId = order.iEquipId.Value; } equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iId = EquipId; equip.cAction = "S"; if(equip.EquipmentDetail() == -1) { Session["lastpage"] = "wo_default.aspx?select=AddRoadside"; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); return; } lblOperator.Text = equip.sEquipOperator.Value; lblTempOperator.Text = equip.sTempOperator.Value; lblEquipId.Text = equip.sEquipId.Value; lblEquipType.Text = equip.sType.Value; lblMakeModel.Text = equip.sMakeModelName.Value; lblYear.Text = equip.iYear.Value.ToString(); lblSerial.Text = equip.sVinSerial.Value; lblEquipId2.Text = equip.sEquipId.Value; lblEquipType2.Text = equip.sType.Value; } catch(Exception ex) { throw new Exception(ex.Message, ex); } finally { if(order != null) order.Dispose(); if(equip != null) equip.Dispose(); } }
private void repOperators_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e) { try { if(e.CommandName == "Select") { UserId = Convert.ToInt32(e.CommandArgument); // assign operator to equipment equip = new clsEquipment(); equip.iOrgId = OrgId; equip.iId = EquipId; equip.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); equip.iEquipOperatorId = UserId; equip.sNote = "changing old operator to new during Roadside Repair procedure"; equip.EquipAssignedTo(); pnlSelectOperator.Visible = false; pnlVerifyOperator.Visible = true; EquipmentDetails(); } } catch(Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "wo_selectOperator.aspx?equipid=" + EquipId.ToString() + "&orderid=" + OrderId.ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if(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(); } } }