/// <summary>
        /// 添加记录操作
        /// </summary>
        protected void AddRecord()
        {
            HttpContext context = HttpContext.Current;
            HttpRequest request = context.Request;
            HttpResponse response = context.Response;

            string description = request.Params["textareaDescription"];
            string isPublicId = request.Params["radioIsPublicId"];
            string moduleLevelId = request.Params["selectModuleLevelId"];
            string moduleName = request.Params["textModuleName"];
            string fartherId = request.Params["selectFartherId"];
            string sortFieldId = request.Params["selectSortFieldId"];

            FunctionModule functionModule = new FunctionModule();

            functionModule.AddTime = DateTime.Now;
            functionModule.UpdateTime = DateTime.Now;
            if (description != null)
                functionModule.Description = description;
            if (!String.IsNullOrEmpty(isPublicId))
                functionModule.IsPublicId = isPublicId;
            functionModule.ModuleId = Guid.NewGuid().ToString("N");
            if (!String.IsNullOrEmpty(moduleLevelId))
                functionModule.ModuleLevelId = Convert.ToInt32(moduleLevelId);
            if (moduleName != null)
                functionModule.ModuleName = moduleName;
            if (!String.IsNullOrEmpty(fartherId))
                functionModule.FartherId = fartherId;
            if (!String.IsNullOrEmpty(sortFieldId))
                functionModule.SortFieldId = sortFieldId;
            ResultModel result = FunctionModuleBll.Insert(functionModule);
            string jsonString = JsonConvert.SerializeObject(result);
            response.Write(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 修改某条记录
        /// </summary>
        /// <param name="user">要修改记录对应的实体</param>
        /// <returns>修改结果,包括是否修改成功、记录主键等信息</returns>
        public static ResultModel Update(FunctionModule functionModule)
        {
            OperationLog log = new OperationLog();
            ResultModel result = new ResultModel();

            try
            {

                log.AddTime = DateTime.Now;
                log.IsSuccessId = SymbolicConstant.ISSUCCESS_TRUE;
                log.OperationLogId = System.Guid.NewGuid().ToString("N");
                log.OperationContent = SymbolicConstant.OPERATIONCONTENT_UPDATE;
                log.OperationTable = typeof(FunctionModule).Name;
                log.OperationTypeCode = SymbolicConstant.OPERATIONTYPE_UPDATE;
                log.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_SUCCESS;
                log.ResultMessage=SymbolicConstant.RESULTMESSAGE_UPDATE_SUCCESS;
                log.UserId = CurrentSession.getUser().UserId;

                log.ObjectRecordId = functionModule.ModuleId;
                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)
            {
                log.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR;
                log.IsSuccessId = SymbolicConstant.ISSUCCESS_FALSE;
                log.ResultMessage=exception.Message;

                result.IsSuccess = false;
                result.ObjectRecordId =functionModule.ModuleId;
                result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR;
                result.ResultMessage = exception.Message;

                return result;
            }
            finally
            {
                OperationLogBll.Insert(log);
            }
        }
Ejemplo n.º 3
0
        /// <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;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 添加一条新记录
        /// </summary>
        /// <param name="functionModule">FunctionModule实体</param>
        /// <param name="isLog">是否写入日志</param>
        /// <returns>添加结果,包括是否插入成功、记录主键等信息</returns>
        public static ResultModel Insert(FunctionModule functionModule, bool isLog)
        {
            if (isLog)
                return Insert(functionModule);
            ResultModel result = new ResultModel();
            object id = "";
            try
            {
                id = FunctionModuleDal.Insert(functionModule);

                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;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 根据主键查询指定记录
        /// </summary>
        /// <param name="moduleId">主键</param>
        /// <param name="isLog">是否写入日志</param>
        /// <returns>查询结果,封装了查询出的实体</returns>
        public static ResultModel GetFunctionModuleById(string moduleId, bool isLog)
        {
            if (isLog)
                return GetFunctionModuleById(moduleId);
            FunctionModule functionModule = new FunctionModule();
            ResultModel result = new ResultModel();

            try
            {
                functionModule= FunctionModuleDal.GetModel(moduleId);
                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;
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 修改FunctionModule表中的某条记录
 /// </summary>
 /// <param name="user">要修改记录对应的实体</param>
 public static void Update(FunctionModule functionModule)
 {
     DataAccessUtility.Update<FunctionModule>(functionModule);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 插入一条新记录
 /// </summary>
 /// <param name="functionModule">FunctionModule实体</param>
 /// <returns>插入记录的主键</returns>
 public static object Insert(FunctionModule functionModule)
 {
     Object id = DataAccessUtility.Insert<FunctionModule>(functionModule);
     return id;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 删除FunctionModule表中的某条记录
 /// </summary>
 /// <param name="user">要删除记录的对应的实体</param>
 public static void Delete(FunctionModule functionModule)
 {
     DataAccessUtility.Delete<FunctionModule>(functionModule);
 }