public List <SV_LH> GetSV_LH(string sql) { try { SqlDataReader dr = dp.ExecReader(sql); List <SV_LH> list = new List <SV_LH>(); int masv; string malh; double diemgk, diemck; while (dr.Read()) { masv = dr.GetInt32(0); malh = dr.GetString(1); diemgk = dr.GetDouble(2); diemck = dr.GetDouble(3); SV_LH slh = new SV_LH(masv, malh, diemgk, diemck); list.Add(slh); } return(list); } catch (Exception ex) { throw ex; } finally { dp.disCon(); } }
public SV_LH get1diemhocki(string sql) { try { SqlDataReader dr = dp.ExecReader(sql); int masv; string malh; double diemgk, diemck; SV_LH svlh; dr.Read(); { masv = dr.GetInt32(0); malh = dr.GetString(1); diemgk = dr.GetDouble(2); diemck = dr.GetDouble(3); svlh = new SV_LH(masv, malh, diemgk, diemck); return(svlh); } } catch (SqlException ex) { throw ex; } finally { dp.disCon(); } }
private void button7_Click(object sender, EventArgs e) { int masv; string malh; double diemgk, diemck; masv = int.Parse(txtmsv1.Text.Trim()); malh = txtmalh1.Text.Trim(); diemgk = double.Parse(txtdiemgk.Text.Trim()); diemck = double.Parse(txtdiemck.Text.Trim()); SV_LH slh = new SV_LH(masv, malh, diemgk, diemck); try { int i = new SV_LHBus().SuaSV_LH(slh); if (i == -2) { throw new Exception(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } dgvSV_LH.DataSource = GetSV_LH(); }
public int SuaSV_LH(SV_LH SV_LH) { try { return(new SV_LHDAO().SuaSV_LH(SV_LH)); } catch (Exception ex) { throw ex; } }
public int SuaSV_LH(SV_LH SLH) { List <SqlParameter> list = new List <SqlParameter>(); list.Add(new SqlParameter("@masv", SLH.MaSV)); list.Add(new SqlParameter("@malop", SLH.MaLop)); list.Add(new SqlParameter("@diemgk", SLH.DiemGK)); list.Add(new SqlParameter("@diemck", SLH.DiemCK)); try { return(dp.ExcuteNonquery("SuaSV_LH", System.Data.CommandType.StoredProcedure, list)); } catch (SqlException ex) { throw ex; } }
public int ThemSV_LH(SV_LH SV_LH) { return(new DichVuSVDAO().ThemSV_LH(SV_LH)); }