protected void Page_Load(object sender, EventArgs e)
        {
            string to = Request["To"].ToString();
            string body = Request["Body"].ToString();
            string from = Request["From"].ToString();

            var docStore = Application["DocumentStore"] as DocumentStore;
            var repository = new RavenDBRepository(docStore);
            var accountController = new AccountController();
            var users = accountController.GetActiveUsers(repository);

            var keywordProcessor = new KeywordProcessor(docStore);
            var message = keywordProcessor.SetActiveUsersForMatch(users)
                                            .MatchReplyToOriginalMessage(body, from);

            using (var session = docStore.OpenSession())
            {
                var step = session.Load<Step>(message.SubjectMatterId);
                step.Answer = message.UserAnswer;
                step.AnswerDate = DateTime.Now;
                string json = JsonConvert.SerializeObject(step);

                var workflowController = new WorkflowController();
                workflowController.ProcessStep(json, repository,
                                                   Application["Registry"] as RavenFilterRegistry<Step>,
                                                   message.UserId);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string to   = Request["To"].ToString();
            string body = Request["Body"].ToString();
            string from = Request["From"].ToString();

            var docStore          = Application["DocumentStore"] as DocumentStore;
            var repository        = new RavenDBRepository(docStore);
            var accountController = new AccountController();
            var users             = accountController.GetActiveUsers(repository);

            var keywordProcessor = new KeywordProcessor(docStore);
            var message          = keywordProcessor.SetActiveUsersForMatch(users)
                                   .MatchReplyToOriginalMessage(body, from);

            using (var session = docStore.OpenSession())
            {
                var step = session.Load <Step>(message.SubjectMatterId);
                step.Answer     = message.UserAnswer;
                step.AnswerDate = DateTime.Now;
                string json = JsonConvert.SerializeObject(step);

                var workflowController = new WorkflowController();
                workflowController.ProcessStep(json, repository,
                                               Application["Registry"] as RavenFilterRegistry <Step>,
                                               message.UserId);
            }
        }
Exemplo n.º 3
0
        public void ListenerWorksTest()
        {
            var config     = JsonConvert.DeserializeObject <WorkflowConfiguration>(File.ReadAllText(@"./TestCases/test.json"), new WorkflowActionConfigConverter());
            var definition = new WorkflowController().IntializeWorkflow(null)(config);

            definition.RegisterListeners();
        }
    //public int siteID = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        WorkflowController.RegisterClientWorkflowGobalVariable(GetCurrentRoleIDs, WorkFlowEngineType.News, this.Page);
        ArticleSettingController.RegisterClientArticleSettingGobalVariable(ArticleEngineType.News, this.Page, GetSiteID);
        //CommonController ComCon = new CommonController();
        //List<RoleInfo> lstRole = ComCon.GetRolesByUsername(GetUsername);
        //roleID =lstRole[0].RoleId;


        UserModuleId = Int32.Parse(SageUserModuleID);
        IncludeCss("NewsReporterCss", "/Modules/ArticleAdmin/CommonCss/ArticleAdmin.css"
                   , "/Modules/Admin/MediaManagement/css/cropper.css", "/Modules/Admin/MediaManagement/css/module.css"
                   , "/Modules/ArticleAdmin/CommonCss/selectize.css",
                   "/Modules/WebBuilder/css/preview.css"
                   , "/Modules/ArticleAdmin/ReporterAdmin/css/module.css");
        IncludeJs("NewsReporterJs"
                  , "/js/SageMediaManagement.js"
                  , "/Modules/ArticleAdmin/ReporterAdmin/js/NewsReporter.js"
                  //, "Modules/Admin/MediaManagement/js/uploader.js"
                  , "/js/jquery.pagination.js"
                  , "/js/jquery.validate.js"
                  , "/js/jquery.alerts.js"
                  , "/Modules/ArticleAdmin/CommonJs/js/commonnews.js"
                  , "/Modules/ArticleAdmin/ReporterAdmin/js/selectize.js");
        if (GetCurrentRoleIDs.Split(',').Length > 0)
        {
            roleID = GetCurrentRoleIDs.Split(',')[0];
        }
    }
