public void MapSetsIdFieldsCorrectly()
        {
            const int expectedOrderDetailId          = 5;
            const int expectedOrderId                = 6;
            const int expectedOrderItemId            = 77;
            const int expectedOrganizationRoleUserId = 283;

            var orderDetailEntity = new OrderDetailEntity
            {
                OrderDetailId             = expectedOrderDetailId,
                OrderId                   = expectedOrderId,
                ForOrganizationRoleUserId = expectedOrganizationRoleUserId,
                OrderItemId               = expectedOrderItemId,
                OrderItem                 = new OrderItemEntity()
            };
            OrderDetail orderDetail = _mapper.Map(orderDetailEntity);

            Assert.AreEqual(expectedOrderDetailId, orderDetail.Id,
                            "The OrderDetail's ID was not set correctly.");
            Assert.AreEqual(expectedOrderId, orderDetail.OrderId,
                            "The OrderDetail's OrderID was not set correctly.");
            Assert.AreEqual(expectedOrderItemId, orderDetail.OrderItemId,
                            "The OrderDetail's OrderItemID was not set correctly.");
            Assert.AreEqual(expectedOrganizationRoleUserId, orderDetail.ForOrganizationRoleUserId,
                            "The OrderDetail's ForOrgizationRoleUserId was not set correctly.");
        }
        public ActionResult GetOrderDetail()
        {
            string orderNum = WebUtil.GetFormValue <string>("orderNum", string.Empty);
            Bill <OrdersEntity, OrderDetailEntity> bill = new OrderBill();

            if (!orderNum.IsEmpty())
            {
                OrderDetailEntity detail = new OrderDetailEntity();
                detail.OrderNum = orderNum;
                List <OrderDetailEntity> listResult = bill.GetOrderDetail(detail);
                if (!listResult.IsNullOrEmpty())
                {
                    listResult.Remove(a => a.Num == 0);
                    LocalProductProvider provider = new LocalProductProvider();
                    string storageNum             = this.DefaultStore;
                    foreach (OrderDetailEntity item in listResult)
                    {
                        item.LocalNum = provider.GetLocalNum(storageNum, item.ProductNum);
                    }
                    string     json       = ConvertJson.ListToJson <OrderDetailEntity>(listResult, "List");
                    JsonObject jsonObject = new JsonObject(json);
                    this.ReturnJson.AddProperty("Data", jsonObject);
                }
            }
            return(Content(this.ReturnJson.ToString()));
        }
Beispiel #3
0
        public static bool ModifyOrderDetail(OrderDetailEntity entity)
        {
            long result = 0;

            if (entity != null)
            {
                OrderDetailRepository mr = new OrderDetailRepository();

                OrderDetailInfo OrderDetailInfo = TranslateOrderDetailInfo(entity);

                if (entity.ID > 0)
                {
                    OrderDetailInfo.ID         = entity.ID;
                    OrderDetailInfo.ChangeDate = DateTime.Now;
                    result = mr.ModifyOrderDetail(OrderDetailInfo);
                }
                else
                {
                    OrderDetailInfo.ChangeDate = DateTime.Now;
                    OrderDetailInfo.CreateDate = DateTime.Now;
                    result = mr.CreateNew(OrderDetailInfo);
                }


                List <OrderDetailInfo> miList = mr.GetAllOrderDetail();//刷新缓存
                Cache.Add("OrderDetailALL", miList);
            }
            return(result > 0);
        }
        public static OrderDetailEntity FromDto(this OrderDetail dto)
        {
            OnBeforeDtoToEntity(dto);
            var entity = new OrderDetailEntity();

            // Map entity properties
            entity.OrderId   = dto.OrderId;
            entity.ProductId = dto.ProductId;
            entity.UnitPrice = dto.UnitPrice;
            entity.Quantity  = dto.Quantity;
            entity.Discount  = dto.Discount;


            // Map entity associations
            // n:1 Order association
            if (dto.Order != null)
            {
                entity.Order = dto.Order.FromDto();
            }
            // n:1 Product association
            if (dto.Product != null)
            {
                entity.Product = dto.Product.FromDto();
            }

            OnAfterDtoToEntity(dto, entity);
            return(entity);
        }
 private static OrderDetailDomain Convert(OrderDetailEntity orderDetail) => new OrderDetailDomain
 {
     ProductName = orderDetail.ProductName,
     Quantity    = orderDetail.Quantity,
     UnitPrice   = orderDetail.UnitPrice,
     Total       = orderDetail.Quantity * orderDetail.UnitPrice
 };
