public MessageModel InsertSingleEntity(WareHouseStockModel model)
        {
            Func <IEntityContext, string> operation = (context => {
                model.ModifyID = UserManagement.CurrentUser.UserID;
                model.ModifyName = UserManagement.CurrentUser.UserName;
                model.ModifyTime = DateTime.Now;
                context.WareHouseStock.Add(model);
                context.SaveChanges();
                return(string.Empty);
            });

            return(base.DbOperation(operation));
        }
Exemple #2
0
        public void DeleteRow(WareHouseStockModel model)
        {
            var result = MessageBox.Show("是否删除", "提示", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                //var model = (WareHouseStockModel)dg.SelectedItem;
                var message = WareHouseStockService.DeleteSingleEntity(model.StockID);
                if (message.Status == MessageStatus.Success)
                {
                    LoadData(string.Empty);
                }
            }
        }
        public MessageModel UpdateSingleWareHouseStock(WareHouseStockModel model)
        {
            var data = wareHouseStockAccess.GetOriEntity(model.StockID, model.ModifyTime);

            if (data == null)
            {
                return new MessageModel()
                       {
                           Message = "当前数据不存在或被更新,请刷新后再次操作!", Status = MessageStatus.Error
                       }
            }
            ;
            return(wareHouseStockAccess.UpdateSingleEntity(model));
        }
    }
Exemple #4
0
        public void EditRow(WareHouseStockModel model)
        {
            var vm = IoC.Get <WareHouseStockEditViewModel>();

            vm.Model = model;
            vm.Mode  = Models.EditMode.UPDATE;
            var result = IoC.Get <IWindowManager>().ShowDialog(vm, null, new Dictionary <string, object> {
                { "Title", "编辑" }, { "ResizeMode", System.Windows.ResizeMode.NoResize },
                { "Width", 450 },
                { "Height", 600 }
            });

            if (result ?? false)
            {
                LoadData(string.Empty);
            }
        }
        public MessageModel UpdateSingleEntity(WareHouseStockModel model)
        {
            Func <IEntityContext, string> operation = (context =>
            {
                var data = context.WareHouseStock.FirstOrDefault(m => m.StockID == model.StockID && m.ModifyTime == model.ModifyTime);
                if (data == null)
                {
                    return("当前数据不存在或被更新,请刷新后再次操作!");
                }
                data.StockID = model.StockID;
                data.ProductID = model.ProductID;
                data.WareHouseID = model.WareHouseID;
                data.ProductName = model.ProductName;
                data.ClassID = model.ClassID;
                data.ClassName = model.ClassName;
                data.ProductCode = model.ProductCode;
                data.ProductSpcID = model.ProductSpcID;
                data.ProductTypeID = model.ProductTypeID;
                data.Weight = model.Weight;
                data.PinYingCode = model.PinYingCode;
                data.StockCount = model.StockCount;
                data.TotalCount = model.TotalCount;
                data.UseCount = model.UseCount;
                data.FreezeCount = model.FreezeCount;
                data.Remark = model.Remark;
                data.IsLocked = model.IsLocked;
                data.IsShow = model.IsShow;
                data.ModifyID = UserManagement.CurrentUser.UserID;
                data.ModifyName = UserManagement.CurrentUser.UserName;
                data.ModifyTime = DateTime.Now;
                context.SaveChanges();
                return(string.Empty);
            });

            return(base.DbOperation(operation));
        }
 /// <summary>
 /// 插入单条wareHouseStock数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public MessageModel InsertSingleWareHouseStock(WareHouseStockModel model)
 {
     return(wareHouseStockAccess.InsertSingleEntity(model));
 }