Пример #1
0
        private void btnYes_Click(object sender, System.EventArgs e)
        {
            try
            {
                order = new clsWorkOrders();
                order.iOrgId = OrgId;
                order.iId = OrderId;
                order.iUserId = _functions.GetUserOrgId(HttpContext.Current.User.Identity.Name, true);
                order.daCurrentDate = DateTime.Now;

                if(order.DeleteWorkOrder() == -1)
                {
                    Session["lastpage"] = "wo_deleteWorkOrder.aspx?id=" + OrderId.ToString();
                    Session["error"] = _functions.ErrorMessage(120);
                    Response.Redirect("error.aspx", false);
                    return;
                }
                // redirect to the finish screen
                BackFinishScreen finish = new BackFinishScreen();

                finish.sMainText = "The Work Order has been successfully deleted!";

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

                finish.bContinueVisible = false;

                finish.bViewVisible = false;

                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_deleteWorkOrder.aspx?id=" + OrderId.ToString();
                Session["error"] = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if(order != null)
                    order.Dispose();
            }
        }