Exemplo n.º 5
0
        public void SocketSendTest()
        {
            var config     = JsonConvert.DeserializeObject <WorkflowConfiguration>(File.ReadAllText(@"./TestCases/test.json"), new WorkflowActionConfigConverter());
            var definition = new WorkflowController().IntializeWorkflow(null)(config);

            definition.ExecuteCustomEvent((actionRegistry) => actionRegistry["Action 13"])();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (GetUsername.ToLower() == "superuser")
     {
         pnlEditorContainer.Visible = false;
     }
     else
     {
         pnlEditorContainer.Visible = true;
         WorkflowController.RegisterClientWorkflowGobalVariable(GetCurrentRoleIDs, WorkFlowEngineType.News, this.Page);
         ArticleSettingController.RegisterClientArticleSettingGobalVariable(ArticleEngineType.News, this.Page, GetSiteID);
         IncludeCss("ComponentTemplate", "/Modules/WebBuilder/fonts/styles.css",
                    "/Modules/WebBuilder/css/custom.css", "/Modules/ArticleAdmin/CommonCss/ArticleAdmin.css", "/Modules/ArticleAdmin/EditorAdmin/css/module.css");
         IncludeJs("EditorAdmin",
                   "/Modules/ArticleAdmin/CommonJs/EasyBuilder/init.js",
                   "/Modules/ArticleAdmin/CommonJs/EasyBuilder/Easylibrary.js",
                   "/Modules/WebBuilder/js/colors.js",
                   "/Modules/WebBuilder/js/tinyColorPicker.js",
                   "/js/SageMediaManagement.js",
                   "/js/jquery.validate.js",
                   "/js/jquery.pagination.js",
                   "/Modules/ArticleAdmin/EditorAdmin/js/masonry.js",
                   "/Modules/ArticleAdmin/CommonJs/js/commonnews.js",
                   "/Modules/ArticleAdmin/EditorAdmin/js/Components.js",
                   "/Modules/ArticleAdmin/EditorAdmin/js/ArticleEditor.js",
                   "/Modules/ArticleAdmin/CommonJs/EasyBuilder/WebBuilder.js"
                   );
         ReadFontFamily();
         CombineFiles();
         getDefaultArticleTemplate();
     }
 }
Exemplo n.º 7
0
        public MainPage()
        {
            InitializeComponent();

            // workflows yield IWorkflow objects. We can optionally handled errors encountered
            // during the workflow, at which point the workflow is terminated.
            WorkflowController.Begin(Workflow(),
                                     ex => JounceHelper.ExecuteOnUI(() => MessageBox.Show(ex.Message)));
        }
Exemplo n.º 8
0
        //
        //====================================================================================================
        //
        public override bool IsLocked(string contentName, string recordId)
        {
            var contentTable = TableModel.createByContentName(cp, contentName);

            if (contentTable != null)
            {
                return(WorkflowController.isRecordLocked(cp.core, contentTable.id, GenericController.encodeInteger(recordId)));
            }
            return(false);
        }
Exemplo n.º 9
0
        public static string WorkflowStartAction(this UrlHelper urlHelper, string workflowKey)
        {
            var startActivity = WorkflowController.GetWorkflow(workflowKey).StartActivity;

            return(urlHelper.Action("Start", "Workflow", new
            {
                workflowKey,
                modelType = startActivity.Method.DeclaringType.PartialName(),
                methodName = startActivity.Method.Name
            }));
        }
Exemplo n.º 10
0
        public async Task Edit()
        {
            // Arrange
            WorkflowController controller = new WorkflowController();

            // Act
            ViewResult result = await controller.Edit(2) as ViewResult;

            // Assert
            Assert.IsNotNull(result);
            Assert.IsNotNull(result.Model);
        }
Exemplo n.º 11
0
        public void InitializeWorkflowTest()
        {
            var config     = JsonConvert.DeserializeObject <WorkflowConfiguration>(File.ReadAllText(@"./TestCases/test.json"), new WorkflowActionConfigConverter());
            var definition = new WorkflowController().IntializeWorkflow(null);

            Assert.AreEqual("Initial", definition(config)
                            .CurrentActionManager()
                            .StateManager()
                            .CurrentWorkflowState
                            .WorkflowStateConfiguration
                            .StateName);
        }
