public void SaveRoleAuth(string roleId, string ids) { Sqldb.Deleteable <sys_role_authorize>().Where(s => s.role_id == SqlFunc.ToInt64(roleId)).ExecuteCommand(); if (!string.IsNullOrEmpty(ids)) { var list = new List <sys_role_authorize>(); var menuIds = ids.ToObject <List <ZtreeDto> >(); foreach (var mid in menuIds) { mid.pId = mid.pId ?? "0"; var model = new sys_role_authorize(); model.id = IdWorkerHelper.NewId(); model.role_id = roleId.ToInt64(); model.menu_id = mid.id.ToInt64(); model.menu_pid = mid.pId.ToInt64(); model.create_time = DateTime.Now; model.create_person = UserCookie.AccountName; list.Add(model); } if (list.Any()) { Sqldb.Insertable(list).ExecuteCommand(); } } }
public void UpdateMenu(sys_menu dto, string funcs) { 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.Updateable(dto).IgnoreColumns(s => new { s.create_time, s.create_person }).ExecuteCommand(); Sqldb.Deleteable <sys_menu_ref_operate>().Where(s => s.menu_id == dto.id).ExecuteCommand(); if (!string.IsNullOrEmpty(funcs)) { var funcArray = funcs.Split(','); if (funcArray.Length > 0) { var list = new List <sys_menu_ref_operate>(); foreach (var func in funcArray) { var funcModel = new sys_menu_ref_operate(); funcModel.menu_id = dto.id; funcModel.operate_id = func.ToInt64(); list.Add(funcModel); } Sqldb.Insertable(list).ExecuteCommand(); } } }
public void AddMenu(sys_menu dto, string funcs) { dto.id = IdWorkerHelper.NewId(); dto.create_time = DateTime.Now; dto.create_person = "admin"; 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 (!string.IsNullOrEmpty(funcs)) { var funcArray = funcs.Split(','); if (funcArray.Length > 0) { var list = new List <sys_menu_ref_operate>(); foreach (var func in funcArray) { var funcModel = new sys_menu_ref_operate(); funcModel.menu_id = dto.id; funcModel.operate_id = func.ToInt64(); list.Add(funcModel); } Sqldb.Insertable(list).ExecuteCommand(); } } }
public void InsertRoleData(sys_role dto) { dto.role_code = dto.role_code ?? string.Empty; dto.id = IdWorkerHelper.NewId(); dto.create_person = UserCookie.AccountName; dto.create_time = DateTime.Now; 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; Sqldb.Insertable(dto).ExecuteCommand(); }
public void AddMenu(sys_menu dto) { dto.id = Guid.NewGuid().ToString("N"); dto.create_time = DateTime.Now; dto.creator = "admin"; dto.menu_icon = dto.menu_font; Sqldb.Insertable(dto).ExecuteCommand(); }
public void InsertData(sys_user dto) { dto.id = IdWorkerHelper.NewId(); dto.create_time = DateTime.Now; dto.create_person = UserCookie.AccountName; dto.fax = dto.fax ?? string.Empty; dto.email = dto.email ?? string.Empty; dto.mobile_phone = dto.mobile_phone ?? string.Empty; Sqldb.Insertable(dto).ExecuteCommand(); }
public void InsertAreaData(sys_area dto) { dto.id = IdWorkerHelper.NewId(); dto.zipcode = dto.zipcode; dto.name = dto.name; dto.name = dto.name ?? string.Empty; dto.province_code = dto.province_code; dto.city_code = dto.city_code; dto.city_level = dto.city_level; Sqldb.Insertable(dto).ExecuteCommand(); }
public void InsertData(demo dto) { dto.id = IdWorkerHelper.NewId(); dto.create_time = DateTime.Now; dto.create_person = UserCookie.AccountName; dto.name = dto.name ?? string.Empty; dto.sex = dto.sex ?? string.Empty; dto.age = dto.age; dto.remark = dto.remark ?? string.Empty; Sqldb.Insertable(dto).ExecuteCommand(); }
public void WriteLog(LogType logtype, string logmsg, LogState logstate) { sys_log log = new sys_log(); log.id = IdWorkerHelper.NewId(); log.operation = UserCookie.AccountName; log.logtime = DateTime.Now; log.logtype = logtype.ToString(); log.logmsg = logmsg; log.loglevel = logstate.ToString(); log.logip = "127.0.0.1"; //TODO Sqldb.Insertable(log).ExecuteCommand(); }
public void SaveRoleData(sys_role dto) { if (string.IsNullOrEmpty(dto.id)) { dto.id = Guid.NewGuid().ToString("N"); dto.creator = "admin"; dto.create_time = DateTime.Now; Sqldb.Insertable(dto).ExecuteCommand(); } else { Sqldb.Updateable(dto).IgnoreColumns(s => new { s.create_time, s.creator }).ExecuteCommand(); } }
public void InsertDicData(sys_dictionary dto) { dto.id = IdWorkerHelper.NewId(); dto.create_person = UserCookie.AccountName; dto.create_time = DateTime.Now; if (dto.parent_id != 0) { var dicCode = Sqldb.Queryable <sys_dictionary>().Where(s => s.id == dto.parent_id).Select(s => s.dic_code).First(); dto.dic_code = dicCode; } Sqldb.Insertable(dto).ExecuteCommand(); }
public void SaveData(sys_func dto) { if (dto.id == 0) { dto.id = NewLongId(); dto.create_time = DateTime.Now; dto.creator = "admin"; Sqldb.Insertable(dto).ExecuteCommand(); } else { Sqldb.Updateable(dto).IgnoreColumns(s => new { s.create_time, s.creator }).ExecuteCommand(); } }
public void InsertData(sys_citys dto) { //if (dto.parent_id == 0) //{ // dto.parent_name = string.Empty; //} //else //{ // var parea = Sqldb.Queryable<sys_citys>().Where(s => s.id == dto.parent_id).First(); // dto.area_Level = parea.area_Level + 1; //} //dto.lat_lng = dto.lat_lng ?? string.Empty; //dto.id = IdWorkerHelper.NewId(); //dto.create_person = UserCookie.AccountName; //dto.create_time = DateTime.Now; Sqldb.Insertable(dto).ExecuteCommand(); }
/// <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(); } }
public void InitAllJobs(List <hangfire_jobs> jobs) { Sqldb.Insertable(jobs).ExecuteCommand(); }