private void loadThongTinHocTap() { if (ControlUtil.IsEditValueNull(cmbLop) || ControlUtil.IsEditValueNull(cmbNam) || ControlUtil.IsEditValueNull(cmbThang)) { return; } int lopId = (int)cmbLop.EditValue; int nam = (int)cmbNam.EditValue; int thang = IntUtil.StringToInt((string)cmbThang.EditValue).Value; DateTime ngay = new DateTime(nam, thang, DateTime.DaysInMonth(nam, thang)); this.viewHocTapRowBindingSource.DataSource = this.viewHocTapTableAdapter.GetDataByLopAndNgay(lopId, ngay); this.DataTable = this.viewHocTapRowBindingSource.DataSource as DataTable; foreach (QLMamNon.Dao.QLMamNonDs.ViewHocTapRow row in (this.DataTable as QLMamNon.Dao.QLMamNonDs.ViewHocTapDataTable)) { if (row.IsNgayTinhNull()) { row.NgayTinh = new MySql.Data.Types.MySqlDateTime(nam, thang, DateTime.DaysInMonth(nam, thang), 0, 0, 0, 0); } if (row.IsSoNgayNghiThangNull()) { row.SoNgayNghiThang = 0; } } }
private DateTime GetNgayTinh() { if (!ControlUtil.IsEditValueNull(this.cmbNam) && !ControlUtil.IsEditValueNull(this.cmbThang)) { Int32 nam = (Int32)cmbNam.EditValue; int thang = IntUtil.StringToInt((string)cmbThang.EditValue).Value; int ngay = DateTime.DaysInMonth(nam, thang); DateTime ngayTinh = new DateTime(nam, thang, ngay); return(ngayTinh); } return(DateTime.MinValue); }
private void btnTimKiem_Click(object sender, EventArgs e) { this.loadThongTinHocSinh((int?)cmbQuanHuyen.EditValue, (int?)cmbPhuongXa.EditValue, (int?)cmbLop.EditValue, IntUtil.StringToInt((string)cmbThang.Text), IntUtil.StringToInt((string)cmbNamSinh.Text), (DateTime?)cmbNgaySinh.EditValue, (int?)cmbThoiHoc.EditValue); }