Beispiel #6
0
        private static OrderDetailInfo TranslateOrderDetailInfo(OrderDetailEntity entity)
        {
            OrderDetailInfo info = new OrderDetailInfo();

            if (entity != null)
            {
                info.ID          = entity.ID;
                info.OrderID     = entity.OrderID;
                info.GoodsID     = entity.GoodsID;
                info.InventoryID = entity.InventoryID;
                info.GoodsNo     = entity.GoodsNo;
                info.GoodsName   = entity.GoodsName;
                info.GoodsModel  = entity.GoodsModel;
                info.Quantity    = entity.Quantity;
                info.Units       = entity.Units;
                info.Weight      = entity.Weight;
                info.TotalWeight = entity.TotalWeight;
                info.BatchNumber = entity.BatchNumber;
                info.ProductDate = entity.ProductDate;
                info.ExceedDate  = entity.ExceedDate;
                info.CreateDate  = entity.CreateDate;
                info.ChangeDate  = entity.ChangeDate;
            }


            return(info);
        }
    /// <summary>
    /// Handles the RowCommand event of the theGrid control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewCommandEventArgs"/> instance containing the event data.</param>
    protected void theGrid_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        switch (e.CommandName)
        {
        case "EditExisting":
        case "ViewExisting":
            break;

        default:
            // apparently another command, return
            return;
        }
        int index = Convert.ToInt32(e.CommandArgument);
        OrderDetailEntity selectedEntity = (OrderDetailEntity)_OrderDetailDS.EntityCollection[index];

        StringBuilder pkFieldsAndValues = new StringBuilder();

        pkFieldsAndValues.AppendFormat("&OrderId={0}", selectedEntity.OrderId);         pkFieldsAndValues.AppendFormat("&ProductId={0}", selectedEntity.ProductId);
        switch (e.CommandName)
        {
        case "EditExisting":
            Response.Redirect("~/EditExisting.aspx?EntityType=" + (int)EntityType.OrderDetailEntity + pkFieldsAndValues.ToString());
            break;

        case "ViewExisting":
            Response.Redirect("~/ViewExisting.aspx?EntityType=" + (int)EntityType.OrderDetailEntity + pkFieldsAndValues.ToString());
            break;
        }
    }
