Exemplo n.º 1
0
        public OperationResult Delete(string ID)
        {
            var model = SALES_EBASKETList.FirstOrDefault(t => t.ID == ID);

            SALES_EBASKETRepository.Delete(model);
            return(new OperationResult(OperationResultType.Success, "successfully deleted"));
        }
Exemplo n.º 2
0
        public int ModificationCart(SALES_EBASKETModel model)
        {
            var entity = SALES_EBASKETList.ToList().Where(t =>
                                                          t.CustomerID == model.CustomerID &&
                                                          t.ContactID == model.ContactID &&
                                                          t.ProductNo == model.ProductNo && t.Status == 0).FirstOrDefault();

            if (entity == null)
            {
                entity = new SALES_EBASKET
                {
                    ID          = CombHelper.NewComb().ToString(),
                    CustomerID  = model.CustomerID,
                    ContactID   = model.ContactID,
                    ProductNo   = model.ProductNo,
                    Quantity    = model.Quantity,
                    UnitPrice   = model.UnitPrice,
                    Unit        = model.Unit,
                    Creator     = model.Creator,
                    Modifier    = model.Modifier,
                    CreateDate  = model.CreateDate,
                    ModiDate    = model.ModiDate,
                    MakeOrderID = model.MakeOrderID,
                    //RowID = model.RowID,
                    Status    = model.Status,
                    UnitPType = model.UnitPType,
                };
                return(SALES_EBASKETRepository.Insert(entity));
            }
            else
            {
                //entity.ID = model.ID;
                //entity.CustomerID = model.CustomerID;
                //entity.ContactID = model.ContactID;
                //entity.ProductNo = model.ProductNo;
                entity.Quantity += model.Quantity;
                //entity.UnitPrice = model.UnitPrice;
                //entity.Unit = model.Unit;
                //entity.Creator = model.Creator;
                entity.Modifier = model.Modifier;
                //entity.CreateDate = model.CreateDate;
                entity.ModiDate = model.ModiDate;
                //entity.MakeOrderID = model.MakeOrderID;
                //entity.RowID = model.RowID;
                //entity.Status = model.Status;
                //entity.UnitPType = model.UnitPType;

                return(SALES_EBASKETRepository.Update(entity));  //这个是可以成功; 注意entity是通过entities集成读取

                //return SALES_EBASKETRepository.Update(e => new { e.Quantity }, entity); //这个局部更新
            }
        }
Exemplo n.º 3
0
        public int UpdateEBasket(string id, string orderID, string modifier)
        {
            //Ecomm.BLL.SALES_EBASKET basket = Ecomm.BLL.BLLFactory<Ecomm.BLL.SALES_EBASKET>.Instance;
            //Model.SALES_EBASKETInfo ebasketInfo = basket.Get(id);
            //ebasketInfo.MakeOrderID = orderID;
            //ebasketInfo.Status = 1;
            //ebasketInfo.ModiDate = DateTime.Now;
            //ebasketInfo.Modifier = base.UserInfo.Name;
            //basket.UpdateByProce(ebasketInfo);

            var entity = SALES_EBASKETList.First(t => t.ID == id);

            entity.Modifier    = modifier;
            entity.ModiDate    = DateTime.Now;
            entity.MakeOrderID = orderID;
            entity.Status      = 1;
            return(SALES_EBASKETRepository.Update(entity));
        }
Exemplo n.º 4
0
        public OperationResult Update(UpdateSALES_EBASKETModel model)
        {
            var entity = SALES_EBASKETList.First(t => t.ID == model.ID);

            entity.ID          = model.ID;
            entity.CustomerID  = model.CustomerID;
            entity.ContactID   = model.ContactID;
            entity.ProductNo   = model.ProductNo;
            entity.Quantity    = model.Quantity;
            entity.UnitPrice   = model.UnitPrice;
            entity.Unit        = model.Unit;
            entity.Creator     = model.Creator;
            entity.Modifier    = model.Modifier;
            entity.CreateDate  = model.CreateDate;
            entity.ModiDate    = model.ModiDate;
            entity.MakeOrderID = model.MakeOrderID;
            entity.RowID       = model.RowID;
            entity.Status      = model.Status;
            entity.UnitPType   = model.UnitPType;

            SALES_EBASKETRepository.Update(entity);
            return(new OperationResult(OperationResultType.Success, "update completed"));
        }
Exemplo n.º 5
0
        public int DeleteItem(string ID)
        {
            var model = SALES_EBASKETList.FirstOrDefault(t => t.ID == ID);

            return(SALES_EBASKETRepository.Delete(model));
        }