예제 #1
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.UserGroupBLL.BLLUserGroup_TFactory UserGroupFactory = new HPS.BLL.UserGroupBLL.BLLUserGroup_TFactory();

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


                HPS.BLL.UserGroupBLL.BLLUserGroup_TFactory UserGroup_TFactory = new HPS.BLL.UserGroupBLL.BLLUserGroup_TFactory();
                HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys    UserGroupKey       = new HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys();

                UserGroupKey.UserGroupID_int = (Int32?)UserGroupGridView.CurrentRow.Cells["colUserGroupID_int"].Value;
                UserGroupFactory.Delete(UserGroupKey);

                DataRow[] dr = ((DataTable)this.UserGroupGridView.DataSource).Select(HPS.BLL.UserGroupBLL.BLLUserGroup_T.UserGroup_TField.UserGroupID_int.ToString() + "='" + UserGroupKey.UserGroupID_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.UserGroupGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
예제 #2
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;
     }
 }
예제 #3
0
        private void EditButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys UserGroupKey = new HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys();
            UserGroupKey.UserGroupID_int = (Int32?)this.UserGroupGridView.CurrentRow.Cells["colUserGroupID_int"].Value;
            UserGroupEntityForm UserGroup = new UserGroupEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.UserGroupGridView.DataSource, UserGroupKey);

            UserGroup.ShowDialog();
        }
예제 #4
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;
            }
        }
예제 #5
0
 public void GetBy(HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys keys, ref System.Data.DataSet dataSet)
 {
     try
     {
         _dataObject.SelectByPrimaryKey(keys, ref dataSet);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
예제 #6
0
 public HPS.BLL.UserGroupBLL.BLLUserGroup_T GetBy(HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys keys)
 {
     try
     {
         return(_dataObject.SelectByPrimaryKey(keys));
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
예제 #7
0
 public void Delete(HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys keys)
 {
     try
     {
         _dataObject.Delete(keys);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
예제 #8
0
        public void SelectByPrimaryKey(HPS.BLL.UserGroupBLL.BLLUserGroup_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_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();
                }

                sqlDataAdapter.Fill(dataTable);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
예제 #9
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);
            }
        }
예제 #10
0
 public UserGroupEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.UserGroupBLL.BLLUserGroup_TKeys Key)
     : base(State, DataTable, Key)
 {
     InitializeComponent();
 }
예제 #11
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;
            }
        }