Beispiel #8
0
        public ActionResult GetPageListJson(Pagination pagination, string queryJson)
        {
            var watch = CommonHelper.TimerStart();

            var queryParam = queryJson.ToJObject();
            var para       = new OrderDetailEntity();

            if (!queryParam["keyword"].IsEmpty())
            {
                para.KeyWord = queryParam["keyword"].ToString();
            }
            if (!queryParam["orderId"].IsEmpty())
            {
                para.OrderId = queryParam["orderId"].ToString();
            }

            //数据对象
            var pageList = OrderDetailBLL.Instance.GetPageList(para, ref pagination);
            var JsonData = new
            {
                rows     = pageList,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(Content(JsonData.ToJson()));
        }
        public ActionResult Print()
        {
            string orderNum = WebUtil.GetQueryStringValue <string>("orderNum", string.Empty);
            Bill <OutStorageEntity, OutStoDetailEntity> bill = new OutStorageOrder();
            OutStorageEntity entity = new OutStorageEntity();

            entity.OrderNum = orderNum;
            entity          = bill.GetOrder(entity);
            entity          = entity.IsNull() ? new OutStorageEntity() : entity;
            ViewBag.Entity  = entity;

            OutStoDetailEntity detail = new OutStoDetailEntity();

            detail.OrderNum = orderNum;
            List <OutStoDetailEntity> listResult = bill.GetOrderDetail(detail);

            listResult = listResult.IsNull() ? new List <OutStoDetailEntity>() : listResult;
            OrderProvider orderProvider = new OrderProvider();

            foreach (OutStoDetailEntity item in listResult)
            {
                OrderDetailEntity orderDetail = new OrderDetailEntity();
                orderDetail.Where(a => a.SnNum == item.ContractSn).And(a => a.OrderNum == item.ContractOrder);
                orderDetail = orderProvider.GetOrderDetail(orderDetail);
                if (orderDetail != null)
                {
                    item.Qty = orderDetail.Num;
                }
            }
            ViewBag.Detail = listResult;
            return(View());
        }
Beispiel #10
0
        public void SourceCodeOrderDetailIsCreatedWhenASourceCodeIsUsed()
        {
            const bool saveSuccessful          = true;
            var        orderDetailEntityToSave = new OrderDetailEntity();
            var        orderDetailToSave       = new OrderDetail
            {
                OrderItemStatus       = EventPackageItemStatus.Availed,
                SourceCodeOrderDetail = new SourceCodeOrderDetail
                {
                    Amount       = 0,
                    SourceCodeId = 0
                },
                DetailType = OrderItemType.EventPackageItem
            };

            Expect.Call(_sourceCodeOrderDetailRepository.GetForOrderDetailId(orderDetailToSave.Id)).
            Throw(new ObjectNotFoundInPersistenceException <SourceCodeOrderDetail>());
            Expect.Call(
                _sourceCodeOrderDetailRepository.GetForSourceCodeIdAndOrderDetailId(
                    orderDetailToSave.SourceCodeOrderDetail.SourceCodeId, orderDetailToSave.Id)).
            Throw(new ObjectNotFoundInPersistenceException <SourceCodeOrderDetail>());
            Expect.Call(_mockedOrderDetailMapper.Map(orderDetailToSave)).Return(orderDetailEntityToSave);
            Expect.Call(_mockedOrderDetailMapper.Map(orderDetailEntityToSave)).Return(orderDetailToSave);
            Expect.Call(_sourceCodeOrderDetailRepository.Save(null)).IgnoreArguments().Return(null);
            ExpectGetDataAccessAdapterAndDispose();
            ExpectSaveEntity(saveSuccessful, true);

            _mocks.ReplayAll();
            _orderDetailRepository.SaveOrderDetail(orderDetailToSave);
            _mocks.VerifyAll();
        }
Beispiel #11
0
        public static void CreateInventoryDetail(OrderEntity order, OrderDetailEntity orderDetail)
        {
            InventoryDetailRepository mrDetail   = new InventoryDetailRepository();
            InventoryDetailInfo       infoDetail = new InventoryDetailInfo();

            if (order != null)
            {
                infoDetail.InventoryID   = orderDetail.InventoryID;
                infoDetail.OrderID       = order.OrderID;
                infoDetail.OrderNo       = order.OrderNo;
                infoDetail.OrderType     = order.OrderType;
                infoDetail.GoodsID       = orderDetail.GoodsID;
                infoDetail.StorageID     = order.SendStorageID;
                infoDetail.Quantity      = orderDetail.Quantity;
                infoDetail.CustomerID    = order.CustomerID;
                infoDetail.InventoryType = Common.InventoryType.入库.ToString();
                infoDetail.BatchNumber   = orderDetail.BatchNumber;
                infoDetail.ProductDate   = orderDetail.ProductDate;
                infoDetail.InventoryDate = DateTime.Now;
                infoDetail.UnitPrice     = 0;
                infoDetail.Remark        = "订单删除-库存回位";
                infoDetail.OperatorID    = order.OperatorID;
                infoDetail.CreateDate    = DateTime.Now;
                infoDetail.ChangeDate    = DateTime.Now;
                mrDetail.CreateNew(infoDetail);
            }
        }
Beispiel #12
0
        /// <summary>
        /// 库存计算处理
        /// </summary>
        /// <param name="orderDetail"></param>
        /// <param name="inventoryList"></param>
        private static void inventoryInfoProcess(OrderDetailEntity orderDetail, List <InventoryEntity> inventoryList, OrderEntity orderInfo)
        {
            int TotalGoodQuantity = orderDetail.Quantity;//当前明细出库数量

            if (inventoryList != null && inventoryList.Count > 0)
            {
                foreach (InventoryEntity inventory in inventoryList)
                {
                    //库存扣减
                    int newQuantity = inventory.Quantity - TotalGoodQuantity;
                    if (newQuantity >= 0)//库存数量大于订单出库数量  足够扣
                    {
                        //库存更新
                        deductionInventory(newQuantity, inventory);//直接扣除库存
                        //库存明细更新
                        createInventoryDetail(orderDetail, orderInfo, inventory.StorageID, TotalGoodQuantity);

                        break;//扣完跳出循环
                    }
                    else
                    {
                        //库存不足扣减
                        TotalGoodQuantity = TotalGoodQuantity - inventory.Quantity; //当前明细出库数量 减去库存数量
                        //库存更新
                        deductionInventory(0, inventory);                           //库存直接清0
                        //库存明细更新
                        createInventoryDetail(orderDetail, orderInfo, inventory.StorageID, inventory.Quantity);
                    }
                }
            }
        }
        //public double GetTotalProductsNumber()
        //{
        //    // Multiply album price by count of that album to get
        //    // the current price for each of those albums in the cart
        //    // sum all album price totals to get the cart total
        //    double total = (from cartItems in storeDB.Carts
        //                    where cartItems.CartId == ShoppingCartId
        //                    select (int?)cartItems.Number *
        //                    cartItems.Product.Price).Sum() ?? 0;

        //    return total;
        //}

        public int CreateOrder(OrderEntity order)
        {
            double orderTotal = 0;

            var cartItems = GetCartItems();

            // Iterate over the items in the cart,
            // adding the order details for each
            foreach (var item in cartItems)
            {
                var orderDetail = new OrderDetailEntity
                {
                    ProductId = item.CartProductId,
                    OrderId   = order.OrderId,
                    UnitPrice = item.Product.Price,
                    Quantity  = item.Number
                };
                // Set the order total of the shopping cart
                orderTotal += (item.Number * item.Product.Price);

                storeDB.OrderDetails.Add(orderDetail);
            }
            // Set the order's total to the orderTotal count
            order.Total = orderTotal;

            // Save the order
            storeDB.SaveChanges();
            // Empty the shopping cart
            EmptyCart();
            // Return the OrderId as the confirmation number
            return(order.OrderId);
        }
Beispiel #14
0
        /// <summary>Creates a new, empty OrderDetailEntity object.</summary>
        /// <returns>A new, empty OrderDetailEntity object.</returns>
        public override IEntity Create()
        {
            IEntity toReturn = new OrderDetailEntity();

            // __LLBLGENPRO_USER_CODE_REGION_START CreateNewOrderDetail
            // __LLBLGENPRO_USER_CODE_REGION_END
            return(toReturn);
        }
Beispiel #15
0
        public static OrderDetailEntity GetOrderDetailEntityById(long cid)
        {
            OrderDetailEntity     result = new OrderDetailEntity();
            OrderDetailRepository mr     = new OrderDetailRepository();
            OrderDetailInfo       info   = mr.GetOrderDetailByKey(cid);

            result = TranslateOrderDetailEntity(info);
            return(result);
        }
Beispiel #16
0
 /// <summary> setups the sync logic for member _orderDetail</summary>
 /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param>
 private void SetupSyncOrderDetail(IEntity2 relatedEntity)
 {
     if (_orderDetail != relatedEntity)
     {
         DesetupSyncOrderDetail(true, true);
         _orderDetail = (OrderDetailEntity)relatedEntity;
         base.PerformSetupSyncRelatedEntity(_orderDetail, new PropertyChangedEventHandler(OnOrderDetailPropertyChanged), "OrderDetail", ShippingDetailOrderDetailEntity.Relations.OrderDetailEntityUsingOrderDetailId, true, new string[] {  });
     }
 }
Beispiel #17
0
 public string AddRecommonOrder([FromBody] JObject jOject)
 {
     try
     {
         dynamic           json             = jOject;
         JObject           jOrder           = json.order;
         JObject           jOrderDetail     = json.orderDetail;
         var               orderModel       = jOrder.ToObject <OrderModel>();
         var               orderDetailModel = jOrderDetail.ToObject <OrderDetailModel>();
         ProductEntity     PE  = _productService.GetProductById(orderDetailModel.ProductId);
         OrderDetailEntity ODE = new OrderDetailEntity()
         {
             Adddate        = DateTime.Now,
             Adduser        = orderDetailModel.Adduser,
             Commission     = PE.Commission,
             Dealcommission = PE.Dealcommission,
             Price          = PE.Price,
             Product        = PE,
             Productname    = PE.Productname,
             Remark         = orderDetailModel.Remark,
             Snapshoturl    = orderDetailModel.Snapshoturl,
             Upddate        = DateTime.Now,
             Upduser        = orderDetailModel.Upduser
         };
         OrderDetailEntity ODEResult = _orderDetailService.Create(ODE);//创建订单详情;
         //生成当前订单编号
         Random      rd          = new Random();
         string      OrderNumber = "YJYDD" + DateTime.Now.ToString("yyyyMMddHHmmssffff") + rd.Next(100, 999).ToString();
         OrderEntity OE          = new OrderEntity()
         {
             Adddate     = DateTime.Now,
             Adduser     = orderModel.Adduser,
             AgentId     = orderModel.AgentId,
             Agentname   = orderModel.Agentname,
             Agenttel    = orderModel.Agenttel,
             BusId       = PE.Bussnessid,
             Busname     = "YooPoon",
             Customname  = orderModel.Customname,
             Ordercode   = OrderNumber,
             OrderDetail = ODEResult,
             //该条字段属性变更,因方法无使用,故注释
             //Ordertype = orderModel.Ordertype,
             Remark     = orderModel.Remark,
             Shipstatus = orderModel.Shipstatus,
             Status     = orderModel.Status,
             Upddate    = DateTime.Now,
             Upduser    = orderModel.Adduser
         };
         _orderService.Create(OE);//添加订单;
         return("生成订单成功");
     }
     catch (Exception e)
     {
         return("生成订单失败");
     }
 }
Beispiel #18
0
 /// <summary>
 /// Maps order detail entity to order detail business object.
 /// </summary>
 /// <param name="entity">An order detail entity.</param>
 /// <returns>An order detail business object.</returns>
 internal static OrderDetail Map(OrderDetailEntity entity)
 {
     return(new OrderDetail
     {
         ProductName = entity.ProductEntity.ProductName,
         Discount = (float)entity.Discount,
         Quantity = entity.Quantity,
         UnitPrice = (float)entity.UnitPrice,
         Version = VersionConverter.ToString(entity.Version)
     });
 }
Beispiel #19
0
        /// <summary> Initializes the class members</summary>
        protected virtual void InitClassMembers()
        {
            _orderDetail    = null;
            _shippingDetail = null;

            PerformDependencyInjection();

            // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers
            // __LLBLGENPRO_USER_CODE_REGION_END
            OnInitClassMembersComplete();
        }
Beispiel #20
0
        public int Update(OrderDetailEntity entity)
        {
            string sql = "Update OrderDetail set OrderId=@OrderId, BookId=@BookId,BookSalePrice=@BookSalePrice,BookSaleCount=@BookSaleCount where OrderDetailId=@OrderDetailId";

            db.PrepareSql(sql);
            db.SetParameter("OrderId", entity.OrderId);
            db.SetParameter("BookId", entity.BookId);
            db.SetParameter("BookSalePrice", entity.BookSalePrice);
            db.SetParameter("BookSaleCount", entity.BookSaleCount);
            return(db.ExecNonQuery());
        }
Beispiel #21
0
 /// <summary>
 /// Maps order detail entity to order detail business object.
 /// </summary>
 /// <param name="entity">An order detail entity.</param>
 /// <returns>An order detail business object.</returns>
 internal static OrderDetail Map(OrderDetailEntity entity)
 {
     return(new OrderDetail
     {
         ProductName = entity.Product == null ? "" : entity.Product.ProductName,
         Discount = (float)entity.Discount,
         Quantity = entity.Quantity,
         UnitPrice = (float)entity.UnitPrice,
         Version = entity.Version.AsBase64String()
     });
 }
Beispiel #22
0
 /// <summary>
 /// Maps order detail entity to order detail business object.
 /// </summary>
 /// <param name="od">An order detail entity.</param>
 /// <returns>An order detail business object.</returns>
 internal static OrderDetail ToBusinessObject(OrderDetailEntity od)
 {
     return(new OrderDetail
     {
         ProductName = od.ProductEntity.ProductName,
         Discount = (float)od.Discount,
         Quantity = od.Quantity,
         UnitPrice = (float)od.UnitPrice,
         Version = VersionConverter.ToString(od.Version)
     });
 }
Beispiel #23
0
        public int Add(OrderDetailEntity entity)
        {
            string sql = @"insert into OrderDetail(OrderId,BookId,BookSalePrice,BookSaleCount)
values(@OrderId, @BookId,@BookSalePrice,@BookSaleCount)";

            db.PrepareSql(sql);
            db.SetParameter("OrderId", entity.OrderId);
            db.SetParameter("BookId", entity.BookId);
            db.SetParameter("BookSalePrice", entity.BookSalePrice);
            db.SetParameter("BookSaleCount", entity.BookSaleCount);
            return(db.ExecNonQuery());
        }
Beispiel #24
0
        public static List <OrderDetailEntity> GetOrderDetailInfoPager(PagerInfo pager)
        {
            List <OrderDetailEntity> all    = new List <OrderDetailEntity>();
            OrderDetailRepository    mr     = new OrderDetailRepository();
            List <OrderDetailInfo>   miList = mr.GetAllOrderDetailInfoPager(pager);

            foreach (OrderDetailInfo mInfo in miList)
            {
                OrderDetailEntity carEntity = TranslateOrderDetailEntity(mInfo);
                all.Add(carEntity);
            }
            return(all);
        }
 public bool Delete(OrderDetailEntity entity)
 {
     try
     {
         _orderdetailRepository.Delete(entity);
         return(true);
     }
     catch (Exception e)
     {
         _log.Error(e, "数据库操作出错");
         return(false);
     }
 }
Beispiel #26
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (_filterToUse != null)
     {
         using (DataAccessAdapter adapter = new DataAccessAdapter())
         {
             OrderDetailEntity instance = (OrderDetailEntity)adapter.FetchNewEntity(new OrderDetailEntityFactory(), new RelationPredicateBucket(_filterToUse));
             if (instance != null)
             {
             }
         }
     }
 }
        public bool UpdateOrderDetail(long cancelledOrderId, long activeOrderId)
        {
            using (var adapter = PersistenceLayer.GetDataAccessAdapter())
            {
                var entity = new OrderDetailEntity {
                    OrderId = activeOrderId
                };

                var bucket = new RelationPredicateBucket(OrderDetailFields.OrderId == cancelledOrderId);

                return((adapter.UpdateEntitiesDirectly(entity, bucket) > 0) ? true : false);
            }
        }
 public OrderDetailEntity Update(OrderDetailEntity entity)
 {
     try
     {
         _orderdetailRepository.Update(entity);
         return(entity);
     }
     catch (Exception e)
     {
         _log.Error(e, "数据库操作出错");
         return(null);
     }
 }