Exemplo n.º 12
0
        public void WorkflowTransitionTest()
        {
            var config     = JsonConvert.DeserializeObject <WorkflowConfiguration>(File.ReadAllText(@"./TestCases/test.json"), new WorkflowActionConfigConverter());
            var definition = new WorkflowController().IntializeWorkflow(null);

            Assert.AreEqual("State 2", definition(config)
                            .ExecuteCustomEvent((actionRegistry) => actionRegistry["Action 3"])()
                            .CurrentActionManager()
                            .StateManager()
                            .CurrentWorkflowState
                            .WorkflowStateConfiguration
                            .StateName);
        }
Exemplo n.º 13
0
        public void WorkflowTimerExecutionTest()
        {
            var config     = JsonConvert.DeserializeObject <WorkflowConfiguration>(File.ReadAllText(@"./TestCases/test.json"), new WorkflowActionConfigConverter());
            var definition = new WorkflowController().IntializeWorkflow(null)(config);

            Assert.AreNotEqual("1", definition
                               .ExecuteCustomEvent((actionRegistry) => actionRegistry["Action 3"])()
                               .ExecuteCustomEvent((actionRegistry) => actionRegistry["Action 10"])()
                               .CurrentActionManager()
                               .StateManager()
                               .CurrentWorkflowState
                               .CurrentParameterValues["Name1"]
                               .Value);
        }
Exemplo n.º 14
0
        public void WorkflowConditionalExecutionTest()
        {
            //ToDo: Conditional execution is not correct, it should be able to derive the conditional parameter from anywhere
            var config     = JsonConvert.DeserializeObject <WorkflowConfiguration>(File.ReadAllText(@"./TestCases/test.json"), new WorkflowActionConfigConverter());
            var definition = new WorkflowController().IntializeWorkflow(null)(config);

            Assert.AreEqual("State 4", definition
                            .ExecuteCustomEvent((actionRegistry) => actionRegistry["Action 9"])()
                            .CurrentActionManager()
                            .StateManager()
                            .CurrentWorkflowState
                            .WorkflowStateConfiguration
                            .StateName);
        }
Exemplo n.º 15
0
        public static void Main(string[] args)
        {
            var config     = JsonConvert.DeserializeObject <WorkflowConfiguration>(File.ReadAllText(@"./Configs/test.json"), new WorkflowActionConfigConverter());
            var definition = new WorkflowController().IntializeWorkflow(null)(config);


            var host = new WebHostBuilder()
                       .UseKestrel()
                       .UseContentRoot(Directory.GetCurrentDirectory())
                       .UseIISIntegration()
                       .UseStartup <Startup>()
                       .Build();

            host.Run();
        }
Exemplo n.º 16
0
        public void WorkflowQueueExecutionTest()
        {
            var config     = JsonConvert.DeserializeObject <WorkflowConfiguration>(File.ReadAllText(@"./TestCases/test.json"), new WorkflowActionConfigConverter());
            var definition = new WorkflowController().IntializeWorkflow(null)(config);

            definition.ExecuteCustomEvent((actionRegistry) => actionRegistry["Action 11"])();

            var options  = new KafkaOptions(new Uri("http://192.168.99.100:9092"));
            var router   = new BrokerRouter(options);
            var consumer = new Consumer(new ConsumerOptions("workflowtest", router));

            var amessage = consumer.Consume().FirstOrDefault();

            Assert.IsNotNull(amessage);
            Assert.AreEqual("Action 6", amessage.Value.ToUtf8String());
        }
