예제 #1
0
 public IActionResult Create(models.Post post)
 {
     if (ModelState.IsValid)
     {
         //CreatePostRequest request
     }
     return View(post);
 }
예제 #2
0
        public void TestSimpson()
        {
            Data.alts    = 4;
            Data.experts = 5;
            int[,] a     = { { 1, 2, 3, 4 }, { 1, 3, 2, 4 }, { 2, 3, 4, 1 },
                             { 4, 2, 3, 1 }, { 3, 4, 2, 1 }, };
            int[]  experted    = { 2, 3, 2, 1 };
            models simpsontest = new models();

            int[] actual = simpsontest.simpson(a);
            CollectionAssert.AreEqual(experted, actual);
        }
예제 #3
0
파일: UnitBoard.cs 프로젝트: Maydreya/ISIT
        public void TestBoard()
        {
            Data.alts    = 4;
            Data.experts = 5;
            int[,] a     = { { 1, 2, 3, 4 }, { 1, 3, 2, 4 }, { 2, 3, 4, 1 },
                             { 4, 2, 3, 1 }, { 3, 4, 2, 1 }, };
            int[] experted = { 11, 14, 14, 11 };

            models boardtest = new models();

            CollectionAssert.AreEqual(experted, boardtest.board(a));
        }
예제 #4
0
        public void TestKopland()
        {
            Data.alts    = 4;
            Data.experts = 5;
            int[,] a     = { { 1, 2, 3, 4 }, { 1, 3, 2, 4 }, { 2, 3, 4, 1 },
                             { 4, 2, 3, 1 }, { 3, 4, 2, 1 }, };
            int[] experted = { -3, 3, 3, -3 };

            models koplandtest = new models();

            int[] actual = koplandtest.kopland(a);
            CollectionAssert.AreEqual(experted, actual);
        }
예제 #5
0
        static void Main(string[] args)
        {
            var models1 = new models
            {
                models_Id = Util.MakeIdInt32()
            };

            for (int iTimes = 0; iTimes < 10; iTimes++)
            {
                var model = new model
                {
                    identifier = Util.MakeIdentifierTimestamped(ModelConst.MODEL_PREFIX, DateTime.Now),
                    version    = ModelConst.MODEL_VERSION,
                    model_Id   = Util.MakeIdInt32()
                };
                models1.model.Add(model);
            }

            var models2 = new models
            {
                models_Id = Util.MakeIdInt32()
            };

            for (int iTimes = 0; iTimes < 10; iTimes++)
            {
                var model = new model
                {
                    identifier = Util.MakeIdentifierTimestamped(ModelConst.MODEL_PREFIX, DateTime.Now),
                    version    = ModelConst.MODEL_VERSION,
                    model_Id   = Util.MakeIdInt32()
                };
                models2.model.Add(model);
            }

            folder[] folderArray = new folder[2];
            folderArray[0] = new folder
            {
                identifier = Util.MakeIdentifierTimestamped(ModelConst.MODEL_PREFIX, DateTime.Now),
                folder_Id  = Util.MakeIdInt32()
            };
            folderArray[0].models.Add(models1); // NOTE: Models

            folderArray[1] = new folder
            {
                identifier = Util.MakeIdentifierTimestamped(ModelConst.MODEL_PREFIX, DateTime.Now),
                folder_Id  = Util.MakeIdInt32()
            };
            folderArray[1].models.Add(models2); // NOTE: Model Templates

            var folders = new folders
            {
                folders_Id = Util.MakeIdInt32()
            };

            for (int iTimes = 0; iTimes < 2; iTimes++)
            {
                var folder = folderArray[iTimes];
                folders.folder.Add(folder);
            }

            var tenant = new tenant
            {
                identifier = Util.MakeIdentifierTimestamped(ModelConst.TENANT_PREFIX, DateTime.Now),
                version    = ModelConst.TENANT_VERSION,
                tenant_Id  = Util.MakeIdInt32()
            };

            name name;

            name           = new name();
            name.name_Id   = Util.MakeIdInt32();
            name.lang      = "en";
            name.name_text = Util.MakeIdentifierTimestamped(ModelConst.TENANT_PREFIX);
            tenant.name.Add(name);

            name           = new name();
            name.name_Id   = Util.MakeIdInt32();
            name.lang      = "en";
            name.name_text = Util.MakeIdentifierTimestamped(ModelConst.TENANT_PREFIX);
            tenant.name.Add(name);

            tenant.folders.Add(folders);

            using (var context = new ModelMateEFModel9Context())
            {
                context.tenant.Add(tenant);
                context.SaveChanges();

                tenant.version = ModelConst.TENANT_TESTVERSION;

                context.SaveChanges();

                object[] keys         = { 1724588879 };
                tenant   tenantDelete = context.tenant.Find(keys);
                context.tenant.Remove(tenantDelete);
                context.SaveChanges();
            }

            Console.WriteLine("Press Enter to continue...");
            Console.ReadLine();
        }
예제 #6
0
 public models.Product AddInventory(models.Product product)
 {
     return _storeRepository.AddInventory(product.ProductId, product.Inventory);
 }
