Exemplo n.º 1
0
        private void btNext_FormSubmit(object sender, EventArgs e)
        {
            try
            {
                order = new clsWorkOrders();
                order.iOrgId = OrgId;
                order.iId = OrderId;
                order.sInitials = Signature.sInitials;
                order.sPIN = Signature.sPIN;
                order.daCurrentDate = DateTime.Now;
                switch(order.SigningWorkOrderOpen())
                {
                    case -1:
                        Signature.sError = _functions.ErrorMessage(140);
                        break;
                    case -2:
                        Session["lastpage"] = "wo_preview.aspx?id=" + OrderId.ToString();
                        Session["error"] = _functions.ErrorMessage(120);
                        Response.Redirect("error.aspx", false);
                        return;
                    case 0:
                        // redirect to the finish screen
                        BackFinishScreen finish = new BackFinishScreen();

                        finish.sMainText = "The Work Order opened successfully!";

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

                        finish.bContinueVisible = false;

                        finish.bViewVisible = true;
                        finish.sViewText = "[View the Opened Work Order]";
                        finish.sViewURL = "wo_viewWorkOrder.aspx?id=" + OrderId.ToString();

                        finish.bAdditionalVisible = false;

                        finish.bPrintVisible = true;
                        finish.sPrintText = "[Print the Opened Work Order]";
                        finish.sPrintURL = "ReportViewer.aspx?Report=FleetProReports%2fWorkOrderRequest&rs:Command=Render&rc:Parameters=false&OrderId=" + OrderId.ToString() + "&OrgId=" + OrgId.ToString();

                        Session["BackFinish"] = finish;

                        Response.Redirect("wo_finish.aspx", false);
                        break;
                }
            }
            catch(Exception ex)
            {
                _functions.Log(ex, HttpContext.Current.User.Identity.Name, SourcePageName);
                Session["lastpage"] = "wo_preview.aspx?id=" + OrderId.ToString();
                Session["error"] = ex.Message;
                Session["error_report"] = ex.ToString();
                Response.Redirect("error.aspx", false);
            }
            finally
            {
                if(order != null)
                    order.Dispose();
            }
        }