public void SuspendOrDeleteActiveOrder(OrderContract contract, int idActiveOrder, string userName, string dealer, string member, char buysell, char action)
        {
            SuspendDeleteActiveOrder susOrdel = new SuspendDeleteActiveOrder();

            susOrdel.Contract      = contract;
            susOrdel.DealerCode    = DataConverter.ConvertToDelphiString(dealer, 4);
            susOrdel.IdActiveOrder = idActiveOrder;
            susOrdel.MemberCode    = DataConverter.ConvertToDelphiString(member, 6);
            susOrdel.Action        = action;
            susOrdel.BuySell       = buysell;
            connection.Send(MessageType.MESSAGE_8_SUSPEND_OR_CANCEL_ACTIVE_ORDER, userName, susOrdel);
        }
示例#2
0
        public void Deal(OrderContract contract)
        {
            var orderDetailFacade = new T_InoutDetailFacade();
            var orderFacade       = new T_InoutFacade();

            var inoutDetails = new List <T_Inout_DetailEntity>();

            foreach (var detail in contract.DetailList)
            {
                var tmp = ConvertToT_InoutDetial(contract.OrderId, detail);
                inoutDetails.Add(tmp);
            }

            switch (contract.Operation)
            {
            case OptEnum.Create:
                var tInout = ConvertToT_Inout(contract);

                orderFacade.Create(tInout);
                foreach (var entity in inoutDetails)
                {
                    orderDetailFacade.Create(entity);
                }
                break;

            case OptEnum.Update:
                var tinout = orderFacade.GetOrderByOrderId(contract.OrderId);

                if (contract.Status == EnumOrderStatus.Done)
                {
                }

                tinout.total_amount   = tinout.total_amount + inoutDetails[0].enter_amount;
                tinout.actual_amount  = tinout.total_amount * (tinout.discount_rate / 100);
                tinout.modify_time    = contract.ModifyTime;
                tinout.modify_user_id = contract.ModifyUserId;

                orderFacade.Update(tinout);
                foreach (var entity in inoutDetails)
                {
                    orderDetailFacade.Create(entity);
                }
                break;

            case OptEnum.Delete:

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
示例#3
0
        /// <summary>
        /// 添加到购物车
        /// </summary>
        /// <returns></returns>
        public async Task <ActionResult> AddCartGoods(CartGoodsInputDto dto)
        {
            //只要提交过来的都是经过前端验证的用户已经登录
            dto.CheckNotNull(nameof(dto));

            dto.UserId = CurrentUser.Id;
            OperationResult result;

            //判断购物车中是否相同商品,相同商品只改变数量即可
            result = await OrderContract.AddCartGoodses(dto);

            return(Json(result.ToAjaxResult()));
        }
示例#4
0
        private void btnSelectOrderContractSale_Click(object sender, EventArgs e)
        {
            DlgOrderContract dlg    = new DlgOrderContract();
            DialogResult     result = dlg.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK ||
                result == System.Windows.Forms.DialogResult.Yes)
            {
                OrderContract orderContract = dlg.OrderContract;
                var           orderProducts = orderContract.OrderProducts;

                CreateOrderProductsByItems(orderProducts);
            }
        }
示例#5
0
        private JsonResult RemoveCore(OrderContract model)
        {
            if (ModelState.IsValid)
            {
                var temp = dxContext.OrderContracts.FirstOrDefault(
                    m => model.OrderContractKey == model.OrderContractKey);
                if (temp != null)
                {
                    dxContext.OrderContracts.Remove(temp);
                    dxContext.SaveChanges();
                }
            }

            return(Json(null));
        }
示例#6
0
        private static void GetOrderDetails(string orderID)
        {
            WebClient proxy      = new WebClient();
            string    serviceURL = string.Format("http://localhost:61090/OrderService.svc/GetOrderDetails/{0}", orderID);

            byte[] data   = proxy.DownloadData(serviceURL);
            Stream stream = new MemoryStream(data);
            DataContractJsonSerializer obj = new DataContractJsonSerializer(typeof(OrderContract));
            OrderContract order            = obj.ReadObject(stream) as OrderContract;

            Console.WriteLine("Order ID : " + order.OrderID);
            Console.WriteLine("Order Date : " + order.OrderDate);
            Console.WriteLine("Order Shipped Date : " + order.ShippedDate);
            Console.WriteLine("Order Ship Country : " + order.ShipCountry);
            Console.WriteLine("Order Total : " + order.OrderTotal);
        }
        public void EditSuspendedOrder(OrderContract Contract, char BuyOrSell, double Price, long Quantity, string Principle, string Reference,
                                       string Dealer, string Member, int IdActiveOrder, string userName)
        {
            EditSuspendedOrder eso = new Stt.Derivatives.Api.EditSuspendedOrder();

            eso.Contract      = Contract;
            eso.BuyOrSell     = BuyOrSell;
            eso.Price         = Price;
            eso.Quantity      = Quantity;
            eso.Principle     = DataConverter.ConvertToDelphiString(Principle, 8);
            eso.Reference     = DataConverter.ConvertToDelphiString(Reference, 10);
            eso.Dealer        = DataConverter.ConvertToDelphiString(Dealer, 4);
            eso.Member        = DataConverter.ConvertToDelphiString(Member, 6);
            eso.IdActiveOrder = IdActiveOrder;

            connection.Send(MessageType.MESSAGE_118_EDIT_SUSPENDED_ORDER, userName, eso);
        }
        public static bool ProductComplexityConfirmationReceived(this OrderContract order, bool defaultValue = false)
        {
            try
            {
                var model = JsonConvert.DeserializeAnonymousType(order.AdditionalInfo,
                                                                 new
                {
                    ProductComplexityConfirmationReceived = (bool?)null
                });

                return(model.ProductComplexityConfirmationReceived ?? defaultValue);
            }
            catch
            {
                return(defaultValue);
            }
        }
示例#9
0
        public async Task Orders_CreateForExistingProduct_ShouldReturnHttpOk()
        {
            // Arrange
            const string ordersUrl            = "api/v1/order";
            const string customerFirstName    = "Tom";
            const string customerLastName     = "Kerkhove";
            var          selloService         = new SelloService();
            var          customerEmailAddress = $"{Guid.NewGuid().ToString()}@codit.eu";
            var          productToBuy         = await GetProductFromCatalogAsync();

            var customer = new CustomerContract
            {
                FirstName    = customerFirstName,
                LastName     = customerLastName,
                EmailAddress = customerEmailAddress
            };
            var order = new OrderContract
            {
                Customer = customer,
                Product  = productToBuy
            };

            // Act
            var response = await selloService.PostResponseAsync(ordersUrl, order);

            // Assert
            Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
            var rawContent = await response.Content.ReadAsStringAsync();

            var orderConfirmation = JsonConvert.DeserializeObject <OrderConfirmationContract>(rawContent);

            Assert.NotNull(orderConfirmation);
            Assert.NotNull(orderConfirmation.ConfirmationId);
            Assert.IsNotEmpty(orderConfirmation.ConfirmationId);
            Assert.NotNull(orderConfirmation.Order);
            Assert.NotNull(orderConfirmation.Order.Product);
            Assert.AreEqual(productToBuy.Id, orderConfirmation.Order.Product.Id);
            Assert.AreEqual(productToBuy.Name, orderConfirmation.Order.Product.Name);
            Assert.AreEqual(productToBuy.Description, orderConfirmation.Order.Product.Description);
            Assert.AreEqual(productToBuy.Price, orderConfirmation.Order.Product.Price);
            Assert.NotNull(orderConfirmation.Order.Customer);
            Assert.AreEqual(customerFirstName, orderConfirmation.Order.Customer.FirstName);
            Assert.AreEqual(customerLastName, orderConfirmation.Order.Customer.LastName);
            Assert.AreEqual(customerEmailAddress, orderConfirmation.Order.Customer.EmailAddress);
        }
示例#10
0
        public void Order_MapFromContractToDbEntity_Succeeds()
        {
            // Arrange
            const string customerFirstName    = "John";
            const string customerLastName     = "Doe";
            const string customerEmailAddress = "*****@*****.**";
            const string productName          = "Xbox One X";
            const string productDescription   = "Microsoft's latest gaming console";
            const double productPrice         = 599;
            string       productId            = Guid.NewGuid().ToString();
            var          customerContract     = new CustomerContract
            {
                FirstName    = customerFirstName,
                LastName     = customerLastName,
                EmailAddress = customerEmailAddress
            };
            var product = new ProductInformationContract
            {
                Id          = productId,
                Name        = productName,
                Description = productDescription,
                Price       = productPrice
            };

            var orderContract = new OrderContract
            {
                Customer = customerContract,
                Product  = product
            };

            // Act
            var order = Mapper.Map <Order>(orderContract);

            // Assert
            Assert.NotNull(order);
            Assert.NotNull(order.Customer);
            Assert.AreEqual(customerFirstName, order.Customer.FirstName);
            Assert.AreEqual(customerLastName, order.Customer.LastName);
            Assert.AreEqual(customerEmailAddress, order.Customer.EmailAddress);
            Assert.NotNull(order.Product);
            Assert.AreEqual(productId, order.Product.ExternalId);
            Assert.AreEqual(productName, order.Product.Name);
            Assert.AreEqual(productPrice, order.Product.Price);
            Assert.AreEqual(productDescription, order.Product.Description);
        }
示例#11
0
        public OrderContract GetOrder(ORDER order)
        {
            var ordercontract = new OrderContract
            {
                ORDERID      = order.ORDERID,
                DESCRIPTION  = order.DESCRIPTION,
                CREATEDDATE  = order.CREATEDDATE,
                ORDERDETAILs = order.ORDERDETAILs.Select(
                    x => new OrderDetailsContract
                {
                    ORDERDETAILID = x.ORDERDETAILID,
                    DESCRIPTION   = x.DESCRIPTION,
                    CREATEDDATE   = x.CREATEDDATE
                }
                    ).ToList()
            };

            return(ordercontract);
        }
示例#12
0
        public ORDER GetOrderFromOrderContract(OrderContract orderContract)
        {
            var order = new ORDER
            {
                CREATEDDATE  = orderContract.CREATEDDATE,
                DESCRIPTION  = orderContract.DESCRIPTION,
                ORDERID      = orderContract.ORDERID,
                ORDERDETAILs = orderContract.ORDERDETAILs.Select(
                    x => new ORDERDETAIL
                {
                    CREATEDDATE   = x.CREATEDDATE,
                    DESCRIPTION   = x.DESCRIPTION,
                    ORDERDETAILID = x.ORDERDETAILID
                }
                    ).ToList()
            };

            return(order);
        }
示例#13
0
        private async Task <OrderConfirmationContract> StoreOrderAsync(OrderContract order)
        {
            var confirmationId = Guid.NewGuid().ToString();

            var dbOrder = Mapper.Map <Order>(order);

            dbOrder.ConfirmationId = confirmationId;

            var ordersRepository = await GetOrCreateOrdersRepositoryAsync();

            await ordersRepository.AddAsync(dbOrder);

            var orderConfirmation = new OrderConfirmationContract
            {
                ConfirmationId = confirmationId,
                Order          = order
            };

            return(orderConfirmation);
        }
        public void Execute()
        {
            var flights = new FlightContract().AllocateFlightOrders();
            var orders  = new OrderContract().LoadOrders().OrderBy(o => o.Key);

            Console.WriteLine();
            Console.WriteLine("************************* Print Order Details *************************");

            foreach (var order in orders)
            {
                var flight = flights.FirstOrDefault(s => s.Orders.ContainsKey(order.Key));
                if (flight != null)
                {
                    Console.WriteLine($"Order: {order.Key}, FlightNumber: {flight.FlightNo}, Departure: { flight.Departure}, Arrival: {flight.Arrival}, Day: {flight.Day}");
                }
                else
                {
                    Console.WriteLine("order: order-X, flightNumber: not scheduled");
                }
            }
        }
示例#15
0
        public List <FlightDto> Execute()
        {
            var flights = new FlightContract().LoadFlights();
            var orders  = new OrderContract().LoadOrders();

            foreach (var flight in flights)
            {
                flight.Orders = orders
                                .Where(t => t.Value.Destination == flight.Arrival)
                                .Take(App.Default.FlightCapacity)
                                .ToList()
                                .ToDictionary(x => x.Key, x => x.Value);

                flight.Orders.Keys.ToList().ForEach(f =>
                {
                    orders.Remove(f);
                });
            }

            return(flights);
        }
示例#16
0
        public async Task <IHttpActionResult> Post([FromBody] OrderContract order)
        {
            if (IsChaosMonkeyUnleashed())
            {
                throw new ChaosMonkeyException();
            }

            var validationResult = await ValidateOrderAsync(order);

            if (validationResult != null)
            {
                return(validationResult);
            }

            var orderConfirmation = await StoreOrderAsync(order);

            var resourceUri = ComposeResourceLocation(orderConfirmation.ConfirmationId);

            TrackNewOrderCreatedEvent(orderConfirmation);

            return(Created(resourceUri, orderConfirmation));
        }
        public void SendOrderInsert(OrderContract contract, string clientCode, string secondMemberCode, string SecondDealerCode, char buySell, int qty, double price, string userName, int bidType,
                                    int cancelFlag, string orderReferenceNumber, int TimeoutSeconds, DateTime ExpiryDate)
        {
            MultiBid mb = new MultiBid();


            MitsDate ExpDate = new MitsDate();

            if (ExpiryDate.CompareTo(DateTime.MinValue) == 0)
            {
                ExpDate.Day   = 0;
                ExpDate.Month = 0;
                ExpDate.Year  = 0;
            }
            else
            {
                ExpDate.Day   = ExpiryDate.Day;
                ExpDate.Month = ExpiryDate.Month;
                ExpDate.Year  = ExpiryDate.Year;
            }

            mb.NumberOfOrders                 = 1;
            mb.FirstOrder.BuySell             = buySell;
            mb.FirstOrder.Cancel              = cancelFlag;
            mb.FirstOrder.Contract            = contract;
            mb.FirstOrder.DealerCode          = Utilities.ConvertToDelphiString(SecondDealerCode, 4);
            mb.FirstOrder.MemberCode          = Utilities.ConvertToDelphiString(secondMemberCode, 6);
            mb.FirstOrder.Price               = price;
            mb.FirstOrder.Principal           = Utilities.ConvertToDelphiString(clientCode, 8);
            mb.FirstOrder.PrincipleAgency     = 'A';
            mb.FirstOrder.Quantity            = qty;
            mb.FirstOrder.Reference           = Utilities.ConvertToDelphiString(orderReferenceNumber, 10);
            mb.FirstOrder.Type                = bidType;
            mb.FirstOrder.TimeOutSeconds      = TimeoutSeconds;
            mb.FirstOrder.HoldOverDate        = ExpDate;
            mb.FirstOrder.NumberOfAllocations = 0;
            connection.Send(MessageType.MESSAGE_56_MULTIBID, userName, mb);
        }
示例#18
0
        public async Task Orders_CreateForExistingProductWithChangedDescription_ShouldReturnHttpBadRequest()
        {
            // Arrange
            const string ordersUrl            = "api/v1/order";
            const string customerFirstName    = "Tom";
            const string customerLastName     = "Kerkhove";
            const string customerEmailAddress = "*****@*****.**";
            var          selloService         = new SelloService();
            var          productToBuy         = await GetProductFromCatalogAsync();

            productToBuy.Description = "Altered description";

            var customer = new CustomerContract
            {
                FirstName    = customerFirstName,
                LastName     = customerLastName,
                EmailAddress = customerEmailAddress
            };
            var order = new OrderContract
            {
                Customer = customer,
                Product  = productToBuy
            };

            // Act
            var response = await selloService.PostResponseAsync(ordersUrl, order);

            // Assert
            Assert.NotNull(response);
            Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode);
            Assert.NotNull(response.Content);
            var rawResponse = await response.Content.ReadAsStringAsync();

            var validationMessages = JsonConvert.DeserializeObject <List <string> >(rawResponse);

            Assert.IsTrue(validationMessages.Any(
                              validationMessage => validationMessage == ValidationMessages.Product_DescriptionIsNotCorrect));
        }
