private void btnTISSearchOK_Click(object sender, RoutedEventArgs e) { try { //Date Validation if ((dtpPromoStartDate.SelectedDate == null) || (dtpPromoEndDate.SelectedDate == null)) { MessageBox.ShowBox("MessageID551", BMC_Icon.Warning);//Please Enter the Valid Expiry Date return; } DateTime dtpPromoStartDateVal = DateTime.Now; DateTime dtpPromoEndDateVal = DateTime.Now; DateTime.TryParse(dtpPromoStartDate.SelectedDate.ToString(), out dtpPromoStartDateVal); DateTime.TryParse(dtpPromoEndDate.SelectedDate.ToString(), out dtpPromoEndDateVal); if (dtpPromoStartDateVal == DateTime.Today) { if (tmpPromoStartTime.SelectedTime > DateTime.Now.TimeOfDay) { MessageBox.ShowBox("MessageID885", BMC_Icon.Warning); return; } } if (dtpPromoEndDateVal == DateTime.Today) { if (tmpPromoEndTime.SelectedTime > DateTime.Now.TimeOfDay) { MessageBox.ShowBox("MessageID886", BMC_Icon.Warning); return; } } if (dtpPromoStartDateVal == DateTime.Today && dtpPromoEndDateVal == DateTime.Today) { if (tmpPromoStartTime.SelectedTime > tmpPromoEndTime.SelectedTime) { MessageBox.ShowBox("MessageID884", BMC_Icon.Warning); return; } } if (dtpPromoStartDateVal == dtpPromoEndDateVal) { if (tmpPromoStartTime.SelectedTime > tmpPromoEndTime.SelectedTime) { MessageBox.ShowBox("MessageID887", BMC_Icon.Warning); return; } } if (dtpPromoStartDateVal > DateTime.Now) { MessageBox.ShowBox("MessageID880", BMC_Icon.Warning); return; } if (dtpPromoEndDateVal > DateTime.Now) { MessageBox.ShowBox("MessageID881", BMC_Icon.Warning); return; } if (dtpPromoStartDateVal > dtpPromoEndDateVal) { MessageBox.ShowBox("MessageID551", BMC_Icon.Warning); return; } DateTime ds = dtpPromoStartDate.SelectedDate.Value; DateTime dtSCombined = new DateTime(ds.Year, ds.Month, ds.Day, tmpPromoStartTime.SelectedTime.Hours, tmpPromoStartTime.SelectedTime.Minutes, tmpPromoStartTime.SelectedTime.Seconds); DateTime de = dtpPromoEndDate.SelectedDate.Value; DateTime dtECombined = new DateTime(de.Year, de.Month, de.Day, tmpPromoEndTime.SelectedTime.Hours, tmpPromoEndTime.SelectedTime.Minutes, tmpPromoEndTime.SelectedTime.Seconds); // TIS Promotional Details screen TISPromoDetails objTISPromoDetails = new TISPromoDetails(dtSCombined, dtECombined); if (objTISPromoDetails.IsTISDataFound) { objTISPromoDetails.ShowDialogEx(this); } } catch (Exception ex) { ExceptionManager.Publish(ex); } }
private void btnTISSearchOK_Click(object sender, RoutedEventArgs e) { try { //Date Validation if((dtpPromoStartDate.SelectedDate==null)||(dtpPromoEndDate.SelectedDate==null)) { MessageBox.ShowBox("MessageID551", BMC_Icon.Warning);//Please Enter the Valid Expiry Date return; } DateTime dtpPromoStartDateVal = DateTime.Now; DateTime dtpPromoEndDateVal = DateTime.Now; DateTime.TryParse(dtpPromoStartDate.SelectedDate.ToString(),out dtpPromoStartDateVal); DateTime.TryParse(dtpPromoEndDate.SelectedDate.ToString(), out dtpPromoEndDateVal); if (dtpPromoStartDateVal == DateTime.Today) { if (tmpPromoStartTime.SelectedTime > DateTime.Now.TimeOfDay) { MessageBox.ShowBox("MessageID885", BMC_Icon.Warning); return; } } if (dtpPromoEndDateVal == DateTime.Today) { if (tmpPromoEndTime.SelectedTime > DateTime.Now.TimeOfDay) { MessageBox.ShowBox("MessageID886", BMC_Icon.Warning); return; } } if (dtpPromoStartDateVal == DateTime.Today && dtpPromoEndDateVal == DateTime.Today) { if (tmpPromoStartTime.SelectedTime > tmpPromoEndTime.SelectedTime) { MessageBox.ShowBox("MessageID884", BMC_Icon.Warning); return; } } if (dtpPromoStartDateVal == dtpPromoEndDateVal) { if (tmpPromoStartTime.SelectedTime > tmpPromoEndTime.SelectedTime) { MessageBox.ShowBox("MessageID887", BMC_Icon.Warning); return; } } if (dtpPromoStartDateVal > DateTime.Now) { MessageBox.ShowBox("MessageID880", BMC_Icon.Warning); return; } if (dtpPromoEndDateVal > DateTime.Now) { MessageBox.ShowBox("MessageID881", BMC_Icon.Warning); return; } if (dtpPromoStartDateVal > dtpPromoEndDateVal) { MessageBox.ShowBox("MessageID551", BMC_Icon.Warning); return; } DateTime ds = dtpPromoStartDate.SelectedDate.Value; DateTime dtSCombined = new DateTime(ds.Year, ds.Month, ds.Day, tmpPromoStartTime.SelectedTime.Hours, tmpPromoStartTime.SelectedTime.Minutes, tmpPromoStartTime.SelectedTime.Seconds); DateTime de = dtpPromoEndDate.SelectedDate.Value; DateTime dtECombined = new DateTime(de.Year, de.Month, de.Day, tmpPromoEndTime.SelectedTime.Hours, tmpPromoEndTime.SelectedTime.Minutes, tmpPromoEndTime.SelectedTime.Seconds); // TIS Promotional Details screen TISPromoDetails objTISPromoDetails = new TISPromoDetails(dtSCombined, dtECombined); if (objTISPromoDetails.IsTISDataFound) { objTISPromoDetails.ShowDialogEx(this); } } catch (Exception ex) { ExceptionManager.Publish(ex); } }