//thêm 1 điểm theo dỏi lên lớp public static void insertDTD(DOLenLop lenlop) { String sqlString = @"insert into DIEM_THEO_DOI_LEN_LOP(DTD_ID,NGAY_LEN_LOP,THOI_GIAN_BAT_DAU,THOI_GIAN_KET_THUC,NHAN_SU,NGUOI_GIAO,NGAY_GIAO,GHI_CHU,THONG_BAO,BTD_ID,LCV_ID,NGUOI_CAP_NHAT,NGAY_CAP_NHAT) values(@DTD_ID,@NGAY_LEN_LOP,@THOI_GIAN_BAT_DAU,@THOI_GIAN_KET_THUC,@NHAN_SU,@NGUOI_GIAO,@NGAY_GIAO,@GHI_CHU,@THONG_BAO,@BTD_ID,@LCV_ID,@NGUOI_CAP_NHAT,@NGAY_CAP_NHAT)"; DatabaseFB db = DABase.getDatabase(); DbCommand cmd = db.GetSQLStringCommand(sqlString); db.AddInParameter(cmd, "@DTD_ID", DbType.Int64, lenlop.DTD_ID); db.AddInParameter(cmd, "@NGAY_LEN_LOP", DbType.DateTime, lenlop.NGAY_LEN_LOP); db.AddInParameter(cmd, "@THOI_GIAN_BAT_DAU", DbType.Time, lenlop.THOI_GIAN_BAT_DAU); db.AddInParameter(cmd, "@THOI_GIAN_KET_THUC", DbType.Time, lenlop.THOI_GIAN_KET_THUC); db.AddInParameter(cmd, "@NHAN_SU", DbType.Int64, lenlop.NHAN_SU); db.AddInParameter(cmd, "@NGUOI_GIAO", DbType.Int64, lenlop.NGUOI_GIAO); db.AddInParameter(cmd, "@NGAY_GIAO", DbType.Date, lenlop.NGAY_GIAO); db.AddInParameter(cmd, "@GHI_CHU", DbType.String, lenlop.GHI_CHU); db.AddInParameter(cmd, "@THONG_BAO", DbType.String, lenlop.THONG_BAO); db.AddInParameter(cmd, "@BTD_ID", DbType.Int64, lenlop.BTD_ID); db.AddInParameter(cmd, "@LCV_ID", DbType.Int64, lenlop.LCV_ID); db.AddInParameter(cmd, "@NGUOI_CAP_NHAT", DbType.Int64, lenlop.NGUOI_CAP_NHAT); db.AddInParameter(cmd, "@NGAY_CAP_NHAT", DbType.Date, lenlop.NGAY_CAP_NHAT); db.ExecuteNonQuery(cmd); }
// update 1 diểm theo doi lên lớp public static void updateDTDLL(DOLenLop lenlop) { String sqlString = @"update DIEM_THEO_DOI_LEN_LOP set NGAY_LEN_LOP = @NGAY_LEN_LOP,THOI_GIAN_BAT_DAU = @THOI_GIAN_BAT_DAU,THOI_GIAN_KET_THUC = @THOI_GIAN_KET_THUC, NHAN_SU = @NHAN_SU,NGUOI_GIAO = @NGUOI_GIAO,NGAY_GIAO = @NGAY_GIAO,GHI_CHU = @GHI_CHU,THONG_BAO = @THONG_BAO,BTD_ID = @BTD_ID,LCV_ID = @LCV_ID,NGUOI_CAP_NHAT = @NGUOI_CAP_NHAT,NGAY_CAP_NHAT = @NGAY_CAP_NHAT WHERE DTD_ID = @DTD_ID"; DatabaseFB db = DABase.getDatabase(); DbCommand cmd = db.GetSQLStringCommand(sqlString); db.AddInParameter(cmd, "@NGAY_LEN_LOP", DbType.DateTime, lenlop.NGAY_LEN_LOP); db.AddInParameter(cmd, "@THOI_GIAN_BAT_DAU", DbType.Time, lenlop.THOI_GIAN_BAT_DAU); db.AddInParameter(cmd, "@THOI_GIAN_KET_THUC", DbType.Time, lenlop.THOI_GIAN_KET_THUC); db.AddInParameter(cmd, "@NHAN_SU", DbType.Int64, lenlop.NHAN_SU); db.AddInParameter(cmd, "@NGUOI_GIAO", DbType.Int64, lenlop.NGUOI_GIAO); db.AddInParameter(cmd, "@NGAY_GIAO", DbType.Date, lenlop.NGAY_GIAO); db.AddInParameter(cmd, "@GHI_CHU", DbType.String, lenlop.GHI_CHU); db.AddInParameter(cmd, "@THONG_BAO", DbType.String, lenlop.THONG_BAO); db.AddInParameter(cmd, "@BTD_ID", DbType.Int64, lenlop.BTD_ID); db.AddInParameter(cmd, "@LCV_ID", DbType.Int64, lenlop.LCV_ID); db.AddInParameter(cmd, "@NGUOI_CAP_NHAT", DbType.Int64, lenlop.NGUOI_CAP_NHAT); db.AddInParameter(cmd, "@NGAY_CAP_NHAT", DbType.Date, lenlop.NGAY_CAP_NHAT); db.AddInParameter(cmd, "@DTD_ID", DbType.Int64, lenlop.DTD_ID); db.ExecuteNonQuery(cmd); }
public void SaveLen_Lop(DataSet ds_DTDLL, GridControl gridControl1, long btd_id) { DOLenLop lenlop = new DOLenLop(); DataTable dt_temp = DALenLop.loadDTDLL(btd_id).Tables[0]; int i = 0; foreach (DataRow dr in (gridControl1.DataSource as DataTable).Rows) { if (dr.RowState == DataRowState.Modified) { lenlop = new DOLenLop(long.Parse(dr[0].ToString()), Convert.ToDateTime(dr[1]), Convert.ToDateTime(dr[2]), Convert.ToDateTime(dr[3]), long.Parse(dr[4].ToString()), long.Parse(dr[5].ToString()), Convert.ToDateTime(dr[6]), dr[7].ToString(), dr[8].ToString(), long.Parse(dr[9].ToString()), long.Parse(dr[10].ToString()), long.Parse(dr[11].ToString()), Convert.ToDateTime(dr[12])); DALenLop.updateDTDLL(lenlop); } if (dr.RowState == DataRowState.Added) { lenlop = new DOLenLop(long.Parse(HelpGen.ID("G_NGHIEP_VU").ToString()), Convert.ToDateTime(dr[1]), Convert.ToDateTime(dr[2]), Convert.ToDateTime(dr[3]), long.Parse(dr[4].ToString()), long.Parse(dr[5].ToString()), Convert.ToDateTime(dr[6]), dr[7].ToString(), dr[8].ToString(), long.Parse(dr[9].ToString()), long.Parse(dr[10].ToString()), long.Parse(dr[11].ToString()), Convert.ToDateTime(dr[12])); DALenLop.insertDTD(lenlop); } if (dr.RowState == DataRowState.Deleted) DALenLop.xoaDTDLL(long.Parse((dt_temp.Rows[i][0]).ToString())); i++; } ds_DTDLL = DALenLop.loadDTDLL(btd_id); }