Example #1
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TFactory AnnouncementTimeFactory = new HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TFactory();

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


                HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TFactory AnnouncementTime_TFactory = new HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TFactory();
                HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TKeys    AnnouncementTimeKey       = new HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TKeys();

                AnnouncementTimeKey.AnnouncementTimeID_int = (Int32?)AnnouncementTimeGridView.CurrentRow.Cells["colAnnouncementTimeID_int"].Value;
                AnnouncementTimeFactory.Delete(AnnouncementTimeKey);

                DataRow[] dr = ((DataTable)this.AnnouncementTimeGridView.DataSource).Select(HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_T.AnnouncementTime_TField.AnnouncementTimeID_int.ToString() + "='" + AnnouncementTimeKey.AnnouncementTimeID_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.AnnouncementTimeGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Example #2
0
        private void EditButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TKeys AnnouncementTimeKey = new HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TKeys();
            AnnouncementTimeKey.AnnouncementTimeID_int = (Int32?)this.AnnouncementTimeGridView.CurrentRow.Cells["colAnnouncementTimeID_int"].Value;
            AnnouncementTimeEntityForm AnnouncementTime = new AnnouncementTimeEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.AnnouncementTimeGridView.DataSource, AnnouncementTimeKey);

            AnnouncementTime.ShowDialog();
        }
Example #3
0
        public HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_T SelectByPrimaryKey(HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_T businessObject = new HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_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 GetBy(HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_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);
     }
 }
Example #5
0
 public HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_T GetBy(HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TKeys keys)
 {
     try
     {
         return(_dataObject.SelectByPrimaryKey(keys));
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Example #6
0
 public void Delete(HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TKeys keys)
 {
     try
     {
         _dataObject.Delete(keys);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Example #7
0
        public void SelectByPrimaryKey(HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_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_AnnouncementTime_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

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

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



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

                sqlDataAdapter.Fill(dataTable);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Example #8
0
        public void Update(HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_T businessObject, HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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

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

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


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



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

                this.Command.ExecuteNonQuery();

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Example #9
0
 public AnnouncementTimeEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TKeys Key)
     : base(State, DataTable, Key)
 {
     InitializeComponent();
 }
Example #10
0
        public void Update(HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_T businessObject, HPS.BLL.AnnouncementTimeBLL.BLLAnnouncementTime_TKeys businessObjectKey)
        {
            try
            {
                if (businessObject.AnnouncementTimeID_int == businessObjectKey.AnnouncementTimeID_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueAnnouncementTimeID_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);
            }
        }