示例#19
0
        public async Task Orders_CreateForNotExistingProduct_ShouldReturnHttpNotFound()
        {
            // Arrange
            const string ordersUrl            = "api/v1/order";
            const string productId            = "I-DO-NOT-EXIST";
            const string productName          = "Validation Product";
            const string productDescription   = "Product created by Integration Test, however it should never make it in";
            const double productPrice         = 100;
            const string customerFirstName    = "Tom";
            const string customerLastName     = "Tom";
            const string customerEmailAddress = "*****@*****.**";
            var          selloService         = new SelloService();

            var customer = new CustomerContract
            {
                FirstName    = customerFirstName,
                LastName     = customerLastName,
                EmailAddress = customerEmailAddress
            };
            var product = new ProductInformationContract
            {
                Id          = productId,
                Name        = productName,
                Description = productDescription,
                Price       = productPrice
            };
            var order = new OrderContract
            {
                Customer = customer,
                Product  = product
            };

            // Act
            var response = await selloService.PostResponseAsync(ordersUrl, order);

            // Assert
            Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode);
        }
示例#20
0
        private static void PlaceOrder()
        {
            OrderContract order = new OrderContract
            {
                OrderID     = "10550",
                OrderDate   = DateTime.Now.ToString(),
                ShippedDate = DateTime.Now.AddDays(10).ToString(),
                ShipCountry = "India",
                OrderTotal  = "781"
            };

            DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(OrderContract));
            MemoryStream mem = new MemoryStream();

            ser.WriteObject(mem, order);
            string    data      = Encoding.UTF8.GetString(mem.ToArray(), 0, (int)mem.Length);
            WebClient webClient = new WebClient();

            webClient.Headers["Content-type"] = "application/json";
            webClient.Encoding = Encoding.UTF8;
            webClient.UploadString("http://localhost:61090/OrderService.svc/PlaceOrder", "POST", data);
            Console.WriteLine("Order placed successfully...");
        }
        public void SendOrderInsert(OrderContract contract, string clientCode, string secondMemberCode, string SecondDealerCode, char buySell, int qty, double price, string userName, int bidType,
                                    int cancelFlag, string orderReferenceNumber, int TimeoutSeconds, char principleAgency)
        {
            MultiBid mb = new MultiBid();

            mb.NumberOfOrders                 = 1;
            mb.FirstOrder.BuySell             = buySell;
            mb.FirstOrder.Cancel              = cancelFlag;
            mb.FirstOrder.Contract            = contract;
            mb.FirstOrder.DealerCode          = Utilities.ConvertToDelphiString(SecondDealerCode, 4);
            mb.FirstOrder.MemberCode          = Utilities.ConvertToDelphiString(secondMemberCode, 6);
            mb.FirstOrder.Price               = price;
            mb.FirstOrder.Principal           = Utilities.ConvertToDelphiString(clientCode, 8);
            mb.FirstOrder.PrincipleAgency     = principleAgency;
            mb.FirstOrder.Quantity            = qty;
            mb.FirstOrder.Reference           = Utilities.ConvertToDelphiString(orderReferenceNumber, 10);
            mb.FirstOrder.Type                = bidType;
            mb.FirstOrder.TimeOutSeconds      = TimeoutSeconds;
            mb.FirstOrder.HoldOverDate        = new MitsDate(0, 0, 0);
            mb.FirstOrder.NumberOfAllocations = 0;

            connection.Send(MessageType.MESSAGE_56_MULTIBID, userName, mb);
        }
