예제 #1
0
        public void TestInit()
        {
            // unittest-consolidatetestinit
            bool success = Consolidate.Initialize();

            Assert.AreEqual(true, success);
        }
예제 #2
0
        public void TestExtraVariable()
        {
            EquationConversion.ResetEquationConversion();
            Consolidate.Initialize();

            // test-input variableNotInFunction
            string varToken = EquationConversion.GetVariableToken();

            Consolidate.ConvertAndCheckInputs("x+y", "x,2,3\ny,4,5\nz,6,7", Solver.GetValidOperators(), Solver.GetValidTerminators(), "\n", ",");
            EquationStruct eqRoot = Consolidate.GetEquationStruct();

            IntervalStruct[] vars = Consolidate.GetIntervalStructList();

            EquationStruct targetStructure = new EquationStruct("+", "", new EquationStruct(varToken, "x", null, null), new EquationStruct(varToken, "y", null, null));

            IntervalStruct[] targetIntervals = new IntervalStruct[] { new IntervalStruct("x", 2, 3, true, true), new IntervalStruct("y", 4, 5, true, true) };

            Assert.AreEqual(PrintEquation(targetStructure), PrintEquation(eqRoot));
            Assert.AreEqual(targetIntervals[0].GetVariableName(), vars[0].GetVariableName());
            Assert.AreEqual(targetIntervals[0].GetMinBound(), vars[0].GetMinBound());
            Assert.AreEqual(targetIntervals[0].GetMaxBound(), vars[0].GetMaxBound());

            Assert.AreEqual(targetIntervals[1].GetVariableName(), vars[1].GetVariableName());
            Assert.AreEqual(targetIntervals[1].GetMinBound(), vars[1].GetMinBound());
            Assert.AreEqual(targetIntervals[1].GetMaxBound(), vars[1].GetMaxBound());

            Assert.AreEqual(2, vars.Length);
        }
예제 #3
0
        public AssmanContext BuildContext(ResourceMode resourceMode, IResourceFinder fileFinder, IPreCompiledReportPersister preCompiledPersister)
        {
            var context = AssmanContext.Create(resourceMode);

            context.ConfigurationLastModified = LastModified(PathResolver);
            context.ConsolidateScripts        = Consolidate.IsTrue(resourceMode) && Scripts.Consolidate.IsTrue(resourceMode);
            context.ConsolidateStylesheets    = Consolidate.IsTrue(resourceMode) && Stylesheets.Consolidate.IsTrue(resourceMode);
            context.GZip = GZip.IsTrue(resourceMode);
            context.ManageDependencies = ManageDependencies;
            context.AddFinder(fileFinder);
            context.AddAssemblies(Assemblies.GetAssemblies());
            context.ScriptGroups.AddGlobalDependencies(Scripts.GlobalDependencies.Cast <GlobalDependenciesElement>().Select(e => e.Path));
            context.ScriptGroups.AddRange(Scripts.Groups.Cast <IResourceGroupTemplate>());
            context.StyleGroups.AddGlobalDependencies(Stylesheets.GlobalDependencies.Cast <GlobalDependenciesElement>().Select(e => e.Path));
            context.StyleGroups.AddRange(Stylesheets.Groups.Cast <IResourceGroupTemplate>());
            context.MapExtensionToContentPipeline(".js", DefaultPipelines.Javascript());
            context.MapExtensionToContentPipeline(".css", DefaultPipelines.Css());
            context.MapExtensionToDependencyProvider(".js", VisualStudioScriptDependencyProvider.GetInstance());
            context.MapExtensionToDependencyProvider(".css", CssDependencyProvider.GetInstance());

            PreCompilationReport preCompilationReport;

            if (preCompiledPersister.TryGetPreConsolidationInfo(out preCompilationReport))
            {
                context.LoadPreCompilationReport(preCompilationReport);
            }

            foreach (var plugin in Plugins.GetPlugins())
            {
                plugin.Initialize(context);
            }

            return(context);
        }
예제 #4
0
        public virtual IActionResult ExportXlsx(string status)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCategories))
            {
                return(AccessDeniedView());
            }

            try
            {
                Consolidate payment = new Consolidate
                {
                    StatusPaymentOrder = Convert.ToInt32(status),
                };

                var transferList = _consolidateService.SearchPayment(payment);

                var xml = ExportPaymentToXlsx(transferList);

                return(File(xml, MimeTypes.TextXlsx, "Pagos.xlsx"));
            }
            catch (Exception exc)
            {
                ErrorNotification(exc);
                return(RedirectToAction("List"));
            }
        }