Beispiel #29
0
        // xacs nhan

        public ActionResult OrderDetail(long?id)
        {
            var temp = db.OrderDetails.Where(d => d.OrderID == id);
            List <OrderDetailEntity> listdetail = new List <OrderDetailEntity>();

            foreach (var item in temp)
            {
                OrderDetailEntity or = new OrderDetailEntity();
                or.TypeOf_OrderEntity(item);
                listdetail.Add(or);
            }

            return(View(listdetail));
        }
        private OrderDetail CreateOrderDetail(OrderDetail orderDetailToSave,
                                              OrderDetailEntity orderDetailEntityToSave)
        {
            IOrderItemStatusFactory orderItemStatusFactory = new OrderItemStatusFactory();
            OrderItemType           orderItemType          = orderItemStatusFactory.GetOrderItemType
                                                                 (orderDetailToSave.OrderItemStatus);

            orderDetailEntityToSave.OrderItem = new OrderItemEntity {
                Type = (short)orderItemType
            };
            OrderDetail detailToReturn = _orderDetailMapper.Map(orderDetailEntityToSave);

            return(detailToReturn);
        }
Beispiel #31
0
 public bool Delete(Guid Id)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         OrderDetailEntity _OrderDetailEntity = new OrderDetailEntity(Id);
         if (adapter.FetchEntity(_OrderDetailEntity))
         {
             adapter.DeleteEntity(_OrderDetailEntity);
             toReturn = true;
         }
     }
     return toReturn;
 }
