public MessageModel UpdateSingleEntity(BreedBatchModel model) { Func <IEntityContext, string> operation = delegate(IEntityContext context) { var data = context.BreedBatch.FirstOrDefault(m => m.BreedBatchID == model.BreedBatchID); if (data == null) { return("当前数据不存在或被更新,请刷新后再次操作!"); } data.BreedID = model.BreedID; data.BatchNO = model.BatchNO; data.RecvicePeople = model.RecvicePeople; 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)); }
public void DeleteRow(BreedBatchModel model) { var result = MessageBox.Show("是否删除", "提示", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { var message = iBreedBatchService.DeleteSingleEntity(model.BreedBatchID); if (message.Status == MessageStatus.Success) { LoadData(string.Empty); } } }
public MessageModel InsertSingleEntity(BreedBatchModel model) { Func <IEntityContext, string> operation = delegate(IEntityContext context) { model.ModifyID = UserManagement.CurrentUser.UserID; model.ModifyName = UserManagement.CurrentUser.UserName; model.ModifyTime = DateTime.Now; context.BreedBatch.Add(model); context.SaveChanges(); return(string.Empty); }; return(base.DbOperation(operation)); }
public void EditRow(BreedBatchModel model) { var vm = IoC.Get <BreedBatchEditViewModel>(); 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); } }
/// <summary> /// 编辑单条BreedBatch /// </summary> /// <param name="model"></param> /// <returns></returns> public MessageModel UpdateSingleBreedBatch(BreedBatchModel model) { return(breedBatchAccess.UpdateSingleEntity(model)); }
/// <summary> /// 插入单条BreedBatch数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public MessageModel InsertSingleBreedBatch(BreedBatchModel model) { return(breedBatchAccess.InsertSingleEntity(model)); }