Esempio n. 1
0
 private void btnAddHoliday_Click(object sender, System.EventArgs e)
 {
     try
     {
         if(adtNewEndDate.Date >= adtNewStartDate.Date)
         {
             inspect = new clsInspections();
             inspect.cAction = "U";
             inspect.iOrgId = OrgId;
             inspect.iHolidayId = 0;
             inspect.daHolidayStartDate = adtNewStartDate.Date;
             inspect.daHolidayEndDate = adtNewEndDate.Date;
             inspect.sHolidayName = tbNewHolidayName.Text;
             inspect.iHolidayPercentOff = Convert.ToInt32(lbNewPercentOff.SelectedValue);
             inspect.HolidayDetail();
             ShowHolidays();
         }
         else
             Header.ErrorMessage = "Start Date must be less than End Date";
     }
     catch(Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"] = "admin_holidays.aspx";
         Session["error"] = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if(inspect != null)
             inspect.Dispose();
     }
 }
 private void btnAddSchedule_Click(object sender, System.EventArgs e)
 {
     try
     {
         inspect = new clsInspections();
         inspect.cAction = "U";
         inspect.iOrgId = OrgId;
         inspect.iInspectScheduleId = 0;
         inspect.sInspectScheduleName= tbScheduleName.Text;
         tbScheduleName.Text = "";
         inspect.InspectScheduleDetails();
         ShowInspectSchedules();
     }
     catch(Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"] = "admin_inspectschedules.aspx";
         Session["error"] = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if(inspect != null)
             inspect.Dispose();
     }
 }
 private void btnDelete_Click(object sender, System.EventArgs e)
 {
     try
     {
         inspect = new clsInspections();
         inspect.cAction = "D";
         inspect.iOrgId = OrgId;
         inspect.iId = InspectionId;
         inspect.iCategoryId = CategoryId;
         if(inspect.InspectCatDetails() == -1)
         {
             Session["lastpage"] = sCurrentPage;
             Session["error"] = _functions.ErrorMessage(156);
             Response.Redirect("error.aspx", false);
             return;
         }
         Response.Redirect(sLastPage, false);
     }
     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();
     }
 }
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                if(!IsPostBack)
                {
                    inspect = new clsInspections();
                    inspect.iOrgId = OrgId;
                    ShowInspectSchedules();
                }
            }
            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(inspect != null)
                    inspect.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 || 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();
            }
        }
        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();
            }
        }
