コード例 #1
0
 public static int LoginValidationB(string UserName, string Pass)
 {
     try
     {
         int Status = DALogIn.LoginvalidationD(UserName, Pass);
         return(Status);
     }
     catch (Exception Excptn_LoginValidationB)
     {
         throw Excptn_LoginValidationB;
     }
 }
コード例 #2
0
        public void RegisterUser(string userName, string password, out bool status)
        {
            byte[] buffer = System.Text.Encoding.UTF8.GetBytes(password);
            password = System.Convert.ToBase64String(buffer);
            DataTable tableUsers = new DataTable();

            DALogIn da = new DALogIn();

            tableUsers = da.CheckRegisterUser(userName);
            status     = true;
            for (int i = 0; i < tableUsers.Rows.Count; i++)
            {
                if (userName == tableUsers.Rows[i]["UserName"].ToString())
                {
                    status = false;
                }
            }
            if (status == true)
            {
                da.RegisterUser(userName, password);
            }
        }
コード例 #3
0
        public UserModel CheckUser(string userName, string password, out bool status)
        {
            UserModel user = new UserModel();

            byte[] buffer = System.Text.Encoding.UTF8.GetBytes(password);
            password = System.Convert.ToBase64String(buffer);


            status = false;
            DALogIn   da         = new DALogIn();
            DataTable tableUsers = da.CheckUser(userName);

            if (tableUsers.Rows.Count == 0)
            {
                status = false;
            }
            else
            {
                for (int i = 0; i < tableUsers.Rows.Count; i++)
                {
                    if (password == tableUsers.Rows[i]["UserPassword"].ToString())
                    {
                        status            = true;
                        user.UserId       = Convert.ToInt32(tableUsers.Rows[i]["UserId"]);
                        user.UserName     = tableUsers.Rows[i]["UserName"].ToString();
                        user.UserPassword = tableUsers.Rows[i]["UserPassword"].ToString();
                        user.LastLogIn    = DateTime.Now;
                    }
                }
            }

            if (status)
            {
                da.LastLogIn(user.UserId);
            }


            return(user);
        }