Beispiel #1
0
 protected override void Insert()
 {
     HPS.BLL.UserGroupBLL.BLLUserGroup_TFactory UserGroupFactory = new HPS.BLL.UserGroupBLL.BLLUserGroup_TFactory();
     HPS.BLL.UserGroupBLL.BLLUserGroup_T        UserGroupEntity  = new HPS.BLL.UserGroupBLL.BLLUserGroup_T();
     HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys    UserGroupKey     = new HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys();
     try
     {
         UserGroupEntity.Active_bit = this.Active_bitCheckBox.Checked;
         string refer = null;
         this.GetPermission(ref refer, this.PermisionTabControl);
         UserGroupEntity.Permission_nvc = refer;
         UserGroupEntity.UserGroup_nvc  = this.UserGroup_nvcTextBox.Text;
         UserGroupFactory.BeginProc();
         UserGroupFactory.Insert(UserGroupEntity);
         UserGroupFactory.CommitProc();
         if (DataTable != null)
         {
             DataRow dr = this.DataTable.NewRow();
             dr[HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.UserGroupID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(UserGroupEntity.UserGroupID_int, TypeCode.Int32);
             dr[HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.UserGroup_nvc.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(UserGroupEntity.UserGroup_nvc, TypeCode.String);
             dr[HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.Permission_nvc.ToString()]  = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(UserGroupEntity.Permission_nvc, TypeCode.String);
             dr[HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.Active_bit.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(UserGroupEntity.Active_bit, TypeCode.Boolean);
             DataTable.Rows.Add(dr);
             DataTable.AcceptChanges();
         }
         this.ClearForm(this);
     }
     catch (Exception ex)
     {
         UserGroupFactory.RollBackProc();
         throw ex;
     }
 }
Beispiel #2
0
        public HPS.BLL.UserGroupBLL.BLLUserGroup_T SelectByPrimaryKey(HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.UserGroupBLL.BLLUserGroup_T businessObject = new HPS.BLL.UserGroupBLL.BLLUserGroup_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 #3
0
        public List <HPS.BLL.UserGroupBLL.BLLUserGroup_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.UserGroupBLL.BLLUserGroup_T> list = new List <HPS.BLL.UserGroupBLL.BLLUserGroup_T>();

            while (dataReader.Read())
            {
                HPS.BLL.UserGroupBLL.BLLUserGroup_T businessObject = new HPS.BLL.UserGroupBLL.BLLUserGroup_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
Beispiel #4
0
 public void Insert(HPS.BLL.UserGroupBLL.BLLUserGroup_T businessObject)
 {
     try
     {
         if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UserGroupID_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);
     }
 }
Beispiel #5
0
        public void PopulateBusinessObjectFromReader(HPS.BLL.UserGroupBLL.BLLUserGroup_T businessObject, IDataReader dataReader)
        {
            businessObject.UserGroupID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.UserGroupID_int.ToString()));
            businessObject.UserGroup_nvc   = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.UserGroup_nvc.ToString()));
            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.Permission_nvc.ToString())) == false)
            {
                businessObject.Permission_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.Permission_nvc.ToString()));
            }
            else
            {
                businessObject.Permission_nvc = String.Empty;
            }

            businessObject.Active_bit = dataReader.GetBoolean(dataReader.GetOrdinal(HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.Active_bit.ToString()));
        }
Beispiel #6
0
 protected override void ShowForm()
 {
     HPS.BLL.UserGroupBLL.BLLUserGroup_TFactory UserGroupFactory = new HPS.BLL.UserGroupBLL.BLLUserGroup_TFactory();
     HPS.BLL.UserGroupBLL.BLLUserGroup_T        UserGroupEntity  = UserGroupFactory.GetBy((HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys)Key);
     if (UserGroupEntity == null)
     {
         throw new HPS.Exceptions.UserGroupNotFound();
     }
     else
     {
         this.MakePermission();
         if (UserGroupEntity.Permission_nvc != null)
         {
             this.ShowPermision(UserGroupEntity.Permission_nvc, this.PermisionTabControl);
         }
         this.UserGroup_nvcTextBox.Text = UserGroupEntity.UserGroup_nvc;
         Active_bitCheckBox.Checked     = (bool)Hepsa.Core.Common.PersentationController.GetEntityValue(UserGroupEntity.Active_bit, TypeCode.Boolean);
     }
 }
Beispiel #7
0
 protected override void Edit()
 {
     HPS.BLL.UserGroupBLL.BLLUserGroup_TFactory UserGroupFactory = new HPS.BLL.UserGroupBLL.BLLUserGroup_TFactory();
     try
     {
         HPS.BLL.UserGroupBLL.BLLUserGroup_T UserGroupEntity = new HPS.BLL.UserGroupBLL.BLLUserGroup_T();
         UserGroupEntity.UserGroupID_int = ((HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys)Key).UserGroupID_int;
         UserGroupEntity.Active_bit      = Active_bitCheckBox.Checked;
         UserGroupEntity.UserGroup_nvc   = UserGroup_nvcTextBox.Text;
         string refer = null;
         this.GetPermission(ref refer, this.PermisionTabControl);
         UserGroupEntity.Permission_nvc = refer;
         if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
         {
             UserGroupFactory.BeginProc();
             UserGroupFactory.Update(UserGroupEntity, (HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys)Key);
             UserGroupFactory.CommitProc();
             if (DataTable != null)
             {
                 DataRow[] dr = DataTable.Select(HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.UserGroupID_int.ToString() + "='" + ((HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys)Key).UserGroupID_int.ToString() + "'");
                 if (dr.Length > 0)
                 {
                     dr[0][HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.UserGroupID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(UserGroupEntity.UserGroupID_int, TypeCode.Int32);
                     dr[0][HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.UserGroup_nvc.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(UserGroupEntity.UserGroup_nvc, TypeCode.String);
                     dr[0][HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.Permission_nvc.ToString()]  = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(UserGroupEntity.Permission_nvc, TypeCode.String);
                     dr[0][HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.Active_bit.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(UserGroupEntity.Active_bit, TypeCode.Boolean);
                 }
                 DataTable.AcceptChanges();
             }
         }
     }
     catch (Exception ex)
     {
         UserGroupFactory.RollBackProc();
         throw ex;
     }
 }
Beispiel #8
0
        public void Update(HPS.BLL.UserGroupBLL.BLLUserGroup_T businessObject, HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys businessObjectKey)
        {
            try
            {
                HPS.BLL.UserGroupBLL.BLLUserGroup_T tmpUserGroup = this.GetBy(businessObjectKey);
                List <string> Except = new List <string>();
                if (businessObject.UserGroupID_int == businessObjectKey.UserGroupID_int)
                {
                    Except.Add("UniqueUserGroupID_int");
                }
                if (businessObject.UserGroup_nvc == tmpUserGroup.UserGroup_nvc)
                {
                    Except.Add("UniqueUserGroup_nvc");
                }
                if (Except.Count > 0)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, Except.ToArray()) == 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);
            }
        }
Beispiel #9
0
        public void Update(HPS.BLL.UserGroupBLL.BLLUserGroup_T businessObject, HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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

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

                SqlParameter Active_bit = new SqlParameter();
                Active_bit.ParameterName = "@Active_bit";
                Active_bit.SqlDbType     = SqlDbType.Bit;
                Active_bit.Direction     = ParameterDirection.Input;
                Active_bit.IsNullable    = true;
                Active_bit.Value         = businessObject.Active_bit;
                this.Command.Parameters.Add(Active_bit);


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



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

                this.Command.ExecuteNonQuery();

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