Beispiel #32
0
 public OrderDetailEntity SelectOne(Guid Id)
 {
     OrderDetailEntity toReturn = null;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         OrderDetailEntity _OrderDetailEntity = new OrderDetailEntity(Id);
         if (adapter.FetchEntity(_OrderDetailEntity))
         {
             toReturn = _OrderDetailEntity;
         }
     }
     return toReturn;
 }
Beispiel #33
0
        public bool Update(OrderDetailEntity _OrderDetailEntity)
        {
            bool toReturn = false;
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                RelationPredicateBucket filter = new RelationPredicateBucket();
                IPredicateExpression _PredicateExpression = new PredicateExpression();
                _PredicateExpression.Add(OrderDetailFields.Id == _OrderDetailEntity.Id);

                filter.PredicateExpression.Add(_PredicateExpression);

                adapter.UpdateEntitiesDirectly(_OrderDetailEntity, filter);
                toReturn = true;
            }
            return toReturn;
        }
Beispiel #34
0
 public bool Update(OrderDetailEntity _OrderDetailEntity, RelationPredicateBucket filter)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.UpdateEntitiesDirectly(_OrderDetailEntity, filter);
         toReturn = true;
     }
     return toReturn;
 }
Beispiel #35
0
        public bool Update(Guid Id, Guid ProductId, string ProductName, string ProductCode, Guid OrderItemId, decimal PriceBeforeTax, decimal PriceAfterTax, int Amount, decimal PoPrice, string Note, Guid ProductSubId)
        {
            bool toReturn = false;
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                OrderDetailEntity _OrderDetailEntity = new OrderDetailEntity(Id);
                if (adapter.FetchEntity(_OrderDetailEntity))
                {

                    _OrderDetailEntity.ProductId = ProductId;
                    _OrderDetailEntity.ProductName = ProductName;
                    _OrderDetailEntity.ProductCode = ProductCode;
                    _OrderDetailEntity.OrderItemId = OrderItemId;
                    _OrderDetailEntity.PriceBeforeTax = PriceBeforeTax;
                    _OrderDetailEntity.PriceAfterTax = PriceAfterTax;
                    _OrderDetailEntity.Amount = Amount;
                    _OrderDetailEntity.PoPrice = PoPrice;
                    _OrderDetailEntity.Note = Note;
                    _OrderDetailEntity.ProductSubId = ProductSubId;
                    adapter.SaveEntity(_OrderDetailEntity, true);
                    toReturn = true;
                }
            }
            return toReturn;
        }
