protected override void Delete() { HPS.BLL.DriverBLL.BLLDriver_TFactory DriverFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory(); try { if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true) { DriverFactory.BeginProc(); DriverFactory.Delete((HPS.BLL.DriverBLL.BLLDriver_TKeys)Key); DriverFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.DriverID_bint.ToString() + "='" + ((HPS.BLL.DriverBLL.BLLDriver_TKeys)Key).DriverID_bint.ToString() + "'"); if (dr.Length > 0) { dr[0].Delete(); } DataTable.AcceptChanges(); } this.Close(); } } catch (Exception ex) { DriverFactory.RollBackProc(); throw ex; } }
protected override void Edit() { HPS.BLL.DriverBLL.BLLDriver_TFactory DriverFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory(); try { HPS.BLL.DriverBLL.BLLDriver_T DriverEntity = new HPS.BLL.DriverBLL.BLLDriver_T(); DriverEntity.DriverCardDate_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(DriverCardDate_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.DriverCardNumber_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(DriverCardNumber_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.DriverType_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(DriverType_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.FirstName_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(FirstName_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.LastName_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(LastName_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.InsuranceNumber_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(InsuranceNumber_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.CityID_int = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(CityID_intComboBox.SelectedValue, TypeCode.Int32); DriverEntity.CityCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(CityCode_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.licenceNumber_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(licenceNumber_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.LicenceCityID_int = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(LicenceCityID_intComboBox.SelectedValue, TypeCode.Int32); DriverEntity.LicenceType_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(LicenceType_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.LiceniceDate_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(LiceniceDate_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.ActivityScope_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(ActivityScope_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.NationalCode_int = (Nullable <Int64>)Hepsa.Core.Common.PersentationController.GetEntityValue(NationalCode_intNumericTextBox.NumericText, TypeCode.Int64); DriverEntity.Active_bit = Active_bitCheckBox.Checked; DriverEntity.InfractionGroupID_int = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionGroupID_intComboBox.SelectedValue, TypeCode.Int32); DriverEntity.DocNumber_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(DocNumber_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.InsertDate_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(InsertDate_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.UpdateDate_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(UpdateDate_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.Deleted_bit = Deleted_bitCheckBox.Checked; DriverEntity.Mobile_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Mobile_nvctextBox.Text, TypeCode.String).ToString(); DriverEntity.Active_bit = Active_bit.Checked; if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true) { DriverFactory.BeginProc(); DriverFactory.Update(DriverEntity, (HPS.BLL.DriverBLL.BLLDriver_TKeys)Key); DriverFactory.CommitProc(); if (DataTable != null) { DataRow[] dr = DataTable.Select(HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.DriverID_bint.ToString() + "='" + ((HPS.BLL.DriverBLL.BLLDriver_TKeys)Key).DriverID_bint.ToString() + "'"); if (dr.Length > 0) { dr[0][HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.DriverCardDate_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.DriverCardDate_nvc, TypeCode.String); dr[0][HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.DriverCardNumber_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.DriverCardNumber_nvc, TypeCode.String); dr[0][HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.DriverType_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.DriverType_nvc, TypeCode.String); dr[0][HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.FirstName_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.FirstName_nvc, TypeCode.String); dr[0][HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.LastName_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.LastName_nvc, TypeCode.String); dr[0][HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.InsuranceNumber_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.InsuranceNumber_nvc, TypeCode.String); dr[0]["CityID_intCity_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(CityID_intComboBox); dr[0][HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.CityCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.CityCode_nvc, TypeCode.String); dr[0][HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.licenceNumber_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.licenceNumber_nvc, TypeCode.String); dr[0]["LicenceCityID_intCity_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(LicenceCityID_intComboBox); dr[0][HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.LicenceType_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.LicenceType_nvc, TypeCode.String); dr[0][HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.LiceniceDate_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.LiceniceDate_nvc, TypeCode.String); dr[0][HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.ActivityScope_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.ActivityScope_nvc, TypeCode.String); dr[0][HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.NationalCode_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.NationalCode_int, TypeCode.Int64); dr[0][HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.Active_bit.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.Active_bit, TypeCode.Boolean); dr[0]["InfractionGroupID_intInfractionGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(InfractionGroupID_intComboBox); dr[0][HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.DocNumber_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.DocNumber_nvc, TypeCode.String); dr[0][HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.InsertDate_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.InsertDate_nvc, TypeCode.String); dr[0][HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.UpdateDate_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.UpdateDate_nvc, TypeCode.String); dr[0][HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.Deleted_bit.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.Deleted_bit, TypeCode.Boolean); } DataTable.AcceptChanges(); } } } catch (Exception ex) { DriverFactory.RollBackProc(); throw ex; } }
protected override void Insert() { HPS.BLL.DriverBLL.BLLDriver_TFactory DriverFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory(); if (online) { var driver = DriverFactory.GetAllBy(BLL.DriverBLL.BLLDriver_T.Driver_TField.DriverCardNumber_nvc, DriverCardNumber_nvcTextBox.Text); if (driver.Count > 0) { Edit(); return; } } try { HPS.BLL.DriverBLL.BLLDriver_T DriverEntity = new HPS.BLL.DriverBLL.BLLDriver_T(); DriverEntity.DriverCardDate_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(DriverCardDate_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.DriverCardNumber_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(DriverCardNumber_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.DriverType_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(DriverType_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.FirstName_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(FirstName_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.LastName_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(LastName_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.InsuranceNumber_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(InsuranceNumber_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.CityID_int = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(CityID_intComboBox.SelectedValue, TypeCode.Int32); DriverEntity.CityCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(CityCode_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.licenceNumber_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(licenceNumber_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.LicenceCityID_int = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(LicenceCityID_intComboBox.SelectedValue, TypeCode.Int32); DriverEntity.LicenceType_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(LicenceType_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.LiceniceDate_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(LiceniceDate_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.ActivityScope_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(ActivityScope_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.NationalCode_int = (Nullable <Int64>)Hepsa.Core.Common.PersentationController.GetEntityValue(NationalCode_intNumericTextBox.NumericText, TypeCode.Int64); DriverEntity.Active_bit = Active_bitCheckBox.Checked; DriverEntity.InfractionGroupID_int = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionGroupID_intComboBox.SelectedValue, TypeCode.Int32); DriverEntity.DocNumber_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(DocNumber_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.InsertDate_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(InsertDate_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.UpdateDate_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(UpdateDate_nvcTextBox.Text, TypeCode.String).ToString(); DriverEntity.Deleted_bit = Deleted_bitCheckBox.Checked; DriverEntity.Mobile_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Mobile_nvctextBox.Text, TypeCode.String).ToString(); DriverEntity.Active_bit = Active_bit.Checked; DriverFactory.BeginProc(); DriverFactory.Insert(DriverEntity); DriverFactory.CommitProc(); if (DataTable != null) { DataRow dr = this.DataTable.NewRow(); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.DriverID_bint.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.DriverID_bint, TypeCode.Int64); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.DriverCardDate_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.DriverCardDate_nvc, TypeCode.String); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.DriverCardNumber_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.DriverCardNumber_nvc, TypeCode.String); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.DriverType_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.DriverType_nvc, TypeCode.String); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.FirstName_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.FirstName_nvc, TypeCode.String); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.LastName_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.LastName_nvc, TypeCode.String); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.InsuranceNumber_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.InsuranceNumber_nvc, TypeCode.String); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.CityID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.CityID_int, TypeCode.Int32); dr["CityID_intCity_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(CityID_intComboBox); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.CityCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.CityCode_nvc, TypeCode.String); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.licenceNumber_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.licenceNumber_nvc, TypeCode.String); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.LicenceCityID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.LicenceCityID_int, TypeCode.Int32); dr["LicenceCityID_intCity_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(LicenceCityID_intComboBox); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.LicenceType_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.LicenceType_nvc, TypeCode.String); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.LiceniceDate_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.LiceniceDate_nvc, TypeCode.String); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.ActivityScope_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.ActivityScope_nvc, TypeCode.String); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.NationalCode_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.NationalCode_int, TypeCode.Int64); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.Active_bit.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.Active_bit, TypeCode.Boolean); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.InfractionGroupID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.InfractionGroupID_int, TypeCode.Int32); dr["InfractionGroupID_intInfractionGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(InfractionGroupID_intComboBox); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.DocNumber_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.DocNumber_nvc, TypeCode.String); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.InsertDate_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.InsertDate_nvc, TypeCode.String); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.UpdateDate_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.UpdateDate_nvc, TypeCode.String); dr[HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.Deleted_bit.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(DriverEntity.Deleted_bit, TypeCode.Boolean); DataTable.Rows.Add(dr); DataTable.AcceptChanges(); } this.ClearForm(this); } catch (Exception ex) { DriverFactory.RollBackProc(); throw ex; } }