Ejemplo n.º 1
0
        public HPS.BLL.BLLInOut_T SelectByPrimaryKey(HPS.BLL.BLLInOut_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader        dataReader     = this.Command.ExecuteReader();
                HPS.BLL.BLLInOut_T businessObject = new HPS.BLL.BLLInOut_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;
            }
        }
Ejemplo n.º 2
0
 public void GetBy(HPS.BLL.BLLInOut_TKeys keys, ref System.Data.DataTable dataTable)
 {
     try
     {
         _dataObject.SelectByPrimaryKey(keys, ref dataTable);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Ejemplo n.º 3
0
 public HPS.BLL.BLLInOut_T GetBy(HPS.BLL.BLLInOut_TKeys keys)
 {
     try
     {
         return(_dataObject.SelectByPrimaryKey(keys));
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Ejemplo n.º 4
0
 public void Delete(HPS.BLL.BLLInOut_TKeys keys)
 {
     try
     {
         _dataObject.Delete(keys);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Ejemplo n.º 5
0
        public void SelectByPrimaryKey(HPS.BLL.BLLInOut_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_InOut_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

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

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



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

                sqlDataAdapter.Fill(dataTable);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Ejemplo n.º 6
0
        public void Update(HPS.BLL.BLLInOut_T businessObject, HPS.BLL.BLLInOut_TKeys businessObjectKey)
        {
            try
            {
                List <string> ExceptList = new List <string>();
                if (businessObject.inOutID_bint == businessObjectKey.inOutID_bint)
                {
                    ExceptList.Add("UniqueinOutID_bint");
                }
                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);
            }
        }
Ejemplo n.º 7
0
        public void Update(HPS.BLL.BLLInOut_T businessObject, HPS.BLL.BLLInOut_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

                SqlParameter cameraPicturesID_bint = new SqlParameter();
                cameraPicturesID_bint.ParameterName = "@cameraPicturesID_bint";
                cameraPicturesID_bint.SqlDbType     = SqlDbType.BigInt;
                cameraPicturesID_bint.Direction     = ParameterDirection.Input;
                cameraPicturesID_bint.IsNullable    = false;
                cameraPicturesID_bint.Value         = businessObject.cameraPicturesID_bint;
                this.Command.Parameters.Add(cameraPicturesID_bint);

                SqlParameter date_vc = new SqlParameter();
                date_vc.ParameterName = "@date_vc";
                date_vc.SqlDbType     = SqlDbType.VarChar;
                date_vc.Direction     = ParameterDirection.Input;
                date_vc.IsNullable    = false;
                date_vc.Value         = businessObject.date_vc;
                this.Command.Parameters.Add(date_vc);

                SqlParameter time_vc = new SqlParameter();
                time_vc.ParameterName = "@time_vc";
                time_vc.SqlDbType     = SqlDbType.VarChar;
                time_vc.Direction     = ParameterDirection.Input;
                time_vc.IsNullable    = false;
                time_vc.Value         = businessObject.time_vc;
                this.Command.Parameters.Add(time_vc);

                SqlParameter gate_tint = new SqlParameter();
                gate_tint.ParameterName = "@gate_tint";
                gate_tint.SqlDbType     = SqlDbType.TinyInt;
                gate_tint.Direction     = ParameterDirection.Input;
                gate_tint.IsNullable    = false;
                gate_tint.Value         = businessObject.gate_tint;
                this.Command.Parameters.Add(gate_tint);


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



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

                this.Command.ExecuteNonQuery();

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }