public void SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { itemsDetailEntity.Modify(keyValue); service.Update(itemsDetailEntity); try { //添加日志 LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "修改数据字典信息【" + itemsDetailEntity.F_ItemName + "】成功!"); } catch { } } else { itemsDetailEntity.Create(); service.Insert(itemsDetailEntity); try { //添加日志 LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "新建数据字典信息【" + itemsDetailEntity.F_ItemName + "】成功!"); } catch { } } }
public ActionResult SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue) { var module = new ModuleApp().GetList().Where(a => a.F_Layers == 1 && a.F_EnCode == moduleName).FirstOrDefault(); var moduleitem = new ModuleApp().GetList().Where(a => a.F_Layers > 1 && a.F_EnCode == className.Substring(0, className.Length - 10)).FirstOrDefault(); LogEntity logEntity; if (string.IsNullOrEmpty(keyValue)) { itemsDetailEntity.F_DeleteMark = false; logEntity = new LogEntity(module.F_FullName, moduleitem.F_FullName, DbLogType.Create.ToString()); logEntity.F_Description += DbLogType.Create.ToDescription(); } else { logEntity = new LogEntity(module.F_FullName, moduleitem.F_FullName, DbLogType.Update.ToString()); logEntity.F_Description += DbLogType.Update.ToDescription(); logEntity.F_KeyValue = keyValue; } try { logEntity.F_Account = OperatorProvider.Provider.GetCurrent().UserCode; logEntity.F_NickName = OperatorProvider.Provider.GetCurrent().UserName; itemsDetailApp.SubmitForm(itemsDetailEntity, keyValue); logEntity.F_Description += "操作成功"; new LogApp().WriteDbLog(logEntity); return(Success("操作成功。")); } catch (Exception ex) { logEntity.F_Result = false; logEntity.F_Description += "操作失败," + ex.Message; new LogApp().WriteDbLog(logEntity); return(Error(ex.Message)); } }
public ActionResult SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue) { if (itemsDetailEntity.F_DeleteMark == null) { itemsDetailEntity.F_DeleteMark = false; } itemsDetailApp.SubmitForm(itemsDetailEntity, keyValue); return(Success("操作成功。")); }
/// <summary> /// 根据enCode获取字典实体 /// </summary> /// <param name="enCode"></param> /// <returns></returns> public ItemsDetailEntity GetItemByItemCode(string enCode) { ItemsDetailEntity model = new ItemsDetailEntity(); List <ItemsDetailEntity> lst = service.GetItemByItemCode(enCode); if (lst.Count > 0) { model = lst[0]; } return(model); }
public ActionResult SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue) { try { itemsDetailApp.SubmitForm(itemsDetailEntity, keyValue); return(Success("操作成功。")); } catch (Exception ex) { return(Error(ex.Message)); } }
public async Task <ActionResult> SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue) { try { await _service.SubmitForm(itemsDetailEntity, keyValue); return(await Success("操作成功。", "", keyValue)); } catch (Exception ex) { return(await Error(ex.Message, "", keyValue)); } }
public Task <int> Save(ItemsDetailEntity itemsDetailEntity, string keyValue, HttpContext context) { if (!string.IsNullOrEmpty(keyValue)) { itemsDetailEntity.AttachModifyInfo(keyValue, context); return(service.UpdateAsync(itemsDetailEntity)); } else { itemsDetailEntity.AttachCreateInfo(context); return(service.InsertAsync(itemsDetailEntity)); } }
public void SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { itemsDetailEntity.Modify(keyValue); service.Update(itemsDetailEntity); } else { itemsDetailEntity.Create(); service.Insert(itemsDetailEntity); } }
public ActionResult SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue) { itemsDetailApp.SubmitForm(itemsDetailEntity, keyValue); if (!string.IsNullOrEmpty(keyValue)) { base.OperateLog("字典编辑:F_Id:" + keyValue, "/SystemManage/Items/SubmitForm", "字典管理", Application.DbLogType.Update); } else { base.OperateLog("新增字典:" + itemsDetailEntity.F_ItemName, "/SystemManage/Items/SubmitForm", "字典管理", Application.DbLogType.Create); } return(Success("操作成功。")); }
public async Task <bool> SubmitFormAsync(ItemsDetailEntity entity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { _repository.ShadowCopy(_repository.FindById(keyValue), entity); await entity.Modify(keyValue); return(await _repository.UpdateAsync(entity)); } await entity.Create(); entity.DeleteMark = false; return(await _repository.InsertAsync(entity) >= 1); }
public async Task <IActionResult> SubmitForm([FromBody] BaseSubmitInput <ItemsDetailDto> input) { ItemsDetailEntity entity = null; if (input.KeyValue.IsEmpty()) { entity = _mapper.Map <ItemsDetailEntity>(input.Entity); } else { entity = await _itemsDetailApp.GetForm(input.KeyValue); } entity.CheckArgumentIsNull(nameof(entity)); await _itemsDetailApp.SubmitForm(entity, input.Entity); return(Success("操作成功。")); }
public void SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { itemsDetailEntity.Modify(keyValue); service.Update(itemsDetailEntity); //添加日志 LogHelp.logHelp.WriteDbLog(true, "修改字典内容信息=>" + itemsDetailEntity.ItemName, Enums.DbLogType.Update, "字典内容管理"); } else { itemsDetailEntity.Create(); service.Insert(itemsDetailEntity); //添加日志 LogHelp.logHelp.WriteDbLog(true, "添加字典内容信息=>" + itemsDetailEntity.ItemName, Enums.DbLogType.Create, "字典内容管理"); } }
public ActionResult SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { var itemDetail = itemsDetailApp.GetForm(keyValue); itemDetail.F_ItemName = itemsDetailEntity.F_ItemName; itemDetail.F_ItemCode = itemsDetailEntity.F_ItemCode; itemDetail.F_SortCode = itemsDetailEntity.F_SortCode; itemDetail.F_IsDefault = itemsDetailEntity.F_IsDefault; itemDetail.F_EnabledMark = itemsDetailEntity.F_EnabledMark; itemDetail.F_Description = itemsDetailEntity.F_Description; itemsDetailApp.SubmitForm(itemDetail, keyValue); } else { itemsDetailApp.SubmitForm(itemsDetailEntity, keyValue); } return(Success("操作成功。")); }
/// <summary> /// /// </summary> /// <param name="itemsDetailEntity"></param> /// <param name="keyValue"></param> public void SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { itemsDetailEntity.Modify(keyValue); ResultClass <int> _ret = service.Update(itemsDetailEntity); if (!_ret.Result) { throw new Exception(_ret.ErrorMessage); } } else { itemsDetailEntity.Create(); ResultClass <int> _ret = service.Insert(itemsDetailEntity); if (!_ret.Result) { throw new Exception(_ret.ErrorMessage); } } }
public Task <int> SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue) { var claimsIdentity = _httpContext.HttpContext.User.Identity as ClaimsIdentity; var claim = claimsIdentity?.FindFirst(t => t.Type == ClaimTypes.NameIdentifier); if (!string.IsNullOrEmpty(keyValue)) { itemsDetailEntity.Modify(keyValue); if (claim != null) { itemsDetailEntity.F_LastModifyUserId = claim.Value; } return(_service.UpdateAsync(itemsDetailEntity)); } else { itemsDetailEntity.Create(); if (claim != null) { itemsDetailEntity.F_CreatorUserId = claim.Value; } return(_service.InsertAsync(itemsDetailEntity)); } }
public Task <int> SubmitForm <TDto>(ItemsDetailEntity entity, TDto dto) where TDto : class { var claimsIdentity = _httpContext.HttpContext.User.Identity as ClaimsIdentity; var claim = claimsIdentity?.FindFirst(t => t.Type == ClaimTypes.NameIdentifier); if (!string.IsNullOrEmpty(entity.F_Id)) { entity.Modify(entity.F_Id); if (claim != null) { entity.F_LastModifyUserId = claim.Value; } return(_service.UpdateAsync(entity, dto)); } else { entity.Create(); if (claim != null) { entity.F_CreatorUserId = claim.Value; } return(_service.InsertAsync(entity)); } }
public void Delete(ItemsDetailEntity entity) { service.Delete(entity); }
public static void InitFreameworkDbData(this IApplicationBuilder app, IServiceProvider applicationServices, string webRootPath, EvolutionDBContext dbContext) { var sqlServerDatabase = dbContext.Database; //try //{ // int r = sqlServerDatabase.ExecuteSqlCommand("select count(*) from Sys_User"); // return; //} //catch(Exception ex) //{ // //这个ex是可预期的。 //} try { sqlServerDatabase.EnsureDeleted(); } catch { } if (sqlServerDatabase.EnsureCreated()) { //sqlServerDatabase.Migrate(); DataInitTool.ProcessFile("Sys_DbBackup.csv", webRootPath, colums => { DbBackupEntity entity = new DbBackupEntity(); entity.Id = colums[0]; entity.BackupType = colums[1]; entity.DbName = colums[2]; entity.FileName = colums[3]; entity.FileSize = colums[4]; entity.FilePath = colums[5]; entity.BackupTime = DateTime.Parse(colums[6]); entity.EnabledMark = bool.Parse(colums[9]); entity.CreateTime = DateTime.MinValue; dbContext.DbBackups.Add(entity); }); DataInitTool.ProcessFile("Sys_FilterIP.csv", webRootPath, colums => { FilterIPEntity entity = new FilterIPEntity(); entity.Id = colums[0]; entity.Type = bool.Parse(colums[1]); entity.StartIP = colums[2]; entity.EndIP = colums[3]; entity.EnabledMark = bool.Parse(colums[6]); entity.Description = colums[7]; entity.CreateTime = DateTime.Parse(colums[8]); dbContext.FilterIPs.Add(entity); }); DataInitTool.ProcessFile("Sys_Items.csv", webRootPath, colums => { ItemsEntity entity = new ItemsEntity(); entity.Id = colums[0]; entity.ParentId = colums[1]; entity.EnCode = colums[2]; entity.FullName = colums[3]; entity.IsTree = GetDefaultBool(colums[4], false); entity.Layers = int.Parse(colums[5]); entity.SortCode = int.Parse(colums[6]); entity.DeleteMark = GetDefaultBool(colums[7], false); entity.EnabledMark = GetDefaultBool(colums[8], true); entity.CreateTime = DateTime.MinValue; dbContext.Items.Add(entity); }); DataInitTool.ProcessFile("Sys_ItemsDetail.csv", webRootPath, colums => { ItemsDetailEntity entity = new ItemsDetailEntity(); entity.Id = colums[0]; entity.ItemId = colums[1]; entity.ParentId = colums[2]; entity.ItemCode = colums[3]; entity.ItemName = colums[4]; entity.IsDefault = GetDefaultBool(colums[6], false); entity.SortCode = int.Parse(colums[8]); entity.DeleteMark = GetDefaultBool(colums[9], false); entity.EnabledMark = GetDefaultBool(colums[10], true); dbContext.ItemsDetails.Add(entity); }); DataInitTool.ProcessFile("Sys_Log.csv", webRootPath, colums => { LogEntity entity = new LogEntity(); entity.Id = colums[0]; entity.Date = DateTime.Parse(colums[1]); entity.Account = colums[2]; entity.NickName = colums[3]; entity.Type = colums[4]; entity.IPAddress = colums[5]; entity.IPAddressName = colums[6]; entity.ModuleName = colums[8]; entity.Result = bool.Parse(colums[9]); entity.Description = colums[10]; entity.CreateTime = DateTime.MinValue; entity.CreatorUserId = colums[12]; dbContext.Logs.Add(entity); }); DataInitTool.ProcessFile("Sys_Menu.csv", webRootPath, colums => { MenuEntity entity = new MenuEntity(); entity.Id = colums[0]; entity.ParentId = colums[1]; entity.Layers = int.Parse(colums[2]); entity.FullName = colums[4]; entity.Icon = colums[5]; entity.UrlAddress = colums[6]; entity.Target = colums[7]; entity.IsMenu = bool.Parse(colums[8]); entity.IsExpand = bool.Parse(colums[9]); entity.IsPublic = bool.Parse(colums[10]); entity.AllowEdit = bool.Parse(colums[11]); entity.AllowDelete = bool.Parse(colums[12]); entity.SortCode = int.Parse(colums[13]); entity.DeleteMark = bool.Parse(colums[14]); entity.EnabledMark = bool.Parse(colums[15]); entity.Description = colums[16]; entity.CreateTime = DateTime.MinValue; entity.LastModifyTime = DateTime.MinValue; entity.LastModifyUserId = colums[20]; dbContext.Menus.Add(entity); }); DataInitTool.ProcessFile("Sys_MenuButton.csv", webRootPath, colums => { MenuButtonEntity entity = new MenuButtonEntity(); entity.Id = colums[0]; entity.MenuId = colums[1]; entity.ParentId = colums[2]; if (!string.IsNullOrEmpty(colums[3])) { entity.Layers = int.Parse(colums[3]); } entity.EnCode = colums[4]; entity.FullName = colums[5]; if (!string.IsNullOrEmpty(colums[7])) { entity.Location = int.Parse(colums[7]); } entity.JsEvent = colums[8]; entity.UrlAddress = colums[9]; if (!string.IsNullOrEmpty(colums[10])) { entity.Split = bool.Parse(colums[10]); } if (!string.IsNullOrEmpty(colums[11])) { entity.IsPublic = bool.Parse(colums[11]); } if (!string.IsNullOrEmpty(colums[12])) { entity.AllowEdit = bool.Parse(colums[12]); } if (!string.IsNullOrEmpty(colums[13])) { entity.AllowDelete = bool.Parse(colums[13]); } if (!string.IsNullOrEmpty(colums[14])) { entity.SortCode = int.Parse(colums[14]); } if (!string.IsNullOrEmpty(colums[15])) { entity.DeleteMark = bool.Parse(colums[15]); } if (!string.IsNullOrEmpty(colums[16])) { entity.EnabledMark = bool.Parse(colums[16]); } entity.CreateTime = DateTime.MinValue; entity.LastModifyTime = DateTime.MinValue; entity.LastModifyUserId = colums[20]; dbContext.ModuleButtons.Add(entity); }); DataInitTool.ProcessFile("Sys_Organize.csv", webRootPath, colums => { OrganizeEntity entity = new OrganizeEntity(); entity.Id = colums[0]; entity.ParentId = colums[1]; entity.Layers = int.Parse(colums[2]); entity.EnCode = colums[3]; entity.FullName = colums[4]; entity.ShortName = colums[5]; entity.CategoryId = colums[6]; entity.ManagerId = colums[7]; entity.Address = colums[14]; entity.SortCode = int.Parse(colums[17]); entity.DeleteMark = bool.Parse(colums[18]); entity.EnabledMark = bool.Parse(colums[19]); entity.CreateTime = DateTime.MinValue; dbContext.Organizes.Add(entity); }); DataInitTool.ProcessFile("Sys_Role.csv", webRootPath, colums => { RoleEntity entity = new RoleEntity(); entity.Id = colums[0]; entity.OrganizeId = colums[1]; entity.Category = int.Parse(colums[2]); entity.EnCode = colums[3]; entity.FullName = colums[4]; entity.Type = colums[5]; entity.AllowEdit = bool.Parse(colums[6]); entity.AllowDelete = bool.Parse(colums[7]); entity.SortCode = int.Parse(colums[8]); entity.DeleteMark = bool.Parse(colums[9]); entity.EnabledMark = bool.Parse(colums[10]); entity.CreateTime = DateTime.MinValue; entity.LastModifyTime = DateTime.MinValue; entity.LastModifyUserId = colums[15]; dbContext.Roles.Add(entity); }); DataInitTool.ProcessFile("Sys_RoleAuthorize.csv", webRootPath, colums => { RoleAuthorizeEntity entity = new RoleAuthorizeEntity(); entity.Id = colums[0]; entity.ItemType = int.Parse(colums[1]); entity.ItemId = colums[2]; entity.ObjectType = int.Parse(colums[3]); entity.ObjectId = colums[4]; //entity.SortCode = int.Parse(colums[5]); entity.CreateTime = DateTime.MinValue; entity.CreatorUserId = colums[7]; dbContext.RoleAuthorize.Add(entity); }); DataInitTool.ProcessFile("Sys_User.csv", webRootPath, colums => { UserEntity entity = new UserEntity(); entity.Id = colums[0]; entity.Account = colums[1]; entity.RealName = colums[2]; entity.NickName = colums[3]; entity.Gender = bool.Parse(colums[5]); entity.MobilePhone = colums[7]; entity.OrganizeId = colums[13]; entity.DepartmentId = colums[14]; entity.RoleId = colums[15]; entity.DutyId = colums[16]; entity.IsAdministrator = bool.Parse(colums[17]); entity.DeleteMark = bool.Parse(colums[19]); entity.EnabledMark = bool.Parse(colums[20]); entity.Description = colums[21]; entity.CreateTime = DateTime.MinValue; entity.LastModifyTime = DateTime.MinValue; entity.LastModifyUserId = colums[25]; dbContext.Users.Add(entity); }); DataInitTool.ProcessFile("Sys_UserLogOn.csv", webRootPath, colums => { UserLogOnEntity entityt = new UserLogOnEntity(); entityt.Id = colums[0]; entityt.UserId = colums[1]; entityt.UserPassword = colums[2]; entityt.UserSecretkey = colums[3]; if (!string.IsNullOrEmpty(colums[9])) { entityt.PreviousVisitTime = DateTime.Parse(colums[9]); } if (!string.IsNullOrEmpty(colums[10])) { entityt.LastVisitTime = DateTime.Parse(colums[10]); } if (!string.IsNullOrEmpty(colums[13])) { entityt.LogOnCount = int.Parse(colums[13]); } dbContext.UserLogOn.Add(entityt); }); dbContext.SaveChanges(); } }
public ActionResult SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue) { itemsDetailApp.SubmitForm(itemsDetailEntity, keyValue); return(Success("操作成功。")); }
public async Task <IActionResult> SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue) { await itemsDetailApp.Save(itemsDetailEntity, keyValue, this.UserId); return(Success("操作成功。")); }
public void InsertForm(ItemsDetailEntity itemsDetailEntity) { service.Insert(itemsDetailEntity); }