예제 #1
0
 private void ShowInspections()
 {
     try
     {
         dgInspections.DataSource = new DataView(inspect.GetInspectionsList());
         dgInspections.DataBind();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
예제 #2
0
        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;

                SourcePageName = "edit2.aspx.cs";

                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);

                    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.GetInspectionsList());
                    ddInspectionId.DataBind();
                    ddInspectionId.Items.Insert(0, new ListItem("", ""));

                    // getting equipment's data
                    if (equip.EquipmentDetail_Alt() != -1)
                    {
                        if (equip.iPMSched.IsNull)
                        {
                            ddPMScheduleId.SelectedValue = "";
                        }
                        else
                        {
                            ddPMScheduleId.SelectedValue = Convert.ToString(equip.iPMSched);
                        }
                        if (equip.iInspectId.IsNull)
                        {
                            ddInspectionId.SelectedValue = "";
                        }
                        else
                        {
                            ddInspectionId.SelectedValue = Convert.ToString(equip.iInspectId);
                        }
                        if (equip.iCurrentUnits.IsNull)
                        {
                            tbCurrentUnits.Text = "";
                        }
                        else
                        {
                            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(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 (inspec != null)
                {
                    inspec.Dispose();
                }
                if (pm != null)
                {
                    pm.Dispose();
                }
                if (equip != null)
                {
                    equip.Dispose();
                }
            }
        }
예제 #3
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                if (Request.QueryString["id"] == null || Request.QueryString["detailid"] == null)
                {
                    Session["lastpage"] = "admin_inspectschedules.aspx";
                    Session["error"]    = _functions.ErrorMessage(104);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                try
                {
                    InspectSchedId = Convert.ToInt32(Request.QueryString["id"]);
                    DetailId       = Convert.ToInt32(Request.QueryString["detailid"]);
                }
                catch (FormatException fex)
                {
                    Session["lastpage"] = "admin_inspectschedules.aspx";
                    Session["error"]    = _functions.ErrorMessage(105);
                    Response.Redirect("error.aspx", false);
                    return;
                }

                sLastPage    = "admin_inspectschedule_detail.aspx?id=" + InspectSchedId.ToString();
                sCurrentPage = "admin_inspectschedule_detail_edit.aspx?id=" + InspectSchedId.ToString() + "&detailid=" + DetailId.ToString();

                Header.AddBreadCrumb("Home", "/selectMode.aspx");
                Header.AddBreadCrumb("Administration", "/admin.aspx");
                Header.AddBreadCrumb("Inspections Manager", "/admin_inspections.aspx");
                Header.AddBreadCrumb("Inspections Schedules Manager", "/admin_inspectschedules.aspx");
                Header.AddBreadCrumb("Inspection Schedule Detail", "/" + sLastPage);
                this.PageTitle     = "Inspection Schedule Detail Edit";
                Header.LeftBarHtml = "Edit Inspection Schedule";

                SaveCancelControl.CancelText    = " Back ";
                SaveCancelControl.ParentPageURL = sLastPage;
                if (!IsPostBack)
                {
                    inspect         = new clsInspections();
                    inspect.cAction = "S";
                    inspect.iOrgId  = OrgId;
                    inspect.iInspectSchedDetailId = DetailId;
                    inspect.iInspectScheduleId    = InspectSchedId;
                    ddlInspections.DataSource     = new DataView(inspect.GetInspectionsList());
                    ddlInspections.DataBind();
                    if (inspect.InspectSchedDetailDetails() == -1)
                    {
                        Session["lastpage"] = sLastPage;
                        Session["error"]    = _functions.ErrorMessage(159);
                        Response.Redirect("error.aspx", false);
                        return;
                    }
                    lblScheduleName.Text = inspect.sInspectScheduleName.Value;
                    if (DetailId != 0)
                    {
                        ddlInspections.SelectedValue = inspect.iId.Value.ToString();
                        ddlInspections.Enabled       = false;
                        tbMinDays.Text   = inspect.iMinDays.Value.ToString();
                        tbMaxDays.Text   = inspect.iMaxDays.Value.ToString();
                        tbTagetDays.Text = inspect.iTargetDays.Value.ToString();
                    }
                    else
                    {
                        btnDelete.Visible = false;
                    }
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = sLastPage;
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (inspect != null)
                {
                    inspect.Dispose();
                }
            }
        }