Beispiel #1
0
 private void btNext_FormSubmit(object sender, EventArgs e)
 {
     try
     {
         equip          = new clsEquipment();
         equip.iOrgId   = OrgId;
         equip.iUserId  = op.Id;
         equip.iOrderId = OrderId;
         equip.iId      = System.Data.SqlTypes.SqlInt32.Null;
         equip.sNote    = "checking in the spare equipment";
         equip.EquipSpareTo(true);
         Response.Redirect("ok_viewNotes.aspx?id=" + OrderId.ToString(), false);
     }
     catch (Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"]     = "ok_updateSpare.aspx?id=" + OrderId.ToString();
         Session["error"]        = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if (equip != null)
         {
             equip.Dispose();
         }
     }
 }
 private void repOperators_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Select")
         {
             UserId = Convert.ToInt32(e.CommandArgument);
             ViewState["TempOpId"]     = UserId;
             lblNewTempOperator.Text   = ((Label)e.Item.FindControl("lblLastName")).Text + ", " + ((Label)e.Item.FindControl("lblFirstName")).Text;
             pnlVerifyOperator.Visible = true;
             pnlSelectOperator.Visible = false;
         }
     }
     catch (Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"]     = "e_selectTempOperator.aspx?id=" + EquipId.ToString();
         Session["error"]        = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if (equip != null)
         {
             equip.Dispose();
         }
     }
 }
Beispiel #3
0
        private void btnFiltration_Click(object sender, System.EventArgs e)
        {
            try
            {
                equip = new clsEquipment();

                equip.EnableDefaultFiltration = false;
                equip.iOrgId          = OrgId;
                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();
                ShowList();
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = "wo_selectSpareEquip.aspx?id=" + OrderId.ToString() + "&equipid=" + EquipId.ToString();
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (equip != null)
                {
                    equip.Dispose();
                }
            }
        }
Beispiel #4
0
 private void btSave_FormSubmit(object sender, EventArgs e)
 {
     try
     {
         equip                  = new clsEquipment();
         equip.iOrgId           = OrgId;
         equip.iId              = EquipId;
         equip.iUserId          = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true);
         equip.iEquipOperatorId = Convert.ToInt32(ddAssignTo.SelectedValue);
         equip.sNote            = tbNote.Text;
         equip.EquipAssignedTo();
         Response.Redirect("e_view.aspx?id=" + EquipId.ToString(), false);
     }
     catch (Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"]     = "e_reassign.aspx?id=" + EquipId.ToString();
         Session["error"]        = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if (equip != null)
         {
             equip.Dispose();
         }
     }
 }
 private void btnReport_Click(object sender, System.EventArgs e)
 {
     try
     {
         equip                    = new clsEquipment();
         equip.iOrgId             = OrgId;
         equip.iId                = EquipId;
         equip.daMinDate          = adtStartDate.Date;
         equip.daMaxDate          = adtEndDate.Date.AddHours(23).AddMinutes(59);
         dgAssignments.DataSource = new DataView(equip.GetEquipmentAssignmentList());
         dgAssignments.DataBind();
         lblEquipId.Text = equip.sEquipId.Value;
     }
     catch (Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"]     = "e_viewEquipAssignmentReport.aspx?id=" + EquipId.ToString();
         Session["error"]        = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if (equip != null)
         {
             equip.Dispose();
         }
     }
 }
Beispiel #6
0
        private void btnChangeType_Click(object sender, System.EventArgs e)
        {
            try
            {
                Session["EquipTypeId"] = ddlEquipType.SelectedValue;

                equip = new clsEquipment();

                equip.cAction = "S";
                equip.iOrgId  = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);
                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();
                }
            }
        }
Beispiel #7
0
 private void dgUnAssignedIssues_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
 {
     try
     {
         dgUnAssignedIssues.EditItemIndex = e.Item.ItemIndex;
         equip        = new clsEquipment();
         equip.iId    = EquipId;
         equip.iOrgId = OrgId;
         ShowIssues();
     }
     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 (equip != null)
         {
             equip.Dispose();
         }
     }
 }