Exemplo n.º 17
0
        public model.MsgStruct server(model.MsgStruct message)
        {
            //EndpointAddress epCAM = new EndpointAddress("http://localhost:8010/Server/services/workflow_controller");
            model.MsgStruct returnMsg = new model.MsgStruct();

            string operationName = message.operationName;
            string tokenApp      = message.tokenApp;

            //verif tokenApp
            if (tokenApp == "?h:XPjO9b)z3Ox7")
            {
                try
                {
                    //workflowController.I_WorkflowController proxyWorkflowController = ChannelFactory<workflowController.I_WorkflowController>.CreateChannel(new BasicHttpBinding(), epCAM);
                    workflowController.WorkflowController proxyWorkflowController = new WorkflowController();
                    Console.WriteLine("calling CAM");
                    returnMsg = proxyWorkflowController.workflowControl(message);
                    Console.WriteLine("CAM call finished");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    //return message error CAM
                    returnMsg.info             = "unsuccessful authentification - CAM access error";
                    returnMsg.operationName    = "return";
                    returnMsg.operationVersion = "1.0";
                    returnMsg.data             = new object[2] {
                        (object)false, (object)"CAM access error"
                    };
                }
            }
            else
            {
                //on renvoit un message informant le client que son token app n'est ps valide
                returnMsg.info          = "invalid tokenApp";
                returnMsg.operationName = "return";
                returnMsg.data          = new object[2] {
                    (object)false, (object)"unknow appVersion"
                };
            }
            returnMsg.statutOp   = false;
            returnMsg.tokenApp   = "R]f^l(sj9.*HX+u";
            returnMsg.appVersion = "1.0";

            return(returnMsg);
        }
Exemplo n.º 18
0
        /// <summary>
        ///     Request a xap to be downloaded and integrated
        /// </summary>
        /// <param name="xapName">The name of the XAP to download</param>
        /// <param name="xapLoaded">Callback once xap is loaded</param>
        /// <param name="xapProgress">Callback for xap progress with bytes received, pct, and total bytes</param>
        public void RequestXap(string xapName, Action <Exception> xapLoaded,
                               Action <long, int, long> xapProgress)
        {
            if (string.IsNullOrEmpty(xapName))
            {
                throw new ArgumentNullException("xapName");
            }

            var uri = new Uri(Application.Current.Host.Source, xapName);

            if (!uri.GetComponents(UriComponents.Path, UriFormat.Unescaped).EndsWith(".xap", StringComparison.InvariantCultureIgnoreCase))
            {
                throw new ArgumentOutOfRangeException("xapName", Resources.DeploymentService_RequestXap_XAPExtensionError);
            }

            WorkflowController.Begin(DownloadWorkflow(xapName, xapLoaded, xapProgress));
        }
