예제 #1
0
        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;
            }
        }
예제 #2
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.DriverBLL.BLLDriver_TFactory DriverFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false)
                {
                    return;
                }


                HPS.BLL.DriverBLL.BLLDriver_TFactory Driver_TFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory();
                HPS.BLL.DriverBLL.BLLDriver_TKeys    DriverKey       = new HPS.BLL.DriverBLL.BLLDriver_TKeys();

                DriverKey.DriverID_bint = (Int64)DriverGridView.CurrentRow.Cells["colDriverID_bint"].Value;
                DriverFactory.Delete(DriverKey);

                DataRow[] dr = ((DataTable)this.DriverGridView.DataSource).Select(HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.DriverID_bint.ToString() + "='" + DriverKey.DriverID_bint.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.DriverGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
예제 #3
0
        public override bool Validate(params object[] value)
        {
            try
            {
                this.Description = string.Empty;
                if (value.Length != Field.Length)
                {
                    this.Description = Hepsa.Core.My.Resources.ValidationMessage.IncorrectDataType;
                    return(false);
                }
                string DriverCardNumber_nvc    = Convert.ToString(value[0]);
                string DriverFirstName_nvc     = Convert.ToString(value[1]);
                string DriverLastName_nvc      = Convert.ToString(value[2]);
                Int64? DriverNationalCode_bint = (Int64?)value[3];
                HPS.BLL.InfractionBLL.BLLInfraction_TFactory InfractionFactory = new HPS.BLL.InfractionBLL.BLLInfraction_TFactory();
                List <HPS.BLL.InfractionBLL.BLLInfraction_T> InfractionList    = new List <HPS.BLL.InfractionBLL.BLLInfraction_T>();



                if (!string.IsNullOrEmpty(DriverCardNumber_nvc))
                {
                    HPS.BLL.DriverBLL.BLLDriver_TFactory DriverFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory();
                    List <HPS.BLL.DriverBLL.BLLDriver_T> DriverList    = new List <HPS.BLL.DriverBLL.BLLDriver_T>();
                    DriverList = DriverFactory.GetAllBy(HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.DriverCardNumber_nvc, DriverCardNumber_nvc);
                    if (DriverList != null && DriverList.Count > 0)
                    {
                        InfractionList = InfractionFactory.GetAllBy(HPS.BLL.InfractionBLL.BLLInfraction_T.Infraction_TField.DriverID_bint, DriverList[0].DriverID_bint);
                        if (InfractionList != null && InfractionList.Count > 0)
                        {
                            this.Description = "جهت ادامه کار به مسئول کامپیوتر مراجعه کنید";
                            return(false);
                        }
                    }
                }
                else
                {
                    string infractionCondition = "Infraction_T.DriverFirstName_nvc='" + DriverFirstName_nvc + "' AND Infraction_T.DriverLastName_nvc='" + DriverLastName_nvc + "' AND Infraction_T.DriverNationalCode_bint='" + DriverNationalCode_bint + "'";

                    InfractionList = InfractionFactory.GetAllByCondition(infractionCondition);
                    if (InfractionList != null && InfractionList.Count > 0)
                    {
                        this.Description = "جهت ادامه کار به مسئول کامپیوتر مراجعه کنید";
                        return(false);
                    }
                }
                return(true);
            }
            catch (System.Exception ex)
            {
                this.Description = ex.Message;
                return(false);
            }
        }
예제 #4
0
 private void DeleteTransferData(string FilePath, string TableName)
 {
     HPS.BLL.DriverBLL.BLLDriver_TFactory DriverFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory();
     try
     {
         DriverFactory.DeleteTransferData(FilePath, TableName);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #5
0
        private void LoadWithoutDriverCardNumber()
        {
            HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_TFactory DriverSpecificationFactory = new HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_TFactory();
            DataTable DriverFieldTable = new DataTable();

            DriverSpecificationFactory.SelectByDriverField(_FirstName, _LastName, _NationalCode, ref DriverFieldTable);
            if (DriverFieldTable != null && DriverFieldTable.Rows.Count > 0)
            {
                _DriverSpecificationID = (Int32)DriverFieldTable.Rows[0]["DriverSpecificationID_int"];
                Key = new HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_TKeys();
                Key.DriverSpecificationID_int       = _DriverSpecificationID;
                DriverCardNumber_nvcTextBox.Text    = DriverFieldTable.Rows[0]["DriverCardNumber_nvc"].ToString();
                FirstName_nvcTextBox.Text           = DriverFieldTable.Rows[0]["FirstName_nvc"].ToString();
                LastName_nvcTextBox.Text            = DriverFieldTable.Rows[0]["LastName_nvc"].ToString();
                NationalCode_intNumericTextBox.Text = DriverFieldTable.Rows[0]["NationalCode_int"].ToString();
                licenceNumber_nvcTextBox.Text       = DriverFieldTable.Rows[0]["licenceNumber_nvc"].ToString();

                LicenceEnd_nvcTextBox.Text            = DriverFieldTable.Rows[0]["LicenceEnd_nvc"].ToString();
                CarExaminationEndDate_nvcTextBox.Text = DriverFieldTable.Rows[0]["CarExaminationEndDate_nvc"].ToString();

                InsuranceEndDate_nvcTextBox.Text        = DriverFieldTable.Rows[0]["InsuranceEndDate_nvc"].ToString();
                ClassID_intComboBox.SelectedValue       = DriverFieldTable.Rows[0]["ClassID_int"];
                HealthCardEndDate_nvcTextBox.Text       = DriverFieldTable.Rows[0]["HealthCardEndDate_nvc"].ToString();
                DriverCardSharjeEndDate_nvcTextBox.Text = DriverFieldTable.Rows[0]["DriverCardSharjeEndDate_nvc"].ToString();
            }
            else
            {
                HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
                string Condition = "Traffic_T.FirstName_nvc=N'" + _FirstName + "' AND Traffic_T.LastName_nvc=N'" + _LastName + "' AND Traffic_T.NationalCode_int='" + _NationalCode + "'";
                List <HPS.BLL.TrafficBLL.BLLTraffic_T> TrafficList = TrafficFactory.GetAllByCondition(Condition);
                if (TrafficList != null && TrafficList.Count > 0)
                {
                    DriverCardNumber_nvcTextBox.Text    = TrafficList[TrafficList.Count - 1].DriverCardNumber_nvc;
                    FirstName_nvcTextBox.Text           = TrafficList[TrafficList.Count - 1].FirstName_nvc;
                    LastName_nvcTextBox.Text            = TrafficList[TrafficList.Count - 1].LastName_nvc;
                    NationalCode_intNumericTextBox.Text = Convert.ToString(TrafficList[TrafficList.Count - 1].NationalCode_int);
                    licenceNumber_nvcTextBox.Text       = Convert.ToString(TrafficList[TrafficList.Count - 1].licenceNumber_int);
                }
                else
                {
                    HPS.BLL.DriverBLL.BLLDriver_TFactory DriverFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory();
                    List <HPS.BLL.DriverBLL.BLLDriver_T> DriverList    = DriverFactory.GetAllBy(HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.DriverCardNumber_nvc, _DriverCardNumber);
                    if (DriverList != null && DriverList.Count > 0)
                    {
                        DriverCardNumber_nvcTextBox.Text    = DriverList[0].DriverCardNumber_nvc;
                        FirstName_nvcTextBox.Text           = DriverList[0].FirstName_nvc;
                        LastName_nvcTextBox.Text            = DriverList[0].LastName_nvc;
                        NationalCode_intNumericTextBox.Text = Convert.ToString(DriverList[0].NationalCode_int);
                        licenceNumber_nvcTextBox.Text       = Convert.ToString(DriverList[0].licenceNumber_nvc);
                    }
                }
            }
        }
예제 #6
0
 private void LoadAllDrivers()
 {
     try
     {
         HPS.BLL.DriverBLL.BLLDriver_TFactory DriverFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory();
         DataTable DriverDataTable = new DataTable();
         DriverFactory.GetAll(ref DriverDataTable);
         this.DriverGridView.DataSource = DriverDataTable;
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
예제 #7
0
 private void LoadDiverTraffic()
 {
     try
     {
         HPS.BLL.DriverBLL.BLLDriver_TFactory DriverFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory();
         DataTable DriverDataTable = new DataTable();
         DriverFactory.GetByCardNumber(_DriverCardNumber, ref DriverDataTable);
         this.DriverGridView.DataSource = DriverDataTable;
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
예제 #8
0
 private void Search()
 {
     try
     {
         HPS.BLL.DriverBLL.BLLDriver_TFactory DriverFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory();
         DataTable DriverDataTable = new DataTable();
         DriverFactory.GetAllByConditionSearch(DriverCardNumber_bintNumericTextBox.NumericText, DocNumber_nvcTextBox.Text, Convert.ToInt64(NationalCode_intNumericTextBox.NumericText), LastName_nvcTextBox.Text, ref DriverDataTable);
         this.DriverGridView.DataSource = DriverDataTable;
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
예제 #9
0
        private void LoadWithDriverCardNumber()
        {
            HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_TFactory DriverSpecificationFactory = new HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_TFactory();
            List <HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_T> DriverSpecificationList    = DriverSpecificationFactory.GetAllBy(HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_T.DriverSpecification_TField.NationalCode_int, _NationalCode);

            if (DriverSpecificationList != null && DriverSpecificationList.Count > 0)
            {
                _DriverSpecificationID = DriverSpecificationList[0].DriverSpecificationID_int;
                Key = new HPS.BLL.DriverSpecificationBLL.BLLDriverSpecification_TKeys();
                Key.DriverSpecificationID_int           = _DriverSpecificationID;
                DriverCardNumber_nvcTextBox.Text        = DriverSpecificationList[0].DriverCardNumber_nvc;
                FirstName_nvcTextBox.Text               = DriverSpecificationList[0].FirstName_nvc;
                LastName_nvcTextBox.Text                = DriverSpecificationList[0].LastName_nvc;
                NationalCode_intNumericTextBox.Text     = Convert.ToString(DriverSpecificationList[0].NationalCode_int);
                licenceNumber_nvcTextBox.Text           = DriverSpecificationList[0].licenceNumber_nvc;
                LicenceEnd_nvcTextBox.Text              = DriverSpecificationList[0].LicenceEnd_nvc;
                ClassID_intComboBox.SelectedValue       = DriverSpecificationList[0].ClassID_int.HasValue?DriverSpecificationList[0].ClassID_int:0;
                HealthCardEndDate_nvcTextBox.Text       = DriverSpecificationList[0].HealthCardEndDate_nvc;
                DriverCardSharjeEndDate_nvcTextBox.Text = DriverSpecificationList[0].DriverCardSharjeEndDate_nvc;
                SaveAndCloseButton.Visible              = false;
            }
            else
            {
                Editbutton.Visible = false;
                HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
                List <HPS.BLL.TrafficBLL.BLLTraffic_T> TrafficList    = TrafficFactory.GetAllBy(HPS.BLL.TrafficBLL.BLLTraffic_T.Traffic_TField.NationalCode_int, _NationalCode);
                if (TrafficList != null && TrafficList.Count > 0)
                {
                    DriverCardNumber_nvcTextBox.Text    = TrafficList[TrafficList.Count - 1].DriverCardNumber_nvc;
                    FirstName_nvcTextBox.Text           = TrafficList[TrafficList.Count - 1].FirstName_nvc;
                    LastName_nvcTextBox.Text            = TrafficList[TrafficList.Count - 1].LastName_nvc;
                    NationalCode_intNumericTextBox.Text = Convert.ToString(TrafficList[TrafficList.Count - 1].NationalCode_int);
                    licenceNumber_nvcTextBox.Text       = Convert.ToString(TrafficList[TrafficList.Count - 1].licenceNumber_int);
                }
                else
                {
                    HPS.BLL.DriverBLL.BLLDriver_TFactory DriverFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory();
                    List <HPS.BLL.DriverBLL.BLLDriver_T> DriverList    = DriverFactory.GetAllBy(HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.NationalCode_int, _NationalCode);
                    if (DriverList != null && DriverList.Count > 0)
                    {
                        DriverCardNumber_nvcTextBox.Text    = DriverList[0].DriverCardNumber_nvc;
                        FirstName_nvcTextBox.Text           = DriverList[0].FirstName_nvc;
                        LastName_nvcTextBox.Text            = DriverList[0].LastName_nvc;
                        NationalCode_intNumericTextBox.Text = Convert.ToString(DriverList[0].NationalCode_int);
                        licenceNumber_nvcTextBox.Text       = Convert.ToString(DriverList[0].licenceNumber_nvc);
                    }
                }
            }
        }
예제 #10
0
 private void LoadDriver()
 {
     try
     {
         HPS.BLL.DriverBLL.BLLDriver_TFactory DriverFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory();
         DataTable DriverDataTable = new DataTable();
         DriverFactory.GetAll(ref DriverDataTable);
         this.DriverGridView.DataSource = DriverDataTable;
         //
         //HPS.Common.FrequentlyUsedData.CarDataTable.DefaultView.RowFilter = "";
         //this.DriverGridView.DataSource = HPS.Common.FrequentlyUsedData.DriverDataTable;
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
예제 #11
0
 private void FillCombo()
 {
     try
     {
         HPS.BLL.DriverBLL.BLLDriver_TFactory DriverID_bintFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory();
         DataTable DriverID_bintDataTable = new DataTable();
         DriverID_bintFactory.GetAll(ref DriverID_bintDataTable);
         this.DriverID_bintComboBox.DisplayMember = HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.FirstName_nvc.ToString();
         this.DriverID_bintComboBox.ValueMember   = HPS.BLL.DriverBLL.BLLDriver_T.Driver_TField.DriverID_bint.ToString();
         this.DriverID_bintComboBox.DataSource    = DriverID_bintDataTable;
         this.DriverID_bintComboBox.SelectedIndex = -1;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #12
0
 private void SearchButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (DriverGridView.CurrentRow != null)
         {
             HPS.BLL.DriverBLL.BLLDriver_TFactory DriverFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory();
             HPS.BLL.DriverBLL.BLLDriver_TKeys    DriverKey     = new HPS.BLL.DriverBLL.BLLDriver_TKeys();
             DriverKey.DriverID_bint = (Int64)DriverGridView.CurrentRow.Cells[colDriverID_bint.Name].Value;
             DriverEntity            = DriverFactory.GetBy(DriverKey);
         }
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     catch (Exception ex)
     {
         Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
     }
 }
예제 #13
0
 protected override void ShowForm()
 {
     try
     {
         this.FillCombo();
         HPS.BLL.DriverBLL.BLLDriver_TFactory DriverFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory();
         HPS.BLL.DriverBLL.BLLDriver_T        DriverEntity  = DriverFactory.GetBy((HPS.BLL.DriverBLL.BLLDriver_TKeys)Key);
         if (DriverEntity == null)
         {
             throw new HPS.Exceptions.DriverNotFound();
         }
         DriverCardDate_nvcTextBox.Text   = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.DriverCardDate_nvc, TypeCode.String));
         DriverCardNumber_nvcTextBox.Text = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.DriverCardNumber_nvc, TypeCode.String));
         DriverType_nvcTextBox.Text       = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.DriverType_nvc, TypeCode.String));
         FirstName_nvcTextBox.Text        = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.FirstName_nvc, TypeCode.String));
         LastName_nvcTextBox.Text         = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.LastName_nvc, TypeCode.String));
         InsuranceNumber_nvcTextBox.Text  = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.InsuranceNumber_nvc, TypeCode.String));
         Hepsa.Core.Common.PersentationController.SetComboBoxValue(ref CityID_intComboBox, DriverEntity.CityID_int, TypeCode.Int32);
         CityCode_nvcTextBox.Text      = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.CityCode_nvc, TypeCode.String));
         licenceNumber_nvcTextBox.Text = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.licenceNumber_nvc, TypeCode.String));
         Hepsa.Core.Common.PersentationController.SetComboBoxValue(ref LicenceCityID_intComboBox, DriverEntity.LicenceCityID_int, TypeCode.Int32);
         LicenceType_nvcTextBox.Text         = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.LicenceType_nvc, TypeCode.String));
         LiceniceDate_nvcTextBox.Text        = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.LiceniceDate_nvc, TypeCode.String));
         ActivityScope_nvcTextBox.Text       = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.ActivityScope_nvc, TypeCode.String));
         NationalCode_intNumericTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.NationalCode_int, TypeCode.Int64).ToString();
         Active_bitCheckBox.Checked          = (Boolean)Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.Active_bit, TypeCode.Boolean);
         Hepsa.Core.Common.PersentationController.SetComboBoxValue(ref InfractionGroupID_intComboBox, DriverEntity.InfractionGroupID_int, TypeCode.Int32);
         DocNumber_nvcTextBox.Text   = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.DocNumber_nvc, TypeCode.String));
         InsertDate_nvcTextBox.Text  = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.InsertDate_nvc, TypeCode.String));
         UpdateDate_nvcTextBox.Text  = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.UpdateDate_nvc, TypeCode.String));
         Deleted_bitCheckBox.Checked = (Boolean)Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.Deleted_bit, TypeCode.Boolean);
         Mobile_nvctextBox.Text      = Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.Mobile_nvc, TypeCode.String).ToString();
         Active_bit.Checked          = Convert.ToBoolean(Hepsa.Core.Common.PersentationController.GetEntityValue(DriverEntity.Active_bit, TypeCode.Boolean));
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #14
0
 public static void LoadData()
 {
     HPS.BLL.CarBLL.BLLCar_TFactory       CarFactory    = new HPS.BLL.CarBLL.BLLCar_TFactory();
     HPS.BLL.DriverBLL.BLLDriver_TFactory DriverFactory = new HPS.BLL.DriverBLL.BLLDriver_TFactory();
     try
     {
         if (_CarDataTable == null)
         {
             _CarDataTable = new DataTable();
         }
         CarFactory.GetByPlate(string.Empty, ref _CarDataTable);
         if (_DriverDataTable == null)
         {
             _DriverDataTable = new DataTable();
         }
         DriverFactory.GetByCardNumber(string.Empty, ref _DriverDataTable);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #15
0
 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;
     }
 }
예제 #16
0
        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;
            }
        }