Beispiel #8
0
        private void btnNO_Click(object sender, System.EventArgs e)
        {
            try
            {
                ViewState["SelectedWorkOrderId"] = null;
                pnlNoneEquipment.Visible         = false;
                pnlOneEquipment.Visible          = false;
                pnlManyEquipment.Visible         = true;

                equip         = new clsEquipment();
                equip.iOrgId  = OrgId;
                equip.iUserId = 6;                 //op.Id;

                dtEquipments             = equip.GetEquipListForCheckOut();
                repEquipments.DataSource = new DataView(dtEquipments);
                repEquipments.DataBind();
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = "ok_selectWorkOrder.aspx";
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (equip != null)
                {
                    equip.Dispose();
                }
            }
        }
Beispiel #9
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                if (!IsPostBack)
                {
                    OperatorInfo op = new OperatorInfo(Request.Cookies["bfp_operator"].Value);
                    lblFirstName.Text        = op.FirstName;
                    equip                    = new clsEquipment();
                    equip.iOrgId             = OrgId;
                    equip.iUserId            = op.Id;
                    repEquipments.DataSource = new DataView(equip.GetEquipListByOperator2());
                    repEquipments.DataBind();
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = "ok_mainMenu.aspx";
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (equip != null)
                {
                    equip.Dispose();
                }
            }
        }
Beispiel #10
0
 /// <summary>
 /// Updating the equipment information
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btSave_FormSubmit(object sender, EventArgs e)
 {
     try
     {
         equip              = new clsEquipment();
         equip.cAction      = "U";
         equip.iId          = EquipId;
         equip.iOrgId       = OrgId;
         equip.iModelId     = mmValue.ModelId;
         equip.iYear        = Convert.ToInt32(tbYear.Text);
         equip.iDeptId      = Convert.ToInt32(ddlDepts.SelectedValue);
         equip.iLocId       = Convert.ToInt32(ddlLocs.SelectedValue);
         equip.bSpare       = chSpare.Checked;
         equip.sFuelCode    = tbFuelCode.Text;
         equip.sEquipId     = tbEquipId.Text;
         equip.sVinSerial   = tbVinSerial.Text;
         equip.sPlateNumber = tbPlateNumber.Text;
         equip.iUserId      = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true);
         if (equip.EquipmentDetail() == -1)
         {
             Session["lastpage"] = "e_edit.aspx?id=" + EquipId.ToString();
             Session["error"]    = _functions.ErrorMessage(107);
             sURL_return         = "error.aspx";
         }
         else
         {
             if (cbReassign.Checked)
             {
                 sURL_return = "e_reassign.aspx?id=" + EquipId.ToString();
             }
             else
             {
                 sURL_return = "e_view.aspx?id=" + EquipId.ToString();
             }
         }
     }
     catch (FormatException fex)
     {
         Session["lastpage"] = "e_edit.aspx?id=" + EquipId.ToString();
         Session["error"]    = _functions.ErrorMessage(108);
         sURL_return         = "error.aspx";
     }
     catch (Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"]     = "e_edit.aspx?id=" + EquipId.ToString();
         Session["error"]        = ex.Message;
         Session["error_report"] = ex.ToString();
         sURL_return             = "error.aspx";
     }
     finally
     {
         if (equip != null)
         {
             equip.Dispose();
         }
     }
     Response.Redirect(sURL_return, true);
 }
        private void btnYES_Click(object sender, System.EventArgs e)
        {
            DataTable dtSpareEquip = null;

            try
            {
                equip        = new clsEquipment();
                equip.iOrgId = OrgId;
                equip.iId    = EquipId;
                dtSpareEquip = equip.GetSpareEquipList();

                if (dtSpareEquip.Rows.Count > 0)
                {                 // view spare equipments
                    pnlSelectSpare.Visible  = true;
                    pnlNoSpare.Visible      = false;
                    pnlViewQuestion.Visible = false;

                    repSpareEquip.DataSource = new DataView(dtSpareEquip);
                    repSpareEquip.DataBind();
                }
                else
                {
                    // no spare
                    pnlNoSpare.Visible      = true;
                    pnlSelectSpare.Visible  = false;
                    pnlViewQuestion.Visible = false;
                    btnBack.Visible         = false;

                    NextBackControl.sCSSClass = "ok_input_button";
                    if (Operation == "CheckIn")
                    {
                        NextBackControl.BackText = "<< Back";
                        NextBackControl.BackPage = BackPage;
                        NextBackControl.NextText = "Continue >>";
                    }
                    else
                    {
                        NextBackControl.NextText    = "Back to Main Menu";
                        NextBackControl.BackVisible = false;
                    }
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = CurrentPage;
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (equip != null)
                {
                    equip.Dispose();
                }
            }
        }
Beispiel #12
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();
                }
            }
        }
