private void btnNew_Click(object sender, EventArgs e) { try { try { Convert.ToDateTime(label1.Text); } catch (Exception) { XtraMessageBox.Show("Bạn phải click chọn ngày trước khi thêm mới"); return; } DataTable df = TextUtils.Select("SELECT NgayNghi FROM NgayNghi WITH (NOLOCK) WHERE NgayNghi = '" + (monthCalendar1.SelectionEnd).ToString("yyyy/MM/dd") + " 23:59:59.000'"); if (df == null || df.Rows.Count > 0) { XtraMessageBox.Show("Ngày này đã có trong cơ sở dữ liệu"); return; } NgayNghiModel model = new NgayNghiModel(); model.NgayNghi = monthCalendar1.SelectionEnd; NgayNghiBO.Instance.Insert(model); SelectAll(); } catch (Exception) { throw; } }
protected NgayNghiFacade(NgayNghiModel model) : base(model) { }