Beispiel #36
0
    ShippingDetailEntity[] getShipDetail(ShippingEntity ship, OrderDetailEntity[] orderDetail)
    {
        ShippingDetailEntity[] items = new ShippingDetailEntity[orderDetail.Length];
        for (int i = 0; i < orderDetail.Length; i++)
        {
            items[i] = new ShippingDetailEntity();

            items[i].Id = Guid.NewGuid();
            items[i].ShippingId = ship.Id;
            items[i].OrderDetailId = orderDetail[i].Id;
            items[i].Amount = orderDetail[i].Amount;
        }
        return items;
    }
Beispiel #37
0
    OrderDetailEntity[] getOrderDetail(OrderItemsEntity item)
    {
        List<CartItem> carts = CartsSession.CreateInstant().GetCarts(Page);

        OrderDetailEntity[] details = new OrderDetailEntity[carts.Count];
        for (int i = 0; i < carts.Count; i++)
        {
            details[i] = new OrderDetailEntity();

            details[i].Id = Guid.NewGuid();

            if (carts[i].ProductParentId == Guid.Empty)
            {
                ProductsEntity product = ProductsManager.CreateInstant().SelectOne(carts[i].ProductId, true);
                if (product != null)
                {
                    int cnt = carts[i].Total;
                    if (cnt > Config.GetMaxItemInCart())
                        cnt = Config.GetMaxItemInCart();

                    details[i].ProductId = product.Id;
                    details[i].ProductName = product.ProductName;
                    details[i].OrderItemId = item.Id;
                    details[i].PriceBeforeTax = 0;
                    details[i].PriceAfterTax = product.Price;
                    details[i].Amount = cnt;
                    details[i].PoPrice = product.ProductInfo.PriceBuy;
                    details[i].ProductCode = product.ProductCode;
                }
            }
            else
            {
                ProductsEntity product = ProductsManager.CreateInstant().SelectOne(carts[i].ProductParentId, true);
                ProductSubEntity sub = ProductSubManager.CreateInstant().SelectOne(carts[i].ProductId);
                if (product != null && sub != null)
                {
                    int cnt = carts[i].Total;
                    if (cnt > Config.GetMaxItemInCart())
                        cnt = Config.GetMaxItemInCart();

                    details[i].ProductId = product.Id;
                    details[i].OrderItemId = item.Id;
                    details[i].PriceBeforeTax = 0;
                    details[i].PriceAfterTax = sub.Price;
                    details[i].Amount = cnt;
                    details[i].PoPrice = product.ProductInfo.PriceBuy;
                    details[i].ProductSubId = sub.Id;
                    details[i].ProductName = product.ProductName + " - " + sub.ProductName;
                    details[i].ProductCode = product.ProductCode;
                }
            }
        }

        return details;
    }
