private void ShowInspectSchedules() { try { dgInspectSchedules.DataSource = new DataView(inspect.GetInspectSchedulesList()); dgInspectSchedules.DataBind(); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
private void Page_Load(object sender, System.EventArgs e) { try { if (Request.QueryString["id"] == null) { Session["lastpage"] = "e_list.aspx"; Session["error"] = _functions.ErrorMessage(104); Response.Redirect("error.aspx", false); return; } try { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); EquipId = Convert.ToInt32(Request.QueryString["id"]); } catch (FormatException fex) { Session["lastpage"] = "e_list.aspx"; Session["error"] = _functions.ErrorMessage(105); Response.Redirect("error.aspx", false); return; } Header.AddBreadCrumb("Home", "/main.aspx"); Header.AddBreadCrumb("Equipment List", "/e_list.aspx"); Header.AddBreadCrumb("Equipment Detail", "/e_view.aspx?id=" + EquipId.ToString()); Header.LeftBarHtml = "Edit Alternative Information of Equipment"; SaveCancelControl.ParentPageURL = this.ParentPageURL; if (!IsPostBack) { equip = new clsEquipment(); pm = new clsPMSchedService(); inspec = new clsInspections(); equip.cAction = "S"; equip.iOrgId = OrgId; equip.iId = EquipId; pm.iOrgId = OrgId; inspec.iOrgId = OrgId; ddPMScheduleId.DataTextField = "vchName"; ddPMScheduleId.DataValueField = "Id"; ddPMScheduleId.DataSource = new DataView(pm.GetPMSchedulesList()); ddPMScheduleId.DataBind(); ddInspectionId.DataTextField = "vchName"; ddInspectionId.DataValueField = "Id"; ddInspectionId.DataSource = new DataView(inspec.GetInspectSchedulesList()); ddInspectionId.DataBind(); // getting equipment's data if (equip.EquipmentDetail_Alt() != -1) { if (equip.iPMSched.IsNull) { ddPMScheduleId.SelectedValue = ""; } else { ddPMScheduleId.SelectedValue = equip.iPMSched.Value.ToString(); } if (equip.iInspectScheduleId.IsNull) { ddInspectionId.SelectedValue = ""; } else { ddInspectionId.SelectedValue = equip.iInspectScheduleId.Value.ToString(); } if (equip.dmCurrentUnits.IsNull) { tbCurrentUnits.Text = ""; } else { tbCurrentUnits.Text = Convert.ToDouble(equip.dmCurrentUnits.Value).ToString(); } } else { Session["lastpage"] = this.ParentPageURL; Session["error"] = _functions.ErrorMessage(102); Response.Redirect("error.aspx", false); } } } catch (Exception ex) { _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName); Session["lastpage"] = this.ParentPageURL; Session["error"] = ex.Message; Session["error_report"] = ex.ToString(); Response.Redirect("error.aspx", false); } finally { if (inspec != null) { inspec.Dispose(); } if (pm != null) { pm.Dispose(); } if (equip != null) { equip.Dispose(); } } }
private void Page_Load(object sender, System.EventArgs e) { try { OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false); 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(); } } }