示例#22
0
        private static void PlaceOrder()
        {
            OrderContract order = new OrderContract
            {
                metricDate  = null,
                deviceType  = null,
                metricValue = null,
                deviceID    = null
            };

            DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(OrderContract));
            MemoryStream mem = new MemoryStream();

            if (order.deviceType != null)
            {
                ser.WriteObject(mem, order);
                string    data      = Encoding.UTF8.GetString(mem.ToArray(), 0, (int)mem.Length);
                WebClient webClient = new WebClient();
                webClient.Headers["Content-type"] = "application/json";
                webClient.Encoding = Encoding.UTF8;
                webClient.UploadString("http://10.162.50.14:61090/OrderService.svc/device", "POST", data);
                Console.WriteLine("Order placed successfully...");
            }
        }
        public JsonResult AddProductItemSalesGuidePrice(
            IEnumerable <AddSalesGuidePriceViewModel> list)
        {
            //FIXED 批量添加指导销售价
            if (ModelState.IsValid)
            {
                OrderContract orderContract = null;
                try
                {
                    ProductItem item = dxContext.ProductItems.Find(
                        list.First().ProductItemId);
                    if (item != null && item.OrderContract != null)
                    {
                        orderContract = dxContext.OrderContracts.Find(
                            item.OrderContract.OrderContractId);
                    }
                    if (orderContract != null)
                    {
                        //foreach (var i in orderContract.OrderProducts)
                        //{
                        //    var j = list.FirstOrDefault(
                        //        m => m.ProductItemId == i.ProductItemId);
                        //    if (j != null)
                        //        i.SalesGuidePrice = j.SalesGuidePrice;
                        //}

                        dxContext.SaveChanges();
                    }
                }
                catch (Exception ee)
                {
                    ModelState.AddModelError(string.Empty, ee);
                }
            }
            return(Json(this.GetModelStateErrors(ModelState)));
        }
