Exemple #1
0
        protected override void Edit()
        {
            HPS.BLL.TrafficTypeBLL.BLLTrafficType_TFactory TrafficTypeFactory = new HPS.BLL.TrafficTypeBLL.BLLTrafficType_TFactory();
            try
            {
                HPS.BLL.TrafficTypeBLL.BLLTrafficType_T TrafficTypeEntity = new HPS.BLL.TrafficTypeBLL.BLLTrafficType_T();
                TrafficTypeEntity.TrafficType_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficType_nvcTextBox.Text, TypeCode.String).ToString();


                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    TrafficTypeFactory.BeginProc();
                    TrafficTypeFactory.Update(TrafficTypeEntity, (HPS.BLL.TrafficTypeBLL.BLLTrafficType_TKeys)Key);
                    TrafficTypeFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.TrafficTypeBLL.BLLTrafficType_T.TrafficType_TField.TrafficTypeID_int.ToString() + "='" + ((HPS.BLL.TrafficTypeBLL.BLLTrafficType_TKeys)Key).TrafficTypeID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0][HPS.BLL.TrafficTypeBLL.BLLTrafficType_T.TrafficType_TField.TrafficType_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(TrafficTypeEntity.TrafficType_nvc, TypeCode.String);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                TrafficTypeFactory.RollBackProc();
                throw ex;
            }
        }
Exemple #2
0
        protected override void Insert()
        {
            HPS.BLL.TrafficTypeBLL.BLLTrafficType_TFactory TrafficTypeFactory = new HPS.BLL.TrafficTypeBLL.BLLTrafficType_TFactory();
            try
            {
                HPS.BLL.TrafficTypeBLL.BLLTrafficType_T TrafficTypeEntity = new HPS.BLL.TrafficTypeBLL.BLLTrafficType_T();
                TrafficTypeEntity.TrafficType_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficType_nvcTextBox.Text, TypeCode.String).ToString();

                TrafficTypeFactory.BeginProc();
                TrafficTypeFactory.Insert(TrafficTypeEntity);
                TrafficTypeFactory.CommitProc();
                if (DataTable != null)
                {
                    DataRow dr = this.DataTable.NewRow();
                    dr[HPS.BLL.TrafficTypeBLL.BLLTrafficType_T.TrafficType_TField.TrafficTypeID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(TrafficTypeEntity.TrafficTypeID_int, TypeCode.Int32);
                    dr[HPS.BLL.TrafficTypeBLL.BLLTrafficType_T.TrafficType_TField.TrafficType_nvc.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(TrafficTypeEntity.TrafficType_nvc, TypeCode.String);

                    DataTable.Rows.Add(dr);
                    DataTable.AcceptChanges();
                }
                this.ClearForm(this);
            }
            catch (Exception ex)
            {
                TrafficTypeFactory.RollBackProc();
                throw ex;
            }
        }
Exemple #3
0
        public HPS.BLL.TrafficTypeBLL.BLLTrafficType_T SelectByPrimaryKey(HPS.BLL.TrafficTypeBLL.BLLTrafficType_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.TrafficTypeBLL.BLLTrafficType_T businessObject = new HPS.BLL.TrafficTypeBLL.BLLTrafficType_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 #4
0
        public List <HPS.BLL.TrafficTypeBLL.BLLTrafficType_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.TrafficTypeBLL.BLLTrafficType_T> list = new List <HPS.BLL.TrafficTypeBLL.BLLTrafficType_T>();

            while (dataReader.Read())
            {
                HPS.BLL.TrafficTypeBLL.BLLTrafficType_T businessObject = new HPS.BLL.TrafficTypeBLL.BLLTrafficType_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
Exemple #5
0
        protected override void ShowForm()
        {
            this.FillCombo();
            HPS.BLL.TrafficTypeBLL.BLLTrafficType_TFactory TrafficTypeFactory = new HPS.BLL.TrafficTypeBLL.BLLTrafficType_TFactory();
            HPS.BLL.TrafficTypeBLL.BLLTrafficType_T        TrafficTypeEntity  = TrafficTypeFactory.GetBy((HPS.BLL.TrafficTypeBLL.BLLTrafficType_TKeys)Key);
            if (TrafficTypeEntity == null)
            {
                throw new HPS.Exceptions.TrafficTypeNotFound();
            }

            TrafficType_nvcTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(TrafficTypeEntity.TrafficType_nvc, TypeCode.String).ToString();
        }
Exemple #6
0
        public void Insert(HPS.BLL.TrafficTypeBLL.BLLTrafficType_T businessObject)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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

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



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

                this.Command.ExecuteNonQuery();

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

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Exemple #7
0
        public void Insert(HPS.BLL.TrafficTypeBLL.BLLTrafficType_T businessObject)
        {
            try
            {
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "TrafficTypeID_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.TrafficTypeBLL.BLLTrafficType_T businessObject, HPS.BLL.TrafficTypeBLL.BLLTrafficType_TKeys businessObjectKey)
        {
            try
            {
                HPS.BLL.TrafficTypeBLL.BLLTrafficType_T tmpTrafficType = this.GetBy(businessObjectKey);
                List <string> Except = new List <string>();
                if (businessObject.TrafficTypeID_int == businessObjectKey.TrafficTypeID_int)
                {
                    Except.Add("UniqueTrafficTypeID_int");
                }
                if (businessObject.TrafficType_nvc == tmpTrafficType.TrafficType_nvc)
                {
                    Except.Add("UniqueTrafficType_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.TrafficTypeBLL.BLLTrafficType_T businessObject, IDataReader dataReader)
 {
     businessObject.TrafficTypeID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.TrafficTypeBLL.BLLTrafficType_T.TrafficType_TField.TrafficTypeID_int.ToString()));
     businessObject.TrafficType_nvc   = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.TrafficTypeBLL.BLLTrafficType_T.TrafficType_TField.TrafficType_nvc.ToString()));
 }