Beispiel #1
0
        public HPS.BLL.VerifiedCarsBLL.BLLVerifiedCars_T SelectByPrimaryKey(HPS.BLL.VerifiedCarsBLL.BLLVerifiedCars_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

            this.Command.CommandText = "[sp_VerifiedCars_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try
            {
                this.Command.Parameters.Clear();

                SqlParameter VerifiedCarID_int = new SqlParameter();
                VerifiedCarID_int.ParameterName = "@VerifiedCarID_int";
                VerifiedCarID_int.SqlDbType     = SqlDbType.Int;
                VerifiedCarID_int.Direction     = ParameterDirection.Input;
                VerifiedCarID_int.IsNullable    = false;
                VerifiedCarID_int.Value         = businessObjectKey.VerifiedCarID_int;
                this.Command.Parameters.Add(VerifiedCarID_int);



                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.VerifiedCarsBLL.BLLVerifiedCars_T businessObject = new HPS.BLL.VerifiedCarsBLL.BLLVerifiedCars_T();
                if (dataReader.Read())
                {
                    PopulateBusinessObjectFromReader(businessObject, dataReader);
                }
                else
                {
                    businessObject = null;
                }

                if (dataReader.IsClosed == false)
                {
                    dataReader.Close();
                }


                if (ControlConnection)
                {
                    this.Commit();
                }
                return(businessObject);
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Beispiel #2
0
 public void GetBy(HPS.BLL.VerifiedCarsBLL.BLLVerifiedCars_TKeys keys, ref System.Data.DataSet dataSet, String srcTable)
 {
     try
     {
         _dataObject.SelectByPrimaryKey(keys, ref dataSet, srcTable);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Beispiel #3
0
 public HPS.BLL.VerifiedCarsBLL.BLLVerifiedCars_T GetBy(HPS.BLL.VerifiedCarsBLL.BLLVerifiedCars_TKeys keys)
 {
     try
     {
         return(_dataObject.SelectByPrimaryKey(keys));
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Beispiel #4
0
 public void Delete(HPS.BLL.VerifiedCarsBLL.BLLVerifiedCars_TKeys keys)
 {
     try
     {
         _dataObject.Delete(keys);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Beispiel #5
0
        public void SelectByPrimaryKey(HPS.BLL.VerifiedCarsBLL.BLLVerifiedCars_TKeys businessObjectKey, ref System.Data.DataTable dataTable)
        {
            bool           ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);
            SqlDataAdapter sqlDataAdapter    = new System.Data.SqlClient.SqlDataAdapter(this.Command);

            this.Command.CommandText = "[sp_VerifiedCars_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try
            {
                this.Command.Parameters.Clear();

                SqlParameter VerifiedCarID_int = new SqlParameter();
                VerifiedCarID_int.ParameterName = "@VerifiedCarID_int";
                VerifiedCarID_int.SqlDbType     = SqlDbType.Int;
                VerifiedCarID_int.Direction     = ParameterDirection.Input;
                VerifiedCarID_int.IsNullable    = false;
                VerifiedCarID_int.Value         = businessObjectKey.VerifiedCarID_int;
                this.Command.Parameters.Add(VerifiedCarID_int);



                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                sqlDataAdapter.Fill(dataTable);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Beispiel #6
0
        public void Update(HPS.BLL.VerifiedCarsBLL.BLLVerifiedCars_T businessObject, HPS.BLL.VerifiedCarsBLL.BLLVerifiedCars_TKeys businessObjectKey)
        {
            try
            {
                List <string> ExceptList = new List <string>();
                if (businessObject.VerifiedCarID_int == businessObjectKey.VerifiedCarID_int)
                {
                    ExceptList.Add("UniqueVerifiedCarID_int");
                    ExceptList.Add("UniqueNumberPlate");
                }
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, ExceptList.ToArray()) == false)
                {
                    throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                }

                _dataObject.Update(businessObject, businessObjectKey);
            }
            catch (System.Exception ex)
            {
                throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
            }
        }
Beispiel #7
0
        public void Update(HPS.BLL.VerifiedCarsBLL.BLLVerifiedCars_T businessObject, HPS.BLL.VerifiedCarsBLL.BLLVerifiedCars_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

            this.Command.CommandText = "[sp_VerifiedCars_T_Update]";
            this.Command.CommandType = CommandType.StoredProcedure;

            try
            {
                this.Command.Parameters.Clear();

                SqlParameter CompanyID_int = new SqlParameter();
                CompanyID_int.ParameterName = "@CompanyID_int";
                CompanyID_int.SqlDbType     = SqlDbType.Int;
                CompanyID_int.Direction     = ParameterDirection.Input;
                CompanyID_int.IsNullable    = true;
                if (businessObject.CompanyID_int.HasValue == false)
                {
                    CompanyID_int.Value = DBNull.Value;
                }
                else
                {
                    CompanyID_int.Value = businessObject.CompanyID_int;
                }
                this.Command.Parameters.Add(CompanyID_int);

                SqlParameter NumberPlate_nvc = new SqlParameter();
                NumberPlate_nvc.ParameterName = "@NumberPlate_nvc";
                NumberPlate_nvc.SqlDbType     = SqlDbType.NVarChar;
                NumberPlate_nvc.Direction     = ParameterDirection.Input;
                NumberPlate_nvc.IsNullable    = true;
                if (String.IsNullOrEmpty(businessObject.NumberPlate_nvc))
                {
                    NumberPlate_nvc.Value = DBNull.Value;
                }
                else
                {
                    NumberPlate_nvc.Value = businessObject.NumberPlate_nvc;
                }
                this.Command.Parameters.Add(NumberPlate_nvc);

                SqlParameter SerialPlate_nvc = new SqlParameter();
                SerialPlate_nvc.ParameterName = "@SerialPlate_nvc";
                SerialPlate_nvc.SqlDbType     = SqlDbType.NVarChar;
                SerialPlate_nvc.Direction     = ParameterDirection.Input;
                SerialPlate_nvc.IsNullable    = true;
                if (String.IsNullOrEmpty(businessObject.SerialPlate_nvc))
                {
                    SerialPlate_nvc.Value = DBNull.Value;
                }
                else
                {
                    SerialPlate_nvc.Value = businessObject.SerialPlate_nvc;
                }
                this.Command.Parameters.Add(SerialPlate_nvc);

                SqlParameter Date_vc = new SqlParameter();
                Date_vc.ParameterName = "@Date_vc";
                Date_vc.SqlDbType     = SqlDbType.VarChar;
                Date_vc.Direction     = ParameterDirection.Input;
                Date_vc.IsNullable    = true;
                if (string.IsNullOrEmpty(businessObject.Date_vc))
                {
                    Date_vc.Value = DBNull.Value;
                }
                else
                {
                    Date_vc.Value = businessObject.Date_vc;
                }
                this.Command.Parameters.Add(Date_vc);


                SqlParameter pk_VerifiedCarID_int = new SqlParameter();
                pk_VerifiedCarID_int.ParameterName = "@pk_VerifiedCarID_int";
                pk_VerifiedCarID_int.SqlDbType     = SqlDbType.Int;
                pk_VerifiedCarID_int.Direction     = ParameterDirection.Input;
                pk_VerifiedCarID_int.IsNullable    = false;
                pk_VerifiedCarID_int.Value         = businessObjectKey.VerifiedCarID_int;
                this.Command.Parameters.Add(pk_VerifiedCarID_int);

                SqlParameter FullName_nvc = new SqlParameter();
                FullName_nvc.ParameterName = "@FullName_nvc";
                FullName_nvc.SqlDbType     = SqlDbType.NVarChar;
                FullName_nvc.Direction     = ParameterDirection.Input;
                FullName_nvc.IsNullable    = true;
                if (string.IsNullOrEmpty(businessObject.FullName_nvc))
                {
                    FullName_nvc.Value = DBNull.Value;
                }
                else
                {
                    FullName_nvc.Value = businessObject.FullName_nvc;
                }
                this.Command.Parameters.Add(FullName_nvc);

                SqlParameter Unit_nvc = new SqlParameter();
                Unit_nvc.ParameterName = "@Unit_nvc";
                Unit_nvc.SqlDbType     = SqlDbType.NVarChar;
                Unit_nvc.Direction     = ParameterDirection.Input;
                Unit_nvc.IsNullable    = true;
                if (string.IsNullOrEmpty(businessObject.Unit_nvc))
                {
                    Unit_nvc.Value = DBNull.Value;
                }
                else
                {
                    Unit_nvc.Value = businessObject.Unit_nvc;
                }
                this.Command.Parameters.Add(Unit_nvc);

                if (ControlConnection)
                {
                    this.BeginTransaction();
                }

                this.Command.ExecuteNonQuery();

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Beispiel #8
0
 public VerifiedCarsEntityForm(enmState State, DataTable DataTable, HPS.BLL.VerifiedCarsBLL.BLLVerifiedCars_TKeys Key)
     : base(State, DataTable, Key)
 {
     InitializeComponent();
 }