示例#24
0
 public IHttpActionResult Put(int id, [FromBody] OrderContract orderContract)
 {
     return(Ok(_orderBusiness.UpdateOrder(orderContract)));
 }
示例#25
0
        public static OrderHistory ToOrderHistoryDomain(this OrderContract order, OrderHistoryTypeContract historyType, string correlationId)
        {
            var orderContract = new OrderHistory
            {
                Id                     = order.Id,
                AccountId              = order.AccountId,
                AssetPairId            = order.AssetPairId,
                CreatedTimestamp       = order.CreatedTimestamp,
                Direction              = order.Direction.ToType <OrderDirection>(),
                ExecutionPrice         = order.ExecutionPrice,
                FxRate                 = order.FxRate,
                FxAssetPairId          = order.FxAssetPairId,
                FxToAssetPairDirection = order.FxToAssetPairDirection.ToType <FxToAssetPairDirection>(),
                ExpectedOpenPrice      = order.ExpectedOpenPrice,
                ForceOpen              = order.ForceOpen,
                ModifiedTimestamp      = order.ModifiedTimestamp,
                Originator             = order.Originator.ToType <OriginatorType>(),
                ParentOrderId          = order.ParentOrderId,
                PositionId             = order.PositionId,
                Status                 = order.Status.ToType <OrderStatus>(),
                FillType               = order.FillType.ToType <OrderFillType>(),
                Type                   = order.Type.ToType <OrderType>(),
                ValidityTime           = order.ValidityTime,
                Volume                 = order.Volume ?? 0,
                //------
                AccountAssetId     = order.AccountAssetId,
                EquivalentAsset    = order.EquivalentAsset,
                ActivatedTimestamp = order.ActivatedTimestamp == default(DateTime)
                    ? null
                    : order.ActivatedTimestamp,
                CanceledTimestamp = order.CanceledTimestamp,
                Code                      = order.Code,
                Comment                   = order.Comment,
                EquivalentRate            = order.EquivalentRate,
                ExecutedTimestamp         = order.ExecutedTimestamp,
                ExecutionStartedTimestamp = order.ExecutionStartedTimestamp,
                ExternalOrderId           = order.ExternalOrderId,
                ExternalProviderId        = order.ExternalProviderId,
                LegalEntity               = order.LegalEntity,
                MatchingEngineId          = order.MatchingEngineId,
                Rejected                  = order.Rejected,
                RejectReason              = order.RejectReason.ToType <OrderRejectReason>(),
                RejectReasonText          = order.RejectReasonText,
                RelatedOrderInfos         = order.RelatedOrderInfos.Select(o =>
                                                                           new RelatedOrderInfo {
                    Id = o.Id, Type = o.Type.ToType <OrderType>()
                }).ToList(),
                TradingConditionId       = order.TradingConditionId,
                UpdateType               = historyType.ToType <OrderUpdateType>(),
                MatchedOrders            = new List <MatchedOrder>(),
                AdditionalInfo           = order.AdditionalInfo,
                CorrelationId            = correlationId,
                PendingOrderRetriesCount = order.PendingOrderRetriesCount,
            };

            foreach (var mo in order.MatchedOrders)
            {
                orderContract.MatchedOrders.Add(mo.ToDomain());
            }

            return(orderContract);
        }
