Ejemplo n.º 1
0
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="strAccount">帐号</param>
        /// <param name="strPassword">密码</param>
        /// <param name="strIP">IP地址</param>
        /// <returns></returns>
        public AccountModel Login(string strAccount, string strPassword, string strIP)
        {
            AccountModel accountModel = new AccountModel();
            //if (strAccount.Equals("3shine"))
            //{
            //    accountModel.LoginState = AccountState.Succeed;
            //}
            //else
            //{
                accountModel = LoginAccount(strAccount, strPassword);      // 帐号登录
            //}

            //if (accountModel.LoginState == AccountState.Succeed)
            //{
            AccountLogModel logModel = new AccountLogModel();

            logModel.AccountName = strAccount;
            logModel.LoginTime = DateTime.Now;
            logModel.Result = GetEnumValue.GetDescription(accountModel.LoginState);
            logModel.LoginIP = strIP;
            logModel.Type = 0;
            logModel.ID = accountModel.ID.ToString();

            dal.SaveLoginLog(logModel);          // 记录日志
            //}
            return accountModel;
        }
Ejemplo n.º 2
0
 public int SaveLoginLog(AccountLogModel logModel)
 {
     return logbll.SaveLoginLog(logModel);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 登录日志
 /// </summary>
 /// <param name="logModel">登录日志实体</param>
 public int SaveLoginLog(AccountLogModel logModel)
 {
     return accountdal.SaveLoginLog(logModel);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 登录日志
        /// </summary>
        /// <param name="logModel">登录日志实体</param>
        public int SaveLoginLog(AccountLogModel logModel)
        {
            SqlParameter[] paras ={
                new SqlParameter("@AcountName",SqlDbType.NVarChar,20),
                new SqlParameter("@LoginTime",SqlDbType.DateTime),
                new SqlParameter("@Result",SqlDbType.NVarChar,20),
                new SqlParameter("@Remark",SqlDbType.NVarChar,50),
                new SqlParameter("@LoginIP",SqlDbType.NChar,255),
                new SqlParameter("@type",SqlDbType.Int)
            };

            paras[0].Value = logModel.AccountName;
            paras[1].Value = logModel.LoginTime;
            paras[2].Value = logModel.Result;
            paras[3].Value = logModel.Remark;
            paras[4].Value = logModel.LoginIP;
            paras[5].Value = logModel.Type;

            try
            {
                int iReturn;
                int i = DbHelperSQL.RunProcedure("Power_Insert_LoginLog", paras, out iReturn);
                return iReturn;
            }
            catch
            {
                return -1;
            }
        }