public void Save(object obj) { var input = new EmployeEditInput() { Organize = CurrentUser.User.Organize, Code = Code, Name = Name, Password = Password, BatchStart = BatchStart, BatchEnd = BatchEnd }; if (input.Code.IsEmpty()) { throw new DbxException(EnumCode.提示消息, culture.Lang.userQingShuRuZhangHuBianHao); } if (input.Password.IsEmpty()) { throw new DbxException(EnumCode.提示消息, culture.Lang.userQingShuRuMiMa); } if (IsBatch == Visibility.Visible) { if (input.BatchStart <= 0 || input.BatchEnd <= 0 || input.BatchEnd < input.BatchStart) { throw new DbxException(EnumCode.提示消息, culture.Lang.sysQingShuRuQiZhiXingXi); } var result = PlugCoreHelper.ApiUrl.User.EmployeBatchAdd.GetResult <List <EmployeDTO>, EmployeEditInput>(input); if (result.Code != EnumCode.成功) { throw new DbxException(EnumCode.提示消息, result.Message); } } else { var result = PlugCoreHelper.ApiUrl.User.EmployeInsert.GetResult <EmployeDTO, EmployeEditInput>(input); if (result.Code != EnumCode.成功) { throw new DbxException(EnumCode.提示消息, result.Message); } } Code = string.Empty; Name = string.Empty; Password = string.Empty; BatchStart = 0; BatchEnd = 0; MessageAlert("成功", okAction: () => { new AppViewModelLocator().EmployeModel.Query(1); }); Close(obj.GetType().FullName); }
/// <summary> /// 员工删除 /// </summary> /// <param name="obj"></param> public void Delete(object obj) { MessageAlert("是否删除?", img: System.Windows.MessageBoxImage.Question, okAction: () => { var input = new EmployeEditInput() { Organize = CurrentUser.User.Organize, Ids = Source.Where(x => x.IsSelected).Select(x => x.Id).ToList() }; var result = "/api/user/employe/delete".GetResult <int, EmployeEditInput>(input); if (result.Code == EnumCode.成功) { MessageAlert("成功", okAction: () => { Query(1, size: Pager.PageSize); }); } else { throw new DbxException(EnumCode.提示消息, result.Message); } }); }