Exemple #1
0
        protected override void Insert()
        {
            HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TFactory InfractionGroupFactory = new HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TFactory();
            try
            {
                HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T InfractionGroupEntity = new HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T();
                InfractionGroupEntity.InfractionGroup_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionGroup_nvcTextBox.Text, TypeCode.String).ToString();
                InfractionGroupEntity.Active_bit          = Active_bitCheckBox.Checked;

                InfractionGroupFactory.BeginProc();
                InfractionGroupFactory.Insert(InfractionGroupEntity);
                InfractionGroupFactory.CommitProc();
                if (DataTable != null)
                {
                    DataRow dr = this.DataTable.NewRow();
                    dr[HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T.InfractionGroup_TField.InfractionGroupID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionGroupEntity.InfractionGroupID_int, TypeCode.Int32);
                    dr[HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T.InfractionGroup_TField.InfractionGroup_nvc.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionGroupEntity.InfractionGroup_nvc, TypeCode.String);
                    dr[HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T.InfractionGroup_TField.Active_bit.ToString()]            = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionGroupEntity.Active_bit, TypeCode.Boolean);

                    DataTable.Rows.Add(dr);
                    DataTable.AcceptChanges();
                }
                this.ClearForm(this);
            }
            catch (Exception ex)
            {
                InfractionGroupFactory.RollBackProc();
                throw ex;
            }
        }
Exemple #2
0
        protected override void Edit()
        {
            HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TFactory InfractionGroupFactory = new HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TFactory();
            try
            {
                HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T InfractionGroupEntity = new HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T();
                InfractionGroupEntity.InfractionGroup_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionGroup_nvcTextBox.Text, TypeCode.String).ToString();
                InfractionGroupEntity.Active_bit          = Active_bitCheckBox.Checked;

                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    InfractionGroupFactory.BeginProc();
                    InfractionGroupFactory.Update(InfractionGroupEntity, (HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TKeys)Key);
                    InfractionGroupFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T.InfractionGroup_TField.InfractionGroupID_int.ToString() + "='" + ((HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TKeys)Key).InfractionGroupID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0][HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T.InfractionGroup_TField.InfractionGroup_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionGroupEntity.InfractionGroup_nvc, TypeCode.String);
                            dr[0][HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T.InfractionGroup_TField.Active_bit.ToString()]          = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(InfractionGroupEntity.Active_bit, TypeCode.Boolean);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                InfractionGroupFactory.RollBackProc();
                throw ex;
            }
        }
Exemple #3
0
        public void Insert(HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T businessObject)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

            this.Command.CommandText = "[sp_InfractionGroup_T_Add]";
            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.Output;
                InfractionGroupID_int.IsNullable    = false;
                InfractionGroupID_int.Value         = businessObject.InfractionGroupID_int;
                this.Command.Parameters.Add(InfractionGroupID_int);

                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);



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

                this.Command.ExecuteNonQuery();

                businessObject.InfractionGroupID_int = (Int32?)(this.Command.Parameters["@InfractionGroupID_int"].Value);

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex) {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Exemple #4
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;
            }
        }
Exemple #5
0
 protected override void ShowForm()
 {
     this.FillCombo();
     HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TFactory InfractionGroupFactory = new HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TFactory();
     HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T        InfractionGroupEntity  = InfractionGroupFactory.GetBy((HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_TKeys)Key);
     if (InfractionGroupEntity == null)
     {
         throw new HPS.Exceptions.InfractionGroupNotFound();
     }
     InfractionGroup_nvcTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionGroupEntity.InfractionGroup_nvc, TypeCode.String).ToString();
     Active_bitCheckBox.Checked      = (Boolean)Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionGroupEntity.Active_bit, TypeCode.Boolean);
 }
Exemple #6
0
        public List <HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T> list = new List <HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T>();

            while (dataReader.Read())
            {
                HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T businessObject = new HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
Exemple #7
0
        public void Insert(HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T businessObject)
        {
            try
            {
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "InfractionGroupID_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);
            }
        }
Exemple #8
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);
            }
        }
Exemple #9
0
 public void PopulateBusinessObjectFromReader(HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T businessObject, IDataReader dataReader)
 {
     businessObject.InfractionGroupID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T.InfractionGroup_TField.InfractionGroupID_int.ToString()));
     businessObject.InfractionGroup_nvc   = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T.InfractionGroup_TField.InfractionGroup_nvc.ToString()));
     businessObject.Active_bit            = dataReader.GetBoolean(dataReader.GetOrdinal(HPS.BLL.InfractionGroupBLL.BLLInfractionGroup_T.InfractionGroup_TField.Active_bit.ToString()));
 }