Beispiel #13
0
        private void btnFind_Click(object sender, System.EventArgs e)
        {
            int      EquipId, OrderId;
            DataView dwOrders;

            try
            {
                equip          = new clsEquipment();
                equip.iOrgId   = OrgId;
                equip.sEquipId = tbEquipmentId.Text;
                if (equip.SearchEquipId() == 0)
                {
                    Header.ErrorMessage = "<span style='FONT-SIZE:12pt;'>The specified equipment could not be located</span>";
                    tbEquipmentId.Text  = "";
                }
                else
                {
                    EquipId             = equip.iId.Value;
                    order               = new clsWorkOrders();
                    order.iOrgId        = OrgId;
                    order.daCurrentDate = DateTime.Now;
                    dwOrders            = new DataView(order.GetActivityWorkOrder());
                    dwOrders.RowFilter  = "EquipId = " + EquipId.ToString();
                    if (dwOrders.Count > 0)
                    {
                        dwOrders.Sort = "StatusColor desc, OperatorStatusName asc";
                        OrderId       = Convert.ToInt32(dwOrders[0]["Id"].ToString());
                        Response.Redirect("ok_mainDetails.aspx?id=" + OrderId.ToString() + "&back=mainmenu2", false);
                    }
                    else
                    {
                        Response.Redirect("ok_selectEquipment.aspx?orderid=0&equipid=" + EquipId.ToString() + "&back=mainmenu2", false);
                    }
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = "ok_mainMenu2.aspx";
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (equip != null)
                {
                    equip.Dispose();
                }
                if (order != null)
                {
                    order.Dispose();
                }
            }
        }
Beispiel #14
0
        private void lbCheckInSpare_Click(object sender, System.EventArgs e)
        {
            try
            {
                equip          = new clsEquipment();
                equip.iOrgId   = OrgId;
                equip.iUserId  = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true);
                equip.iId      = 0;
                equip.iOrderId = OrderId;
                equip.sNote    = "checking in the spare equipment";
                if (equip.EquipSpareTo(false) == -1)
                {
                    Session["lastpage"] = m_sLastPage;
                    Session["error"]    = _functions.ErrorMessage(120);
                    Response.Redirect("error.aspx", false);
                }
                else
                {
                    switch (sBack)
                    {
                    case "open":
                        Response.Redirect("wo_openWorkOrder.aspx?id=" + OrderId.ToString(), false);
                        break;

                    case "edit":
                        Response.Redirect("wo_editWorkOrder.aspx?id=" + OrderId.ToString(), false);
                        break;

                    case "checkin":
                        Response.Redirect("wo_viewCheckIn.aspx?id=" + OrderId.ToString(), false);
                        break;

                    default:
                        Response.Redirect("wo_addRepairs.aspx?id=" + OrderId.ToString(), false);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = "wo_selectSpareEquip.aspx?id=" + OrderId.ToString() + "&equipid=" + EquipId.ToString();
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (equip != null)
                {
                    equip.Dispose();
                }
            }
        }
Beispiel #15
0
        private void dgUnAssignedIssues_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            try
            {
                order                  = new clsWorkOrders();
                equip                  = new clsEquipment();
                equip.iId              = EquipId;
                equip.iOrgId           = OrgId;
                order.cAction          = "S";
                order.iOrgId           = OrgId;
                order.iReportedIssueId = Convert.ToInt32(((Label)e.Item.FindControl("lblReportIssueId")).Text);
                if (order.WorkOrderReportedIssuesDetail() == -1)
                {
                    Session["lastpage"] = sCurrentPage;
                    Session["error"]    = _functions.ErrorMessage(121);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                order.cAction     = "U";
                order.sReportDesc = ((TextBox)e.Item.FindControl("tbIssueName")).Text;
                if (order.WorkOrderReportedIssuesDetail() == -1)
                {
                    Session["lastpage"] = sCurrentPage;
                    Session["error"]    = _functions.ErrorMessage(121);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                dgUnAssignedIssues.EditItemIndex = -1;

                ShowIssues();
            }
            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 (equip != null)
                {
                    equip.Dispose();
                }
                if (order != null)
                {
                    order.Dispose();
                }
            }
        }
Beispiel #16
0
 /// <summary>
 /// Update the disposed data for current equipment
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btSave_FormSubmit(object sender, EventArgs e)
 {
     try
     {
         equip                 = new clsEquipment();
         equip.cAction         = "S";
         equip.iOrgId          = OrgId;
         equip.iId             = EquipId;
         equip.cAction         = "U";
         equip.daDisposed      = adtDisposed.Date;
         equip.daOutOfService  = adtOutOfService.Date;
         equip.sDispOrgContact = tbOrgContact.Text;
         equip.curDispAmount   = Convert.ToDecimal(tbAmount.Text);
         equip.dmDispUnits     = Convert.ToDecimal(tbUnits.Text);
         equip.sDispNotes      = tbNotes.Text;
         equip.iDispMethod     = Convert.ToInt32(ddMethod.SelectedValue);
         if (equip.EquipmentDetail_Disp() != -1)
         {
             Response.Redirect("e_view.aspx?id=" + EquipId.ToString(), false);
         }
         else
         {
             Session["lastpage"] = "e_editDisp.aspx?id=" + EquipId.ToString();
             Session["error"]    = _functions.ErrorMessage(107);
             Response.Redirect("error.aspx", false);
         }
     }
     catch (FormatException fex)
     {
         Session["lastpage"] = "e_editDisp.aspx?id=" + EquipId.ToString();
         Session["error"]    = _functions.ErrorMessage(108);
         Response.Redirect("error.aspx", false);
     }
     catch (Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"]     = "e_editDisp.aspx?id=" + EquipId.ToString();
         Session["error"]        = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if (equip != null)
         {
             equip.Dispose();
         }
     }
 }
Beispiel #17
0
        private void btnAddRepair_Click(object sender, System.EventArgs e)
        {
            try
            {
                order                  = new clsWorkOrders();
                equip                  = new clsEquipment();
                equip.iId              = EquipId;
                equip.iOrgId           = OrgId;
                order.cAction          = "U";
                order.iOrgId           = OrgId;
                order.iEquipId         = EquipId;
                order.iReportedIssueId = 0;
                order.iRepairCatId     = Convert.ToInt32(ddlCategory.SelectedValue);
                order.sReportDesc      = tbDesc.Text;
                order.iId              = SqlInt32.Null;
                order.iServiceResultId = SqlInt32.Null;
                order.iServiceCheckId  = SqlInt32.Null;
                order.iRepairMultId    = SqlInt32.Null;
                if (order.WorkOrderReportedIssuesDetail() == -1)
                {
                    Session["lastpage"] = sCurrentPage;
                    Session["error"]    = _functions.ErrorMessage(121);
                    Response.Redirect("error.aspx", false);
                }
                tbDesc.Text = "";
                ddlCategory.SelectedIndex = 0;

                ShowIssues();
            }
            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 (equip != null)
                {
                    equip.Dispose();
                }
                if (order != null)
                {
                    order.Dispose();
                }
            }
        }
Beispiel #18
0
 private void btSave_FormSubmit(object sender, EventArgs e)
 {
     try
     {
         equip                = new clsEquipment();
         equip.cAction        = "U";
         equip.iOrgId         = OrgId;
         equip.iId            = EquipId;
         equip.daInService    = adtInService.Date;
         equip.daAquired      = adtAquired.Date;
         equip.curPurAmount   = Convert.ToDecimal(tbAmount.Text);
         equip.sPurOrgContact = tbOrgContact.Text;
         equip.sPurNotes      = tbNotes.Text;
         equip.dmPurUnits     = Convert.ToDecimal(tbUnits.Text);
         if (equip.EquipmentDetail_Aquis() != -1)
         {
             Response.Redirect("e_view.aspx?id=" + EquipId.ToString(), false);
             return;
         }
         else
         {
             Session["lastpage"] = "e_editAquis.aspx?id=" + EquipId.ToString();
             Session["error"]    = _functions.ErrorMessage(102);
             Response.Redirect("error.aspx", false);
         }
     }
     catch (FormatException fex)
     {
         Session["lastpage"] = "e_editAquis.aspx?id=" + EquipId.ToString();
         Session["error"]    = _functions.ErrorMessage(108);
         Response.Redirect("error.aspx", false);
     }
     catch (Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"]     = "e_editAquis.aspx?id=" + EquipId.ToString();
         Session["error"]        = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if (equip != null)
         {
             equip.Dispose();
         }
     }
 }
Beispiel #19
0
 private void btSave_FormSubmit(object sender, 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;
         }
         equip             = new clsEquipment();
         equip.iOrgId      = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);
         equip.iId         = EquipId;
         equip.iUserId     = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true);
         equip.iAssignedTo = Convert.ToInt32(ddAssignTo.SelectedValue);
         equip.sNote       = tbNote.Text;
         equip.EquipAssignedTo();
         Response.Redirect(ParentPageURL, false);
     }
     catch (Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"]     = "reassign.aspx?id=" + EquipId.ToString();
         Session["error"]        = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if (equip != null)
         {
             equip.Dispose();
         }
     }
 }
