private void LoadActiveTurns() { try { HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory(); DataTable TrafficDataTable = new DataTable(); TrafficFactory.SelectActiveTurns(FromDatefaDatePicker.Text, FromTimeTextBox.Text, ToDatefaDatePicker.Text, ToTimeTextBox.Text, TrafficDataTable); this.TrafficGridView.DataSource = TrafficDataTable; } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void ShowButton_Click(object sender, EventArgs e) { try { if (FromDatefaDatePicker.IsNull) { throw new ApplicationException("از تاریخ خالی است"); } else if (ToDatefaDatePicker.IsNull) { throw new ApplicationException("تا تاریخ خالی است"); } else if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(FromTimeTextBox))) { throw new ApplicationException("از ساعت خالی است"); } else if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(ToTimeTextBox))) { throw new ApplicationException("تا ساعت خالی است"); } Hepsa.Core.Validation.TimeRule <string> FromTimeValidator = new Hepsa.Core.Validation.TimeRule <string>("FromTime", "از ساعت", null, null); if (FromTimeValidator.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(FromTimeTextBox)) == false) { throw new ApplicationException(FromTimeValidator.Description); } Hepsa.Core.Validation.TimeRule <string> ToTimeValidator = new Hepsa.Core.Validation.TimeRule <string>("ToTime", "تا ساعت", null, null); if (ToTimeValidator.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(ToTimeTextBox)) == false) { throw new ApplicationException(ToTimeValidator.Description); } HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory(); DataTable TrafficDataTable = new DataTable(); TrafficFactory.SelectActiveTurns(FromDatefaDatePicker.Text, FromTimeTextBox.Text, ToDatefaDatePicker.Text, ToTimeTextBox.Text, TrafficDataTable); this.TrafficGridView.DataSource = TrafficDataTable; } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }