public static DTO.OrderProduct ToDTO(this Models.OrderProduct op)
 {
     return(new DTO.OrderProduct
     {
         OrderID = op.Id,
         ProductID = op.ProductId,
         Quantity = op.Quantity,
     });
 }
Beispiel #2
0
        public Models.OrderProduct NewOrderProduct()
        {
            var newOrderProduct = new Models.OrderProduct();

            newOrderProduct.RStatus        = true;
            newOrderProduct.RIDate         = DateTime.Now;
            newOrderProduct.OrderProductId = GetNewOrderProductId();
            return(newOrderProduct);
        }
 public static DTO.OrderProduct ToDTO(this Models.OrderProduct orderProduct)
 {
     return(new DTO.OrderProduct
     {
         Id = orderProduct.Id.ToString(),
         Quantity = orderProduct.Quantity,
         Product = orderProduct.Product.ToDTO()
     });
 }
 public static DTO.OrderProduct ToDTO(this Models.OrderProduct op)
 {
     return(new DTO.OrderProduct
     {
         Id = op.Id,
         ProductID = op.ProductID,
         Quantity = op.Quantity,
         Order = op.Order.ToDTO(),
     });
 }
Beispiel #5
0
        public Task <BaseResponse> AddProductToOrder(AddProductToOrderRequest request, int UserID)
        {
            Models.Order        order        = null;
            Models.Product      product      = null;
            Models.OrderProduct orderProduct = null;



            throw new NotImplementedException();
        }
 public static DTO.OrderProduct ToDTO(this Models.OrderProduct op)
 {
     return(new DTO.OrderProduct
     {
         OrderID = op.OrderID,
         ProductID = op.ProductId,
         Quantity = op.Quantity,
         Orders = op.Order?.ToDTO(),
         Products = op.Product?.toDTO()
     });
 }
Beispiel #7
0
        private void dgv_OrderProd_RowValidated(object sender, DataGridViewCellEventArgs e)
        {
            if (dataOrder.OrderProducts == null ||
                dataOrder.OrderProducts.Count != this.dgv_OrderProd.Rows.Count - 1 ||
                this.dgv_OrderProd.Rows.Count == e.RowIndex + 1)
            {
                return;
            }
            DataGridViewRow row = this.dgv_OrderProd.Rows[e.RowIndex];

            Models.OrderProduct orderProduct = dataOrder.OrderProducts[e.RowIndex];
            if (string.IsNullOrWhiteSpace(orderProduct.OrderProductId))
            {
                orderProduct.OrderProductId = new OrderProductService().GetNewOrderProductId();
            }
            orderProduct.OrderId      = dataOrder.OrderId;
            orderProduct.SeqNo        = e.RowIndex + 1;
            orderProduct.ProductName  = row.Cells["ProductName"] == null || row.Cells["ProductName"].Value == null ? "" : row.Cells["ProductName"].Value.ToString();
            orderProduct.ProductModel = row.Cells["ProductModel"] == null || row.Cells["ProductModel"].Value == null ? "" : row.Cells["ProductModel"].Value.ToString();
            orderProduct.ProductUnit  = row.Cells["ProductUnit"] == null || row.Cells["ProductUnit"].Value == null ? "" : row.Cells["ProductUnit"].Value.ToString();
            decimal qty = 0, price = 0;

            if (row.Cells["Qty"].Value != null)
            {
                decimal.TryParse(row.Cells["Qty"].Value.ToString(), out qty);
            }
            if (row.Cells["Price"].Value != null)
            {
                decimal.TryParse(row.Cells["Price"].Value.ToString(), out price);
            }
            orderProduct.Qty    = qty;
            orderProduct.Price  = price;
            orderProduct.Amt    = qty * price;
            orderProduct.Remark = row.Cells["Remark"] == null || row.Cells["Remark"].Value == null ? "" : row.Cells["Remark"].Value.ToString();
            SumAmt();

            this.dgv_OrderProd.Refresh();
        }