Exemplo n.º 19
0
 private void OnSerializingMethod(StreamingContext context)
 {
     SerializableLayerMaps.Clear();
     SerializableSelectedLayerMap = null;
     SerializableLayerMaps.AddRange(LocalLayerMaps);
     if (SelectedLayerMap != null && WorkflowController.IsLocalLayer(SelectedLayerMap.MapType))
     {
         if (SelectedLayerMap.IsValid)
         {
             SerializableSelectedLayerMap = SelectedLayerMap;
         }
         else
         {
             SelectedLayerMap = null;
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     WorkflowController.RegisterClientWorkflowGobalVariable(GetCurrentRoleIDs, WorkFlowEngineType.News, this.Page);
     ArticleSettingController.RegisterClientArticleSettingGobalVariable(ArticleEngineType.News, this.Page, siteID);
     IncludeCss("ArticlePublisher", "/Modules/ArticleAdmin/CommonCss/ArticleAdmin.css", "/Modules/WebBuilder/css/preview.css", "/Modules/ArticleAdmin/Publisher/css/module.css");
     IncludeJs("ArticlePublisherJs",
               "/js/jquery.validate.js",
               "/js/jquery.pagination.js",
               "/Modules/ArticleAdmin/CommonJs/js/commonnews.js",
               "/Modules/WebBuilder/js/WebBuilderView.js",
               "/Modules/ArticleAdmin/Publisher/js/ArticlePublisher.js"
               );
     if (GetCurrentRoleIDs.Split(',').Length > 0)
     {
         roleID = GetCurrentRoleIDs.Split(',')[0];
     }
 }
Exemplo n.º 21
0
        public async Task <object> LaunchProcess(object msn)
        {
            Message            message    = (Message)msn;
            String             service    = message.Service;
            WorkflowController controller = new WorkflowController();
            object             msg        = null;

            switch (service)
            {
            case "1":
                msg = controller.Method(message);
                break;

            case "2":

                break;
            }
            return(msg);
        }
Exemplo n.º 22
0
        public void DoActionOnStateChanged(StateTransaction stateTransaction)
        {
            // TODO:  Do soemthing when the workflow has started

            // If this is a direct publish workflow, there should be only one state in the workflow
            // Automatically complete the workflow or else it stays in limbo

            ContentController contentController = new ContentController();

            ContentItem content = contentController.GetContentItem(stateTransaction.ContentItemId);

            Workflow workflow = WorkflowManager.Instance.GetWorkflow(content);

            if (workflow.FirstState == workflow.LastState)
            {
                WorkflowController workflowController = new WorkflowController();

                workflowController.CompleteState(content, "Completing direct publish workflow.");
            }
        }
        public void Initial()
        {
            var mockIProjectService        = new Mock <IProjectService>();
            var mockIProjectsShareService  = new Mock <IProjectsShareService>();
            var mockIUserService           = new Mock <IUserService>();
            var mockIConnectionDbService   = new Mock <IConnectionDbService>();
            var mockIQueryService          = new Mock <IQueryService>();
            var mockIQueriesHistoryService = new Mock <IQueriesHistoryService>();

            Mapper.Initialize(m => m.AddProfile <ViewModelToDomainMappingProfile>());
            mockIProjectService.Setup(a => a.GetProjects()).Returns(new List <Project>()
            {
                new Project()
            });
            mockIUserService.Setup(a => a.GetUsers()).Returns(new List <ApplicationUser>()
            {
                new ApplicationUser()
                {
                    FirstName = "s", LastName = "d"
                }
            });
            mockIProjectsShareService.Setup(a => a.GetUserProjects(new ApplicationUser())).Returns(new List <Project>());
            mockIConnectionDbService.Setup(a => a.GetConnectionDBs()).Returns(new List <ConnectionDB>()
            {
                new ConnectionDB()
                {
                    ConnectionID = 0, ConnectionName = "Name", PasswordDB = Rijndael.EncryptStringToBytes("pass"), DatabaseName = "nameDB"
                }
            });
            mockIQueryService.Setup(a => a.GetQueries()).Returns(new List <Query>()
            {
                new Query()
                {
                    QueryID = 1, QueryBody = "Select", ProjectID = 1
                }
            });
            mockIQueriesHistoryService.Setup(a => a.GetQueriesHistory()).Returns(new List <QueryHistory>());

            wc = new WorkflowController(mockIProjectService.Object, mockIUserService.Object, mockIProjectsShareService.Object,
                                        mockIConnectionDbService.Object, mockIQueryService.Object, mockIQueriesHistoryService.Object);
        }
Exemplo n.º 24
0
        public async Task <object> LaunchProcess(object msn)
        {
            Messenger          message    = (Messenger)msn;
            String             service    = message.Service;
            WorkflowController controller = new WorkflowController();
            object             msg        = null;

            switch (service)
            {
            case "ListePharmacie":
                msg = controller.ListePharmacie(message);
                break;

            case "ListeParapharmacie":
                msg = controller.ListeParapharmacie(message);
                break;

            case "Connection":
                msg = controller.Connection(message);
                break;

            case "SendOrder":
                msg = controller.SendOrder(message);
                break;

            case "CustomerOrder":
                msg = controller.CustomerOrder(message);
                break;

            case "DeleteOrder":
                msg = controller.DeleteOrder(message);
                break;

            case "AllOrders":
                msg = controller.AllOrders(message);
                break;
            }
            return(msg);
        }
 public void Setup()
 {
     this.workflowController = new WorkflowController();
     this.workItemCreator    = new WorkItemCreator();
 }
Exemplo n.º 26
0
        public void ProcessOneWayEvent(SPRemoteEventProperties properties)
        {
            var factoryDecision = new WorkflowController();

            factoryDecision.ProcessWorkflowActions(properties.ItemEventProperties.ListTitle, properties.ItemEventProperties.ListItemId);
        }
        public async Task <ActionResult> ExcelFile(IList <IFormFile> excelFileName)
        {
            string[] validationSet     = configuration.GetSection("ExcelFileValidation:mandatoryFields").GetChildren().Select(val => val.Value).ToArray();
            string[] cellValidationSet = configuration.GetSection("ExcelFileValidation:cellValidationFields").GetChildren().Select(val => val.Value).ToArray();
            string   addressBookEnable = configuration["AddressBook:Enable"];

            ShipmentDataResponse shipmentDataResponse = new ShipmentDataResponse();

            try
            {
                int userId = Convert.ToInt32(HttpContext.User.Claims.FirstOrDefault(x => x.Type == JwtConstant.UserId).Value);
                ShipmentDataResponse result = null;
                //string response = string.Empty;
                if (excelFileName != null)
                {
                    //var uploads = Path.Combine(_hostingEnvironment.WebRootPath, "uploads");
                    foreach (var file in excelFileName)
                    {
                        if (file.Length > 0)
                        {
                            //string paths = hostingEnvironment.WebRootPath;

                            var filePath = Path.Combine(_hostingEnvironment.WebRootPath, file.FileName);

                            //var filePath = Path.Combine(@"D:\UserExcels", file.FileName);
                            using (var fileStream = new FileStream(filePath, FileMode.Create))
                            {
                                //FileStream stream = File.Open(fileName, FileMode.Open, FileAccess.Read);
                                //response = new ExcelExtension().Test(filePath);
                                await file.CopyToAsync(fileStream);
                            }


                            ExcelExtensionReponse excelExtensionReponse =
                                new ExcelExtension()
                                .Test(
                                    filePath,
                                    configuration.GetSection("ExcelFileValidation:mandatoryFields").GetChildren().Select(val => val.Value).ToArray(),
                                    configuration.GetSection("ColumnValidation:regexList").GetChildren().Select(val => val.Value).ToArray(),
                                    configuration.GetSection("ColumnValidation:columnLengths").GetChildren().Select(val => val.Value).ToArray());
                            if (excelExtensionReponse.success)
                            {
                                var excelDataObject2 = JsonConvert.DeserializeObject <List <ExcelDataObject> >(excelExtensionReponse.ExcelExtensionReponseData);
                                WorkflowController   workflowController = new WorkflowController(this._hostingEnvironment, this._context, this._addressBookService, this._entityValidationService);
                                WorkflowDataResponse response           = ((WorkflowDataResponse)((ObjectResult)(workflowController.CreateWorkflow(file, userId)).Result).Value);
                                _workflowID = response.Workflow.ID;
                                result      = _shipmentService.CreateShipments(excelDataObject2, _workflowID, addressBookEnable, out int?workflowStatus);
                                if (result.Success)
                                {
                                    shipmentDataResponse.Success   = true;
                                    shipmentDataResponse.Shipments = result.Shipments;
                                    WorkflowDataRequest workflowDataRequest = new WorkflowDataRequest();
                                    workflowDataRequest.ID         = _workflowID;
                                    workflowDataRequest.WFL_STA_TE = workflowStatus;
                                    _workflowService.UpdateWorkflowStatusById(workflowDataRequest);
                                }
                                else
                                {
                                    shipmentDataResponse.Success = false;
                                    shipmentDataResponse.OperationExceptionMsg = result.OperationExceptionMsg;
                                    WorkflowService workflowService = new WorkflowService(_context, _addressBookService, _entityValidationService);
                                    workflowService.DeleteWorkflowById(_workflowID);
                                }
                            }
                            else
                            {
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                                Task.Run(() => iCustomLog.AddLogEntry(new UPS.DataObjects.LogData.LogDataModel()
                                {
                                    apiType        = Enum.GetName(typeof(UPS.DataObjects.LogData.APITypes), 7),
                                    dateTime       = System.DateTime.Now,
                                    LogInformation = new UPS.DataObjects.LogData.LogInformation()
                                    {
                                        LogException = string.Empty,
                                        LogRequest   = "Excel Uploaded",
                                        LogResponse  = JsonConvert.SerializeObject(excelExtensionReponse)
                                    }
                                }));
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                                return(Ok(excelExtensionReponse));
                            }
                        }
                    }
                }

#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                Task.Run(() => iCustomLog.AddLogEntry(new UPS.DataObjects.LogData.LogDataModel()
                {
                    apiTypes       = UPS.DataObjects.LogData.APITypes.ExcelUpload,
                    apiType        = Enum.GetName(typeof(UPS.DataObjects.LogData.APITypes), 7),
                    dateTime       = System.DateTime.Now,
                    LogInformation = new UPS.DataObjects.LogData.LogInformation()
                    {
                        LogException = null,
                        LogRequest   = "Excel Uploaded",
                        LogResponse  = JsonConvert.SerializeObject(shipmentDataResponse)
                    }
                }));
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed

                return(Ok(shipmentDataResponse));
            }
            catch (Exception ex)
            {
                // new AuditEventEntry.WriteEntry(new Exception(ex.Message));
                AuditEventEntry.WriteEntry(ex);
                return(Ok(shipmentDataResponse.OperationExceptionMsg = ex.Message));
            }
        }