Beispiel #20
0
 private void btSave_FormSubmit(object sender, EventArgs e)
 {
     try
     {
         equip                    = new clsEquipment();
         equip.cAction            = "U";
         equip.iOrgId             = OrgId;
         equip.iId                = EquipId;
         equip.iUserId            = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true);
         equip.iPMSched           = Convert.ToInt32(ddPMScheduleId.SelectedValue);
         equip.iInspectScheduleId = Convert.ToInt32(ddInspectionId.SelectedValue);
         equip.dmCurrentUnits     = Convert.ToDecimal(tbCurrentUnits.Text);
         if (equip.EquipmentDetail_Alt() == -1)
         {
             Session["lastpage"] = "e_edit2.aspx?id=" + EquipId.ToString();
             Session["error"]    = _functions.ErrorMessage(107);
             Response.Redirect("error.aspx", false);
             return;
         }
         else
         {
             Response.Redirect("e_view.aspx?id=" + EquipId.ToString(), false);
         }
     }
     catch (FormatException fex)
     {
         Session["lastpage"] = "e_edit2.aspx?id=" + EquipId.ToString();
         Session["error"]    = _functions.ErrorMessage(108);
         Response.Redirect("error.aspx", false);
     }
     catch (Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"]     = "e_edit2.aspx?id=" + EquipId.ToString();
         Session["error"]        = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if (equip != null)
         {
             equip.Dispose();
         }
     }
 }
        private void btnFiltration_Click(object sender, System.EventArgs e)
        {
            try
            {
                equip = new clsEquipment();

                equip.iOrgId          = OrgId;
                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.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;

                dgInspections.DataSource = new DataView(equip.GetEquipInspectList_Filter());
                dgInspections.DataBind();
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = "wo_showEquipsForInspect.aspx";
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (equip != null)
                {
                    equip.Dispose();
                }
            }
        }