Esempio n. 7
0
 private void dgHolidays_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
 {
     try
     {
         dgHolidays.EditItemIndex = e.Item.ItemIndex;
         inspect = new clsInspections();
         inspect.iOrgId = OrgId;
         ShowHolidays();
     }
     catch(Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"] = "admin_holidays.aspx";
         Session["error"] = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if(inspect != null)
             inspect.Dispose();
     }
 }
 /// <summary>
 /// Update the Category information and positions of items
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btSave_FormSubmit(object sender, EventArgs e)
 {
     int Position, NewPosition;
     try
     {
         inspect = new clsInspections();
         inspect.cAction = "U";
         inspect.iOrgId = OrgId;
         inspect.iId = InspectionId;
         inspect.iCategoryId = CategoryId;
         inspect.sCategoryName = tbCategory.Text;
         inspect.iCatPosition = Convert.ToInt32(ddlOrder.SelectedValue);
         if(inspect.InspectCatDetails() == -1)
         {
             Session["lastpage"] = sCurrentPage;
             Session["error"] = _functions.ErrorMessage(156);
             Response.Redirect("error.aspx", false);
             return;
         }
         foreach(DataGridItem Item in dgInspectItems.Items)
         {
             Position = Convert.ToInt32(((Label)Item.FindControl("lblCatId")).Text);
             NewPosition = Convert.ToInt32(Request.Params["FormPosition" + Item.ItemIndex.ToString()]);
             if(Position != NewPosition)
             {
                 inspect.iInspectItemId = Convert.ToInt32(Item.Cells[0].Text);
                 inspect.iItemPosition = NewPosition;
                 inspect.UpdatePosInspectItem();
             }
         }
         Response.Redirect(sLastPage, false);
     }
     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();
     }
 }
        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["catid"] == null)
                {
                    Session["lastpage"] = "admin_inspections.aspx";
                    Session["error"] = _functions.ErrorMessage(104);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                try
                {
                    InspectionId = Convert.ToInt32(Request.QueryString["id"]);
                    CategoryId = Convert.ToInt32(Request.QueryString["catid"]);
                }
                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_category_edit.aspx?id=" + InspectionId.ToString() + "&catid=" + CategoryId.ToString();

                this.PageTitle = "Inspection Category Edit";
                Header.MainMenuSelectedItem = "Administration";
                Header.AddJavaScriptFile("/admin_inspection_category_edit.js");
                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 Category and Set Category Position and Items Position";

                SaveCancelControl.CancelText= " Back ";
                SaveCancelControl.ParentPageURL = sLastPage;
                if(!IsPostBack)
                {
                    inspect = new clsInspections();
                    inspect.cAction = "S";
                    inspect.iOrgId = OrgId;
                    inspect.iId = InspectionId;
                    inspect.iCategoryId = CategoryId;
                    if(inspect.InspectCatDetails() == -1)
                    {
                        Session["lastpage"] = sLastPage;
                        Session["error"] = _functions.ErrorMessage(156);
                        Response.Redirect("error.aspx", false);
                        return;
                    }
                    lblInspectionName.Text = inspect.sInspectionName.Value;
                    tbCategory.Text = inspect.sCategoryName.Value;
                    for(int i=1; i<= inspect.iCatMaxPosition.Value; i++)
                    {
                        ddlOrder.Items.Add(new ListItem(i.ToString(),i.ToString()));
                    }
                    ddlOrder.SelectedValue = inspect.iCatPosition.Value.ToString();

                    dgInspectItems.DataSource = new DataView(inspect.GetInspectionItemsListByCategory());
                    dgInspectItems.DataBind();

                    if(dgInspectItems.Items.Count > 0 || CategoryId == 0)
                        btnDelete.Enabled = 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();
            }
        }
        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_inspections.aspx";
                    Session["error"] = _functions.ErrorMessage(104);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                try
                {
                    InspectId = Convert.ToInt32(Request.QueryString["id"]);
                }
                catch(FormatException fex)
                {
                    Session["lastpage"] = "admin_inspections.aspx";
                    Session["error"] = _functions.ErrorMessage(105);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                Header.AddBreadCrumb("Home", "/selectMode.aspx");
                Header.AddBreadCrumb("Administration", "/admin.aspx");
                Header.AddBreadCrumb("Inspections Manager", "/admin_inspections.aspx");
                Header.LeftBarHtml = "View Inspection Items";
                this.PageTitle = "Inspection Items Manager";

                lblBack.Text = "<input type=button value=\" Back \" onclick=\"document.location='admin_inspections.aspx'\">";
                if(!IsPostBack)
                {
                    inspect = new clsInspections();
                    inspect.iOrgId = OrgId;
                    inspect.iId = InspectId;
                    repInspections.DataSource = new DataView(inspect.GetInspectionItemsList());
                    repInspections.DataBind();
                    lblInspectionName.Text = inspect.sInspectionName.Value;
                    hlAddCategory.NavigateUrl = "admin_inspection_category_edit.aspx?id=" + InspectId.ToString() + "&catid=0";
                    hlAddInspectionItem.NavigateUrl = "admin_inspection_item_edit.aspx?id=" + InspectId.ToString() + "&itemid=0";
                }
            }
            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(inspect != null)
                    inspect.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 || 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();
            }
        }
 /// <summary>
 /// Update the Inspect Schedule Detail info
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btSave_FormSubmit(object sender, EventArgs e)
 {
     int MinDays, TargetDays, MaxDays;
     try
     {
         MinDays = Convert.ToInt32(tbMinDays.Text);
         MaxDays	= Convert.ToInt32(tbMaxDays.Text);
         TargetDays = Convert.ToInt32(tbTagetDays.Text);
         if(MinDays >= TargetDays)
         {
             Header.ErrorMessage = _functions.ErrorMessage(162);
         }
         else if(TargetDays >= MaxDays)
         {
             Header.ErrorMessage = _functions.ErrorMessage(163);
         }
         else if(MinDays >= MaxDays)
         {
             Header.ErrorMessage = _functions.ErrorMessage(164);
         }
         else
         {
             inspect = new clsInspections();
             inspect.cAction = "U";
             inspect.iOrgId = OrgId;
             inspect.iInspectSchedDetailId = DetailId;
             inspect.iInspectScheduleId = InspectSchedId;
             inspect.iId = Convert.ToInt32(ddlInspections.SelectedValue);
             inspect.iTargetDays = TargetDays;
             inspect.iMinDays = MinDays;
             inspect.iMaxDays = MaxDays;
             if(inspect.InspectSchedDetailDetails() == -1)
             {
                 Session["lastpage"] = sLastPage;
                 Session["error"] = _functions.ErrorMessage(159);
                 Response.Redirect("error.aspx", false);
                 return;
             }
             Response.Redirect(sLastPage, false);
         }
     }
     catch(FormatException fex)
     {
         Header.ErrorMessage = _functions.ErrorMessage(108);
     }
     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();
     }
 }
