Ejemplo n.º 1
0
        public void Update(HPS.BLL.SaloonBLL.BLLSaloon_T businessObject, HPS.BLL.SaloonBLL.BLLSaloon_TKeys businessObjectKey)
        {
            try
            {
                if (businessObject.SaloonID_int == businessObjectKey.SaloonID_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueSaloonID_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);
            }
        }
Ejemplo n.º 2
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.SaloonBLL.BLLSaloon_TFactory SaloonFactory = new HPS.BLL.SaloonBLL.BLLSaloon_TFactory();
            HPS.BLL.SaloonBLL.BLLSaloon_TKeys    SaloonKey     = new HPS.BLL.SaloonBLL.BLLSaloon_TKeys();
            try
            {
                if (this.SaloonGridView.SelectedRows.Count > 0)
                {
                    if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false)
                    {
                        return;
                    }
                }

                SaloonKey.SaloonID_int = (Int32)SaloonGridView.SelectedRows[0].Cells["colSaloonID_int"].Value;

                SaloonFactory.Delete(SaloonKey);
                if ((DataTable)this.SaloonGridView.DataSource != null)
                {
                    DataRow[] dr = ((DataTable)this.SaloonGridView.DataSource).Select(HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.SaloonID_int.ToString() + "=" + SaloonKey.SaloonID_int.ToString() + "");
                    if (dr.Length > 0)
                    {
                        dr[0].Delete();
                    }
                    ((DataTable)this.SaloonGridView.DataSource).AcceptChanges();
                }
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Ejemplo n.º 3
0
        public HPS.BLL.SaloonBLL.BLLSaloon_T SelectByPrimaryKey(HPS.BLL.SaloonBLL.BLLSaloon_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.SaloonBLL.BLLSaloon_T businessObject = new HPS.BLL.SaloonBLL.BLLSaloon_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;
            }
        }
Ejemplo n.º 4
0
 public void GetBy(HPS.BLL.SaloonBLL.BLLSaloon_TKeys keys, ref System.Data.DataTable dataTable)
 {
     try
     {
         _dataObject.SelectByPrimaryKey(keys, ref dataTable);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Ejemplo n.º 5
0
 public HPS.BLL.SaloonBLL.BLLSaloon_T GetBy(HPS.BLL.SaloonBLL.BLLSaloon_TKeys keys)
 {
     try
     {
         return(_dataObject.SelectByPrimaryKey(keys));
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Ejemplo n.º 6
0
 public void Delete(HPS.BLL.SaloonBLL.BLLSaloon_TKeys keys)
 {
     try
     {
         _dataObject.Delete(keys);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Ejemplo n.º 7
0
        private void EditButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.SaloonBLL.BLLSaloon_TKeys SaloonKey = new HPS.BLL.SaloonBLL.BLLSaloon_TKeys();
            if (this.SaloonGridView.SelectedRows.Count > 0)
            {
                SaloonKey.SaloonID_int = (Int32)this.SaloonGridView.CurrentRow.Cells["colSaloonID_int"].Value;
            }
            SaloonEntityForm Saloon = new SaloonEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.SaloonGridView.DataSource, SaloonKey);

            Saloon.ShowDialog();
        }
Ejemplo n.º 8
0
        public void SelectByPrimaryKey(HPS.BLL.SaloonBLL.BLLSaloon_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_Saloon_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

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

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



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

                sqlDataAdapter.Fill(dataTable);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Ejemplo n.º 9
0
        public void Update(HPS.BLL.SaloonBLL.BLLSaloon_T businessObject, HPS.BLL.SaloonBLL.BLLSaloon_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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

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

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


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



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

                this.Command.ExecuteNonQuery();

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Ejemplo n.º 10
0
 public SaloonEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.SaloonBLL.BLLSaloon_TKeys Key)
     : base(State, DataTable, Key)
 {
     InitializeComponent();
 }