Beispiel #22
0
 private void btnFind_Click(object sender, System.EventArgs e)
 {
     try
     {
         equip          = new clsEquipment();
         equip.iOrgId   = OrgId;
         equip.sEquipId = tbEquipId.Text;
         equip.GetEquipId();
         if (equip.iId.Value == 0)
         {
             lblError.Visible = true;
             tbEquipId.Text   = "";
         }
         else
         {
             pnlFindEquipment.Visible     = false;
             pnlManyEquipment.Visible     = false;
             pnlOneEquipment.Visible      = true;
             ViewState["SelectedEqiupId"] = equip.iId.Value.ToString();
             lblEquipId.Text   = tbEquipId.Text;
             lblEquipType.Text = equip.sType.Value;
             lblMakeModel.Text = equip.sMakeModelName.Value;
             lblYear.Text      = equip.iYear.Value.ToString();
         }
     }
     catch (Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"]     = "ok_selectEquipment.aspx?orderid=" + OrderId.ToString();
         Session["error"]        = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if (equip != null)
         {
             equip.Dispose();
         }
     }
 }
        private void btnBackInt_Click(object sender, System.EventArgs e)
        {
            try
            {
                pnlViewQuestion.Visible = true;
                pnlSelectSpare.Visible  = false;
                pnlNoSpare.Visible      = false;

                lblFirstName.Text = op.FirstName;
                equip             = new clsEquipment();
                equip.iOrgId      = OrgId;
                equip.iId         = EquipId;
                if (equip.GetEquipInfo() != -1)
                {
                    lblEquipType.Text = equip.sType.Value;
                }
                else
                {
                    Session["lastpage"] = CurrentPage;
                    Session["error"]    = _functions.ErrorMessage(102);
                    Response.Redirect("error.aspx", false);
                    return;
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = CurrentPage;
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (equip != null)
                {
                    equip.Dispose();
                }
            }
        }
 private void repOperators_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Select")
         {
             UserId = Convert.ToInt32(e.CommandArgument);
             // assign operator to equipment
             equip                  = new clsEquipment();
             equip.iOrgId           = OrgId;
             equip.iId              = EquipId;
             equip.iUserId          = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true);
             equip.iEquipOperatorId = UserId;
             equip.sNote            = "changing old operator to new during Roadside Repair procedure";
             equip.EquipAssignedTo();
             pnlSelectOperator.Visible = false;
             pnlVerifyOperator.Visible = true;
             EquipmentDetails();
         }
     }
     catch (Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"]     = "wo_selectOperator.aspx?equipid=" + EquipId.ToString() + "&orderid=" + OrderId.ToString();
         Session["error"]        = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if (equip != null)
         {
             equip.Dispose();
         }
     }
 }
