예제 #1
0
        public int Insert_DangNhap(string username)
        {
            try
            {
                string     sql     = "SP_INSERT_DANGNHAP";
                SqlCommand command = new SqlCommand(sql, conn);
                dataAdapter = new SqlDataAdapter();

                command.CommandType = CommandType.StoredProcedure;

                command.Parameters.Add(new SqlParameter("@USER", username));

                dataAdapter.SelectCommand = command;
                dataAdapter.Fill(dataTable);

                int count = new DAL_Login().getLogin(username, username);
                return(count);
            }
            catch { return(0); }
        }
        public int Update_Password(string user, string password, string newPassword)
        {
            try
            {
                string     sql     = "SP_CHANGE_PASSWORD";
                SqlCommand command = new SqlCommand(sql, conn);
                dataAdapter = new SqlDataAdapter();

                command.CommandType = CommandType.StoredProcedure;

                command.Parameters.Add(new SqlParameter("@USER", user));
                command.Parameters.Add(new SqlParameter("@PASSWORD", password));
                command.Parameters.Add(new SqlParameter("@NEWPASSWORD", newPassword));

                dataAdapter.SelectCommand = command;
                dataAdapter.Fill(dataTable);

                int count = new DAL_Login().getLogin(user, newPassword);

                return(count);
            }
            catch { return(0); }
        }