public string KTDangNhap(TaiKhoanBO taikhoanBO)
 {             
     cnn.Open();
     string sql = "select IDAcc from Account where Account = @user and Password = @pass";
     SqlCommand commandForCheckUser = new SqlCommand(sql, cnn);
     commandForCheckUser.Parameters.AddWithValue("@user", taikhoanBO.Account);
     commandForCheckUser.Parameters.AddWithValue("@pass", taikhoanBO.Password);
     commandForCheckUser.CommandType = CommandType.Text;
     string userID = Convert.ToString(commandForCheckUser.ExecuteScalar());
     cnn.Close();
     return userID;
 }
 public void Them(TaiKhoanBO taikhoanBO)
 {    
     SqlCommand cmd = new SqlCommand("insert into Account values(@Account,@Password,@Name,@Birth,@Picutre,@Slogun)", cnn);
     cmd.Parameters.AddWithValue("@Account", taikhoanBO.Account);
     cmd.Parameters.AddWithValue("@PassWord", taikhoanBO.Password);
     cmd.Parameters.AddWithValue("@Name", taikhoanBO.Name);
     cmd.Parameters.AddWithValue("@Birth", taikhoanBO.Birth);
     cmd.Parameters.AddWithValue("@Picutre", taikhoanBO.Picutre);
     cmd.Parameters.AddWithValue("@Slogun", taikhoanBO.Slogun);
     cnn.Open();
     cmd.ExecuteNonQuery();
     cnn.Close();
 }
    public string DangNhap(string Acc,string Pass)
    {
        string kq = "";
        try
        {
            TaiKhoanBO tkBO = new TaiKhoanBO();
            tkBO.Account = Acc;
            tkBO.Password = Pass;
            kq = tkDAO.KTDangNhap(tkBO);
            return kq;
        }
        catch
        {
            return kq;
        }

    }
 public bool Them(string Acc,string Pass,string Name,DateTime Birth,Byte[] picture, string Slogun)
 {
     try
     {
         TaiKhoanBO tkBO = new TaiKhoanBO();
         tkBO.Account = Acc;
         tkBO.Password = Pass;
         tkBO.Name = Name;
         tkBO.Birth = Birth;
         tkBO.Picutre = picture;
         tkBO.Slogun = Slogun;
         tkDAO.Them(tkBO);
         return true;
     }
     catch
     {
         return false;
     }
 }
Example #5
0
 public void Add(TaiKhoanBO _taikhoanBO)
 {
     List.Add(_taikhoanBO);
 }