Пример #1
0
        /// <summary>
        /// 驗證使用者,若通過驗證則完成簽入動作
        /// </summary>
        /// <returns></returns>
        public bool ValidateUser()
        {
            IDictionary<string, string> conditions = new Dictionary<string, string>();
            conditions.Add("Account", this.Account);
            IList<MasterMember> adminList = m_FTISService.GetMasterMemberListNoLazy(conditions);
            if (adminList != null && adminList.Count() > 0)
            {
                MasterMember admin = adminList[0];
                string passwordDecrypt = EncryptUtil.GetMD5(Password);
                if (passwordDecrypt.Equals(admin.Password, StringComparison.OrdinalIgnoreCase))
                {
                    //modelUser = admin;
                    FormsAuthentication.SetAuthCookie(this.Account, this.RememberMe);
                    Ticket.SignIn(this.Account, this.RememberMe, 1);
                    m_SessionHelper.LoginUser = admin;

                    ////登入紀錄
                    MasterLog masterLog = new MasterLog(this.Account, HttpHelper.GetUserIp());
                    m_FTISService.CreateMasterLog(masterLog);

                    return true;
                }
            }

            return false;
        }
Пример #2
0
 /// <summary>
 /// 刪除後台帳號登入紀錄
 /// </summary>
 /// <param name="masterLog">被刪除的後台帳號登入紀錄</param>
 public void DeleteMasterLog(MasterLog masterLog)
 {
     FTISDao.DeleteMasterLog(masterLog);
 }
Пример #3
0
 /// <summary>
 /// 更新後台帳號登入紀錄
 /// </summary>
 /// <param name="masterLog">被更新的後台帳號登入紀錄</param>
 /// <returns>更新後的後台帳號登入紀錄</returns>
 public MasterLog UpdateMasterLog(MasterLog masterLog)
 {
     return FTISDao.UpdateMasterLog(masterLog);
 }
Пример #4
0
 /// <summary>
 /// 新增後台帳號登入紀錄
 /// </summary>
 /// <param name="masterLog">被新增的後台帳號登入紀錄</param>
 /// <returns>新增後的後台帳號登入紀錄</returns>
 public MasterLog CreateMasterLog(MasterLog masterLog)
 {
     return FTISDao.CreateMasterLog(masterLog);
 }
Пример #5
0
        public void Test_MasterLog()
        {
            //登入紀錄
            MasterLog masterLog = new MasterLog("test1234", "127.0.0.1");
            m_FTISService.CreateMasterLog(masterLog);

            //查詢登入紀錄
            IDictionary<string, string> conditionsLog = new Dictionary<string, string>();
            conditionsLog.Add("EnterTimeFrom", DateTime.Today.ToShortDateString());
            conditionsLog.Add("EnterTimeTo", DateTime.Today.ToShortDateString());
            IList<MasterLog> logList = m_FTISService.GetMasterLogList(conditionsLog);
            Assert.AreEqual(1, logList.Count);

            conditionsLog.Clear();
            conditionsLog.Add("EnterTimeFrom", DateTime.Today.AddDays(-1).ToShortDateString());
            conditionsLog.Add("EnterTimeTo", DateTime.Today.AddDays(-1).ToShortDateString());
            logList = m_FTISService.GetMasterLogList(conditionsLog);
            Assert.AreEqual(0, logList.Count);

            m_FTISService.DeleteMasterLog(masterLog);
        }