예제 #5
0
        public IPagedList <Consolidate> SearchPayment(Consolidate payment, int storeId = 0, int pageIndex = 0, int pageSize = int.MaxValue)
        {
            try
            {
                var key = string.Format(PAYMENT_ALL_KEY, pageIndex, pageSize, payment.TiendaId);
                return(_cacheManager.Get(key, () =>
                {
                    var query = _paymentRepository.Table;

                    if (payment.TiendaId > 0)
                    {
                        query = query.Where(b => b.TiendaId == payment.TiendaId || b.TiendaId == 0);
                    }

                    if (payment.OrdenId > 0)
                    {
                        query = query.Where(b => b.OrdenId == payment.OrdenId);
                    }

                    if (payment.ClienteId > 0)
                    {
                        query = query.Where(b => b.ClienteId == payment.ClienteId);
                    }

                    if (!string.IsNullOrWhiteSpace(payment.Referencia))
                    {
                        query = query.Where(b => b.Referencia.Contains(payment.Referencia));
                    }

                    if (!string.IsNullOrWhiteSpace(payment.MetodoPago) && !payment.MetodoPago.Equals("0"))
                    {
                        query = query.Where(b => b.MetodoPago.Contains(payment.MetodoPago));
                    }

                    if (payment.StatusPaymentOrder > 0)
                    {
                        query = query.Where(b => b.StatusPaymentOrder == payment.StatusPaymentOrder);
                    }

                    if (payment.BancoEmisorId > 0)
                    {
                        query = query.Where(b => b.BancoEmisorId == payment.BancoEmisorId);
                    }

                    if (payment.BancoReceptorId > 0)
                    {
                        query = query.Where(b => b.BancoReceptorId == payment.BancoReceptorId);
                    }

                    query = query.OrderByDescending(b => b.Id).ThenBy(b => b.FechaUltimaActualizacion);

                    return new PagedList <Consolidate>(query, pageIndex, pageSize);
                }));
            }
            catch (Exception ex)
            {
                throw new NopException("Error al obtener los pagos:: " + ex.Message, ex);
            }
        }
예제 #6
0
        public void UpdatePayment(Consolidate payment)
        {
            try
            {
                if (payment == null)
                {
                    throw new ArgumentNullException(nameof(payment));
                }

                switch (payment.MetodoPago)
                {
                case "Payments.Transfer":
                {
                    try
                    {
                        var paymentTransfer = _transferServices.GetPaymentTransferByOrderId(payment.OrdenId);
                        paymentTransfer.ReceiverBankName = payment.BancoEmisor;
                        paymentTransfer.IssuingBankName  = payment.BancoReceptor;
                        paymentTransfer.ReceiverBankId   = payment.BancoEmisorId;
                        paymentTransfer.IssuingBankId    = payment.BancoReceptorId;
                        paymentTransfer.ReferenceNumber  = payment.Referencia;

                        _transferServices.UpdatePaymentTransfer(paymentTransfer);
                    }
                    catch (Exception ex)
                    {
                        throw new NopException("Error en transferencia: " + ex.Message, ex);
                    }
                    break;
                }

                default: {
                    try
                    {
                        var zelleTransfer = _zelleServices.GetPaymentZelleByOrderId(payment.OrdenId);
                        zelleTransfer.ReferenceNumber = payment.Referencia;
                        zelleTransfer.IssuingEmail    = payment.EmailEmisor;

                        _zelleServices.UpdatePaymentZelle(zelleTransfer);
                    }
                    catch (Exception ex)
                    {
                        throw new NopException("Error en zelle: " + ex.Message, ex);
                    }
                    break;
                }
                }

                payment.FechaUltimaActualizacion = DateTime.Now;

                _paymentRepository.Update(payment);
                _cacheManager.RemoveByPattern(PAYMENT_PATTERN_KEY);
            }
            catch (Exception ex)
            {
                throw new NopException("Error al actualizar el pago: " + ex.Message, ex);
            }
        }
        public void WhenTheTaskIsExecuted()
        {
            var sw   = Stopwatch.StartNew();
            var task = new Consolidate(Substitute.For <ILog>());

            task.AssemblyVersion = "1.2.3";
            (returnValue, _)     = task.Execute(temp, packageReferences);
            Console.WriteLine($"Time: {sw.ElapsedMilliseconds:n0}ms");
        }
예제 #8
0
        public void TestMissingVariable()
        {
            EquationConversion.ResetEquationConversion();
            Consolidate.Initialize();

            // test-input noDomain
            int success = Consolidate.ConvertAndCheckInputs("x+y", "x,2,3", Solver.GetValidOperators(), Solver.GetValidTerminators(), System.Environment.NewLine, ",");

            Assert.AreEqual(-2, success);
        }
