示例#1
0
        static void Main(string[] args)
        {
            var function = new MaintenanceHandler();
            var context  = new TestLambdaContext();

            context.RemainingTime = TimeSpan.FromHours(50);
            context.Logger        = new ConsoleLogger();

            var invokeAction = new LambdaInvokeAction
            {
                Action = CumulusConstants.MaintenanceAction.CalculateNumberOfTrades,
            };

            function.Invoke(invokeAction, context).Wait();

            //var function = new Handler();
            //var context = new TestLambdaContext();
            //context.RemainingTime = TimeSpan.FromHours(50);
            //context.Logger = new ConsoleLogger();

            //var lambdaInvokeAction = new LambdaInvokeAction
            //{
            //    Action = CumulusConstants.LambdaManagerAction.RoutePendingObjects
            //};

            //function.Invoke(lambdaInvokeAction, context).Wait();
            Console.WriteLine("DONE !!!!!!!!!!!!");
            Console.ReadLine();
        }
示例#2
0
        public void TestToUpperFunction()
        {
            // Invoke the lambda function and confirm the string was upper cased.
            var function = new MaintenanceHandler();
            var context  = new TestLambdaContext();

            var invokeAction = new LambdaInvokeAction
            {
                Action = "",
            };

            function.Invoke(invokeAction, context).Wait();
        }
示例#3
0
        public void TestRerouteEurexDeadMessages()
        {
            var function = new MaintenanceHandler();
            var context  = new TestLambdaContext();

            context.RemainingTime = TimeSpan.FromMinutes(5);

            var invokeAction = new LambdaInvokeAction
            {
                Action = CumulusConstants.MaintenanceAction.RerouteEurexDeadMessages,
            };

            function.Invoke(invokeAction, context).Wait();
        }
示例#4
0
        public void TestImportProductsXetra()
        {
            var function = new MaintenanceHandler();
            var context  = new TestLambdaContext();

            context.RemainingTime = TimeSpan.FromMinutes(5);

            var invokeAction = new LambdaInvokeAction
            {
                Action = CumulusConstants.MaintenanceAction.ImportProductXetra,
            };

            function.Invoke(invokeAction, context).Wait();
        }
        public doBatchProcessResult BatchAutoRenewProcess(string UserId, DateTime BatchDate)
        {
            //BatchDate = Convert.ToDateTime("2555-02-04");
            doBatchProcessResult       result    = new doBatchProcessResult();
            RentralContractHandler     rcHandler = new RentralContractHandler();
            MaintenanceHandler         mHandler  = new MaintenanceHandler();
            List <doContractAutoRenew> doContractAutoRenewList = rcHandler.GetContractExpireNextMonth(BatchDate);

            // Initial value of doBatchProcessResult
            result.Result       = FlagType.C_FLAG_ON;
            result.BatchStatus  = null;
            result.Total        = doContractAutoRenewList.Count;
            result.Complete     = 0;
            result.Failed       = 0;
            result.ErrorMessage = string.Empty;
            result.BatchUser    = UserId;

            //DateTime dtEndDateOfNextMonth = (new DateTime(BatchDate.Year, BatchDate.Month + 2, 1)).AddDays(-1); //Add by Jutarat A. on 09052013
            DateTime dtEndDateOfNextMonth = (new DateTime(BatchDate.Year, BatchDate.Month, 1)).AddMonths(2).AddDays(-1); //Add by Jutarat A. on 09052013

            foreach (var doContractAutoRenew in doContractAutoRenewList)
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    try
                    {
                        //================= Update implement data in rental security basic table ==============
                        DateTime tmpDate = Convert.ToDateTime(doContractAutoRenew.CalContractEndDate).AddMonths(Convert.ToInt32(doContractAutoRenew.AutoRenewMonth));

                        //Add by Jutarat A. on 09052013
                        if (doContractAutoRenew.AutoRenewMonth != null && doContractAutoRenew.AutoRenewMonth > 0)
                        {
                            while (tmpDate <= dtEndDateOfNextMonth)
                            {
                                tmpDate = tmpDate.AddMonths(Convert.ToInt32(doContractAutoRenew.AutoRenewMonth));
                            }
                        }
                        //End Add

                        base.UpdateAutoRenew(doContractAutoRenew.ContractCode, doContractAutoRenew.OCC, tmpDate, BatchDate, ProcessID.C_PROCESS_ID_AUTO_RENEW);

                        //================= Update unimplement data in rental security basic table ============
                        string strUnimplementOCC = string.Empty;
                        strUnimplementOCC = rcHandler.GetLastUnimplementedOCC(doContractAutoRenew.ContractCode);
                        base.UpdateAutoRenew(doContractAutoRenew.ContractCode, strUnimplementOCC, tmpDate, BatchDate, ProcessID.C_PROCESS_ID_AUTO_RENEW);

                        //if(doContractAutoRenew.ProductTypeCode == ProductType.C_PROD_TYPE_MA  )
                        if (doContractAutoRenew.ProductTypeCode == ProductType.C_PROD_TYPE_MA ||
                            doContractAutoRenew.ProductTypeCode == ProductType.C_PROD_TYPE_AL ||
                            doContractAutoRenew.ProductTypeCode == ProductType.C_PROD_TYPE_RENTAL_SALE)    //Modify by Jutarat A. on 11042013
                        {
                            //mHandler.GenerateMaintenanceSchedule(doContractAutoRenew.ContractCode,GenerateMAProcessType.C_GEN_MA_TYPE_RE_CREATE);
                            mHandler.GenerateMaintenanceSchedule(doContractAutoRenew.ContractCode, GenerateMAProcessType.C_GEN_MA_TYPE_RE_CREATE, BatchDate, ProcessID.C_PROCESS_ID_AUTO_RENEW, false); //Modify by Jutarat A. on 09052013 (Add createDate, createBy, isWriteTransLog)
                        }

                        scope.Complete();
                        result.Complete++;
                    }
                    catch (Exception ex)
                    {
                        scope.Dispose();
                        result.Failed++;
                        result.ErrorMessage += string.Format("Error: {0} {1}\n", ex.Message, ex.InnerException != null ? ex.InnerException.Message : "");
                    }
                }
            }
            result.Result = result.Failed > 0 ? FlagType.C_FLAG_OFF : FlagType.C_FLAG_ON;

            return(result);
        }