Exemplo n.º 1
0
        public void Update(HPS.BLL.BoxingBLL.BLLBoxing_T businessObject, HPS.BLL.BoxingBLL.BLLBoxing_TKeys businessObjectKey)
        {
            try
            {
                if (businessObject.BoxingID_int == businessObjectKey.BoxingID_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueBoxingID_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);
            }
        }
Exemplo n.º 2
0
        protected override void Edit()
        {
            HPS.BLL.BoxingBLL.BLLBoxing_TFactory BoxingFactory = new HPS.BLL.BoxingBLL.BLLBoxing_TFactory();
            try
            {
                HPS.BLL.BoxingBLL.BLLBoxing_T BoxingEntity = new HPS.BLL.BoxingBLL.BLLBoxing_T();
                BoxingEntity.BoxingCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(BoxingCode_nvcTextBox.Text, TypeCode.String).ToString();
                BoxingEntity.BoxingType_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(BoxingType_nvcTextBox.Text, TypeCode.String).ToString();
                BoxingEntity.Active_bit     = Active_bitCheckBox.Checked;

                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    BoxingFactory.BeginProc();
                    BoxingFactory.Update(BoxingEntity, (HPS.BLL.BoxingBLL.BLLBoxing_TKeys)Key);
                    BoxingFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.BoxingBLL.BLLBoxing_T.Boxing_TField.BoxingID_int.ToString() + "='" + ((HPS.BLL.BoxingBLL.BLLBoxing_TKeys)Key).BoxingID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0][HPS.BLL.BoxingBLL.BLLBoxing_T.Boxing_TField.BoxingCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(BoxingEntity.BoxingCode_nvc, TypeCode.String);
                            dr[0][HPS.BLL.BoxingBLL.BLLBoxing_T.Boxing_TField.BoxingType_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(BoxingEntity.BoxingType_nvc, TypeCode.String);
                            dr[0][HPS.BLL.BoxingBLL.BLLBoxing_T.Boxing_TField.Active_bit.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(BoxingEntity.Active_bit, TypeCode.Boolean);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                BoxingFactory.RollBackProc();
                throw ex;
            }
        }
Exemplo n.º 3
0
 public void PopulateBusinessObjectFromReader(HPS.BLL.BoxingBLL.BLLBoxing_T businessObject, IDataReader dataReader)
 {
     businessObject.BoxingID_int   = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.BoxingBLL.BLLBoxing_T.Boxing_TField.BoxingID_int.ToString()));
     businessObject.BoxingCode_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.BoxingBLL.BLLBoxing_T.Boxing_TField.BoxingCode_nvc.ToString()));
     businessObject.BoxingType_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.BoxingBLL.BLLBoxing_T.Boxing_TField.BoxingType_nvc.ToString()));
     businessObject.Active_bit     = dataReader.GetBoolean(dataReader.GetOrdinal(HPS.BLL.BoxingBLL.BLLBoxing_T.Boxing_TField.Active_bit.ToString()));
 }
