public static ResultModel GetOperationLogList(QueryTerms queryTerms) { List<OperationLog> logList = new List<OperationLog>(); int totalCount = 0; ResultModel result = new ResultModel(); try { logList = (List<OperationLog>)(OperationLogDal.GetList(queryTerms)); totalCount = Convert.ToInt32(OperationLogDal.GetTotalCount(queryTerms)); result.Data = logList; result.DataSize = totalCount; result.IsSuccess = true; result.ResultCode = SymbolicConstant.RESULTCODE_GETLIST_SUCCESS; return result;; } catch (Exception exception) { result.Data = logList; result.DataSize = totalCount; result.IsSuccess = true; result.ResultCode = SymbolicConstant.RESULTCODE_GETLIST_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 根据记录主键,删除指定记录。 /// </summary> /// <param name="dictionaryId">记录主键</param> /// <returns>删除结果,包括是否删除成功、记录主键等信息</returns> public static ResultModel Delete(string dictionaryId) { OperationLog log = new OperationLog(); ResultModel result = new ResultModel(); try { log.LogId = System.Guid.NewGuid().ToString("N"); log.SystemUserId = CurrentSession.getUser().UserId; log.OperationTypeCode = SymbolicConstant.OPERATIONTYPE_DELETE; log.OperationContent = SymbolicConstant.OPERATIONCONTENT_DELETE; log.AddTime = DateTime.Now; log.ObjectRecordId = dictionaryId; log.OperationTable = typeof(Dictionary).Name; log.IsSuccessId = SymbolicConstant.ISSUCCESS_TRUE; log.ResultCode = SymbolicConstant.RESULTCODE_DELETE_SUCCESS; log.ResultMessage=SymbolicConstant.RESULTMESSAGE_DELETE_SUCCESS; Dictionary dictionary =(Dictionary)GetDictionaryById(dictionaryId).Data; DictionaryDal.Delete(dictionary); result.IsSuccess = true; result.ObjectRecordId = dictionaryId; result.ResultCode = SymbolicConstant.RESULTCODE_DELETE_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_DELETE_SUCCESS; return result; } catch (Exception exception) { log.IsSuccessId = SymbolicConstant.ISSUCCESS_FALSE; log.ResultCode = SymbolicConstant.RESULTCODE_DELETE_ERROR; log.ResultMessage=exception.Message; result.IsSuccess = false; result.ObjectRecordId = dictionaryId; result.ResultCode = SymbolicConstant.RESULTCODE_DELETE_ERROR; result.ResultMessage = exception.Message; return result; } finally { OperationLogBll.Insert(log); } }
public static ResultModel Delete(string logId) { OperationLog log = new OperationLog(); ResultModel result = new ResultModel(); try { log = (OperationLog)GetOperationLogById(logId).Data; OperationLogDal.Delete(log); result.IsSuccess = true; result.ObjectRecordId = log.LogId; result.ResultCode = SymbolicConstant.RESULTCODE_DELETE_SUCCESS; return result; } catch (Exception e) { System.Console.Write(e.Message); result.ResultCode = SymbolicConstant.RESULTCODE_DELETE_ERROR; result.IsSuccess = false; return result; } }
public static ResultModel GetOperationLogById(string logId) { OperationLog log = new OperationLog(); ResultModel result = new ResultModel(); try { log = OperationLogDal.GetModel(logId); result.Data = log; result.DataSize = 1; result.IsSuccess = true; result.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_SUCCESS; return result; } catch (Exception exception) { result.Data = log; result.DataSize = 1; result.IsSuccess = false; result.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 根据记录主键,删除指定记录。 /// </summary> /// <param name="userId">记录主键</param> /// <param name="isLog">是否写入日志</param> /// <returns>删除结果,包括是否删除成功、记录主键等信息</returns> public static ResultModel Delete(string webPageId, bool isLog) { if (isLog) return Delete(webPageId); ResultModel result = new ResultModel(); try { WebPage webPage =(WebPage)GetWebPageById(webPageId).Data; WebPageDal.Delete(webPage); result.IsSuccess = true; result.ObjectRecordId = webPageId; result.ResultCode = SymbolicConstant.RESULTCODE_DELETE_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_DELETE_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ObjectRecordId = webPageId; result.ResultCode = SymbolicConstant.RESULTCODE_DELETE_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 修改某条记录 /// </summary> /// <param name="user">要修改记录对应的实体</param> /// <returns>修改结果,包括是否修改成功、记录主键等信息</returns> public static ResultModel Update(WebPage webPage) { OperationLog log = new OperationLog(); ResultModel result = new ResultModel(); try { log.AddTime = DateTime.Now; log.IsSuccessId = SymbolicConstant.ISSUCCESS_TRUE; log.LogId = System.Guid.NewGuid().ToString("N"); log.OperationContent = SymbolicConstant.OPERATIONCONTENT_UPDATE; log.OperationTable = typeof(WebPage).Name; log.OperationTypeCode = SymbolicConstant.OPERATIONTYPE_UPDATE; log.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_SUCCESS; log.ResultMessage=SymbolicConstant.RESULTMESSAGE_UPDATE_SUCCESS; log.SystemUserId = CurrentSession.getUser().UserId; log.ObjectRecordId = webPage.PageId; WebPageDal.Update(webPage); result.IsSuccess = true; result.ObjectRecordId = webPage.PageId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_UPDATE_SUCCESS; return result; } catch (Exception exception) { log.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR; log.IsSuccessId = SymbolicConstant.ISSUCCESS_FALSE; log.ResultMessage=exception.Message; result.IsSuccess = false; result.ObjectRecordId =webPage.PageId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR; result.ResultMessage = exception.Message; return result; } finally { OperationLogBll.Insert(log); } }
/// <summary> /// 修改某条记录 /// </summary> /// <param name="user">要修改记录对应的实体</param> /// <param name="isLog">是否写入日志</param> /// <returns>修改结果,包括是否修改成功、记录主键等信息</returns> public static ResultModel Update(FunctionModule functionModule, bool isLog) { if (isLog) return Update(functionModule); ResultModel result = new ResultModel(); try { FunctionModuleDal.Update(functionModule); result.IsSuccess = true; result.ObjectRecordId = functionModule.ModuleId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_UPDATE_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ObjectRecordId =functionModule.ModuleId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 修改某条记录 /// </summary> /// <param name="user">要修改记录对应的实体</param> /// <param name="isLog">是否写入日志</param> /// <returns>修改结果,包括是否修改成功、记录主键等信息</returns> public static ResultModel Update(Dictionary dictionary, bool isLog) { if (isLog) return Update(dictionary); ResultModel result = new ResultModel(); try { DictionaryDal.Update(dictionary); result.IsSuccess = true; result.ObjectRecordId = dictionary.Id; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_UPDATE_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ObjectRecordId =dictionary.Id; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 根据查询条件获取Dictionary表中符合查询条件的记录 /// </summary> /// <param name="queryTerms">自定义查询条件</param> /// <param name="isLog">是否写入日志</param> /// <returns>查询结果,封装了查询的数据信息</returns> public static ResultModel GetDictionaryList(QueryTerms queryTerms, bool isLog) { if (isLog) return GetDictionaryList(queryTerms); List<Dictionary> dictionaryList = new List<Dictionary>(); int totalCount = 0; ResultModel result = new ResultModel(); try { dictionaryList = (List<Dictionary>)(DictionaryDal.GetList(queryTerms)); totalCount=Convert.ToInt32(SystemUserDal.GetTotalCount(queryTerms)); result.Data = dictionaryList; result.DataSize = totalCount; result.IsSuccess = true; result.ResultCode = SymbolicConstant.RESULTCODE_GETLIST_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_GETLIST_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ResultCode = SymbolicConstant.RESULTCODE_GETLIST_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 根据主键查询指定记录 /// </summary> /// <param name="dictionaryId">主键</param> /// <param name="isLog">是否写入日志</param> /// <returns>查询结果,封装了查询出的实体</returns> public static ResultModel GetDictionaryById(string dictionaryId, bool isLog) { if (isLog) return GetDictionaryById(dictionaryId); Dictionary dictionary = new Dictionary(); ResultModel result = new ResultModel(); try { dictionary= DictionaryDal.GetModel(dictionaryId); result.Data = dictionary; result.IsSuccess = true; result.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_SUCCESS; result.ResultMessage=SymbolicConstant.RESULTMESSAGE_GETMODEL_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 修改某条记录 /// </summary> /// <param name="user">要修改记录对应的实体</param> /// <param name="isLog">是否写入日志</param> /// <returns>修改结果,包括是否修改成功、记录主键等信息</returns> public static ResultModel Update(SystemUser systemUser, bool isLog) { if (isLog) return Update(systemUser); ResultModel result = new ResultModel(); try { SystemUserDal.Update(systemUser); result.IsSuccess = true; result.ObjectRecordId = systemUser.UserId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_UPDATE_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ObjectRecordId =systemUser.UserId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 根据主键查询指定记录 /// </summary> /// <param name="systemUserId">主键</param> /// <param name="isLog">是否写入日志</param> /// <returns>查询结果,封装了查询出的实体</returns> public static ResultModel GetSystemUserById(string systemUserId, bool isLog) { if (isLog) return GetSystemUserById(systemUserId); SystemUser systemUser = new SystemUser(); ResultModel result = new ResultModel(); try { systemUser= SystemUserDal.GetModel(systemUserId); result.Data = systemUser; result.IsSuccess = true; result.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_SUCCESS; result.ResultMessage=SymbolicConstant.RESULTMESSAGE_GETMODEL_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_ERROR; result.ResultMessage = exception.Message; return result; } }
public static ResultModel Insert(OperationLog log) { ResultModel result = new ResultModel(); object id = ""; try { OperationLogDal.Insert(log); result.IsSuccess = true; result.ObjectRecordId = id.ToString(); result.ResultCode = SymbolicConstant.RESULTCODE_INSERT_SUCCESS; return result; } catch (Exception exception) { result.ResultCode = SymbolicConstant.RESULTCODE_INSERT_ERROR; result.IsSuccess = false; result.ResultMessage = exception.Message; return result; } }
public static ResultModel Update(OperationLog log) { ResultModel result = new ResultModel(); object id = new object(); try { OperationLogDal.Update(log); result.IsSuccess = true; result.ObjectRecordId = log.LogId; result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_SUCCESS; return result; } catch (Exception exception) { result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR; result.IsSuccess = false; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 删除数据库Dictionary表中的所有记录 /// </summary> /// <returns>删除结果,包括是删除成功、删除的记录数等信息</returns> public static ResultModel DeleteAll() { OperationLog log = new OperationLog(); ResultModel result = new ResultModel(); try { log.AddTime = DateTime.Now; log.IsSuccessId = SymbolicConstant.ISSUCCESS_TRUE; log.LogId = System.Guid.NewGuid().ToString("N"); log.OperationContent = SymbolicConstant.OPERATIONCONTENT_DELETEALL; log.OperationTable = typeof(Dictionary).Name; log.OperationTypeCode = SymbolicConstant.OPERATIONTYPE_DELETEALL; log.ResultCode = SymbolicConstant.RESULTCODE_DELETEALL_SUCCESS; log.ResultMessage=SymbolicConstant.RESULTMESSAGE_DELETEALL_SUCCESS; log.SystemUserId = CurrentSession.getUser().UserId; //删除的记录数 int count=(int)WebPageDal.DeleteAll(); log.TotalCount = count; result.DataSize = count; result.IsSuccess = true; result.ResultCode = SymbolicConstant.RESULTCODE_DELETEALL_SUCCESS; result.ResultMessage=SymbolicConstant.RESULTMESSAGE_DELETEALL_SUCCESS; return result; } catch (Exception exception) { log.IsSuccessId = SymbolicConstant.ISSUCCESS_FALSE; log.ResultCode = SymbolicConstant.RESULTCODE_DELETEALL_ERROR; log.ResultMessage=exception.Message; result.IsSuccess = false; result.ResultCode = SymbolicConstant.RESULTCODE_DELETEALL_ERROR; result.ResultMessage = exception.Message; return result; } finally { OperationLogBll.Insert(log); } }
/// <summary> /// 根据记录主键,删除指定记录。 /// </summary> /// <param name="userId">记录主键</param> /// <param name="isLog">是否写入日志</param> /// <returns>删除结果,包括是否删除成功、记录主键等信息</returns> public static ResultModel Delete(string systemUserId, bool isLog) { if (isLog) return Delete(systemUserId); ResultModel result = new ResultModel(); try { SystemUser systemUser =(SystemUser)GetSystemUserById(systemUserId).Data; SystemUserDal.Delete(systemUser); result.IsSuccess = true; result.ObjectRecordId = systemUserId; result.ResultCode = SymbolicConstant.RESULTCODE_DELETE_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_DELETE_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ObjectRecordId = systemUserId; result.ResultCode = SymbolicConstant.RESULTCODE_DELETE_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 删除数据库Dictionary表中的所有记录 /// </summary> /// <param name="isLog">是否写稿日志</param> /// <returns>删除结果,包括是否删除成功、记录主键等信息</returns> public static ResultModel DeleteAll(bool isLog) { if(isLog) DeleteAll(); ResultModel result = new ResultModel(); try { //删除的记录数 int count=(int)WebPageDal.DeleteAll(); result.DataSize = count; result.IsSuccess = true; result.ResultCode = SymbolicConstant.RESULTCODE_DELETEALL_SUCCESS; result.ResultMessage=SymbolicConstant.RESULTMESSAGE_DELETEALL_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ResultCode = SymbolicConstant.RESULTCODE_DELETEALL_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 根据主键查询指定记录 /// </summary> /// <param name="userId">主键</param> /// <returns>查询结果,封装了查询出的实体</returns> public static ResultModel GetLinkMenuById(string linkMenuId) { OperationLog log = new OperationLog(); LinkMenu linkMenu = new LinkMenu(); ResultModel result = new ResultModel(); try { linkMenu = LinkMenuDal.GetModel(linkMenuId); log.AddTime = DateTime.Now; log.LogId = System.Guid.NewGuid().ToString("N"); log.OperationTypeCode = SymbolicConstant.OPERATIONTYPE_GETMODEL; log.OperationContent = SymbolicConstant.OPERATIONCONTENT_GETMODEL; log.OperationTable = typeof(LinkMenu).Name; log.ObjectRecordId = linkMenuId; log.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_SUCCESS; log.ResultMessage=SymbolicConstant.RESULTMESSAGE_GETMODEL_SUCCESS; log.SystemUserId = CurrentSession.getUser().UserId; log.IsSuccessId = SymbolicConstant.ISSUCCESS_TRUE; result.Data = linkMenu; result.IsSuccess = true; result.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_SUCCESS; result.ResultMessage=SymbolicConstant.RESULTMESSAGE_GETMODEL_SUCCESS; return result; } catch (Exception exception) { log.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_ERROR; log.IsSuccessId = SymbolicConstant.ISSUCCESS_FALSE; log.ResultMessage=exception.Message; result.IsSuccess = false; result.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_ERROR; result.ResultMessage = exception.Message; return result; } finally { OperationLogBll.Insert(log); } }
/// <summary> /// 根据查询条件获取Dictionary表中符合查询条件的记录 /// </summary> /// <param name="queryTerms">自定义查询条件</param> /// <returns>查询结果,封装了查询的数据信息</returns> public static ResultModel GetDictionaryList(QueryTerms queryTerms) { List<Dictionary> dictionaryList = new List<Dictionary>(); OperationLog log = new OperationLog(); int totalCount = 0; ResultModel result = new ResultModel(); try { log.AddTime = DateTime.Now; log.IsSuccessId = SymbolicConstant.ISSUCCESS_TRUE; log.LogId = System.Guid.NewGuid().ToString("N"); log.OperationContent = SymbolicConstant.OPERATIONCONTENT_GETLIST; log.OperationTable = typeof(Dictionary).Name; log.OperationTypeCode =SymbolicConstant.OPERATIONTYPE_GETLIST; log.ResultCode = SymbolicConstant.RESULTCODE_GETLIST_SUCCESS; log.ResultMessage=SymbolicConstant.RESULTMESSAGE_GETLIST_SUCCESS; log.SystemUserId = CurrentSession.getUser().UserId; dictionaryList = (List<Dictionary>)(DictionaryDal.GetList(queryTerms)); totalCount=Convert.ToInt32(SystemUserDal.GetTotalCount(queryTerms)); log.TotalCount = totalCount; result.Data = dictionaryList; result.DataSize = totalCount; result.IsSuccess = true; result.ResultCode = SymbolicConstant.RESULTCODE_GETLIST_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_GETLIST_SUCCESS; return result; } catch (Exception exception) { log.ResultCode = SymbolicConstant.RESULTCODE_GETLIST_ERROR; log.IsSuccessId = SymbolicConstant.ISSUCCESS_FALSE; log.ResultMessage=exception.Message; result.IsSuccess = false; result.ResultCode = SymbolicConstant.RESULTCODE_GETLIST_ERROR; result.ResultMessage = exception.Message; return result; } finally { OperationLogBll.Insert(log); } }
/// <summary> /// 根据主键查询指定记录 /// </summary> /// <param name="linkMenuId">主键</param> /// <param name="isLog">是否写入日志</param> /// <returns>查询结果,封装了查询出的实体</returns> public static ResultModel GetLinkMenuById(string linkMenuId, bool isLog) { if (isLog) return GetLinkMenuById(linkMenuId); LinkMenu linkMenu = new LinkMenu(); ResultModel result = new ResultModel(); try { linkMenu= LinkMenuDal.GetModel(linkMenuId); result.Data = linkMenu; result.IsSuccess = true; result.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_SUCCESS; result.ResultMessage=SymbolicConstant.RESULTMESSAGE_GETMODEL_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 添加一条新记录 /// </summary> /// <param name="dictionary">Dictionary实体</param> /// <returns>添加结果,包括是否插入成功、记录主键等信息</returns> public static ResultModel Insert(Dictionary dictionary) { OperationLog log = new OperationLog(); ResultModel result = new ResultModel(); object id = ""; try { log.LogId = Guid.NewGuid().ToString("N"); log.SystemUserId = CurrentSession.getUser().UserId; log.OperationTypeCode = SymbolicConstant.OPERATIONTYPE_INSERT; log.OperationContent = SymbolicConstant.OPERATIONCONTENT_INSERT; log.AddTime = DateTime.Now; log.OperationTable = typeof(Dictionary).Name; id = DictionaryDal.Insert(dictionary); log.ObjectRecordId = Convert.ToString(id); log.ResultCode = SymbolicConstant.RESULTCODE_INSERT_SUCCESS; log.IsSuccessId = SymbolicConstant.ISSUCCESS_TRUE; log.ResultMessage=SymbolicConstant.RESULTMESSAGE_INSERT_SUCCESS; result.IsSuccess = true; result.ObjectRecordId = id.ToString(); result.ResultCode = SymbolicConstant.RESULTCODE_INSERT_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_INSERT_SUCCESS; return result; } catch (Exception exception) { log.IsSuccessId = SymbolicConstant.ISSUCCESS_FALSE; log.ObjectRecordId = Convert.ToString(id); log.ResultCode = SymbolicConstant.RESULTCODE_INSERT_ERROR; log.ResultMessage=exception.Message; result.IsSuccess = false; result.ObjectRecordId = id.ToString(); result.ResultCode = SymbolicConstant.RESULTCODE_INSERT_ERROR; result.ResultMessage = exception.Message; return result; } finally { OperationLogBll.Insert(log); } }
/// <summary> /// 根据记录主键,删除指定记录。 /// </summary> /// <param name="userId">记录主键</param> /// <param name="isLog">是否写入日志</param> /// <returns>删除结果,包括是否删除成功、记录主键等信息</returns> public static ResultModel Delete(string linkMenuId, bool isLog) { if (isLog) return Delete(linkMenuId); ResultModel result = new ResultModel(); try { LinkMenu linkMenu =(LinkMenu)GetLinkMenuById(linkMenuId).Data; LinkMenuDal.Delete(linkMenu); result.IsSuccess = true; result.ObjectRecordId = linkMenuId; result.ResultCode = SymbolicConstant.RESULTCODE_DELETE_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_DELETE_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ObjectRecordId = linkMenuId; result.ResultCode = SymbolicConstant.RESULTCODE_DELETE_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 添加一条新记录 /// </summary> /// <param name="dictionary">Dictionary实体</param> /// <param name="isLog">是否写入日志</param> /// <returns>添加结果,包括是否插入成功、记录主键等信息</returns> public static ResultModel Insert(Dictionary dictionary, bool isLog) { if (isLog) return Insert(dictionary); ResultModel result = new ResultModel(); object id = ""; try { id = DictionaryDal.Insert(dictionary); result.IsSuccess = true; result.ObjectRecordId = id.ToString(); result.ResultCode = SymbolicConstant.RESULTCODE_INSERT_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_INSERT_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ObjectRecordId = id.ToString(); result.ResultCode = SymbolicConstant.RESULTCODE_INSERT_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 根据主键查询指定记录 /// </summary> /// <param name="webPageId">主键</param> /// <param name="isLog">是否写入日志</param> /// <returns>查询结果,封装了查询出的实体</returns> public static ResultModel GetWebPageById(string webPageId, bool isLog) { if (isLog) return GetWebPageById(webPageId); WebPage webPage = new WebPage(); ResultModel result = new ResultModel(); try { webPage= WebPageDal.GetModel(webPageId); result.Data = webPage; result.IsSuccess = true; result.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_SUCCESS; result.ResultMessage=SymbolicConstant.RESULTMESSAGE_GETMODEL_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 根据记录主键,删除指定记录。 /// </summary> /// <param name="userId">记录主键</param> /// <param name="isLog">是否写入日志</param> /// <returns>删除结果,包括是否删除成功、记录主键等信息</returns> public static ResultModel Delete(string dictionaryId, bool isLog) { if (isLog) return Delete(dictionaryId); ResultModel result = new ResultModel(); try { Dictionary dictionary =(Dictionary)GetDictionaryById(dictionaryId).Data; DictionaryDal.Delete(dictionary); result.IsSuccess = true; result.ObjectRecordId = dictionaryId; result.ResultCode = SymbolicConstant.RESULTCODE_DELETE_SUCCESS; result.ResultMessage = SymbolicConstant.RESULTMESSAGE_DELETE_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ObjectRecordId = dictionaryId; result.ResultCode = SymbolicConstant.RESULTCODE_DELETE_ERROR; result.ResultMessage = exception.Message; return result; } }
/// <summary> /// 根据主键查询指定记录 /// </summary> /// <param name="functionModuleId">主键</param> /// <param name="isLog">是否写入日志</param> /// <returns>查询结果,封装了查询出的实体</returns> public static ResultModel GetFunctionModuleById(string functionModuleId, bool isLog) { if (isLog) return GetFunctionModuleById(functionModuleId); FunctionModule functionModule = new FunctionModule(); ResultModel result = new ResultModel(); try { functionModule= FunctionModuleDal.GetModel(functionModuleId); result.Data = functionModule; result.IsSuccess = true; result.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_SUCCESS; result.ResultMessage=SymbolicConstant.RESULTMESSAGE_GETMODEL_SUCCESS; return result; } catch (Exception exception) { result.IsSuccess = false; result.ResultCode = SymbolicConstant.RESULTCODE_GETMODEL_ERROR; result.ResultMessage = exception.Message; return result; } }