예제 #9
0
        public void TestIncompleteEquation()
        {
            EquationConversion.ResetEquationConversion();
            Consolidate.Initialize();

            // unittest-consolidateincompleteequation
            int successCode = Consolidate.ConvertAndCheckInputs("", "x,2,3\n", Solver.GetValidOperators(), Solver.GetValidTerminators(), Input.GetLineDelimiter(), Input.GetFieldDelimiter());

            Assert.AreEqual(-3, successCode);
        }
예제 #10
0
 static void Main(string[] args)
 {
     try
     {
         var consolidate = new Consolidate(true);
         Log.Log.LogInfo("Requisições consolidadas com sucesso!");
     }
     catch (Exception ex)
     {
         Log.Log.LogError(ex.Message, ex);
     }
 }
예제 #11
0
        public void TestVarExtraction()
        {
            EquationConversion.ResetEquationConversion();
            Consolidate.Initialize();

            // unittest-consolidateextractvariables
            string[] vars = Consolidate.ExtractVariablesFromEquation("x+y");

            Assert.AreEqual(2, vars.Length);
            Assert.AreEqual("x", vars[0]);
            Assert.AreEqual("y", vars[1]);
        }
예제 #12
0
        public bool TryGetConsolidatedUrl(string virtualPath, ResourceMode resourceMode, out string consolidatedUrl)
        {
            consolidatedUrl = null;
            if (Consolidate.IsFalse(resourceMode))
            {
                return(false);
            }

            var match = GetMatch(virtualPath);

            if (match.IsMatch())
            {
                consolidatedUrl = GetConsolidatedUrl(match);
                return(true);
            }

            return(false);
        }
예제 #13
0
        public IActionResult List(ConfigurationModel search, DataSourceRequest command)
        {
            try
            {
                if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings))
                {
                    return(AccessDeniedKendoGridJson());
                }

                if (search == null)
                {
                    throw new ArgumentNullException(nameof(search));
                }


                Consolidate payment = new Consolidate
                {
                    TiendaId   = search.TiendaId,
                    OrdenId    = search.OrdenId,
                    ClienteId  = search.ClienteId,
                    Referencia = search.Referencia == null ? "" : search.Referencia,
                    MetodoPago = search.MetodoPago == null ? "" : search.MetodoPago,
                    //StatusPaymentOrder = search.StatusPaymentOrder,
                    StatusPaymentOrder = Convert.ToInt32(search.StatusPaymentOrder),
                    BancoEmisorId      = search.BancoReceptorId,
                    BancoReceptorId    = search.BancoReceptorId
                };

                var transferList = _consolidateService.SearchPayment(payment, pageIndex: command.Page - 1, pageSize: command.PageSize);

                return(Json(new DataSourceResult
                {
                    Data = transferList,
                    Total = transferList.TotalCount
                }));
            }
            catch (Exception ex)
            {
                throw new NopException(ex.Message, ex);
            }
        }
예제 #14
0
        public void TestFailedConfig()
        {
            EquationConversion.ResetEquationConversion();
            Consolidate.Initialize();

            // unittest-consolidatenoops
            OperatorStruct[] ops = new OperatorStruct[] { };
            int success          = Consolidate.ConvertAndCheckInputs("x+y", "x,2,3\ny,4,5", ops, Solver.GetValidTerminators(), System.Environment.NewLine, ",");

            Assert.AreEqual(-1, success);

            // unittest-consolidatenorightterm
            string[][] terminators = new string[][] { new string[] { "(", "" } };
            success = Consolidate.ConvertAndCheckInputs("x+y", "x,2,3\ny,4,5", Solver.GetValidOperators(), terminators, System.Environment.NewLine, ",");
            Assert.AreEqual(-1, success);

            // unittest-consolidatenoleftterm
            terminators = new string[][] { new string[] { "", ")" } };
            success     = Consolidate.ConvertAndCheckInputs("x+y", "x,2,3\ny,4,5", Solver.GetValidOperators(), terminators, System.Environment.NewLine, ",");
            Assert.AreEqual(-1, success);
        }
