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

            string addTime = request.Params["textAddTime"];
            string description = request.Params["textareaDescription"];
            string functionModule = request.Params["selectModuleId"];
            string menuId = request.Params["textMenuId"];
            string menuName = request.Params["textMenuName"];
            string pageId = request.Params["textPageId"];

            LinkMenu linkMenu = new LinkMenu();

            linkMenu.MenuId = System.Guid.NewGuid().ToString("N");
            linkMenu.UpdateTime = DateTime.Now;
            if (String.IsNullOrEmpty(description))
                linkMenu.Description = description;
            if (!String.IsNullOrEmpty(functionModule))
                linkMenu.ModuleId = functionModule;
            if (!String.IsNullOrEmpty(menuName))
                linkMenu.MenuName = menuName;
            if (!String.IsNullOrEmpty(pageId))
                linkMenu.PageId = pageId;

            linkMenu.AddTime = DateTime.Now;
            linkMenu.UpdateTime = DateTime.Now;

            ResultModel result = LinkMenuBll.Insert(linkMenu);
            string jsonString = JsonConvert.SerializeObject(result);
            response.Write(result);
        }
示例#2
0
        /// <summary>
        /// 修改某条记录
        /// </summary>
        /// <param name="user">要修改记录对应的实体</param>
        /// <returns>修改结果,包括是否修改成功、记录主键等信息</returns>
        public static ResultModel Update(LinkMenu linkMenu)
        {
            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(LinkMenu).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 = linkMenu.MenuId;
                LinkMenuDal.Update(linkMenu);

                result.IsSuccess = true;
                result.ObjectRecordId = linkMenu.MenuId;
                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 =linkMenu.MenuId;
                result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR;
                result.ResultMessage = exception.Message;

                return result;
            }
            finally
            {
                OperationLogBll.Insert(log);
            }
        }
示例#3
0
        /// <summary>
        /// 修改某条记录
        /// </summary>
        /// <param name="user">要修改记录对应的实体</param>
        /// <param name="isLog">是否写入日志</param>
        /// <returns>修改结果,包括是否修改成功、记录主键等信息</returns>
        public static ResultModel Update(LinkMenu linkMenu, bool isLog)
        {
            if (isLog)
                return Update(linkMenu);

            ResultModel result = new ResultModel();

            try
            {
                LinkMenuDal.Update(linkMenu);

                result.IsSuccess = true;
                result.ObjectRecordId = linkMenu.MenuId;
                result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_SUCCESS;
                result.ResultMessage = SymbolicConstant.RESULTMESSAGE_UPDATE_SUCCESS;

                return result;
            }
            catch (Exception exception)
            {
                result.IsSuccess = false;
                result.ObjectRecordId =linkMenu.MenuId;
                result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR;
                result.ResultMessage = exception.Message;

                return result;
            }
        }
示例#4
0
        /// <summary>
        /// 添加一条新记录
        /// </summary>
        /// <param name="linkMenu">LinkMenu实体</param>
        /// <param name="isLog">是否写入日志</param>
        /// <returns>添加结果,包括是否插入成功、记录主键等信息</returns>
        public static ResultModel Insert(LinkMenu linkMenu, bool isLog)
        {
            if (isLog)
                return Insert(linkMenu);
            ResultModel result = new ResultModel();
            object id = "";
            try
            {
                id = LinkMenuDal.Insert(linkMenu);

                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;
            }
        }
示例#5
0
        /// <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;
            }
        }
示例#6
0
 /// <summary>
 /// 修改LinkMenu表中的某条记录
 /// </summary>
 /// <param name="user">要修改记录对应的实体</param>
 public static void Update(LinkMenu linkMenu)
 {
     DataAccessUtility.Update<LinkMenu>(linkMenu);
 }
示例#7
0
 /// <summary>
 /// 插入一条新记录
 /// </summary>
 /// <param name="linkMenu">LinkMenu实体</param>
 /// <returns>插入记录的主键</returns>
 public static object Insert(LinkMenu linkMenu)
 {
     Object id = DataAccessUtility.Insert<LinkMenu>(linkMenu);
     return id;
 }
示例#8
0
 /// <summary>
 /// 删除LinkMenu表中的某条记录
 /// </summary>
 /// <param name="user">要删除记录的对应的实体</param>
 public static void Delete(LinkMenu linkMenu)
 {
     DataAccessUtility.Delete<LinkMenu>(linkMenu);
 }