Exemplo n.º 4
0
        protected override void Insert()
        {
            HPS.BLL.BoxingBLL.BLLBoxing_TFactory BoxingFactory = new HPS.BLL.BoxingBLL.BLLBoxing_TFactory();
            try
            {
                HPS.BLL.BoxingBLL.BLLBoxing_T BoxingEntity = new HPS.BLL.BoxingBLL.BLLBoxing_T();
                BoxingEntity.BoxingCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(BoxingCode_nvcTextBox.Text, TypeCode.String).ToString();
                BoxingEntity.BoxingType_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(BoxingType_nvcTextBox.Text, TypeCode.String).ToString();
                BoxingEntity.Active_bit     = Active_bitCheckBox.Checked;

                BoxingFactory.BeginProc();
                BoxingFactory.Insert(BoxingEntity);
                BoxingFactory.CommitProc();
                if (DataTable != null)
                {
                    DataRow dr = this.DataTable.NewRow();
                    dr[HPS.BLL.BoxingBLL.BLLBoxing_T.Boxing_TField.BoxingID_int.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(BoxingEntity.BoxingID_int, TypeCode.Int32);
                    dr[HPS.BLL.BoxingBLL.BLLBoxing_T.Boxing_TField.BoxingCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(BoxingEntity.BoxingCode_nvc, TypeCode.String);
                    dr[HPS.BLL.BoxingBLL.BLLBoxing_T.Boxing_TField.BoxingType_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(BoxingEntity.BoxingType_nvc, TypeCode.String);
                    dr[HPS.BLL.BoxingBLL.BLLBoxing_T.Boxing_TField.Active_bit.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(BoxingEntity.Active_bit, TypeCode.Boolean);

                    DataTable.Rows.Add(dr);
                    DataTable.AcceptChanges();
                }
                this.ClearForm(this);
            }
            catch (Exception ex)
            {
                BoxingFactory.RollBackProc();
                throw ex;
            }
        }
Exemplo n.º 5
0
        public HPS.BLL.BoxingBLL.BLLBoxing_T SelectByPrimaryKey(HPS.BLL.BoxingBLL.BLLBoxing_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.BoxingBLL.BLLBoxing_T businessObject = new HPS.BLL.BoxingBLL.BLLBoxing_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;
            }
        }
Exemplo n.º 6
0
        private void BoxingID_intNewButton_Click(object sender, EventArgs e)
        {
            HPS.Present.SearchForm.BoxingSearch frm = new HPS.Present.SearchForm.BoxingSearch();
            frm.ShowDialog();
            if (frm != null)
            {
                BoxingEntity = frm.SelectedBoxingEntity;

                BoxingID_intComboBox.Text = BoxingEntity.BoxingType_nvc;
            }
        }
Exemplo n.º 7
0
        public List <HPS.BLL.BoxingBLL.BLLBoxing_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.BoxingBLL.BLLBoxing_T> list = new List <HPS.BLL.BoxingBLL.BLLBoxing_T>();

            while (dataReader.Read())
            {
                HPS.BLL.BoxingBLL.BLLBoxing_T businessObject = new HPS.BLL.BoxingBLL.BLLBoxing_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
Exemplo n.º 8
0
 protected override void ShowForm()
 {
     this.FillCombo();
     HPS.BLL.BoxingBLL.BLLBoxing_TFactory BoxingFactory = new HPS.BLL.BoxingBLL.BLLBoxing_TFactory();
     HPS.BLL.BoxingBLL.BLLBoxing_T        BoxingEntity  = BoxingFactory.GetBy((HPS.BLL.BoxingBLL.BLLBoxing_TKeys)Key);
     if (BoxingEntity == null)
     {
         throw new HPS.Exceptions.BoxingNotFound();
     }
     BoxingCode_nvcTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(BoxingEntity.BoxingCode_nvc, TypeCode.String).ToString();
     BoxingType_nvcTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(BoxingEntity.BoxingType_nvc, TypeCode.String).ToString();
     Active_bitCheckBox.Checked = (Boolean)Hepsa.Core.Common.PersentationController.GetEntityValue(BoxingEntity.Active_bit, TypeCode.Boolean);
 }
Exemplo n.º 9
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            if (BoxingGridView.CurrentRow != null)
            {
                HPS.BLL.BoxingBLL.BLLBoxing_TFactory BoxingFactory = new HPS.BLL.BoxingBLL.BLLBoxing_TFactory();
                HPS.BLL.BoxingBLL.BLLBoxing_TKeys    BoxingKey     = new HPS.BLL.BoxingBLL.BLLBoxing_TKeys();
                BoxingKey.BoxingID_int = (Int32)BoxingGridView.CurrentRow.Cells[colBoxingID_int.Name].Value;
                BoxingEntity           = BoxingFactory.GetBy(BoxingKey);

                if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetEntityValue(BoxingGridView.CurrentRow.Cells[colBoxingID_int.Name].Value, TypeCode.String).ToString()) == false)
                {
                    BoxingEntity.BoxingType_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(BoxingGridView.CurrentRow.Cells[colBoxingType_nvc.Name].Value, TypeCode.String).ToString();
                }
            }
            this.Close();
        }
Exemplo n.º 10
0
        public void Insert(HPS.BLL.BoxingBLL.BLLBoxing_T businessObject)
        {
            try
            {
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "BoxingID_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);
            }
        }
Exemplo n.º 11
0
        public void Update(HPS.BLL.BoxingBLL.BLLBoxing_T businessObject, HPS.BLL.BoxingBLL.BLLBoxing_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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

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

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


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



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

                this.Command.ExecuteNonQuery();

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