/// <summary> /// 获取单条数据 /// </summary> /// <returns></returns> public V_ctms_sys_userinfo Get(Expression <Func <ctms_sys_userinfo, bool> > predicate = null) { using (ctms_sys_userinfoDAL dal = new ctms_sys_userinfoDAL()) { ctms_sys_userinfo entity = dal.Get(predicate); return(EntityToModel(entity)); } }
/// <summary> /// 通过id更新用户信息 /// </summary> /// <param name="user"></param> /// <returns></returns> public bool UpdateUserInfo(V_ctms_sys_userinfo user) { if (user == null) { return(false); } ctms_sys_userinfo userinfo = ModelToEntity(user); return(dal.UpdateUserInfo(userinfo)); }
/// <summary> /// 更新 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool Edit(V_ctms_sys_userinfo model) { if (model == null) { return(false); } using (ctms_sys_userinfoDAL dal = new ctms_sys_userinfoDAL()) { ctms_sys_userinfo entitys = ModelToEntity(model); return(dal.Edit(entitys)); } }
/// <summary> /// 新增 /// </summary> /// <param name="model"></param> /// <returns></returns> public string Add(V_ctms_sys_userinfo model) { if (model == null) { return(string.Empty); } using (ctms_sys_userinfoDAL dal = new ctms_sys_userinfoDAL()) { ctms_sys_userinfo entity = ModelToEntity(model); entity.USERID = string.IsNullOrEmpty(model.USERID) ? Guid.NewGuid().ToString("N") : model.USERID; return(dal.Add(entity)); } }
/// <summary> /// 登录 /// </summary> /// <param name="loginName">登录名</param> /// <param name="loginPwd">登录密码</param> /// <returns></returns> public V_ctms_sys_userinfo Login(string loginName, string loginPwd) { ctms_sys_userinfo userInfo = dal.GetUserInfoByLoginName(loginName); if (userInfo == null) { return(EntityToModel(userInfo)); } loginPwd = loginPwd.ToMd5(); if (!userInfo.LOGINPWD.Equals(loginPwd)) { return(null); } return(EntityToModel(userInfo)); }
/// <summary> /// Entity转Model /// </summary> /// <param name="entity"></param> /// <returns></returns> private V_ctms_sys_userinfo EntityToModel(ctms_sys_userinfo entity) { if (entity != null) { V_ctms_sys_userinfo model = new V_ctms_sys_userinfo() { USERID = entity.USERID, LOGINNAME = entity.LOGINNAME, USERNAME = entity.USERNAME, LOGINPWD = entity.LOGINPWD, MOBILEPHONE = entity.MOBILEPHONE, EMAIL = entity.EMAIL, USERTYPE = entity.USERTYPE, USERSTATUS = entity.USERSTATUS, MEMBERID = entity.MEMBERID, MEMBERSTARTDATE = entity.MEMBERSTARTDATE, MEMBERENDDATE = entity.MEMBERENDDATE, ACCOUNT = entity.ACCOUNT.Value, ICONPATH = entity.ICONPATH, CREATEUSERNAME = entity.CREATEUSERNAME, EDITUSERNAME = entity.EDITUSERNAME, OWNERNAME = entity.OWNERNAME, CREATEUSERID = entity.CREATEUSERID, CREATEDATETIME = entity.CREATEDATETIME, EDITUSERID = entity.EDITUSERID, EDITDATETIME = entity.EDITDATETIME, ISDELETED = entity.ISDELETED, OWNERID = entity.OWNERID, OWNERPOSTID = entity.OWNERPOSTID, OWNERDEPARTMENTID = entity.OWNERDEPARTMENTID, OWNERCOMPANYID = entity.OWNERCOMPANYID, }; return(model); } return(null); }
/// <summary> /// Model转Entity /// </summary> /// <param name="model"></param> /// <returns></returns> private ctms_sys_userinfo ModelToEntity(V_ctms_sys_userinfo model) { if (model != null) { ctms_sys_userinfo entity = new ctms_sys_userinfo() { USERID = model.USERID, LOGINNAME = model.LOGINNAME, USERNAME = model.USERNAME, LOGINPWD = model.LOGINPWD, MOBILEPHONE = model.MOBILEPHONE, EMAIL = model.EMAIL, USERTYPE = model.USERTYPE, USERSTATUS = model.USERSTATUS, MEMBERID = model.MEMBERID, MEMBERSTARTDATE = model.MEMBERSTARTDATE, MEMBERENDDATE = model.MEMBERENDDATE, ACCOUNT = model.ACCOUNT, ICONPATH = model.ICONPATH, CREATEUSERNAME = model.CREATEUSERNAME, EDITUSERNAME = model.EDITUSERNAME, OWNERNAME = model.OWNERNAME, CREATEUSERID = model.CREATEUSERID, CREATEDATETIME = model.CREATEDATETIME, EDITUSERID = model.EDITUSERID, EDITDATETIME = model.EDITDATETIME, ISDELETED = model.ISDELETED, OWNERID = model.OWNERID, OWNERPOSTID = model.OWNERPOSTID, OWNERDEPARTMENTID = model.OWNERDEPARTMENTID, OWNERCOMPANYID = model.OWNERCOMPANYID, }; return(entity); } return(null); }
/// <summary> /// 通过手机获取用户信息 /// </summary> /// <param name="mobilePhone"></param> /// <returns></returns> public V_ctms_sys_userinfo GetUserByMobilePhone(string mobilePhone) { ctms_sys_userinfo userInfo = dal.GetUserInfoByMobilePhone(mobilePhone); return(EntityToModel(userInfo)); }
/// <summary> /// 通过邮箱获取用户信息 /// </summary> /// <param name="email"></param> /// <returns></returns> public V_ctms_sys_userinfo GetUserByEmail(string email) { ctms_sys_userinfo userInfo = dal.GetUserInfoByEmail(email); return(EntityToModel(userInfo)); }
/// <summary> /// 根据登录名获取用户信息 /// </summary> /// <param name="loginName">登录名</param> /// <returns></returns> public V_ctms_sys_userinfo GetUserByLoginName(string loginName) { ctms_sys_userinfo userInfo = dal.GetUserInfoByLoginName(loginName); return(EntityToModel(userInfo)); }
/// <summary> /// 通过id获取用户信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public V_ctms_sys_userinfo GetUserInfoByID(string id) { ctms_sys_userinfo userInfo = dal.GetUserInfoByID(id); return(EntityToModel(userInfo)); }