Exemplo n.º 28
0
 public void TestMethod1Test([PexAssumeUnderTest] WorkflowController target)
 {
     target.TestMethod1();
     // TODO: add assertions to method WorkflowControllerTest.TestMethod1Test(WorkflowController)
 }
Exemplo n.º 29
0
        public async Task <ActionResult> ExcelFile(IList <IFormFile> excelFileName, int Emp_Id)
        {
            ShipmentDataResponse shipmentDataResponse = new ShipmentDataResponse();

            try
            {
                ShipmentDataResponse result = null;
                //string response = string.Empty;
                if (excelFileName != null)
                {
                    //var uploads = Path.Combine(_hostingEnvironment.WebRootPath, "uploads");
                    foreach (var file in excelFileName)
                    {
                        if (file.Length > 0)
                        {
                            //string paths = hostingEnvironment.WebRootPath;

                            var filePath = Path.Combine(hostingEnvironment.WebRootPath, file.FileName);

                            //var filePath = Path.Combine(@"D:\UserExcels", file.FileName);
                            using (var fileStream = new FileStream(filePath, FileMode.Create))
                            {
                                //FileStream stream = File.Open(fileName, FileMode.Open, FileAccess.Read);
                                //response = new ExcelExtension().Test(filePath);
                                await file.CopyToAsync(fileStream);
                            }


                            ExcelExtensionReponse excelExtensionReponse = new ExcelExtension().Test(filePath);
                            if (excelExtensionReponse.success)
                            {
                                var excelDataObject2 = JsonConvert.DeserializeObject <List <ExcelDataObject> >(excelExtensionReponse.ExcelExtensionReponseData);
                                WorkflowController   workflowController = new WorkflowController();
                                WorkflowDataResponse response           = ((WorkflowDataResponse)((ObjectResult)(workflowController.CreateWorkflow(file, Emp_Id)).Result).Value);
                                _workflowID = response.Workflow.ID;
                                result      = this.CreateShipments(excelDataObject2, _workflowID);
                                if (result.Success)
                                {
                                    shipmentDataResponse.Success   = true;
                                    shipmentDataResponse.Shipments = result.Shipments;
                                }
                                else
                                {
                                    shipmentDataResponse.Success = false;
                                    shipmentDataResponse.OperationExceptionMsg = result.OperationExceptionMsg;
                                    WorkflowService workflowService = new WorkflowService();
                                    workflowService.DeleteWorkflowById(_workflowID);
                                }
                            }
                            else
                            {
                                return(Ok(excelExtensionReponse));
                            }
                        }
                    }
                }

                return(Ok(shipmentDataResponse));
            }
            catch (Exception ex)
            {
                AuditEventEntry.WriteEntry(new Exception(ex.Message));
                return(Ok(shipmentDataResponse.OperationExceptionMsg = ex.Message));
            }
        }