public JsonResult Create(SysUserModel model)
        {
            model.Id = ResultHelper.NewId;
            model.CreateTime = ResultHelper.NowTime;
            if (model != null && ModelState.IsValid)
            {

                if (m_BLL.Create(ref errors, model))
                {
                    m_LogBLL.WriteServiceLog(GetUserId(), "Id" + model.Id + ",UserName" + model.UserName, "成功", "创建", "SysUser");
                    return Json(JsonHandler.CreateMessage(1, Suggestion.InsertSucceed));
                }
                else
                {
                    string ErrorCol = errors.Error;
                    m_LogBLL.WriteServiceLog(GetUserId(), "Id" + model.Id + ",UserName" + model.UserName + "," + ErrorCol, "失败", "创建", "SysUser");
                    return Json(JsonHandler.CreateMessage(0, Suggestion.InsertFail + ErrorCol));
                }
            }
            else
            {
                return Json(JsonHandler.CreateMessage(0, Suggestion.InsertFail));
            }
        }
 public bool Create(ref ValidationErrors errors, SysUserModel model)
 {
     try
     {
         SysUser entity = m_Rep.GetById(model.Id);
         if (entity != null)
         {
             errors.Add(Suggestion.PrimaryRepeat);
             return false;
         }
         entity = new SysUser();
         entity.Id = model.Id;
         entity.UserName = model.UserName;
         entity.Password = model.Password;
         entity.TrueName = model.TrueName;
         entity.Card = model.Card;
         entity.MobileNumber = model.MobileNumber;
         entity.PhoneNumber = model.PhoneNumber;
         entity.QQ = model.QQ;
         entity.EmailAddress = model.EmailAddress;
         entity.OtherContact = model.OtherContact;
         entity.Province = model.Province;
         entity.City = model.City;
         entity.Village = model.Village;
         entity.Address = model.Address;
         entity.State = model.State;
         entity.CreateTime = model.CreateTime;
         entity.CreatePerson = model.CreatePerson;
         entity.Sex = model.Sex;
         entity.Birthday = model.Birthday;
         entity.JoinDate = model.JoinDate;
         entity.Marital = model.Marital;
         entity.Political = model.Political;
         entity.Nationality = model.Nationality;
         entity.Native = model.Native;
         entity.School = model.School;
         entity.Professional = model.Professional;
         entity.Degree = model.Degree;
         entity.DepId = model.DepId;
         entity.PosId = model.PosId;
         entity.Expertise = model.Expertise;
         entity.JobState = model.JobState;
         entity.Photo = model.Photo;
         entity.Attach = model.Attach;
         if (m_Rep.Create(entity) == 1)
         {
             return true;
         }
         else
         {
             errors.Add(Suggestion.InsertFail);
             return false;
         }
     }
     catch (Exception ex)
     {
         errors.Add(ex.Message);
         ExceptionHander.WriteException(ex);
         return false;
     }
 }
        public JsonResult Edit(SysUserModel model)
        {
            if (model != null && ModelState.IsValid)
            {

                if (m_BLL.Edit(ref errors, model))
                {
                    m_LogBLL.WriteServiceLog(GetUserId(), "Id" + model.Id + ",UserName" + model.UserName, "成功", "修改", "SysUser");
                    return Json(JsonHandler.CreateMessage(1, Suggestion.EditSucceed));
                }
                else
                {
                    string ErrorCol = errors.Error;
                    m_LogBLL.WriteServiceLog(GetUserId(), "Id" + model.Id + ",UserName" + model.UserName + "," + ErrorCol, "失败", "修改", "SysUser");
                    return Json(JsonHandler.CreateMessage(0, Suggestion.EditFail + ErrorCol));
                }
            }
            else
            {
                return Json(JsonHandler.CreateMessage(0, Suggestion.EditFail));
            }
        }
 public SysUserModel GetById(string id)
 {
     if (IsExist(id))
     {
         SysUser entity = m_Rep.GetById(id);
         SysUserModel model = new SysUserModel();
         model.Id = entity.Id;
         model.UserName = entity.UserName;
         model.Password = entity.Password;
         model.TrueName = entity.TrueName;
         model.Card = entity.Card;
         model.MobileNumber = entity.MobileNumber;
         model.PhoneNumber = entity.PhoneNumber;
         model.QQ = entity.QQ;
         model.EmailAddress = entity.EmailAddress;
         model.OtherContact = entity.OtherContact;
         model.Province = entity.Province;
         model.City = entity.City;
         model.Village = entity.Village;
         model.Address = entity.Address;
         model.State = (Boolean)entity.State;
         model.CreateTime = (DateTime)entity.CreateTime;
         model.CreatePerson = entity.CreatePerson;
         model.Sex = entity.Sex;
         model.Birthday = (DateTime)entity.Birthday;
         model.JoinDate = (DateTime)entity.JoinDate;
         model.Marital = entity.Marital;
         model.Political = entity.Political;
         model.Nationality = entity.Nationality;
         model.Native = entity.Native;
         model.School = entity.School;
         model.Professional = entity.Professional;
         model.Degree = entity.Degree;
         model.DepId = entity.DepId;
         model.PosId = entity.PosId;
         model.Expertise = entity.Expertise;
         model.JobState = entity.JobState;
         model.Photo = entity.Photo;
         model.Attach = entity.Attach;
         return model;
     }
     else
     {
         return null;
     }
 }