Esempio n. 13
0
        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();
                }
            }
        }
Esempio n. 14
0
 private void dgHolidays_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
 {
     try
     {
         if(((ActiveUp.WebControls.ActiveDateTime)e.Item.FindControl("adtEndDate")).Date >= ((ActiveUp.WebControls.ActiveDateTime)e.Item.FindControl("adtStartDate")).Date)
         {
             inspect = new clsInspections();
             inspect.cAction = "U";
             inspect.iOrgId = OrgId;
             inspect.iHolidayId = Convert.ToInt32(e.Item.Cells[0].Text);
             inspect.daHolidayStartDate = ((ActiveUp.WebControls.ActiveDateTime)e.Item.FindControl("adtStartDate")).Date;
             inspect.daHolidayEndDate = ((ActiveUp.WebControls.ActiveDateTime)e.Item.FindControl("adtEndDate")).Date;
             inspect.sHolidayName = ((TextBox)e.Item.FindControl("tbHolidayName")).Text;
             inspect.iHolidayPercentOff = Convert.ToInt32(((ListBox)e.Item.FindControl("lbPercentOff")).SelectedValue);
             if(inspect.HolidayDetail() == -1)
             {
                 Session["lastpage"] = "admin_holidays.aspx";
                 Session["error"] = _functions.ErrorMessage(153);
                 Response.Redirect("error.aspx", false);
                 return;
             }
             dgHolidays.EditItemIndex = -1;
             ShowHolidays();
         }
         else
             Header.ErrorMessage = "Start Date must be less than End Date";
     }
     catch(Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"] = "admin_holidays.aspx";
         Session["error"] = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if(inspect != null)
             inspect.Dispose();
     }
 }
 private void dgInspectSchedules_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
 {
     try
     {
         inspect = new clsInspections();
         inspect.iOrgId = OrgId;
         inspect.iInspectScheduleId = Convert.ToInt32(e.Item.Cells[0].Text);
         switch(e.CommandName)
         {
             case "Delete":
                 inspect.cAction = "D";
                 switch(inspect.InspectScheduleDetails())
                 {
                     case -1:
                         Session["lastpage"] = "admin_inspectschedules.aspx";
                         Session["error"] = _functions.ErrorMessage(159);
                         Response.Redirect("error.aspx", false);
                         return;
                     case -2:
                         Header.ErrorMessage = _functions.ErrorMessage(160);
                         break;
                     case -3:
                         Header.ErrorMessage = _functions.ErrorMessage(161);
                         break;
                     case 0:
                         dgInspectSchedules.EditItemIndex = -1;
                         ShowInspectSchedules();
                         break;
                     default:
                         break;
                 }
                 break;
             case "Cancel":
                 dgInspectSchedules.EditItemIndex = -1;
                 ShowInspectSchedules();
                 break;
             case "Edit":
                 dgInspectSchedules.EditItemIndex = e.Item.ItemIndex;
                 ShowInspectSchedules();
                 break;
             case "Update":
                 inspect.cAction = "U";
                 inspect.sInspectScheduleName = ((TextBox)e.Item.FindControl("tbNameEdit")).Text;
                 if(inspect.InspectScheduleDetails() == -1)
                 {
                     Session["lastpage"] = "admin_inspectschedules.aspx";
                     Session["error"] = _functions.ErrorMessage(159);
                     Response.Redirect("error.aspx", false);
                     return;
                 }
                 dgInspectSchedules.EditItemIndex = -1;
                 ShowInspectSchedules();
                 break;
             default:
                 break;
         }
     }
     catch(Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"] = "admin_inspectschedules.aspx";
         Session["error"] = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if(inspect != null)
             inspect.Dispose();
     }
 }
