Example #1
0
        private void btnLink_Click(object sender, System.EventArgs e)
        {
            try
            {
                inspect                  = new clsInspections();
                inspect.cAction          = "I";
                inspect.iOrgId           = OrgId;
                inspect.iInspectItemId   = ItemId;
                inspect.iPMSchedDetailId = Convert.ToInt32(ddlPMServices.SelectedValue);

                inspect.InspectItemPMItemDetails();

                dgPMItems.DataSource = new DataView(inspect.GetPMServicesByInspectionItem());
                dgPMItems.DataBind();
                dgPMItems.Visible = true;

                ShowPMItems();
            }
            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 (inspect != null)
                {
                    inspect.Dispose();
                }
            }
        }
Example #2
0
        private void dgPMItems_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            try
            {
                inspect                      = new clsInspections();
                inspect.cAction              = "D";
                inspect.iOrgId               = OrgId;
                inspect.iInspectItemId       = ItemId;
                inspect.iInspectItemPMItemId = Convert.ToInt32(e.Item.Cells[0].Text);

                inspect.InspectItemPMItemDetails();

                dgPMItems.DataSource = new DataView(inspect.GetPMServicesByInspectionItem());
                dgPMItems.DataBind();
                if (dgPMItems.Items.Count == 0)
                {
                    dgPMItems.Visible = false;
                }

                ShowPMItems();
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = sCurrentPage;
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (inspect != null)
                {
                    inspect.Dispose();
                }
            }
        }
Example #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["itemid"] == null)
                {
                    Session["lastpage"] = "admin_inspections.aspx";
                    Session["error"]    = _functions.ErrorMessage(104);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                try
                {
                    InspectionId = Convert.ToInt32(Request.QueryString["id"]);
                    ItemId       = Convert.ToInt32(Request.QueryString["itemid"]);
                }
                catch (FormatException fex)
                {
                    Session["lastpage"] = "admin_inspections.aspx";
                    Session["error"]    = _functions.ErrorMessage(105);
                    Response.Redirect("error.aspx", false);
                    return;
                }

                sLastPage    = "admin_inspections_items.aspx?id=" + InspectionId.ToString();
                sCurrentPage = "admin_inspection_item_edit.aspx?id=" + InspectionId.ToString() + "&itemid=" + ItemId.ToString();

                Header.AddBreadCrumb("Home", "/selectMode.aspx");
                Header.AddBreadCrumb("Administration", "/admin.aspx");
                Header.AddBreadCrumb("Inspections Manager", "/admin_inspections.aspx");
                Header.AddBreadCrumb("Inspection Items Manager", "/" + sLastPage);
                Header.LeftBarHtml = "Add/Edit/Delete Inspection Item and Add/Delete relationship to PM Items";
                this.PageTitle     = "Inspection Item Edit";

                SaveCancelControl.CancelText    = " Back ";
                SaveCancelControl.ParentPageURL = sLastPage;
                if (!IsPostBack)
                {
                    inspect                  = new clsInspections();
                    inspect.cAction          = "S";
                    inspect.iOrgId           = OrgId;
                    inspect.iId              = InspectionId;
                    inspect.iInspectItemId   = ItemId;
                    ddlCategories.DataSource = new DataView(inspect.GetInspectCategoriesList());
                    ddlCategories.DataBind();
                    if (inspect.InspectItemDetails() == -1)
                    {
                        Session["lastpage"] = sLastPage;
                        Session["error"]    = _functions.ErrorMessage(127);
                        Response.Redirect("error.aspx", false);
                        return;
                    }
                    lblInspectionName.Text = inspect.sInspectionName.Value;
                    tbItemName.Text        = inspect.sInspectItemName.Value;

                    if (ItemId == 0)
                    {
                        tblMain.Rows[5].Visible  = false;
                        tblMain.Rows[6].Visible  = false;
                        tblMain.Rows[7].Visible  = false;
                        tblMain.Rows[8].Visible  = false;
                        tblMain.Rows[9].Visible  = false;
                        tblMain.Rows[10].Visible = false;
                        btnDelete.Visible        = false;
                    }
                    else
                    {
                        ddlCategories.SelectedValue = inspect.iCategoryId.Value.ToString();

                        dgPMItems.DataSource = new DataView(inspect.GetPMServicesByInspectionItem());
                        dgPMItems.DataBind();
                        if (dgPMItems.Items.Count == 0)
                        {
                            dgPMItems.Visible = false;
                        }

                        ShowPMItems();
                    }
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = sLastPage;
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (inspect != null)
                {
                    inspect.Dispose();
                }
            }
        }