示例#1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                string [,] arrBrdCrumbs = new string [1, 2];
                arrBrdCrumbs[0, 0]      = "main.aspx";
                arrBrdCrumbs[0, 1]      = "Home";
                PageTitle        = "Equipment List";
                Header.BrdCrumbs = ParseBreadCrumbs(arrBrdCrumbs, PageTitle);
                Header.PageTitle = PageTitle;
                SourcePageName   = "list.aspx.cs";

                if (!IsPostBack)
                {
                    equip = new clsEquipment();

                    equip.cAction = "S";
                    equip.iOrgId  = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                    dtEquipTypes = equip.GetEquipTypesList();

                    ddlEquipType.DataSource = new DataView(dtEquipTypes);
                    ddlEquipType.DataBind();
                    ddlEquipType.Items.Insert(0, new ListItem("All", "0"));

                    if (Session["EquipTypeId"] != null)
                    {
                        ddlEquipType.SelectedValue = Convert.ToString(Session["EquipTypeId"]);
                    }
                    else
                    {
                        ddlEquipType.SelectedIndex = 0;
                        Session["EquipTypeId"]     = ddlEquipType.SelectedValue;
                    }

                    equip.iTypeId = Convert.ToInt32(ddlEquipType.SelectedValue);

                    ShowList();
                }
            }
            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();
                }
            }
        }
        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();
                }
            }
        }
示例#3
0
        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();
                }
            }
        }
示例#4
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)
                {
                    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();
                }
            }
        }
示例#5
0
        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();
                }
            }
        }
示例#6
0
 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();
         }
     }
 }
示例#7
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();
                }
            }
        }