示例#26
0
        private T_InoutEntity ConvertToT_Inout(OrderContract contract)
        {
            var vipFacade = new VipFacade();
            var vipEntity = vipFacade.GetById(contract.VipNo);

            var carrierId = contract.Delivery == EnumDelivery.HomeDelivery ? string.Empty : contract.CreateUnit;
            var statusStr = ((int)contract.Status).ToString();

            var result = new T_InoutEntity
            {
                order_id              = contract.OrderId,
                order_no              = contract.OrderNo,
                VipCardCode           = vipEntity.VipCode,
                order_type_id         = GetEnumOrderType(contract.OrderType),
                order_reason_id       = GetEnumOrderReason(contract.OrderReason),
                red_flag              = red_flag,
                warehouse_id          = "",
                order_date            = contract.OrderDate,
                request_date          = string.Empty,
                complete_date         = contract.CompleteDate,
                create_unit_id        = contract.CreateUnit,
                unit_id               = contract.CreateUnit,
                related_unit_id       = string.Empty,
                related_unit_code     = string.Empty,
                pos_id                = string.Empty,
                shift_id              = string.Empty,
                sales_user            = string.Empty,
                total_amount          = contract.TotalAmount,
                discount_rate         = contract.DiscountRate,
                actual_amount         = contract.ActualAmount,
                receive_points        = contract.ReceivePoints,
                pay_points            = contract.PayPoints,
                pay_id                = string.Empty,
                print_times           = 0,
                carrier_id            = carrierId,
                remark                = contract.Remark,
                status                = statusStr,
                status_desc           = GetStatusDescByStatus(contract.Status),
                total_qty             = contract.TotalQty,
                total_retail          = contract.TotalRetail,
                keep_the_change       = contract.KeepTheChange,
                wiping_zero           = contract.WipingZero,
                vip_no                = contract.VipNo,
                create_time           = contract.CreateTime,
                create_user_id        = contract.CreateUserId,
                approve_time          = contract.ApproveTime,
                approve_user_id       = contract.ApproveUserId,
                send_user_id          = contract.SendUserId,
                send_time             = contract.SendTime,
                accpect_user_id       = contract.AccpectUserId,
                accpect_time          = contract.AccpectTime,
                modify_user_id        = contract.ModifyUserId,
                modify_time           = contract.ModifyTime,
                data_from_id          = "3",
                sales_unit_id         = contract.SalesUnt,
                purchase_unit_id      = contract.PurchaseUnit,
                if_flag               = "0",
                customer_id           = ConfigMgr.CustomerId,
                sales_warehouse_id    = contract.SalesWarehouse,
                purchase_warehouse_id = contract.PurchaseWarehouse,
                Field1                = ((int)contract.IsPay).ToString(),
                Field2                = contract.TrackingNumber,
                Field3                = contract.BalancePayment,
                Field4                = contract.Address,
                Field6                = contract.Phone,
                Field7                = statusStr,
                Field8                = ((int)contract.Delivery).ToString(),
                Field9                = contract.DeliveryDateTime,
                Field10               = GetStatusDescByStatus(contract.Status),
                Field11               = string.Empty,
                Field12               = string.Empty,
                Field13               = vipEntity.WeiXinUserId,
                Field14               = contract.UserName,
                Field15               = string.Empty,
                Field16               = string.Empty,
                Field17               = string.Empty,
                Field18               = string.Empty,
                Field19               = string.Empty,
                Field20               = string.Empty,
                reserveQuantum        = contract.RequestDateQuantum,
                reserveDay            = contract.RequestDate,
                paymentcenter_id      = null,
                ReturnCash            = contract.CashBack,
            };

            return(result);
        }
        private void HKLogistics(OrderContract order)
        {
            if (order != null)
            {
                HongkongLogistics logistics = new HongkongLogistics()
                {
                    HongkongLogisticsName = "新新"
                };

                this.comboBox2.Items.Clear();
                this.comboBox2.Items.Add(logistics.HongkongLogisticsName);
                this.comboBox2.SelectedIndex = 0;

                List <HongkongLogisticsItem> items = new List <HongkongLogisticsItem>();

                items.Add(new HongkongLogisticsItem()
                {
                    ContractQuantity   = 120,
                    ProductKey         = "美国 P32 凤爪 Majar",
                    ContractWeight     = 24.7664764,
                    FreightCharges     = 7000,
                    Insurance          = 12000,
                    Compensation       = 20000,
                    CompensationReason = "少20件",
                    ReceivingTime      = new DateTime(2014, 9, 12),
                    ReceivingQuantity  = 110,
                });
                items.Add(new HongkongLogisticsItem()
                {
                    ProductKey         = "美国 P32 鸡尖 Majar",
                    ContractQuantity   = 302,
                    ContractWeight     = 11.53248306,
                    FreightCharges     = 7000,
                    Insurance          = 11000,
                    Compensation       = 300,
                    CompensationReason = "少2件",
                    ReceivingTime      = new DateTime(2014, 9, 18),
                    ReceivingQuantity  = 300,
                });
                items.Add(new HongkongLogisticsItem()
                {
                    ProductKey        = "美国 P1065 凤爪 Kero",
                    ContractQuantity  = 110,
                    ContractWeight    = 9.123,
                    FreightCharges    = 7000,
                    Insurance         = 800,
                    ReceivingTime     = new DateTime(2014, 9, 18),
                    ReceivingQuantity = 110,
                });

                this.textBox1.Text = items.Sum(new Func <HongkongLogisticsItem, decimal?>(
                                                   delegate(HongkongLogisticsItem item1)
                {
                    return(Convert.ToDecimal(item1.SubTotal));
                })).ToString();

                logistics.CostPayItems = new List <PayItem>(new PayItem[] {
                    new PayItem()
                    {
                        PayCost = 12000, PayTime = new DateTime(2014, 9, 19)
                    },
                    new PayItem()
                    {
                        PayCost = 280000, PayTime = new DateTime(2014, 9, 21)
                    },
                });


                this.HongkongLogistics         = logistics;
                this.bindingSource1.DataSource = items;
            }
            else
            {
                this.HongkongLogistics         = null;
                this.bindingSource1.DataSource = null;
            }

            if (this.HongkongLogistics == null || this.HongkongLogistics.CommitToPayCost)
            {
                this.btnCommitHKLogis.Enabled = false;
            }
            else
            {
                this.btnCommitHKLogis.Enabled = true;
            }

            if (this.HongkongLogistics == null || this.HongkongLogistics.CommitToPayCost == false)
            {
                this.btnAddHKCostPay.Enabled = false;
            }
            else
            {
                this.btnAddHKCostPay.Enabled = true;
            }
        }
