private void CarControlButton_Click(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(_CarCardNumber)) { //HPS.Present.DriverSpecification.DriverSpecificationEntityForm frm = new HPS.Present.DriverSpecification.DriverSpecificationEntityForm(CarCardNumber_nvcTextBox.Text,false); //frm.ShowDialog(); List <string> DateEroorList = new List <string>(); Hepsa.Core.Validation.TodayDateRule InsuranceEndDate_nvcRule = new Hepsa.Core.Validation.TodayDateRule("InsuranceEndDate_nvc", "تاريخ اتمام بيمه"); if (InsuranceEndDate_nvcRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(InsuranceEndDate_nvcTextBox)) == false) { DateEroorList.Add(InsuranceEndDate_nvcRule.Description + "\n"); } Hepsa.Core.Validation.TodayDateRule CarExaminationEndTodayDateRule = new Hepsa.Core.Validation.TodayDateRule("CarExaminationEndDate_nvc", "تاريخ اتمام معاينه"); if (CarExaminationEndTodayDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(CarExaminationEndDate_nvcTextBox)) == false) { DateEroorList.Add(CarExaminationEndTodayDateRule.Description + "\n"); } ////////////add not null rule Hepsa.Core.Validation.NotNullRule InsuranceEndDateNotNullRule = new Hepsa.Core.Validation.NotNullRule("InsuranceEndDate_nvc", "تاريخ اتمام بيمه"); if (InsuranceEndDateNotNullRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(InsuranceEndDate_nvcTextBox)) == false) { DateEroorList.Add(InsuranceEndDateNotNullRule.Description + "\n"); } Hepsa.Core.Validation.NotNullRule CarExaminationEndDateNotNullRule = new Hepsa.Core.Validation.NotNullRule("CarExaminationEndDate_nvc", "تاريخ اتمام معاينه"); if (CarExaminationEndDateNotNullRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(CarExaminationEndDate_nvcTextBox)) == false) { DateEroorList.Add(CarExaminationEndDateNotNullRule.Description + "\n"); } ////////////add date rule Hepsa.Core.Validation.DateRule <string> InsuranceEndDateaDateRule = new Hepsa.Core.Validation.DateRule <string>("InsuranceEndDate_nvc", "تاريخ اتمام بيمه", null, null); if (InsuranceEndDateaDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(InsuranceEndDate_nvcTextBox)) == false) { DateEroorList.Add(InsuranceEndDateaDateRule.Description + "\n"); } Hepsa.Core.Validation.DateRule <string> CarExaminationEndDateRule = new Hepsa.Core.Validation.DateRule <string>("CarExaminationEndDate_nvc", "تاريخ اتمام معاينه", null, null); if (CarExaminationEndDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(CarExaminationEndDate_nvcTextBox)) == false) { DateEroorList.Add(CarExaminationEndDateRule.Description + "\n"); } if (DateEroorList != null && DateEroorList.Count > 0) { throw new ApplicationException(DateEroorList.Aggregate((i, j) => i + j)); } HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_TFactory DriverSpecificationFactory = new HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_TFactory(); try { HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_T DriverSpecificationEntity = new HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_T(); DriverSpecificationEntity.CarExamination_bit = false; DriverSpecificationEntity.Insurance_bit = false; DriverSpecificationEntity.HealthCard_bit = false; DriverSpecificationEntity.DriverCardSharje_bit = false; DriverSpecificationEntity.StatisticCard_bit = false; DriverSpecificationEntity.CarCardNumber_nvc = _CarCardNumber; DriverSpecificationEntity.CarExaminationEndDate_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(CarExaminationEndDate_nvcTextBox.Text, TypeCode.String).ToString(); DriverSpecificationEntity.InsuranceEndDate_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(InsuranceEndDate_nvcTextBox.Text, TypeCode.String).ToString(); HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_TKeys driverSpecificationkey = new BLL.DriverSpecificationBLL.BLLDriverSpecification_TKeys(); if (_DriverSpecificationID != 0) { driverSpecificationkey.DriverSpecificationID_int = _DriverSpecificationID; DriverSpecificationFactory.BeginProc(); DriverSpecificationFactory.Update(DriverSpecificationEntity, driverSpecificationkey); DriverSpecificationFactory.CommitProc(); Hepsa.Core.Common.MessageBox.InformationMessage("اطلاعات ثبت شد"); } else { DriverSpecificationFactory.BeginProc(); DriverSpecificationFactory.Insert(DriverSpecificationEntity); DriverSpecificationFactory.CommitProc(); Hepsa.Core.Common.MessageBox.InformationMessage("اطلاعات ثبت شد"); } } catch (Exception ex) { DriverSpecificationFactory.RollBackProc(); Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } //DriverInformationSave(); } else { throw new ApplicationException("اطلاعات ناوگان خالی است"); } } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }
private void DriverControlbutton_Click(object sender, EventArgs e) { try { List <string> DateEroorList = new List <string>(); Hepsa.Core.Validation.TodayDateRule lisenceEndDateRule = new Hepsa.Core.Validation.TodayDateRule("LicenceEnd_nvc", "تاريخ اتمام گواهینامه"); if (lisenceEndDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(LicenceEnd_nvcTextBox)) == false) { DateEroorList.Add(lisenceEndDateRule.Description + "\n"); } Hepsa.Core.Validation.TodayDateRule DriverCardSharjeStartTodayDateRule = new Hepsa.Core.Validation.TodayDateRule("DriverCardSharjeStartDate_nvc", "تاريخ اتمام شارژ كارت هوشمند"); if (DriverCardSharjeStartTodayDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(DriverCardSharjeEndDate_nvcTextBox)) == false) { DateEroorList.Add(DriverCardSharjeStartTodayDateRule.Description + "\n"); } Hepsa.Core.Validation.TodayDateRule HealthCardEndTodayDateRule = new Hepsa.Core.Validation.TodayDateRule("HealthCardEndDate_nvc", "تاريخ اتمام اعتبار کارت سلامت"); if (HealthCardEndTodayDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(HealthCardEndDate_nvcTextBox)) == false) { DateEroorList.Add(HealthCardEndTodayDateRule.Description + "\n"); } ////////////add not null rule Hepsa.Core.Validation.NotNullRule lisenceEndDateNotNullRule = new Hepsa.Core.Validation.NotNullRule("LicenceEnd_nvc", "تاريخ اتمام گواهینامه"); if (lisenceEndDateNotNullRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(LicenceEnd_nvcTextBox)) == false) { DateEroorList.Add(lisenceEndDateNotNullRule.Description + "\n"); } Hepsa.Core.Validation.NotNullRule DriverCardSharjeStartDateNotNullRule = new Hepsa.Core.Validation.NotNullRule("DriverCardSharjeStartDate_nvc", "تاريخ اتمام شارژ كارت هوشمند"); if (DriverCardSharjeStartDateNotNullRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(DriverCardSharjeEndDate_nvcTextBox)) == false) { DateEroorList.Add(DriverCardSharjeStartDateNotNullRule.Description + "\n"); } Hepsa.Core.Validation.NotNullRule HealthCardEndDateNotNullRule = new Hepsa.Core.Validation.NotNullRule("HealthCardEndDate_nvc", "تاريخ اتمام اعتبار کارت سلامت"); if (HealthCardEndDateNotNullRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(HealthCardEndDate_nvcTextBox)) == false) { DateEroorList.Add(HealthCardEndDateNotNullRule.Description + "\n"); } Hepsa.Core.Validation.NotNullRule licenceNumberNotNullRule = new Hepsa.Core.Validation.NotNullRule("licenceNumber_int", "شماره گواهینامه"); if (licenceNumberNotNullRule.Validate(licenceNumber_nvcTextBox.NumericText) == false) { DateEroorList.Add(licenceNumberNotNullRule.Description + "\n"); } ////////////add date rule Hepsa.Core.Validation.DateRule <string> LicenceEndDateRule = new Hepsa.Core.Validation.DateRule <string>("LicenceEnd_nvc", "تاريخ اتمام گواهینامه", null, null); if (LicenceEndDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(LicenceEnd_nvcTextBox)) == false) { DateEroorList.Add(LicenceEndDateRule.Description + "\n"); } Hepsa.Core.Validation.DateRule <string> DriverCardSharjeStartDateRule = new Hepsa.Core.Validation.DateRule <string>("DriverCardSharjeStartDate_nvc", "تاريخ اتمام شارژ كارت هوشمند", null, null); if (DriverCardSharjeStartDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(DriverCardSharjeEndDate_nvcTextBox)) == false) { DateEroorList.Add(DriverCardSharjeStartDateRule.Description + "\n"); } Hepsa.Core.Validation.DateRule <string> HealthCardEndDateRule = new Hepsa.Core.Validation.DateRule <string>("HealthCardEndDate_nvc", "تاريخ اتمام اعتبار کارت سلامت", null, null); if (HealthCardEndDateRule.Validate(Hepsa.Core.Common.PersentationController.GetMaskedTextBoxValue(HealthCardEndDate_nvcTextBox)) == false) { DateEroorList.Add(HealthCardEndDateRule.Description + "\n"); } if (DateEroorList != null && DateEroorList.Count > 0) { throw new ApplicationException(DateEroorList.Aggregate((i, j) => i + j)); } DriverInformationSave(); } catch (Exception ex) { Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message); } }