예제 #15
0
        public IActionResult RegisterPayment(ConfigurationModel payment)
        {
            try
            {
                if (payment == null)
                {
                    return(Json(new { success = false }));
                }

                var model = new Consolidate
                {
                    BancoEmisorId            = payment.BancoEmisorId,
                    BancoReceptorId          = payment.BancoReceptorId,
                    OrdenId                  = payment.OrdenId,
                    BancoEmisor              = payment.BancoEmisor,
                    BancoReceptor            = payment.BancoReceptor,
                    EmailEmisor              = payment.EmailEmisor,
                    FechaRegistro            = DateTime.Now,
                    FechaUltimaActualizacion = DateTime.Now,
                    Referencia               = payment.Referencia,
                    StatusPaymentOrder       = Convert.ToInt32(payment.StatusPaymentOrder),
                    Tienda = _storeContext.CurrentStore.Name,
                    Id     = payment.Id
                };

                _consolidateService.InsertPayment(model);

                ViewBag.RefreshPage = true;

                return(RedirectToRoute("OrderDetails", new { orderId = payment.OrdenId }));
            }
            catch (Exception ex)
            {
                throw new NopException(ex.Message, ex);
            }
        }
예제 #16
0
        public static void Notify(Consolidate consolidate)
        {
            var json = Mapper.Map <ConsolidateJson>(consolidate);

            Notify(Json.Encode(json), GetEntityName(consolidate));
        }
        public static void Notify(int consolidateId)
        {
            Consolidate consolidate = IndentRepository.GetConsolidate(consolidateId);

            NotificationService.NotifyAll(consolidate);
        }
예제 #18
0
        public void TestMethod1()
        {
            var consolidate = new Consolidate(false);

            consolidate.
        }
 public static void Notify(Consolidate consolidate)
 {
     NotificationService.NotifyAll(consolidate);
 }
예제 #20
0
        public void InsertPayment(Consolidate payment)
        {
            try
            {
                if (payment == null)
                {
                    throw new ArgumentNullException(nameof(payment));
                }

                var order2 = _orderService.GetOrderById(payment.OrdenId);
                if (order2 == null)
                {
                    throw new ArgumentNullException(nameof(payment.OrdenId));
                }

                // datos de la orden

                payment.MetodoPago         = order2.PaymentMethodSystemName;
                payment.CodigoMoneda       = order2.CustomerCurrencyCode;
                payment.TiendaId           = order2.StoreId;
                payment.ClienteId          = order2.CustomerId;
                payment.StatusPaymentOrder = order2.PaymentStatusId;


                switch (payment.MetodoPago)
                {
                case "Payments.Transfer":
                {
                    try
                    {
                        var paymentTransfer = _transferServices.GetPaymentTransferByOrderId(payment.OrdenId);
                        payment.BancoEmisor   = _bankServices.GetBankById(payment.BancoEmisorId).Name;
                        payment.BancoReceptor = payment.BancoEmisor;
                        var mnt = order2.OrderTotal;
                        payment.MontoTotalOrden = mnt.ToString("N", new CultureInfo("es-VE"));


                        if (paymentTransfer == null)
                        {
                            var model = new PaymentTransfer
                            {
                                IssuingBankId   = payment.BancoEmisorId,
                                OrderId         = payment.OrdenId,
                                ReceiverBankId  = payment.BancoReceptorId,
                                ReferenceNumber = payment.Referencia,
                                OrderTotal      = order2.OrderTotal
                            };
                            _transferServices.InsertPaymentTransfer(model);
                        }
                        else
                        {
                            UpdatePayment(payment);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new NopException("Error en insert transferencia: " + ex.Message, ex);
                    }
                    break;
                }

                default:
                {
                    try
                    {
                        var paymentZelle = _zelleServices.GetPaymentZelleByOrderId(payment.OrdenId);
                        if (paymentZelle == null)
                        {
                            var model = new PaymentZelle
                            {
                                IssuingEmail    = payment.EmailEmisor,
                                OrderId         = payment.OrdenId,
                                ReferenceNumber = payment.Referencia,
                                OrderTotal      = order2.OrderTotal * order2.CurrencyRate
                            };

                            _zelleServices.InsertPaymentZelle(model);
                        }
                        else
                        {
                            UpdatePayment(payment);
                        }
                        var mnto = order2.OrderTotal * order2.CurrencyRate;
                        payment.MontoTotalOrden = mnto.ToString("N", new CultureInfo("es-VE"));
                        //paymentZelle.PaymentStatusOrder = (int)order2.PaymentStatus;
                        //_zelleServices.UpdatePaymentZelle(paymentZelle);
                    }
                    catch (Exception ex)
                    {
                        throw new NopException("Error en insert zelle: " + ex.Message, ex);
                    }
                    break;
                }
                }

                if (payment.Id == 0)
                {
                    _paymentRepository.Insert(payment);
                }

                _cacheManager.RemoveByPattern(PAYMENT_PATTERN_KEY);
            }
            catch (Exception ex)
            {
                throw new NopException("Error al insertar el pago: " + ex.Message, ex);
            }
        }