예제 #1
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlacesFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory();

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


                HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory PortPlaces_TFactory = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TFactory();
                HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys    PortPlacesKey       = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys();

                PortPlacesKey.PortPlacesID_int = (Int32?)PortPlacesGridView.CurrentRow.Cells["colPortPlacesID_int"].Value;
                PortPlacesFactory.Delete(PortPlacesKey);

                DataRow[] dr = ((DataTable)this.PortPlacesGridView.DataSource).Select(HPS.BLL.PortPlacesBLL.BLLPortPlaces_T.PortPlaces_TField.PortPlacesID_int.ToString() + "='" + PortPlacesKey.PortPlacesID_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.PortPlacesGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
예제 #2
0
        public void Update(HPS.BLL.PortPlacesBLL.BLLPortPlaces_T businessObject, HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

                SqlParameter PortPlaces_nvc = new SqlParameter();
                PortPlaces_nvc.ParameterName = "@PortPlaces_nvc";
                PortPlaces_nvc.SqlDbType     = SqlDbType.NVarChar;
                PortPlaces_nvc.Direction     = ParameterDirection.Input;
                PortPlaces_nvc.IsNullable    = false;
                PortPlaces_nvc.Value         = businessObject.PortPlaces_nvc;
                this.Command.Parameters.Add(PortPlaces_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_PortPlacesID_int = new SqlParameter();
                pk_PortPlacesID_int.ParameterName = "@pk_PortPlacesID_int";
                pk_PortPlacesID_int.SqlDbType     = SqlDbType.Int;
                pk_PortPlacesID_int.Direction     = ParameterDirection.Input;
                pk_PortPlacesID_int.IsNullable    = false;
                pk_PortPlacesID_int.Value         = businessObjectKey.PortPlacesID_int;
                this.Command.Parameters.Add(pk_PortPlacesID_int);



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

                this.Command.ExecuteNonQuery();

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
예제 #3
0
        private void EditButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys PortPlacesKey = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys();
            PortPlacesKey.PortPlacesID_int = (Int32?)this.PortPlacesGridView.CurrentRow.Cells["colPortPlacesID_int"].Value;
            PortPlacesEntityForm PortPlaces = new PortPlacesEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.PortPlacesGridView.DataSource, PortPlacesKey);

            PortPlaces.ShowDialog();
        }
예제 #4
0
        public HPS.BLL.PortPlacesBLL.BLLPortPlaces_T SelectByPrimaryKey(HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.PortPlacesBLL.BLLPortPlaces_T businessObject = new HPS.BLL.PortPlacesBLL.BLLPortPlaces_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.PortPlacesBLL.BLLPortPlaces_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.PortPlacesBLL.BLLPortPlaces_T GetBy(HPS.BLL.PortPlacesBLL.BLLPortPlaces_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.PortPlacesBLL.BLLPortPlaces_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.PortPlacesBLL.BLLPortPlaces_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_PortPlaces_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

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

                SqlParameter PortPlacesID_int = new SqlParameter();
                PortPlacesID_int.ParameterName = "@PortPlacesID_int";
                PortPlacesID_int.SqlDbType     = SqlDbType.Int;
                PortPlacesID_int.Direction     = ParameterDirection.Input;
                PortPlacesID_int.IsNullable    = false;
                PortPlacesID_int.Value         = businessObjectKey.PortPlacesID_int;
                this.Command.Parameters.Add(PortPlacesID_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.PortPlacesBLL.BLLPortPlaces_T businessObject, HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys businessObjectKey)
        {
            try
            {
                HPS.BLL.PortPlacesBLL.BLLPortPlaces_T tmpPortPlace = this.GetBy(businessObjectKey);
                List <string> Except = new List <string>();
                if (businessObject.PortPlacesID_int == businessObjectKey.PortPlacesID_int)
                {
                    Except.Add("UniquePortPlacesID_int");
                }
                if (businessObject.PortPlaces_nvc == tmpPortPlace.PortPlaces_nvc)
                {
                    Except.Add("UniquePortPlaces_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 PortPlacesEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.PortPlacesBLL.BLLPortPlaces_TKeys Key)
     : base(State, DataTable, Key)
 {
     InitializeComponent();
 }