Ejemplo n.º 1
0
 public static bool update_database(string ten, string diachi, string sdt, string email, string chucvu, int tuoi)
 {
     try
     {
         Class.clsDatabase cls = new QuanLyThuVien.Class.clsDatabase();
         cls.KetNoi();
         string strUpdate = "update tblNhanVien set TENNV='" + ten + "',DIACHI='" + diachi + "',DIENTHOAI='" + sdt + "',EMAIL='" + email + "',ChucVu='" + chucvu + "',Tuoi='" + tuoi + "' where TAIKHOAN='an'";
         cls.ThucThiSQLTheoKetNoi(strUpdate);
         //cls.ThucThiSQLTheoPKN("delete tblNhanVien where id = '" + id+"'");
         return(true);
     }
     catch { Exception ex;
             return(false); };
 }
Ejemplo n.º 2
0
 public static string check_TaoTaiKhoan(string id, string pass, string confpass)
 {
     if (id.Length - 1 < 5)
     {
         return("Id too short");
     }
     else
     if (id.Length - 1 > 30)
     {
         return("Id too long");
     }
     else
     if (pass.Length - 1 < 5)
     {
         return("Pass too short");
     }
     else
     if (pass.Length - 1 > 30)
     {
         return("Pass too long");
     }
     else
     if (pass != confpass)
     {
         return("Pass not same");
     }
     else
     {
         try
         {
             Class.clsDatabase cls = new QuanLyThuVien.Class.clsDatabase();
             cls.KetNoi();
             cls.ThucThiSQLTheoPKN("insert into tblNhanVien(TAIKHOAN,MATKHAU,QUYENHAN)values('" + id + "','" + pass + "','user')");
             //cls.ThucThiSQLTheoPKN("delete tblNhanVien where id = '" + id+"'");
             return("0");
         }
         catch { return("Existed account"); }
     }
 }