private void ShowList() { try { dgMainList.Controls.Clear(); dtData = equip.GetEquipList(); dgMainList.DataSource = new DataView(dtData); dgMainList.DataBind(); } catch (Exception ex) { throw new Exception(ex.Message, ex); } finally { if (dtData != null) { dtData.Dispose(); } if (loc != null) { loc.Dispose(); } if (dep != null) { dep.Dispose(); } if (mm != null) { mm.Dispose(); } } }
private void ShowList() { int i, j; clsCustomFieldsDef cfd = null; string sTypeName; try { dgMainList.Controls.Clear(); dtResult = new DataTable("Result"); dtData = equip.GetEquipList(); if (dtData.Rows.Count > 0) { //arrCFD = _functions.CustomFieldsParse(dtData, Convert.ToInt32(Session["EquipTypeId"])); arrCFD = _functions.GetCustomFields(false, equip.iTypeId.Value, HttpContext.Current.User.Identity.Name); if (arrCFD.Count > 0) { // adding fixed fields dtResult.Columns.Add("id"); // adding variable columns and fields for (i = 0; i < arrCFD.Count; i++) { cfd = (clsCustomFieldsDef)arrCFD[i]; dtResult.Columns.Add(cfd.Name); _column = new BoundColumn(); _column.DataField = cfd.Name; _column.HeaderText = cfd.NameText; dgMainList.Columns.Add(_column); if (cfd.NameLookupTable == "EquipModels") // adding make column if model is exist { _column = null; _column = new BoundColumn(); dtResult.Columns.Add("MakeName"); _column.DataField = "MakeName"; _column.HeaderText = "Make"; dgMainList.Columns.Add(_column); } cfd = null; _column = null; } // fill fields for (i = 0; i < dtData.Rows.Count; i++) { // fill fixed fields drItem = dtResult.NewRow(); drItem["Id"] = dtData.Rows[i]["Id"]; // fill variable 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": mm = new clsMakesModels(); mm.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); mm.iModelId = Convert.ToInt32(dtData.Rows[i][sTypeName]); mm.GetModelMakes(); drItem[cfd.Name] = mm.sModelName; drItem["MakeName"] = mm.sMakeName; break; case "Departments": dep = new clsDepartments(); dep.cAction = "S"; dep.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); dep.iId = Convert.ToInt32(dtData.Rows[i][sTypeName]); if (dep.DepartmentDetail() == 0) { drItem[cfd.Name] = dep.sName.Value; } break; case "Locations": loc = new clsLocations(); loc.cAction = "S"; loc.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); loc.iId = Convert.ToInt32(dtData.Rows[i][sTypeName]); if (loc.LocationDetail() == 0) { drItem[cfd.Name] = loc.sName.Value; } break; default: break; } break; case DBFieldType._bit: if (((bool)dtData.Rows[i][sTypeName]) == true) { drItem[cfd.Name] = "Yes"; } else { drItem[cfd.Name] = "No"; } break; default: drItem[cfd.Name] = dtData.Rows[i][sTypeName]; break; } cfd = null; } dtResult.Rows.Add(drItem); } } else { Session["lastpage"] = ParentPageURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); } } dgMainList.DataSource = new DataView(dtResult); dgMainList.DataBind(); } catch (Exception ex) { throw new Exception(ex.Message); } finally { if (dtData != null) { dtData.Dispose(); } if (loc != null) { loc.Dispose(); } if (dep != null) { dep.Dispose(); } if (mm != null) { mm.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 (!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) { 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; } dgInspections.DataSource = new DataView(equip.GetEquipInspectList_Filter()); dgInspections.DataBind(); } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "main.aspx"; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (equip != null) { equip.Dispose(); } if (loc != null) { loc.Dispose(); } if (dep != null) { dep.Dispose(); } 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["select"] == null) { sSelect = "AddOrder"; } else { sSelect = Convert.ToString(Request.QueryString["select"]); } dgMainList.Controls.Clear(); if (!IsPostBack) { equip = new clsEquipment(); loc = new clsLocations(); dep = new clsDepartments(); user = new clsUsers(); 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")); 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) { // if(ddlDrivers.Items.FindByValue(_functions.GetUserOrgId(Context.User.Identity.Name, true).ToString()) != null) // ddlDrivers.SelectedValue = _functions.GetUserOrgId(Context.User.Identity.Name, true).ToString(); 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.iIsSpare = equip.iIsSpare.Value; eFilter.iDeptId = equip.iDeptId.Value; eFilter.iLocId = equip.iLocId.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; } switch (sSelect) { case "AddOrder": m_bShowUnassigned = false; equip.sLink = "wo_existingWorkOrders.aspx"; break; case "AddPastOrder": m_bShowUnassigned = false; equip.sLink = "wo_editAddInfo.aspx"; break; case "AddIssue": m_bShowUnassigned = false; equip.sLink = "manageIssues.aspx"; break; case "AddRoadside": m_bShowUnassigned = false; equip.sLink = "wo_selectOperator.aspx"; break; case "ChangeTempOper": m_bShowUnassigned = true; equip.sLink = "e_selectTempOperator.aspx"; break; default: m_bShowUnassigned = false; equip.sLink = "wo_existingWorkOrders.aspx"; break; } //dtEquipments = equip.GetEquipList_Filter(m_bShowUnassigned); dtEquipments = equip.GetEquipList_Filter(true); dgMainList.DataSource = new DataView(dtEquipments); dgMainList.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 (equip != null) { equip.Dispose(); } if (loc != null) { loc.Dispose(); } if (dep != null) { dep.Dispose(); } 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; } 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 { 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; } PageTitle = "Reassign Equipment"; 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"; Header.BrdCrumbs = ParseBreadCrumbs(arrBrdCrumbs, PageTitle); Header.PageTitle = "Reassign Equipment"; SaveCancelControl.ParentPageURL = ParentPageURL; SourcePageName = "reassign.aspx.cs"; if (!IsPostBack) { equip = new clsEquipment(); equip.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); 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, ""); // 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; lblShare.Text = equip.bShare.Value?"Yes":"No"; lbAssignFrom.Text = equip.sAssignedTo.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 { 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; } PageTitle = "Reassign Equipment"; 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"; Header.BrdCrumbs = ParseBreadCrumbs(arrBrdCrumbs, PageTitle); Header.PageTitle = "Reassign Equipment"; SaveCancelControl.ParentPageURL = ParentPageURL; if (!IsPostBack) { ViewState["EquipId"] = EquipId; equip = new clsEquipment(); dtCustomFields = new DataTable(); dtCustomFields.Columns.Add("ValueName"); dtCustomFields.Columns.Add("Value"); equip.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); 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, ""); // getting equipment's data dtCustomFieldsFromDB = equip.EquipmentDetail_CustomFields(null); if (dtCustomFieldsFromDB.Rows.Count > 0) { if (dtCustomFieldsFromDB.Rows[0]["UserName"] == DBNull.Value) { lbAssignFrom.Text = ""; } else { lbAssignFrom.Text = dtCustomFieldsFromDB.Rows[0]["UserName"].ToString(); } dtCustomFields.Rows.Add(new object [] { "Type", dtCustomFieldsFromDB.Rows[0]["TypeName"] }); // getting the custom fields in the DataList control arrCFD = _functions.GetCustomFields(false, Convert.ToInt32(Session["EquipTypeId"]), HttpContext.Current.User.Identity.Name); if (arrCFD.Count > 0) { // fill custom fields for (int j = 0; j < arrCFD.Count; j++) { cfd = (clsCustomFieldsDef)arrCFD[j]; if (cfd.FieldTypeId == DBFieldType._lookup) { switch (cfd.NameLookupTable) { case "EquipModels": mm = new clsMakesModels(); mm.iOrgId = 1; // later change mm.iModelId = Convert.ToInt32(dtCustomFieldsFromDB.Rows[0][_functions.GetFieldTypeText(cfd.FieldTypeId) + cfd.NumberColumn.ToString()]); mm.GetModelMakes(); dtCustomFields.Rows.Add(new object [] { "Make/Model", mm.sMakeName + "/" + mm.sModelName }); break; case "Departments": dep = new clsDepartments(); dep.cAction = "S"; dep.iOrgId = 1; dep.iId = Convert.ToInt32(dtCustomFieldsFromDB.Rows[0][_functions.GetFieldTypeText(cfd.FieldTypeId) + cfd.NumberColumn.ToString()]); if (dep.DepartmentDetail() == 0) { dtCustomFields.Rows.Add(new object [] { cfd.NameText, dep.sName.Value }); } break; case "Locations": loc = new clsLocations(); loc.cAction = "S"; loc.iOrgId = 1; loc.iId = Convert.ToInt32(dtCustomFieldsFromDB.Rows[0][_functions.GetFieldTypeText(cfd.FieldTypeId) + cfd.NumberColumn.ToString()]); if (loc.LocationDetail() == 0) { dtCustomFields.Rows.Add(new object [] { cfd.NameText, loc.sName.Value }); } break; default: break; } } else { dtCustomFields.Rows.Add(new object [] { cfd.NameText, dtCustomFieldsFromDB.Rows[0][_functions.GetFieldTypeText(cfd.FieldTypeId) + cfd.NumberColumn.ToString()] }); } cfd = null; } repCustomFields.DataSource = new DataView(dtCustomFields); repCustomFields.DataBind(); } else { Session["lastpage"] = ParentPageURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); } } 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 (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 { 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 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 { 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 { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); SaveCancelControl.ParentPageURL = this.ParentPageURL; if (!IsPostBack) { loc = new clsLocations(); dep = new clsDepartments(); equip = new clsEquipment(); pm = new clsPMSchedService(); inspec = new clsInspections(); equip.iOrgId = OrgId; ddlTypes.DataValueField = "Id"; ddlTypes.DataTextField = "vchName"; ddlTypes.DataSource = new DataView(equip.GetEquipTypesList()); ddlTypes.DataBind(); 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(); mmValue.IsComponent = false; mmValue.TypeId = Convert.ToInt32(ddlTypes.SelectedValue); mmValue.DataBind(); pm.iOrgId = OrgId; inspec.iOrgId = OrgId; ddPMScheduleId.DataTextField = "vchName"; ddPMScheduleId.DataValueField = "Id"; ddPMScheduleId.DataSource = new DataView(pm.GetPMSchedulesList()); ddPMScheduleId.DataBind(); ddPMScheduleId.Items.Insert(0, new ListItem("", "")); ddInspectionId.DataTextField = "vchName"; ddInspectionId.DataValueField = "Id"; ddInspectionId.DataSource = new DataView(inspec.GetInspectSchedulesList()); ddInspectionId.DataBind(); ddInspectionId.Items.Insert(0, new ListItem("", "")); } } 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 (pm != null) { pm.Dispose(); } if (inspec != null) { inspec.Dispose(); } 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"] = "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 Main"; Header.BrdCrumbs = ParseBreadCrumbs(arrBrdCrumbs, PageTitle); Header.PageTitle = PageTitle; SaveCancelControl.ParentPageURL = ParentPageURL; SourcePageName = "edit.aspx.cs"; if (!IsPostBack) { equip = new clsEquipment(); loc = new clsLocations(); dep = new clsDepartments(); equip.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true); equip.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); equip.iId = EquipId; equip.cAction = "S"; 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(); // 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; } ViewState["EquipType"] = equip.iTypeId.Value; if (equip.sAssignedTo.IsNull) { lblAssignedTo.Text = ""; } else { lblAssignedTo.Text = equip.sAssignedTo.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.bShare.IsNull) { chShare.Checked = false; } else { chShare.Checked = equip.bShare.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"] = 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) { string sTypeName; 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; } NextBackControl.BackPage = "wo_addInspections.aspx?id=" + OrderId.ToString(); NextBackControl.BackVisible = true; NextBackControl.NextText = "Open/Finish"; if (!IsPostBack) { hlStart.NavigateUrl = "wo_openWorkOrder.aspx?id=" + OrderId.ToString(); hlInspections.NavigateUrl = "wo_addInspections.aspx?id=" + OrderId.ToString(); hlIssues.NavigateUrl = "wo_addRepairs.aspx?id=" + OrderId.ToString() + "&back=open"; hlPMItems.NavigateUrl = "wo_addPreventiveMaintenance.aspx?id=" + OrderId.ToString() + "&back=preview"; dtCustomFields = new DataTable(); dtCustomFields.Columns.Add("ValueName"); dtCustomFields.Columns.Add("Value"); order = new clsWorkOrders(); order.cAction = "S"; order.iOrgId = OrgId; order.iId = OrderId; if (order.WorkOrderDetails() == -1) { Session["lastpage"] = "wo_addInspections.aspx?id=" + OrderId.ToString(); Session["error"] = _functions.ErrorMessage(120); Response.Redirect("error.aspx", false); return; } if (order.iStatusId.Value != (int)WorkOrderStatus.Scheduled || order.iOperatorStatusId.Value != (int)WorkOrderOperatorStatus.Checked_In) { Signature.sError = _functions.ErrorMessage(144); NextBackControl.NextEnabled = false; } // showing main info lblWorkOrderN.Text = order.daCreated.Value.ToString("yyyy-MM-dd") + "-" + order.iWorkOrderNumber.Value.ToString(); lblWOType.Text = order.sType.Value; lblStatus.Text = order.sStatusId.Value; lblOperatorStatus.Text = order.sOperatorStatus.Value; lblOperator.Text = order.sOperatorName.Value; lblStaying.Text = order.bStaying.IsNull?"not defined":(order.bStaying.Value?"Yes":"No"); lblSpare.Text = order.sSpareEquipId.Value; lblTech.Text = order.sTechName.Value; lblDroppedOffBy.Text = order.sDropedOffBy.Value; lblArrivalDate.Text = order.daArrival.IsNull?"":order.daArrival.Value.ToLongDateString(); lblScheduledDate.Text = order.daScheduled.Value.ToLongDateString(); hlEquipId.Text = order.sEquipId.Value; hlEquipId.NavigateUrl = "e_view.aspx?id=" + order.iEquipId.Value.ToString(); lblType.Text = order.sEquipTypeName.Value; lblMakeModel.Text = order.sEquipMakeModel.Value; lblYear.Text = (order.sEquipYear.Value == "0")?"unknown":order.sEquipYear.Value; lblUnits.Text = Convert.ToDouble(order.dmMileage.Value).ToString(); // showing issues dsRepairs = order.GetReportedIssueLists(); if (dsRepairs.Tables[0].Rows.Count > 0) { html_tblNoneIssues.Visible = false; } else { html_tblNoneIssues.Visible = true; } repIssues.DataSource = new DataView(dsRepairs.Tables[0]); repIssues.DataBind(); // showing the pm items dwPMItems = new DataView(order.GetPMServicesListForWorkOrder()); dwPMItems.RowFilter = "IsChecked='True'"; if (dwPMItems.Count > 0) { html_tblNonePMItems.Visible = false; } else { html_tblNonePMItems.Visible = true; } repPMItems.DataSource = dwPMItems; repPMItems.DataBind(); // showing the inspections dwInspections = new DataView(order.GetInspectionsListForWorkOrder()); dwInspections.RowFilter = "IsChecked='True'"; if (dwInspections.Count > 0) { html_tblNoneInspections.Visible = false; } else { html_tblNoneInspections.Visible = true; } repInspections.DataSource = dwInspections; repInspections.DataBind(); // showing notes order.iItemId = OrderId; order.iNoteTypeId = (int)NoteTypes.CreationNote; repCreationNotes.DataSource = new DataView(order.GetNotesList()); repCreationNotes.DataBind(); order.iNoteTypeId = (int)NoteTypes.OperatorNote; repOperatorNotes.DataSource = new DataView(order.GetNotesList()); repOperatorNotes.DataBind(); #region Showing custom fields of order on screen dtCustomFieldsFromDB = order.WorkOrderDetail_CustomFields(null); if (dtCustomFieldsFromDB.Rows.Count > 0) { arrCFD = _functions.GetCustomFields(CFDataType.WorkOrder, 0, HttpContext.Current.User.Identity.Name); if (arrCFD.Count > 0) { // fill custom fields for (int 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 }); if (mm != null) { mm.Dispose(); } } 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, "" }); } if (dep != null) { dep.Dispose(); } } 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, "" }); } if (loc != null) { loc.Dispose(); } } 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(); } } #endregion } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "wo_addInspections.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 repCustomFields_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e) { DataTable dtListItems = null; try { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.SelectedItem) { switch (((System.Data.DataRowView)e.Item.DataItem).Row.ItemArray[1].ToString()) { case "Make/Model": ((BWA.BFP.Web.Controls.User.MakesModels)e.Item.FindControl("mmValue")).IsComponent = true; ((BWA.BFP.Web.Controls.User.MakesModels)e.Item.FindControl("mmValue")).TypeId = (int)ViewState["ComponentTypeId"]; ((BWA.BFP.Web.Controls.User.MakesModels)e.Item.FindControl("mmValue")).ModelId = Convert.ToInt32(((System.Data.DataRowView)e.Item.DataItem).Row.ItemArray[4]); ((BWA.BFP.Web.Controls.User.MakesModels)e.Item.FindControl("mmValue")).DataBind(); break; case "Department": dep = new clsDepartments(); dep.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); dtListItems = dep.GetDepartmentsList(); ((DropDownList)e.Item.FindControl("ddlValue")).DataTextField = "vchName"; ((DropDownList)e.Item.FindControl("ddlValue")).DataValueField = "Id"; ((DropDownList)e.Item.FindControl("ddlValue")).DataSource = new DataView(dtListItems); ((DropDownList)e.Item.FindControl("ddlValue")).DataBind(); ((DropDownList)e.Item.FindControl("ddlValue")).SelectedValue = Convert.ToString(((System.Data.DataRowView)e.Item.DataItem).Row.ItemArray[2]); break; case "Location": loc = new clsLocations(); loc.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); dtListItems = loc.GetLocationsList(); ((DropDownList)e.Item.FindControl("ddlValue")).DataTextField = "vchName"; ((DropDownList)e.Item.FindControl("ddlValue")).DataValueField = "Id"; ((DropDownList)e.Item.FindControl("ddlValue")).DataSource = new DataView(dtListItems); ((DropDownList)e.Item.FindControl("ddlValue")).DataBind(); ((DropDownList)e.Item.FindControl("ddlValue")).SelectedValue = Convert.ToString(((System.Data.DataRowView)e.Item.DataItem).Row.ItemArray[2]); break; default: break; } } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = "view.aspx?id=" + Session["EquipId"].ToString(); Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (mm != null) { mm.Dispose(); } if (loc != null) { loc.Dispose(); } if (dep != null) { dep.Dispose(); } } }
private void Page_Load(object sender, System.EventArgs e) { clsCustomFieldsDef cfd = null; int j; 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; } PageTitle = "Equipment Detail"; 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 = "Equipment Detail"; Header.BrdCrumbs = ParseBreadCrumbs(arrBrdCrumbs, PageTitle); Header.PageTitle = PageTitle; if (!IsPostBack) { Session["EquipId"] = EquipId; equip = new clsEquipment(); comp = new clsComponents(); dtCustomFields = new DataTable(); dtCustomFields.Columns.Add("ValueName"); dtCustomFields.Columns.Add("Value"); equip.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); equip.iId = EquipId; equip.cAction = "S"; // getting a fixed fields in the label controls if (equip.EquipmentDetail() == -1) { Session["lastpage"] = ParentPageURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); } // showing a Equipment's data from fixed fields lbStatus.Text = equip.sStatus.Value; lbPMSched.Text = equip.sPMSched.Value; lbInspection.Text = equip.sInspect.Value; if (!equip.iCurrentUnits.IsNull) { lbUnits.Text = equip.iCurrentUnits.Value.ToString(); } 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.iPurUnits.IsNull) { lbIntPurUnits.Text = equip.iPurUnits.Value.ToString(); } lbVchPurNotes.Text = equip.sPurNotes.Value; 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.iDispUnits.IsNull) { lbIntDispUnits.Text = equip.iDispUnits.Value.ToString(); } lbVchDispNotes.Text = equip.sDispNotes.Value; // getting all component's types to dropdownlist comp.iOrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); ddlComponentTypes.DataTextField = "vchName"; ddlComponentTypes.DataValueField = "Id"; ddlComponentTypes.DataSource = new DataView(comp.GetComponentTypeList()); ddlComponentTypes.DataBind(); // getting the fixed fields in the DataList control dtCustomFieldsFromDB = equip.EquipmentDetail_CustomFields(null); dtCustomFields.Rows.Add(new object [] { "Type", dtCustomFieldsFromDB.Rows[0]["TypeName"] }); // getting the custom fields in the DataList control //arrCFD = _functions.CustomFieldsParse(dtCustomFieldsFromDB, Convert.ToInt32(Session["EquipTypeId"])); arrCFD = _functions.GetCustomFields(false, Convert.ToInt32(Session["EquipTypeId"]), 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": 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": 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 }); } break; case "Locations": 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 }); } break; default: break; } break; case DBFieldType._datetime: dtCustomFields.Rows.Add(new object [] { cfd.NameText, ((DateTime)dtCustomFieldsFromDB.Rows[0][sTypeName]).ToShortDateString() }); break; case DBFieldType._bit: 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: 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 = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); dtComponents = comp.GetComponentsList(); ViewState["Components"] = dtComponents; repComponents.DataSource = new DataView(dtComponents); repComponents.DataBind(); } 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 (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 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(); } } }