/// <summary> /// 修改 /// </summary> /// <param name="dto"></param> public void UpdateFunc(sys_operate dto) { dto.func_icon = dto.func_icon ?? "tag"; //dto.func_class = dto.func_class ?? "btn-blue"; //Sqldb.Updateable(dto).IgnoreColumns(s => new {s.create_time, s.create_person }).ExecuteCommand(); }
public void InsertFunc(sys_operate dto) { dto.id = IdWorkerHelper.NewId(); dto.func_icon = dto.func_icon ?? "tag"; dto.func_class = dto.func_class ?? "btn-blue"; dto.create_time = DateTime.Now; dto.create_person = UserCookie.AccountName; Sqldb.Insertable(dto).ExecuteCommand(); }
public void InsertFunc(sys_operate dto) { dto.id = IdWorkerHelper.NewId(); dto.func_icon = dto.func_icon ?? "tag"; dto.func_class = dto.func_class ?? "btn-blue"; dto.create_time = DateTime.Now; dto.create_person = UserCookie.AccountName; _sysfuncRepository.Insert(dto); }
public void UpdateFunc(sys_operate dto) { sys_operate sys_operate = _sysfuncRepository.GetById(dto.id); dto.func_icon = dto.func_icon ?? "tag"; dto.func_class = dto.func_class ?? "btn-blue"; dto.create_person = sys_operate.create_person ?? string.Empty; dto.create_time = sys_operate.create_time; _sysfuncRepository.Update(dto); }
public JsonResult SaveData(sys_operate dto) { if (dto.id == 0) { _funcApp.InsertFunc(dto); } else { _funcApp.UpdateFunc(dto); } return(Json("")); }
public JsonResult SaveData(sys_operate dto) { if (dto.id == 0) { _funcService.InsertFunc(dto); _logService.WriteLog(LogType.ADD, $"添加操作(" + dto.func_cname + ")", LogState.NORMAL);//写入日志 } else { _funcService.UpdateFunc(dto); _logService.WriteLog(LogType.EDIT, $"修改操作(" + dto.func_cname + ")", LogState.NORMAL);//写入日志 } return(Json("保存成功")); }
/// <summary> /// 新增 /// </summary> /// <param name="dto"></param> public void AddMenu(sys_menu dto, string funcs) { dto.id = IdWorkerHelper.NewId(); dto.create_time = DateTime.Now; dto.create_person = "admin"; //dto.menu_icon = dto.menu_font; if (!string.IsNullOrEmpty(dto.menu_url)) { dto.menu_type = 1; } if (dto.parent_id == 0) { dto.menu_level = 1; } else { dto.menu_level = Sqldb.Queryable <sys_menu>().Where(s => s.id == dto.parent_id).Select(s => s.menu_level) .First() + 1; } Sqldb.Insertable(dto).ExecuteCommand(); //设置菜单下按钮 if (dto.menu_type == 1 && !string.IsNullOrEmpty(funcs)) { var funcArray = funcs.ToObject <List <SysFuncDto> >(); var list = new List <sys_operate>(); foreach (var func in funcArray) { var funcModel = new sys_operate(); funcModel.menu_id = dto.id; funcModel.func_cname = func.title; funcModel.func_name = func.funcname; funcModel.func_icon = func.icon; funcModel.func_url = func.url; funcModel.in_table = func.intable; funcModel.func_sort = func.funcSort; funcModel.id = func.id > 0 ? func.id : IdWorkerHelper.NewId(); list.Add(funcModel); } Sqldb.Insertable(list).ExecuteCommand(); } }
/// <summary> /// 新增 /// </summary> /// <param name="dto"></param> public void AddMenu(sys_menu dto, string funcs) { dto.id = IdHelper.NextId(); dto.create_time = DateTime.Now; dto.create_person = "admin"; //dto.menu_icon = dto.menu_font; if (dto.menu_url == "#") { dto.menu_type = 0; } else { dto.menu_type = 1; } if (dto.parent_id == 0) { dto.menu_level = 1; } else { dto.menu_level = Sqldb.Select <sys_menu>().Where(s => s.id == dto.parent_id).First(s => s.menu_level) + 1; } Sqldb.Insert(dto).ExecuteAffrows(); //设置菜单下按钮 if (dto.menu_type == 1 && !string.IsNullOrEmpty(funcs)) { var funcArray = funcs.ToObject <List <SysFuncDto> >(); var list = new List <sys_operate>(); foreach (var func in funcArray) { var funcModel = new sys_operate(); funcModel.menu_id = dto.id; funcModel.func_title = func.title; funcModel.role_tag = func.roleTag; funcModel.id = func.id > 0 ? func.id : IdHelper.NextId(); funcModel.func_sort = func.funcSort; list.Add(funcModel); } Sqldb.Insert(list).ExecuteAffrows(); } }
/// <summary> /// 修改 /// </summary> /// <param name="dto"></param> public void UpdateMenu(sys_menu dto, string funcs) { if (dto.menu_url == "#") { dto.menu_type = 0; } else { dto.menu_type = 1; } if (dto.parent_id == 0) { dto.menu_level = 1; } else { dto.menu_level = Sqldb.Queryable <sys_menu>().Where(s => s.id == dto.parent_id) .First(s => s.menu_level) + 1; } Sqldb.Update <sys_menu>(dto).SetSource(dto).IgnoreColumns(s => new { s.create_time, s.create_person }).ExecuteAffrows(); //设置菜单下按钮 Sqldb.Delete <sys_operate>().Where(s => s.menu_id == dto.id).ExecuteAffrows(); if (dto.menu_type == 1 && !string.IsNullOrEmpty(funcs)) { var funcArray = funcs.ToObject <List <SysFuncDto> >(); var list = new List <sys_operate>(); foreach (var func in funcArray) { var funcModel = new sys_operate(); funcModel.menu_id = dto.id; funcModel.func_title = func.title; funcModel.role_tag = func.roleTag; funcModel.id = func.id > 0 ? func.id : IdHelper.NextId(); funcModel.func_sort = func.funcSort; list.Add(funcModel); } Sqldb.Insert(list).ExecuteAffrows(); } }