Esempio n. 16
0
        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
            {
                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                if(Request.QueryString["id"] == null)
                {
                    Session["lastpage"] = "admin_inspectschedules.aspx";
                    Session["error"] = _functions.ErrorMessage(104);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                try
                {
                    InspectSchedId = Convert.ToInt32(Request.QueryString["id"]);
                }
                catch(FormatException fex)
                {
                    Session["lastpage"] = "admin_inspectschedules.aspx";
                    Session["error"] = _functions.ErrorMessage(105);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                lblBack.Text = "<input type=button value=\" Back \" onclick=\"document.location='admin_inspectschedules.aspx'\">";
                if(!IsPostBack)
                {
                    inspect = new clsInspections();
                    inspect.iOrgId = OrgId;
                    inspect.iInspectScheduleId = InspectSchedId;
                    dgInspectSchedDetails.DataSource = new DataView(inspect.GetInspectSchedDetailsList());
                    dgInspectSchedDetails.DataBind();
                    lblScheduleName.Text = inspect.sInspectScheduleName.Value;
                    hlAddInspection.NavigateUrl = "admin_inspectschedule_detail_edit.aspx?id=" + InspectSchedId.ToString() + "&detailid=0";
                }
            }
            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(inspect != null)
                    inspect.Dispose();
            }
        }
        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();
            }
        }
        /// <summary>
        /// Update the Inspection Items
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btSave_FormSubmit(object sender, EventArgs e)
        {
            try
                {
                    if(ddlCategories.Items.Count > 0)
                    {
                        inspect = new clsInspections();
                        inspect.cAction = "U";
                        inspect.iOrgId = OrgId;
                        inspect.iInspectItemId = ItemId;
                        inspect.iId = InspectionId;
                        inspect.iCategoryId = Convert.ToInt32(ddlCategories.SelectedValue);
                        inspect.sInspectItemName = tbItemName.Text;
                        inspect.bEnabled = true;
                        inspect.InspectItemDetails();

                        Response.Redirect(sLastPage, false);
                    }
                    else
                        Header.ErrorMessage = _functions.ErrorMessage(158);
                }
                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();
                }
        }
Esempio n. 20
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;

                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();
                }
            }
        }
Esempio n. 21
0
 private void dgHolidays_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
 {
     try
     {
         inspect = new clsInspections();
         inspect.cAction = "D";
         inspect.iOrgId = OrgId;
         inspect.iHolidayId = Convert.ToInt32(e.Item.Cells[0].Text);
         if(inspect.HolidayDetail() == -1)
         {
             Session["lastpage"] = "admin_holidays.aspx";
             Session["error"] = _functions.ErrorMessage(153);
             Response.Redirect("error.aspx", false);
             return;
         }
         ShowHolidays();
     }
     catch(Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"] = "admin_holidays.aspx";
         Session["error"] = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if(inspect != null)
             inspect.Dispose();
     }
 }