Beispiel #38
0
 public OrderDetailEntity Insert(OrderDetailEntity _OrderDetailEntity)
 {
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.SaveEntity(_OrderDetailEntity, true);
     }
     return _OrderDetailEntity;
 }
Beispiel #39
0
        public OrderDetailEntity Insert(Guid ProductId, string ProductName, string ProductCode, Guid OrderItemId, decimal PriceBeforeTax, decimal PriceAfterTax, int Amount, decimal PoPrice, string Note, Guid ProductSubId)
        {
            OrderDetailEntity _OrderDetailEntity = new OrderDetailEntity();
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {

                _OrderDetailEntity.ProductId = ProductId;
                _OrderDetailEntity.ProductName = ProductName;
                _OrderDetailEntity.ProductCode = ProductCode;
                _OrderDetailEntity.OrderItemId = OrderItemId;
                _OrderDetailEntity.PriceBeforeTax = PriceBeforeTax;
                _OrderDetailEntity.PriceAfterTax = PriceAfterTax;
                _OrderDetailEntity.Amount = Amount;
                _OrderDetailEntity.PoPrice = PoPrice;
                _OrderDetailEntity.Note = Note;
                _OrderDetailEntity.ProductSubId = ProductSubId;
                adapter.SaveEntity(_OrderDetailEntity, true);
            }
            return _OrderDetailEntity;
        }