예제 #7
0
 public Guid AddProduct(models.Product product)
 {
     return _storeRepository.AddProduct(product);
 }
예제 #8
0
        public models.TransactionResponse Refund(models.Profile profile, string originalTranactionId, models.TransactionRequest transactionRequest)
        {
            using (log4net.NDC.Push("Refund::"))
            {
                var merchantId = GetMerchantId(profile);
                var transactionKey = GetTransactionKey(profile);
                var serviceEndPoint = GetServiceEndPoint(profile);

                var request = CreateRequest();
                request.merchantID = merchantId;
                request.merchantReferenceCode = transactionRequest.ReferenceNumber;

                request.ccCreditService = new CCCreditService();
                request.ccCreditService.run = "true";
                request.ccCreditService.captureRequestID = originalTranactionId;
                request.ccCreditService.purchasingLevel = "3";

                PurchaseTotals purchaseTotals = new PurchaseTotals();
                purchaseTotals.currency = transactionRequest.Currency;
                purchaseTotals.grandTotalAmount = FormatPrice(transactionRequest.Amount);
                request.purchaseTotals = purchaseTotals;

                request.invoiceHeader = new InvoiceHeader { userPO = transactionRequest.CustomerPO };
                request.purchaseTotals.dutyAmount = "0.00";
                request.purchaseTotals.discountAmount = "0.00";

                request.invoiceHeader = new InvoiceHeader { userPO = transactionRequest.CustomerPO };
                request.purchaseTotals.dutyAmount = "0.00";
                request.purchaseTotals.discountAmount = "0.00";

                if (transactionRequest.ShipTo != null)
                {
                    request.shipTo = new ShipTo
                    {
                        city = transactionRequest.ShipTo.City,
                        country = transactionRequest.ShipTo.Country,
                        email = transactionRequest.ShipTo.EmailAddress,
                        firstName = transactionRequest.ShipTo.FirstName,
                        lastName = transactionRequest.ShipTo.LastName,
                        postalCode = transactionRequest.ShipTo.PostalCode,
                        state = transactionRequest.ShipTo.State,
                        street1 = transactionRequest.ShipTo.StreetLine1,
                        street2 = transactionRequest.ShipTo.StreetLine2,
                    };
                }
                if (transactionRequest.ShipFrom != null)
                {
                    request.shipFrom = new ShipFrom
                    {
                        country = transactionRequest.ShipFrom.Country,
                        email = transactionRequest.ShipFrom.EmailAddress,
                        firstName = transactionRequest.ShipFrom.FirstName,
                        lastName = transactionRequest.ShipFrom.LastName,
                        postalCode = transactionRequest.ShipFrom.PostalCode,
                        state = transactionRequest.ShipFrom.State,
                        street1 = transactionRequest.ShipFrom.StreetLine1,
                        street2 = transactionRequest.ShipFrom.StreetLine2,
                    };
                }
                if (transactionRequest.LineItems != null)
                {
                    List<Item> items = new List<Item>();
                    foreach (var i in transactionRequest.LineItems)
                    {
                        items.Add(new Item
                        {
                            productCode = i.ProductCode,
                            productName = i.ProductName,
                            productSKU = i.ProductSKU,
                            productDescription = i.ProductDescription,
                            unitPrice = FormatPrice(i.UnitPrice),
                            quantity = i.Quantity.ToString(),
                            taxRate = i.TaxRate.ToString(),
                            taxAmount = FormatPrice(i.TaxAmount),
                            discountAmount = FormatPrice(i.DiscountAmount),
                            totalAmount = FormatPrice(i.UnitPrice),
                            commodityCode = i.CommodityCode,
                            unitOfMeasure = "EA",
                        });
                    }

                    request.item = items.ToArray();
                }
                var client = GetCybersourceService(serviceEndPoint, merchantId, transactionKey);

                _logger.Info("\r\nrequest:" + request.ToJSON());
                var reply = client.runTransaction(request);
                _logger.Info("\r\nreply:" + reply.ToJSON());

                return ProcessReply(profile, reply);
            }
        }
예제 #9
0
        public models.TransactionResponse Void(models.Profile profile, string originalTranactionId, string referenceNumber)
        {
            using (log4net.NDC.Push("Void::"))
            {
                var merchantId = GetMerchantId(profile);
                var transactionKey = GetTransactionKey(profile);
                var serviceEndPoint = GetServiceEndPoint(profile);

                var request = CreateRequest();
                request.merchantID = merchantId;
                request.merchantReferenceCode = referenceNumber;

                request.voidService = new VoidService();
                request.voidService.run = "true";
                request.voidService.voidRequestID = originalTranactionId;

                var client = GetCybersourceService(serviceEndPoint, merchantId, transactionKey);

                _logger.Info("\r\nrequest:" + request.ToJSON());
                var reply = client.runTransaction(request);
                _logger.Info("\r\nreply:" + reply.ToJSON());

                return ProcessReply(profile, reply);
            }
        }
예제 #10
0
 public models.User RegisterUser(models.User user, string password)
 {
     return _storeRepository.RegisterUser(user, password);
 }