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

            Consumer consumer = new Consumer();
            string historyFamily = request.Params["textHistoryFamily"];
            string historyPastIllness = request.Params["textHistoryPastIllness"];
            string historyPersonal = request.Params["textHistoryPersonal"];
            string medCardNum = request.Params["textMedCardNum"];

            string genderId = request.Params["radioGenderId"];
            string password = request.Params["passwordPassword"];
            string realName = request.Params["textRealName"];
            string userName = request.Params["textUserName"];
            string description = request.Params["textareaDescription"];
            string telephone = request.Params["textTelephone"];
            string email = request.Params["textEmail"];
            string userRole = request.Params["checkboxUserRole"];
            string idType = request.Params["selectIdType"];
            string idNum = request.Params["textIdNumber"];
            string birthdate = request.Params["textBirthdate"];
            string age = request.Params["textAge"];
            string marriage = request.Params["radioMarriage"];

            SystemUser user = new SystemUser();
            //默认密码六个一
            user.Password = "******";
            user.AddTime = DateTime.Now;
            user.DeleteFlagId = '0';
            if (!String.IsNullOrEmpty(genderId))
                user.GenderId = Convert.ToChar(genderId);
            user.OnlineFlagId = '0';
            if (!String.IsNullOrEmpty(password))
                user.Password = password;
            if (!String.IsNullOrEmpty(realName))
                user.RealName = realName;
            user.UpdateTime = DateTime.Now;
            user.UserId = Guid.NewGuid().ToString("N");
            if (!String.IsNullOrEmpty(userName))
                user.UserName = userName;
            if (!String.IsNullOrEmpty(description))
                user.Description = description;
            if (!String.IsNullOrEmpty(email))
                user.Email = email;
            if (!String.IsNullOrEmpty(telephone))
                user.Telephone = telephone;
            if (!String.IsNullOrEmpty(idType))
                user.IdType = idType;
            if (!String.IsNullOrEmpty(idNum))
                user.IdNumber = idNum;
            if (!String.IsNullOrEmpty(birthdate))
                user.Birthdate = Convert.ToDateTime(birthdate);
            if (!String.IsNullOrEmpty(age))
                user.Age = Convert.ToInt32(age);
            if (!String.IsNullOrEmpty(marriage))
                user.Marriage = marriage;

            user.RoleList = new List<Role>();
            if (!String.IsNullOrEmpty(userRole))
            {
                string[] userRoleList = userRole.Split(',');
                for (int i = 0; i < userRoleList.Length; i++)
                    user.RoleList.Add((Role)RoleBll.GetRoleById(userRoleList[i]).Data);
            }

            ResultModel result = SystemUserBll.Insert(user);
            if (result.IsSuccess == false)
            {
                response.Write(result);
                return;
            }

            consumer.ConsumerId = Guid.NewGuid().ToString("N");
            if (!String.IsNullOrEmpty(historyFamily))
                consumer.HistoryFamily = historyFamily;
            if (!String.IsNullOrEmpty(historyPastIllness))
                consumer.HistoryPastIllness = historyPastIllness;
            if (!String.IsNullOrEmpty(historyPersonal))
                consumer.HistoryPersonal = historyPersonal;
            if (!String.IsNullOrEmpty(medCardNum))
                consumer.MedCardNum = medCardNum;
            consumer.UserId = user.UserId;
            consumer.UserRef = user;

            result = ConsumerBll.Insert(consumer);
            string jsonString = JsonConvert.SerializeObject(result);
            response.Write(result);
        }
 /// <summary>
 /// 插入一条新记录
 /// </summary>
 /// <param name="systemUser">SystemUser实体</param>
 /// <returns>插入记录的主键</returns>
 public static object Insert(SystemUser systemUser)
 {
     Object id = DataAccessUtility.Insert<SystemUser>(systemUser);
     return id;
 }
 /// <summary>
 /// 修改SystemUser表中的某条记录
 /// </summary>
 /// <param name="user">要修改记录对应的实体</param>
 public static void Update(SystemUser systemUser)
 {
     DataAccessUtility.Update<SystemUser>(systemUser);
 }
 /// <summary>
 /// 删除SystemUser表中的某条记录
 /// </summary>
 /// <param name="user">要删除记录的对应的实体</param>
 public static void Delete(SystemUser systemUser)
 {
     DataAccessUtility.Delete<SystemUser>(systemUser);
 }
        /// <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="user">要修改记录对应的实体</param>
        /// <returns>修改结果,包括是否修改成功、记录主键等信息</returns>
        public static ResultModel Update(SystemUser systemUser)
        {
            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(SystemUser).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 = systemUser.UserId;
                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)
            {
                log.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR;
                log.IsSuccessId = SymbolicConstant.ISSUCCESS_FALSE;
                log.ResultMessage=exception.Message;

                result.IsSuccess = false;
                result.ObjectRecordId =systemUser.UserId;
                result.ResultCode = SymbolicConstant.RESULTCODE_UPDATE_ERROR;
                result.ResultMessage = exception.Message;

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

                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="userId">主键</param>
        /// <param name="isLog">是否写入日志</param>
        /// <returns>查询结果,封装了查询出的实体</returns>
        public static ResultModel GetSystemUserById(string userId, bool isLog)
        {
            if (isLog)
                return GetSystemUserById(userId);
            SystemUser systemUser = new SystemUser();
            ResultModel result = new ResultModel();

            try
            {
                systemUser= SystemUserDal.GetModel(userId);
                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;
            }
        }