Beispiel #25
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 Disposal Information of Equipment";


                SaveCancelControl.ParentPageURL = ParentPageURL;

                if (!IsPostBack)
                {
                    equip         = new clsEquipment();
                    equip.cAction = "S";
                    equip.iOrgId  = OrgId;
                    equip.iId     = EquipId;

                    ddMethod.DataTextField  = "vchName";
                    ddMethod.DataValueField = "Id";
                    ddMethod.DataSource     = new DataView(equip.GetEquipDispMethodsList());
                    ddMethod.DataBind();
                    // getting equipment's data
                    if (equip.EquipmentDetail_Disp() != -1)
                    {
                        if (equip.daDisposed.IsNull)
                        {
                            adtDisposed.Date = new DateTime(adtDisposed.MinYear, 1, 1);
                        }
                        else
                        {
                            adtDisposed.Date = equip.daDisposed.Value;
                        }
                        if (equip.daOutOfService.IsNull)
                        {
                            adtOutOfService.Date = new DateTime(adtOutOfService.MinYear, 1, 1);
                        }
                        else
                        {
                            adtOutOfService.Date = equip.daOutOfService.Value;
                        }
                        if (equip.sDispOrgContact.IsNull)
                        {
                            tbOrgContact.Text = "";
                        }
                        else
                        {
                            tbOrgContact.Text = equip.sDispOrgContact.Value;
                        }
                        if (equip.curDispAmount.IsNull)
                        {
                            tbAmount.Text = "";
                        }
                        else
                        {
                            tbAmount.Text = equip.curDispAmount.Value.ToString("0.00");
                        }
                        if (equip.dmDispUnits.IsNull)
                        {
                            tbUnits.Text = "";
                        }
                        else
                        {
                            tbUnits.Text = Convert.ToDouble(equip.dmDispUnits.Value).ToString();
                        }
                        if (equip.sDispNotes.IsNull)
                        {
                            tbNotes.Text = "";
                        }
                        else
                        {
                            tbNotes.Text = equip.sDispNotes.Value;
                        }
                        if (equip.iDispMethod.IsNull)
                        {
                            ddMethod.SelectedIndex = 0;
                        }
                        else
                        {
                            ddMethod.SelectedValue = equip.iDispMethod.Value.ToString();
                        }
                    }
                    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 (equip != null)
                {
                    equip.Dispose();
                }
            }
        }
Beispiel #26
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (Request.QueryString["orderid"] == null)
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"]    = _functions.ErrorMessage(104);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                try
                {
                    EquipId   = Convert.ToInt32(Request.QueryString["equipid"]);
                    OrderId   = Convert.ToInt32(Request.QueryString["orderid"]);
                    sBackPage = Request.QueryString["back"];
                }
                catch (FormatException fex)
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"]    = _functions.ErrorMessage(105);
                    Response.Redirect("error.aspx", false);
                    return;
                }

                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                sBackURL = "ok_mainMenu.aspx";
                if (sBackPage == "maindetails")
                {
                    sBackURL = "ok_mainDetails.aspx?id=" + OrderId.ToString();
                }
                if (sBackPage == "mainmenu2")
                {
                    sBackURL = "ok_mainMenu2.aspx";
                }
                btnBack.Attributes.Add("onclick", "javascript:document.location='" + sBackURL + "'");

                if (!IsPostBack)
                {
                    OperatorInfo op = new OperatorInfo(Request.Cookies["bfp_operator"].Value);
                    lblFirstName1.Text = lblFirstName2.Text = lblFirstName3.Text = op.FirstName;
                    equip         = new clsEquipment();
                    equip.iOrgId  = OrgId;
                    equip.iUserId = op.Id;
                    dtEquipments  = equip.GetEquipListByOperator();
                    if (dtEquipments.Rows.Count < 1)
                    {
                        // none equipments mode
                        pnlFindEquipment.Visible = true;
                    }
                    else if (dtEquipments.Rows.Count == 1)
                    {
                        // one equipment mode
                        pnlOneEquipment.Visible      = true;
                        lblEquipId.Text              = dtEquipments.Rows[0]["EquipId"].ToString();
                        lblEquipType.Text            = dtEquipments.Rows[0]["TypeName"].ToString();
                        lblMakeModel.Text            = dtEquipments.Rows[0]["MakeName"].ToString() + "/" + dtEquipments.Rows[0]["ModelName"].ToString();
                        lblYear.Text                 = dtEquipments.Rows[0]["Year"].ToString();
                        ViewState["SelectedEqiupId"] = dtEquipments.Rows[0]["Id"].ToString();
                    }
                    else if (dtEquipments.Rows.Count > 1)
                    {
                        // manu equipments mode
                        pnlManyEquipment.Visible = true;
                        repEquipments.DataSource = new DataView(dtEquipments);
                        repEquipments.DataBind();
                    }
                    if (OrderId != 0)
                    {
                        pnlFindEquipment.Visible = false;
                        pnlManyEquipment.Visible = false;
                        pnlOneEquipment.Visible  = true;
                        order        = new clsWorkOrders();
                        order.iOrgId = OrgId;
                        order.iId    = OrderId;
                        if (order.GetEquipInfo() == -1)
                        {
                            Session["lastpage"] = sBackURL;
                            Session["error"]    = _functions.ErrorMessage(120);
                            Response.Redirect("error.aspx", false);
                        }
                        else
                        {
                            lblEquipId.Text              = order.sEquipId.Value;
                            lblEquipType.Text            = order.sEquipTypeName.Value;
                            lblMakeModel.Text            = order.sEquipMakeModel.Value;
                            lblYear.Text                 = order.sEquipYear.Value;
                            ViewState["SelectedEqiupId"] = order.iEquipId.Value.ToString();
                        }
                    }
                    else
                    {
                        if (EquipId != 0)
                        {
                            pnlFindEquipment.Visible = false;
                            pnlManyEquipment.Visible = false;
                            pnlOneEquipment.Visible  = true;
                            equip.iId = EquipId;
                            if (equip.GetEquipInfo() == -1)
                            {
                                Session["lastpage"] = sBackURL;
                                Session["error"]    = _functions.ErrorMessage(102);
                                Response.Redirect("error.aspx", false);
                            }
                            else
                            {
                                lblEquipId.Text              = equip.sEquipId.Value;
                                lblEquipType.Text            = equip.sType.Value;
                                lblMakeModel.Text            = equip.sMakeModelName.Value;
                                lblYear.Text                 = equip.iYear.Value.ToString();
                                ViewState["SelectedEqiupId"] = EquipId.ToString();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = sBackURL;
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (order != null)
                {
                    order.Dispose();
                }
                if (equip != null)
                {
                    equip.Dispose();
                }
            }
        }
        /// <summary>
        /// Procedure close the work order detail
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btSave_FormSubmit(object sender, EventArgs e)
        {
            DateTime daCurrentDate;

            try
            {
                daCurrentDate       = DateTime.Now;
                order               = new clsWorkOrders();
                order.iOrgId        = OrgId;
                order.iId           = OrderId;
                order.sInitials     = Signature.sInitials;
                order.sPIN          = Signature.sPIN;
                order.sReleasedTo   = tbReleasedTo.Text;
                order.daCurrentDate = _functions.CorrectDate(adtCheckOut.Date);
                // signing the Check-Out of Equipment by Technician
                if (order.SigningEquipmentCheckOut() == -1)
                {
                    Signature.sError = _functions.ErrorMessage(140);
                }
                else
                {
                    equip          = new clsEquipment();
                    equip.iOrgId   = OrgId;
                    equip.iUserId  = order.iUserId;
                    equip.iOrderId = OrderId;
                    equip.iId      = System.Data.SqlTypes.SqlInt32.Null;
                    equip.sNote    = "";
                    equip.EquipSpareTo(false);

                    // redirect to the finish screen
                    BackFinishScreen finish = new BackFinishScreen();

                    finish.sMainText = "The Equipment has been checked-out successfully!";

                    finish.bMainMenuVisible = true;
                    finish.sMainMenuText    = "[Return to Main Menu]";
                    finish.sMainMenuURL     = "main.aspx";

                    finish.bContinueVisible = false;

                    finish.bViewVisible = true;
                    finish.sViewText    = "[Return to Work Order Detail]";
                    finish.sViewURL     = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString();

                    finish.bAdditionalVisible = false;

                    finish.bPrintVisible = false;

                    Session["BackFinish"] = finish;

                    Response.Redirect("wo_finish.aspx", false);
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = "wo_viewCheckOut.aspx?id=" + OrderId.ToString();
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (equip != null)
                {
                    equip.Dispose();
                }
                if (order != null)
                {
                    order.Dispose();
                }
            }
        }
Beispiel #28
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            int l_iMileage;

            try
            {
                if ((Request.QueryString["equipid"] == null) && (Request.QueryString["orderid"] == null))
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"]    = _functions.ErrorMessage(104);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                try
                {
                    OrderId = Convert.ToInt32(Request.QueryString["orderid"]);
                    EquipId = Convert.ToInt32(Request.QueryString["equipid"]);
                }
                catch (FormatException fex)
                {
                    Session["lastpage"] = "ok_mainMenu.aspx";
                    Session["error"]    = _functions.ErrorMessage(105);
                    Response.Redirect("error.aspx", false);
                    return;
                }

                OrgId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, false);

                NextBackControl.BackText  = "<< Back";
                NextBackControl.BackPage  = "ok_selectEquipment.aspx?orderid=" + OrderId.ToString();
                NextBackControl.NextText  = "Continue >>";
                NextBackControl.sCSSClass = "ok_input_button";

                op = new OperatorInfo(Request.Cookies["bfp_operator"].Value);

                if (!IsPostBack)
                {
                    equip        = new clsEquipment();
                    equip.iOrgId = OrgId;
                    equip.iId    = EquipId;

                    if (equip.GetEquipInfo() != -1)
                    {
                        if (0 == Decimal.Compare(Decimal.Floor(equip.dmCurrentUnits.Value), equip.dmCurrentUnits.Value))
                        {
                            lblCurrentUnits.Text = Decimal.Floor(equip.dmCurrentUnits.Value).ToString() + " " + equip.sMeasure.Value;
                        }
                        else
                        {
                            lblCurrentUnits.Text = equip.dmCurrentUnits.Value.ToString("F") + " " + equip.sMeasure.Value;
                        }
                        //mileage
                        lblMeasure.Text      = equip.sMeasure.Value;
                        lblMeasure2.Text     = equip.sMeasure.Value;
                        lblMeasure3.Text     = equip.sMeasure.Value;
                        lblEquipId.Text      = equip.sEquipId.Value;
                        lblEquipType.Text    = equip.sType.Value;
                        rvUnits.MinimumValue = equip.dmCurrentUnits.Value.ToString();
                        rvUnits.ErrorMessage = "Value must be greater than was " + equip.dmCurrentUnits.Value.ToString("F");
                    }
                    else
                    {
                        Session["lastpage"] = "ok_selectEquipment.aspx?orderid=" + OrderId.ToString();
                        Session["error"]    = _functions.ErrorMessage(102);
                        Response.Redirect("error.aspx", false);
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = "ok_selectEquipment.aspx?orderid=" + OrderId.ToString();
                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 (Request.QueryString["id"] == null)
                {
                    Session["lastpage"] = "e_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"] = "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 = "View Operators Assignments of Equipment";

                if (!IsPostBack)
                {
                    dtCurrentDate     = DateTime.Now;
                    adtEndDate.Date   = dtCurrentDate;
                    adtStartDate.Date = dtCurrentDate.AddDays(-365);
                    equip             = new clsEquipment();
                    equip.iOrgId      = OrgId;
                    equip.iId         = EquipId;
                    if (equip.GetEquipInfo() == -1)
                    {
                        Session["lastpage"] = "e_view.aspx?id=" + EquipId.ToString();
                        Session["error"]    = _functions.ErrorMessage(102);
                        Response.Redirect("error.aspx", false);
                    }
                    lblEquipId.Text = equip.sEquipId.Value;
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = "e_view.aspx?id=" + EquipId.ToString();
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (equip != null)
                {
                    equip.Dispose();
                }
            }
        }
Beispiel #30
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();
                }
            }
        }