Example #1
0
        protected override void Edit()
        {
            HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TFactory CompanyGroupFactory = new HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TFactory();

            try
            {
                HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T CompanyGroupEntity = CompanyGroupFactory.GetBy((HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys)Key);
                if (CompanyGroupEntity == null)
                {
                    throw new HPS.Exceptions.CompanyGroupNotFound();
                }
                CompanyGroupEntity.GroupName_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(GroupName_nvcTextBox.Text, TypeCode.String).ToString();

                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    CompanyGroupFactory.BeginProc();
                    CompanyGroupFactory.Update(CompanyGroupEntity, (HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys)Key);
                    CompanyGroupFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T.CompanyGroup_TField.GroupID_int.ToString() + "='" + ((HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys)Key).GroupID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0][HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T.CompanyGroup_TField.GroupName_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyGroupEntity.GroupName_nvc, TypeCode.String);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (System.Exception ex)
            {
                CompanyGroupFactory.RollBackProc();
                throw ex;
            }
        }
Example #2
0
        protected override void Insert()
        {
            HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TFactory CompanyGroupFactory = new HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TFactory();

            try
            {
                HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T CompanyGroupEntity = new HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T();
                CompanyGroupEntity.GroupName_nvc = GroupName_nvcTextBox.Text;


                CompanyGroupFactory.BeginProc();
                CompanyGroupFactory.Insert(CompanyGroupEntity);
                CompanyGroupFactory.CommitProc();
                if (DataTable != null)
                {
                    DataRow dr = this.DataTable.NewRow();
                    dr[HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T.CompanyGroup_TField.GroupID_int.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyGroupEntity.GroupID_int, TypeCode.Int32);
                    dr[HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T.CompanyGroup_TField.GroupName_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyGroupEntity.GroupName_nvc, TypeCode.String);

                    DataTable.Rows.Add(dr);
                    DataTable.AcceptChanges();
                }
                this.ClearForm(this);
            }
            catch (System.Exception ex)
            {
                CompanyGroupFactory.RollBackProc();
                throw ex;
            }
        }
Example #3
0
        public HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T SelectByPrimaryKey(HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T businessObject = new HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_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;
            }
        }
Example #4
0
 public void Delete(HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T businessObject)
 {
     try
     {
         _dataObject.Delete(businessObject);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Example #5
0
 protected override void ShowForm()
 {
     this.FillCombo();
     HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TFactory CompanyGroupFactory = new HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TFactory();
     HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T        CompanyGroupEntity  = CompanyGroupFactory.GetBy((HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys)Key);
     if (CompanyGroupEntity == null)
     {
         throw new HPS.Exceptions.CompanyGroupNotFound();
     }
     GroupName_nvcTextBox.Text = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyGroupEntity.GroupName_nvc, TypeCode.String));
 }
Example #6
0
        public void Insert(HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T businessObject)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

                SqlParameter GroupID_int = new SqlParameter();
                GroupID_int.ParameterName = "@GroupID_int";
                GroupID_int.SqlDbType     = SqlDbType.Int;
                GroupID_int.Direction     = ParameterDirection.Output;
                GroupID_int.IsNullable    = false;
                GroupID_int.Value         = businessObject.GroupID_int;
                this.Command.Parameters.Add(GroupID_int);

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



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

                this.Command.ExecuteNonQuery();

                businessObject.GroupID_int = (Int32)(this.Command.Parameters["@GroupID_int"].Value);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Example #7
0
 public void PopulateBusinessObjectFromReader(HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T businessObject, IDataReader dataReader)
 {
     try
     {
         businessObject.GroupID_int   = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T.CompanyGroup_TField.GroupID_int.ToString()));
         businessObject.GroupName_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T.CompanyGroup_TField.GroupName_nvc.ToString()));
     }
     catch (System.Exception ex)
     {
         dataReader.Close();
         throw ex;
     }
 }
Example #8
0
        public void Insert(HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T businessObject)
        {
            try
            {
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueGroupID_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);
            }
        }
Example #9
0
        public void Update(HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T businessObject)
        {
            try
            {
                List <string> ExceptList = new List <string>();
                ExceptList.Add("UniqueGroupID_int");
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, ExceptList.ToArray()) == false)
                {
                    throw new Hepsa.Core.Validation.InvalidBusinessObjectException(businessObject.BrokenRulesList().ToString());
                }

                _dataObject.Update(businessObject);
            }
            catch (System.Exception ex)
            {
                throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
            }
        }
Example #10
0
 public List <HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T> PopulateObjectsFromReader(IDataReader dataReader)
 {
     try
     {
         List <HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T> list = new List <HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T>();
         while (dataReader.Read())
         {
             HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T businessObject = new HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T();
             PopulateBusinessObjectFromReader(businessObject, dataReader);
             list.Add(businessObject);
         }
         return(list);
     }
     catch (System.Exception ex)
     {
         dataReader.Close();
         throw ex;
     }
 }
Example #11
0
        public void Delete(HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_T businessObject)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

            try
            {
                HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys businessObjectKey = new HPS.BLL.CompanyGroupBLL.BLLCompanyGroup_TKeys();
                businessObjectKey.GroupID_int = (Int32)businessObject.GroupID_int;
                this.Command.Parameters.Clear();

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


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

                this.Command.ExecuteNonQuery();

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