public static bool checkConnectSQL() { SqlConnection conn = StringSQLConnect.StringSQL(); try { if (conn.State == System.Data.ConnectionState.Closed) { conn.Open(); return(true); } else { return(false); } } catch { return(false); } finally { conn.Close(); } }
// xóa user đã kiểm duyệt trong bảng DangKy public bool DAL_Xoa(string cbUsers) { SqlConnection cn = StringSQLConnect.StringSQL(); try { cn.Open(); string del = "Delete from DangKy Where ID = " + "'" + cbUsers + "'"; SqlCommand delete = new SqlCommand(del, cnn); if (delete.ExecuteNonQuery() > 0) { return(true); } else { return(false); } } catch { return(false); } finally { cn.Close(); } }
public bool Dal_btnDangKy(DTO_ThongTinDangKy TV) { SqlConnection cnn = StringSQLConnect.StringSQL(); try { cnn.Open(); string stradd = "insert into DangKy (ID, pass, HoTen, SDT, Email, ChucVu) values (N'" + TV.txtID + "', N'" + MaHoaString.GetMD5(MaHoaString.GetMD5(TV.txtpass)) + "', N'" + TV.txtName + "', N'" + TV.txtDT + "', N'" + TV.txtEmail + "', N'" + TV.txtChucvu + "')"; SqlCommand add = new SqlCommand(stradd, cnn); //add.ExecuteNonQuery(); if (add.ExecuteNonQuery() > 0) { return(true); } else { return(false); } } catch { return(false); } finally { cnn.Close(); } }
public SqlDataReader DAL_Load(string strID) { cne = StringSQLConnect.StringSQL(); cne.Open(); SqlCommand cmd = new SqlCommand("SELECT HoTen, SDT, Email, ChucVu, pass From DangKy Where ID = " + "'" + strID + "'", cne); SqlDataReader dr = cmd.ExecuteReader(); return(dr); }
public SqlDataReader DAL_LoadThuocTinhDP(string MaDP) { cn = StringSQLConnect.StringSQL(); cn.Open(); SqlCommand cmd = new SqlCommand("SELECT DVT,SoLuong,GiaBan FROM DanhMucDP WHERE MaDP = '" + MaDP + "'", cn); dr = cmd.ExecuteReader(); return(dr); }
public SqlDataReader DAL_GetThuocTinhUser(string strID) { cn = StringSQLConnect.StringSQL(); SqlDataReader dr = null; cn.Open(); SqlCommand cmd = new SqlCommand("select HoTen,SDT,Email,ChucVu,pass from Users where ID = '" + strID + "'", cn); dr = cmd.ExecuteReader(); return(dr); }
public SqlDataReader DAL_GetPass(string strID) { cn = StringSQLConnect.StringSQL(); SqlDataReader dr = null; cn.Open(); SqlCommand cmd = new SqlCommand("select pass from Users where ID = '" + strID + "'", cn); dr = cmd.ExecuteReader(); return(dr); }
public SqlDataReader DAL_GetTenDP(string TenDP) { cn = StringSQLConnect.StringSQL(); SqlDataReader dr = null; cn.Open(); SqlCommand cmd = new SqlCommand("select TenDP from DanhMucDP where TenDP = N'" + TenDP + "'", cn); dr = cmd.ExecuteReader(); return(dr); }
public SqlDataReader DAL_GetThuocTinhUser(string strID) { cn = StringSQLConnect.StringSQL(); SqlDataReader dr = null; cn.Open(); SqlCommand cmd = new SqlCommand("SELECT HoTen, SDT, Email, ChucVu, ThemDP, SuaDP, NhapHang, XuatHang, QlUsers, pass From Users Where ID = " + "'" + strID + "'", cn); dr = cmd.ExecuteReader(); return(dr); }
public SqlDataReader DAL_KiemTraBangDangKy() { cn = StringSQLConnect.StringSQL(); SqlDataReader dr = null; cn.Open(); SqlCommand cmd = new SqlCommand("SELECT * FROM DangKy", cn); dr = cmd.ExecuteReader(); return(dr); }
public SqlDataReader DAL_CheckDangKy() { SqlDataReader dr = null; cn = StringSQLConnect.StringSQL(); if (cn.State == ConnectionState.Closed) { cn.Open(); } SqlCommand cmd = new SqlCommand("SELECT * FROM DangKy", cn); dr = cmd.ExecuteReader(); return(dr); }
public DataTable DAL_ChiTietPX(int MaPX) { cn = StringSQLConnect.StringSQL(); DataTable dt = new DataTable(); if (cn.State == ConnectionState.Closed) { cn.Open(); } SqlDataAdapter da = new SqlDataAdapter("SELECT DanhMucDP.TenDP, ChiTietPhieuXuat.SoLuong, ChiTietPhieuXuat.DVT, ChiTietPhieuXuat.GiaBan, ChiTietPhieuXuat.ThanhTien FROM ChiTietPhieuXuat, DanhMucDP WHERE DanhMucDP.MaDP = ChiTietPhieuXuat.MaDP and MaPX = " + MaPX, cn); da.Fill(dt); cn.Close(); return(dt); }
public SqlDataReader DAL_DangNhap(string txtUser) { SqlDataReader dr = null; cn = StringSQLConnect.StringSQL(); if (cn.State == ConnectionState.Closed) { cn.Open(); } SqlCommand cmd = new SqlCommand("SELECT ID, Pass FROM Users WHERE ID = " + "'" + txtUser + "'", cn); dr = cmd.ExecuteReader(); return(dr); }
public bool Dal_TextChange(string text, string Select) { SqlConnection cnn = StringSQLConnect.StringSQL(); SqlConnection cnn2 = StringSQLConnect.StringSQL(); cnn.Open(); cnn2.Open(); try { string SQL, SQL2; if (Select == "ID") { SQL = "select ID from Users Where ID = " + "N'" + text + "'"; SQL2 = "select ID from DangKy Where ID = " + "N'" + text + "'"; } else { SQL = "select Email from Users Where Email = " + "N'" + text + "'"; SQL2 = "select Email from DangKy Where Email = " + "N'" + text + "'"; } SqlCommand cmd = new SqlCommand(SQL, cnn); SqlCommand cmd2 = new SqlCommand(SQL2, cnn2); if (cmd.ExecuteReader().Read() || cmd2.ExecuteReader().Read()) { return(true); } } catch { return(false); } finally { cnn.Close(); } return(false); }