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();
     }
 }