Esempio n. 1
0
        public HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_T SelectByPrimaryKey(HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_T businessObject = new HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_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;
            }
        }
Esempio n. 2
0
        public List <HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_T> list = new List <HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_T>();

            while (dataReader.Read())
            {
                HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_T businessObject = new HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
Esempio n. 3
0
        public void Insert(HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_T businessObject)
        {
            try{
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "PermissionGroupID_int") == false)
                {
                    throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                }

                _dataObject.Insert(businessObject);
            }catch (System.Exception ex) {
                throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
            }
        }
Esempio n. 4
0
 public void PopulateBusinessObjectFromReader(HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_T businessObject, IDataReader dataReader)
 {
     businessObject.PermissionGroupID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_T.PermissionGroup_TField.PermissionGroupID_int.ToString()));
     businessObject.PermissionGroup_nvc   = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_T.PermissionGroup_TField.PermissionGroup_nvc.ToString()));
     if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_T.PermissionGroup_TField.ParentID_int.ToString())) == false)
     {
         businessObject.ParentID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_T.PermissionGroup_TField.ParentID_int.ToString()));
     }
     else
     {
         businessObject.ParentID_int = null;
     }
 }
Esempio n. 5
0
        public void Update(HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_T businessObject, HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_TKeys businessObjectKey)
        {
            try{
                if (businessObject.PermissionGroupID_int == businessObjectKey.PermissionGroupID_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniquePermissionGroupID_int") == false)
                    {
                        throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                    }
                }
                else
                {
                    if (businessObject.IsValid() == 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);
            }
        }
Esempio n. 6
0
        public void Update(HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_T businessObject, HPS.BLL.PermissionGroupBLL.BLLPermissionGroup_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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

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


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



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

                this.Command.ExecuteNonQuery();

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