コード例 #1
0
        private void dgFutureIssues_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            try
            {
                int FutureOrderId;

                if (e.CommandName == "Assign")
                {
                    order                  = new clsWorkOrders();
                    order.cAction          = "S";
                    order.iOrgId           = OrgId;
                    order.iReportedIssueId = Convert.ToInt32(e.Item.Cells[0].Text);
                    // getting the undone repair information
                    if (order.WorkOrderReportedIssuesDetail() == -1)
                    {
                        Session["lastpage"] = m_sBackUrl;
                        Session["error"]    = _functions.ErrorMessage(121);
                        Response.Redirect("error.aspx", false);
                    }
                    FutureOrderId = order.iId.Value;
                    // updating the old undone repair
                    order.cAction          = "U";
                    order.iId              = OrderId;
                    order.iServiceResultId = SqlInt32.Null;
                    order.iServiceCheckId  = SqlInt32.Null;
                    order.iRepairMultId    = SqlInt32.Null;
                    if (order.WorkOrderReportedIssuesDetail() == -1)
                    {
                        Session["lastpage"] = m_sBackUrl;
                        Session["error"]    = _functions.ErrorMessage(121);
                        Response.Redirect("error.aspx", false);
                    }
                    // check future work order
                    // if it is empty then to delete it
                    order.iId = FutureOrderId;
                    if (order.DeleteFutureWorkOrder() == -1)
                    {
                        Session["lastpage"] = m_sBackUrl;
                        Session["error"]    = _functions.ErrorMessage(120);
                        Response.Redirect("error.aspx", false);
                    }
                    ShowIssues(OrderId);
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = m_sBackUrl;
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (order != null)
                {
                    order.Dispose();
                }
            }
        }
コード例 #2
0
 private void dgFutureInspections_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
 {
     try
     {
         int FutureOrderId;
         if (e.CommandName == "Assign")
         {
             order                 = new clsWorkOrders();
             order.iId             = OrderId;
             order.iOrgId          = OrgId;
             order.iWOInspectionId = Convert.ToInt32(e.Item.Cells[0].Text);
             // move inspection from future work order
             if (order.SetFutureInspection() == -1)
             {
                 Session["lastpage"] = m_sBackUrl;
                 Session["error"]    = _functions.ErrorMessage(124);
                 Response.Redirect("error.aspx", false);
             }
             // delete future empty work order
             if (order.DeleteFutureWorkOrder() == -1)
             {
                 Session["lastpage"] = m_sBackUrl;
                 Session["error"]    = _functions.ErrorMessage(120);
                 Response.Redirect("error.aspx", false);
             }
             order.iId = OrderId;
             dgInspections.DataSource = new DataView(order.GetInspectionsListForWorkOrder());
             dgInspections.DataBind();
             dtFutureInspections = order.GetFutureInspections();
             if (dtFutureInspections.Rows.Count > 0)
             {
                 dgFutureInspections.DataSource = new DataView(dtFutureInspections);
                 dgFutureInspections.DataBind();
             }
             else
             {
                 tblMain.Rows[2].Visible = false;
                 tblMain.Rows[3].Visible = false;
             }
         }
     }
     catch (Exception ex)
     {
         _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
         Session["lastpage"]     = m_sBackUrl;
         Session["error"]        = ex.Message;
         Session["error_report"] = ex.ToString();
         Response.Redirect("error.aspx", false);
     }
     finally
     {
         if (order != null)
         {
             order.Dispose();
         }
     }
 }
コード例 #3
0
        private void dgFuturePMItems_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            try
            {
                int FutureOrderId;
                if (e.CommandName == "Assign")
                {
                    order           = new clsWorkOrders();
                    order.cAction   = "S";
                    order.iOrgId    = OrgId;
                    order.iPMItemId = Convert.ToInt32(e.Item.Cells[0].Text);
                    // getting the undone repair information
                    if (order.WorkOrderPMItemsDetail() == -1)
                    {
                        Session["lastpage"] = m_sCurrentUrl;
                        Session["error"]    = _functions.ErrorMessage(123);
                        Response.Redirect("error.aspx", false);
                    }
                    FutureOrderId = order.iId.Value;
                    // updating the old undone repair
                    order.cAction          = "U";
                    order.iId              = OrderId;
                    order.iServiceResultId = SqlInt32.Null;
                    order.iServiceCheckId  = SqlInt32.Null;
                    order.iRepairMultId    = SqlInt32.Null;
                    if (order.WorkOrderPMItemsDetail() == -1)
                    {
                        Session["lastpage"] = m_sCurrentUrl;
                        Session["error"]    = _functions.ErrorMessage(123);
                        Response.Redirect("error.aspx", false);
                    }
                    // check future work order
                    // if it is empty then to delete it
                    order.iId = FutureOrderId;
                    if (order.DeleteFutureWorkOrder() == -1)
                    {
                        Session["lastpage"] = m_sCurrentUrl;
                        Session["error"]    = _functions.ErrorMessage(120);
                        Response.Redirect("error.aspx", false);
                    }

                    // show updated PM Items
                    order.iId               = OrderId;
                    dtPMServices            = order.GetPMServicesListForWorkOrder();
                    dgPMServices.DataSource = new DataView(dtPMServices);
                    dgPMServices.DataBind();

                    dtFuturePMService = order.GetFuturePMItems();
                    if (dtFuturePMService.Rows.Count > 0)
                    {
                        dgFuturePMItems.DataSource = new DataView(dtFuturePMService);
                        dgFuturePMItems.DataBind();
                    }
                    else
                    {
                        tblMain.Rows[2].Visible = false;
                        tblMain.Rows[3].Visible = false;
                    }
                }
            }
            catch (Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"]     = m_sCurrentUrl;
                Session["error"]        = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if (order != null)
                {
                    order.Dispose();
                }
            }
        }