public string TinhToan(string tenMon, string maMon, string HoVaTen, string MSSV, string Khoa, string ChuyenNganh, string Lop, string giatri) { string sqlString = "select SinhVien.MSSV, SinhVien.HoVaTen, Khoa.TenKhoa, ChuyenNganh.TenChuyenNganh, Lop.TenLop, " + "BangDiem.MaMon, BangDiem.TenMon, BangDiem.SoTinChi, BangDiem.DiemTB, BangDiem.TrangThai " + "from SinhVien inner join Lop on SinhVien.MaLop = Lop.MaLop " + "inner join ChuyenNganh on ChuyenNganh.MaChuyenNganh = Lop.MaChuyenNganh " + "inner join Khoa on Khoa.MaKhoa = ChuyenNganh.MaKhoa " + "inner join (select SinhVien.MSSV, MonHoc.MaMon, MonHoc.SoTinChi, MonHoc.TenMon, Khoa.TenKhoa, Diem.DiemTB, Diem.TrangThai " + "from MonHoc inner join Khoa on MonHoc.MaKhoa = Khoa.MaKhoa " + "inner join Diem on Diem.MaMon = MonHoc.MaMon " + "inner join SinhVien on SinhVien.MSSV = Diem.MSSV) as BangDiem " + "on bangdiem.MSSV = SinhVien.MSSV " + "Where SinhVien.MSSV Like '%" + MSSV + "%' And SinhVien.HoVaTen Like N'%" + HoVaTen + "%' And BangDiem.MaMon Like '%" + maMon + "%' And BangDiem.TenMon Like N'%" + tenMon + "%' And Khoa.TenKhoa Like N'%" + Khoa + "%' And ChuyenNganh.TenChuyenNganh Like N'%" + ChuyenNganh + "%' And Lop.TenLop Like N'%" + Lop + "%'"; string soMon = "select count(BangPhu.MaMon) as 'Mã Môn' from (" + sqlString + ") as BangPhu"; string soTinChi = "select Sum(BangPhu.SoTinChi) As 'Số Tín Chỉ' from (" + sqlString + ") as BangPhu"; string diemTB = "select Round(AVG(BangPhu.DiemTB), 2) as 'Điểm TB' from (" + sqlString + ") as BangPhu"; if (giatri == "SoLuongMon") { return(dbMain.ExecuteScalar(soMon, CommandType.Text)); } else if (giatri == "SoTinChi") { return(dbMain.ExecuteScalar(soTinChi, CommandType.Text)); } else { return(dbMain.ExecuteScalar(diemTB, CommandType.Text)); } }
public string Login(string Username, string Password) { string sqlstring = "select count (*) as cnt from sys.server_principals where name = '" + Username + "'"; string Result = dBMain.ExecuteScalar(sqlstring, CommandType.Text).ToString(); if (Result == "1") { string sqlString = "SELECT [dbo].[Login]('" + Username + "','" + Password + "')"; return(dBMain.ExecuteScalar(sqlString, CommandType.Text)); } return(""); }
private string checkLoginManager(string username, string password) { string Username = txtUsername.Text; string Password = txtPassword.Text; string sqlString = string.Format("select dbo.checkLoginEmployee('{0}','{1}')", username, password); return(dbMain.ExecuteScalar(sqlString, CommandType.Text)); }
public string get_ID_User(string Username) { string sqlString = "SELECT idUser FROM Account JOIN Customer ON Account.idAccount = " + "Customer.idUser WHERE Username = '******'"; return(dBMain.ExecuteScalar(sqlString, CommandType.Text)); }
public string Send_Mail_To(string Username) { string sqlString = "SELECT [dbo].[take_Gmail]('" + Username + "')"; return(dBMain.ExecuteScalar(sqlString, CommandType.Text)); }
public string Check_Username(string Username) { string sqlString = "SELECT dbo.Check_Username('" + Username + "')"; return(dBMain.ExecuteScalar(sqlString, CommandType.Text)); }
public string Scan_Ticket(string ID) { string sqlString = "SELECT [dbo].[Scan_Ticket]('" + ID + "')"; return(dBMain.ExecuteScalar(sqlString, CommandType.Text)); }
public string isExisted(string id) { string sqlString = "select dbo.Check_Cinema(" + id + ")"; return(dBMain.ExecuteScalar(sqlString, CommandType.Text)); }