/// <summary> /// 自动登录处理 /// </summary> /// <param name="gongSiId">公司编号</param> /// <param name="yongHuId">用户编号</param> /// <param name="username">用户名</param> static void AutoLogin(string gongSiId, string yongHuId, string username, out EyouSoft.Model.SSO.MYongHuInfo yongHuInfo) { yongHuInfo = null; if (string.IsNullOrEmpty(gongSiId) || string.IsNullOrEmpty(yongHuId) || string.IsNullOrEmpty(username)) { return; } IYongHu dal = new DYongHu(); yongHuInfo = dal.Login(gongSiId, username, yongHuId); if (yongHuInfo == null) { return; } if (yongHuInfo.Status != EyouSoft.Model.YongHuStatus.启用) { yongHuInfo = null; return; } dal.LoginLogwr(yongHuInfo, EyouSoft.Model.LoginLeiXing.自动登录); SetYongHuCache(yongHuInfo); }
/// <summary> /// 用户登录,返回1登录成功,其它失败 /// </summary> /// <param name="companyId">系统公司编号</param> /// <param name="username">用户名</param> /// <param name="pwd_md5">登录密码MD5</param> /// <param name="yongHuInfo">登录用户信息</param> /// <param name="cookieTian">cookie保留天数</param> /// <returns></returns> public static int Login(string username, string pwd_md5, out EyouSoft.Model.SSO.MYongHuInfo yongHuInfo, double cookieTian) { IYongHu dal = new DYongHu(); yongHuInfo = null; if (string.IsNullOrEmpty(username)) { return(-1); } if (string.IsNullOrEmpty(pwd_md5)) { return(-2); } yongHuInfo = dal.Login(username, pwd_md5); if (yongHuInfo == null) { return(-4); } if (yongHuInfo.Status != EyouSoft.Model.YongHuStatus.启用) { yongHuInfo = null; return(-5); } /*if (yongHuInfo.ShenHeStatus != ShenHeStatus.已审核) * { * yongHuInfo = null; * return -6; * }*/ dal.LoginLogwr(yongHuInfo, EyouSoft.Model.LoginLeiXing.用户登录); SetYongHuCache(yongHuInfo); SetLoginCookies(yongHuInfo, cookieTian); return(1); }