Exemplo n.º 1
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TFactory InfractionGroupFactory = new HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TFactory();

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


                HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TFactory InfractionGroup_TFactory = new HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TFactory();
                HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TKeys    InfractionGroupKey       = new HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TKeys();

                InfractionGroupKey.InfractionGroupID_int = (Int32?)InfractionGroupGridView.CurrentRow.Cells["colInfractionGroupID_int"].Value;
                InfractionGroupFactory.Delete(InfractionGroupKey);

                DataRow[] dr = ((DataTable)this.InfractionGroupGridView.DataSource).Select(HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T.InfractionGroup_TField.InfractionGroupID_int.ToString() + "='" + InfractionGroupKey.InfractionGroupID_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.InfractionGroupGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Exemplo n.º 2
0
        private void EditButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TKeys InfractionGroupKey = new HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TKeys();
            InfractionGroupKey.InfractionGroupID_int = (Int32?)this.InfractionGroupGridView.CurrentRow.Cells["colInfractionGroupID_int"].Value;
            InfractionGroupEntityForm InfractionGroup = new InfractionGroupEntityForm(BaseEntityForm1.enmState.Edit, (DataTable)this.InfractionGroupGridView.DataSource, InfractionGroupKey);

            InfractionGroup.ShowDialog();
        }
Exemplo n.º 3
0
        public HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T SelectByPrimaryKey(HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T businessObject = new HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_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.º 4
0
 public void GetBy(HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_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);
     }
 }
Exemplo n.º 5
0
 public HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T GetBy(HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TKeys keys)
 {
     try
     {
         return(_dataObject.SelectByPrimaryKey(keys));
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Exemplo n.º 6
0
 public void Delete(HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TKeys keys)
 {
     try
     {
         _dataObject.Delete(keys);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Exemplo n.º 7
0
        public void SelectByPrimaryKey(HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_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_InfractionGroup_T_SelectByPrimaryKey]";
            this.Command.CommandType = CommandType.StoredProcedure;

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

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



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

                sqlDataAdapter.Fill(dataTable);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex) {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Exemplo n.º 8
0
 public InfractionGroupEntityForm(Hepsa.Core.PL.BaseEntityParentForm.enmState State, DataTable DataTable, HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TKeys Key)
     : base(State, DataTable, Key)
 {
     InitializeComponent();
 }
Exemplo n.º 9
0
        public void Update(HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T businessObject, HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

                SqlParameter InfractionGroup_nvc = new SqlParameter();
                InfractionGroup_nvc.ParameterName = "@InfractionGroup_nvc";
                InfractionGroup_nvc.SqlDbType     = SqlDbType.NVarChar;
                InfractionGroup_nvc.Direction     = ParameterDirection.Input;
                InfractionGroup_nvc.IsNullable    = false;
                InfractionGroup_nvc.Value         = businessObject.InfractionGroup_nvc;
                this.Command.Parameters.Add(InfractionGroup_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_InfractionGroupID_int = new SqlParameter();
                pk_InfractionGroupID_int.ParameterName = "@pk_InfractionGroupID_int";
                pk_InfractionGroupID_int.SqlDbType     = SqlDbType.Int;
                pk_InfractionGroupID_int.Direction     = ParameterDirection.Input;
                pk_InfractionGroupID_int.IsNullable    = false;
                pk_InfractionGroupID_int.Value         = businessObjectKey.InfractionGroupID_int;
                this.Command.Parameters.Add(pk_InfractionGroupID_int);



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

                this.Command.ExecuteNonQuery();

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex) {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Exemplo n.º 10
0
        public void Update(HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T businessObject, HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TKeys businessObjectKey)
        {
            try
            {
                HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T tmpInfractionGroup = this.GetBy(businessObjectKey);
                List <string> Except = new List <string>();
                if (businessObject.InfractionGroupID_int == businessObjectKey.InfractionGroupID_int)
                {
                    Except.Add("UniqueInfractionGroupID_int");
                }
                if (businessObject.InfractionGroup_nvc == tmpInfractionGroup.InfractionGroup_nvc)
                {
                    Except.Add("UniqueInfractionGroup_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);
            }
        }