Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            string filename = context.Request.QueryString["f"];

            if (filename.StartsWith("trolove"))
            {
                string          manr = filename.Substring(7, 6);
                DataAccessLayer dal  = new DataAccessLayer();
                dal.AddParameter("@MANR", manr, System.Data.DbType.String);
                dal.AddParameter("@Stabsnummer", null, System.Data.DbType.String, System.Data.ParameterDirection.Output);
                dal.AddParameter("@Name", null, System.Data.DbType.String, System.Data.ParameterDirection.Output);
                dal.ExecuteStoredProcedure("GetEmployeeInfo");

                if (dal.GetParameterValue("@Stabsnummer") == DBNull.Value || dal.GetParameterValue("@Name") == DBNull.Value)
                {
                    throw new System.IO.FileNotFoundException();
                }
                else
                {
                    string stabsnummer = dal.GetParameterValue("@Stabsnummer").ToString();
                    string name        = dal.GetParameterValue("@Name").ToString();
                    System.IO.MemoryStream filestream = new System.IO.MemoryStream();

                    using (DocX document = DocX.Load(context.Server.MapPath("~/Files/solemndeclaration.docx")))
                    {
                        document.InsertAtBookmark(manr, "MANR");
                        document.InsertAtBookmark($"{stabsnummer} {name}", "OutlookName");
                        document.InsertAtBookmark(DateTime.Today.ToString("dd-MM-yyyy"), "Date");
                        document.SaveAs(filestream);
                    }

                    context.Response.ClearContent();
                    context.Response.Clear();
                    context.Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
                    context.Response.AddHeader("Content-Disposition", $"attachment; filename=trolove{manr}.docx");

                    filestream.WriteTo(context.Response.OutputStream);

                    context.Response.Flush();
                    context.Response.Close();
                }
            }
            else
            {
                throw new Exception();
            }
        }
Example #2
0
        /// <summary>
        /// This is the beginning workflow module. You will use this after one of the case creation modules
        /// </summary>
        /// <param name="activityReason"></param>
        /// <param name="context"></param>
        /// <param name="sucessCount"></param>
        /// <param name="screenshotLocation"></param>
        /// <param name="test"></param>
        /// <param name="doc"></param>
        public string HippWorkFlow(string activityReason, IWebDriver context, string screenshotLocation, DocX doc)
        {
            APHPHomePage                    loginPage      = new APHPHomePage(context);
            WorkerPortalLandingPage         landingPage    = new WorkerPortalLandingPage(context);
            HIPPSearchPage                  hIPPSearchpage = new HIPPSearchPage(context);
            HIPPSubmitApplicationPageWorker submitApp      = new HIPPSubmitApplicationPageWorker(context);
            WorkItemComponent               workitem       = new WorkItemComponent(context);
            Generic      generic = new Generic(context);
            Utility      utility = new Utility(context);
            InitiateTest startUp = new InitiateTest(context);

            //Gather Data from app
            generic.CheveronClick("2");
            generic.CheveronClick("3");
            generic.CheveronClick("4");

            ///Pend Application
            workitem.ActivitystatusResn_Input.Click();
            workitem.ActivitystatusResn_Input.SendKeys(activityReason);

            switch (activityReason)
            {
            case "Approved":
                workitem.ClickApproveButton();
                break;

            case "Denied":
                workitem.ClickDenyButton();
                break;

            case "Pended":
                workitem.ClickApproveButton();
                break;
            }
            generic.CheveronClick("3");
            generic.CheveronClick("4");
            generic.HoverByElement(workitem.CompletedBottom);


            workitem.ClickCompletedButton();
            utility.RecordStepStatusMAIN("Appliciation Completed", screenshotLocation, "Application Completed", doc);

            string appNumber = workitem.GatherAppNumber();
            string workItem  = workitem.GatherWorkItemType();
            string appQueue  = workitem.GetGatherWorkItemStatus();

            doc.InsertAtBookmark(appNumber + "\n " + workItem + "\n " + appQueue, "Pass 1");
            utility.RecordStepStatusMAIN("App in " + appQueue + "and in status of " + activityReason, screenshotLocation, "CheckAppStaus", doc);

            // Refresh Page
            context.Url = startUp.AWSINTWoker;

            workitem.ClickExitButton();
            landingPage.HippApplicationSearch();
            hIPPSearchpage.SearchHiPPCase("Contains", "Application ID", appNumber);
            hIPPSearchpage.SearchButtonClick();
            generic.HoverByLinkText(appNumber);
            utility.RecordStepStatusMAIN("Search results", screenshotLocation, "SearchResults", doc);
            generic.LinkTextClick(appNumber);
            if (activityReason == "Denied")
            {
                return(appNumber);
            }
            workitem.ClickWorkItemButton();
            Thread.Sleep(3000);
            generic.CheveronClick("3");
            generic.CheveronClick("4");
            string workItem2 = workitem.GatherWorkItemType();
            string appQueue2 = workitem.GetGatherWorkItemStatus();

            doc.InsertAtBookmark("\n " + "Pass 2: " + workItem2 + "\n " + appQueue2, "Pass 2");
            if (activityReason == "Pended")
            {
                HippPendCase(appNumber, context, screenshotLocation, doc);
            }
            return(appNumber);
        }