示例#28
0
        public async Task <IActionResult> Post([FromBody] OrderContract contract)
        {
            var order = Mapper.Map <Order>(contract);

            return(Created("", await OrderService.AddOrder(order)));
        }
示例#29
0
        internal string InsertOrder(string query, OrderContract order)
        {
            var ordering = order.Direction == OrderDirection.Ascending ? AscKey : DescKey;

            return($"{query} {Environment.NewLine}{OrderByKey} {order.ColumnName} {ordering}");
        }
        private void MainlandLogisticsPay(OrderContract order)
        {
            if (order != null)
            {
                MainlandLogistics logistics = new MainlandLogistics()
                {
                    MainlandLogisticsName = "国通"
                };

                //this.comboBoxMainLand.Items.Clear();
                //this.comboBoxMainLand.Items.Add(logistics.MainlandLogisticsName);
                //this.comboBoxMainLand.SelectedIndex = 0;

                List <MainlandLogisticsItem> items = new List <MainlandLogisticsItem>();

                items.Add(new MainlandLogisticsItem()
                {
                    ContractQuantity = 120,
                    ProductKey       = "美国 P32 凤爪 Majar",
                    ContractWeight   = 24.7664764,
                    FreightCharges   = 80,
                    //Insurance = 12000,
                    Compensation       = 20000,
                    CompensationReason = "少20件",
                    ReceivingTime      = new DateTime(2014, 9, 12),
                    ReceivingQuantity  = 110,
                });
                items.Add(new MainlandLogisticsItem()
                {
                    ProductKey       = "美国 P32 鸡尖 Majar",
                    ContractQuantity = 302,
                    ContractWeight   = 11.53248306,
                    FreightCharges   = 80,
                    //Insurance = 11000,
                    Compensation       = 300,
                    CompensationReason = "少2件",
                    ReceivingTime      = new DateTime(2014, 9, 18),
                    ReceivingQuantity  = 300,
                });
                items.Add(new MainlandLogisticsItem()
                {
                    ProductKey       = "美国 P1065 凤爪 Kero",
                    ContractQuantity = 110,
                    ContractWeight   = 9.123,
                    FreightCharges   = 80,
                    //Insurance = 800,
                    ReceivingTime     = new DateTime(2014, 9, 18),
                    ReceivingQuantity = 110,
                });

                //this.textBoxCostMainland.Text = items.Sum(new Func<MainlandLogisticsItem, decimal?>(
                //    delegate(MainlandLogisticsItem item1)
                //    {
                //        return Convert.ToDecimal(item1.SubTotal);
                //    })).ToString();

                logistics.CostPayItems = new List <PayItem>(new PayItem[] {
                    new PayItem()
                    {
                        PayCost = 12000, PayTime = new DateTime(2014, 9, 14)
                    },
                    //new PayItem() { PayCost = 280000, PayTime = new DateTime(2014, 9, 21) },
                });


                this.MainlandLogistics         = logistics;
                this.bindingSource1.DataSource = items;
            }
            else
            {
                this.MainlandLogistics         = null;
                this.bindingSource1.DataSource = null;
            }

            //if (this.MainlandLogistics == null || this.MainlandLogistics.CommitToPayCost)
            //    this.btnSubmitMainlandLogPay.Enabled = false;
            //else this.btnSubmitMainlandLogPay.Enabled = true;

            //if (this.MainlandLogistics == null || this.MainlandLogistics.CommitToPayCost == false)
            //{
            //    this.btnAddMainlandPayCost.Enabled = false;
            //}
            //else this.btnAddMainlandPayCost.Enabled = true;
        }