Example #1
0
        public void PopulateBusinessObjectFromReader(HPS.BLL.ChargePriceBLL.BLLChargePrice_T businessObject, IDataReader dataReader)
        {
            businessObject.ChargePriceID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.ChargePriceID_int.ToString()));
            businessObject.DriverID_bint     = dataReader.GetInt64(dataReader.GetOrdinal(HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.DriverID_bint.ToString()));
            businessObject.DriverName_nvc    = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.DriverName_nvc.ToString()));
            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.DriverCardNumber_nvc.ToString())) == false)
            {
                businessObject.DriverCardNumber_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.DriverCardNumber_nvc.ToString()));
            }
            else
            {
                businessObject.DriverCardNumber_nvc = String.Empty;
            }

            businessObject.Price_dec    = dataReader.GetDecimal(dataReader.GetOrdinal(HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.Price_dec.ToString()));
            businessObject.Date_nvc     = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.Date_nvc.ToString()));
            businessObject.Time_nvc     = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.Time_nvc.ToString()));
            businessObject.UserName_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.UserName_nvc.ToString()));
            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.Description_nvc.ToString())) == false)
            {
                businessObject.Description_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.Description_nvc.ToString()));
            }
            else
            {
                businessObject.Description_nvc = String.Empty;
            }
        }
Example #2
0
        public void Update(HPS.BLL.ChargePriceBLL.BLLChargePrice_T businessObject, HPS.BLL.ChargePriceBLL.BLLChargePrice_TKeys businessObjectKey)
        {
            try
            {
                if (businessObject.ChargePriceID_int == businessObjectKey.ChargePriceID_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueChargePriceID_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);
            }
        }
Example #3
0
        public HPS.BLL.ChargePriceBLL.BLLChargePrice_T SelectByPrimaryKey(HPS.BLL.ChargePriceBLL.BLLChargePrice_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.ChargePriceBLL.BLLChargePrice_T businessObject = new HPS.BLL.ChargePriceBLL.BLLChargePrice_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 List <HPS.BLL.ChargePriceBLL.BLLChargePrice_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.ChargePriceBLL.BLLChargePrice_T> list = new List <HPS.BLL.ChargePriceBLL.BLLChargePrice_T>();

            while (dataReader.Read())
            {
                HPS.BLL.ChargePriceBLL.BLLChargePrice_T businessObject = new HPS.BLL.ChargePriceBLL.BLLChargePrice_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
Example #5
0
        public void Insert(HPS.BLL.ChargePriceBLL.BLLChargePrice_T businessObject)
        {
            try{
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "ChargePriceID_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);
            }
        }
Example #6
0
 protected override void ShowForm()
 {
     this.FillCombo();
     HPS.BLL.ChargePriceBLL.BLLChargePrice_TFactory ChargePriceFactory = new HPS.BLL.ChargePriceBLL.BLLChargePrice_TFactory();
     HPS.BLL.ChargePriceBLL.BLLChargePrice_T        ChargePriceEntity  = ChargePriceFactory.GetBy((HPS.BLL.ChargePriceBLL.BLLChargePrice_TKeys)Key);
     if (ChargePriceEntity == null)
     {
         throw new HPS.Exceptions.ChargePriceNotFound();
     }
     Hepsa.Core.Common.PersentationController.SetComboBoxValue(ref DriverID_bintComboBox, ChargePriceEntity.DriverID_bint, TypeCode.Int64);
     DriverName_nvcTextBox.Text       = Hepsa.Core.Common.PersentationController.GetEntityValue(ChargePriceEntity.DriverName_nvc, TypeCode.String).ToString();
     DriverCardNumber_nvcTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(ChargePriceEntity.DriverCardNumber_nvc, TypeCode.String).ToString();
     Price_decNumericTextBox.Text     = Hepsa.Core.Common.PersentationController.GetEntityValue(ChargePriceEntity.Price_dec, TypeCode.Decimal).ToString();
     Date_nvcTextBox.Text             = Hepsa.Core.Common.PersentationController.GetEntityValue(ChargePriceEntity.Date_nvc, TypeCode.String).ToString();
     Time_nvcTextBox.Text             = Hepsa.Core.Common.PersentationController.GetEntityValue(ChargePriceEntity.Time_nvc, TypeCode.String).ToString();
     UserName_nvcTextBox.Text         = Hepsa.Core.Common.PersentationController.GetEntityValue(ChargePriceEntity.UserName_nvc, TypeCode.String).ToString();
     Description_nvcTextBox.Text      = Hepsa.Core.Common.PersentationController.GetEntityValue(ChargePriceEntity.Description_nvc, TypeCode.String).ToString();
 }
Example #7
0
        protected override void Edit()
        {
            HPS.BLL.ChargePriceBLL.BLLChargePrice_TFactory ChargePriceFactory = new HPS.BLL.ChargePriceBLL.BLLChargePrice_TFactory();
            try
            {
                HPS.BLL.ChargePriceBLL.BLLChargePrice_T ChargePriceEntity = new HPS.BLL.ChargePriceBLL.BLLChargePrice_T();
                ChargePriceEntity.DriverID_bint        = (Int64?)Hepsa.Core.Common.PersentationController.GetEntityValue(DriverID_bintComboBox.SelectedValue, TypeCode.Int64);
                ChargePriceEntity.DriverName_nvc       = Hepsa.Core.Common.PersentationController.GetEntityValue(DriverName_nvcTextBox.Text, TypeCode.String).ToString();
                ChargePriceEntity.DriverCardNumber_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(DriverCardNumber_nvcTextBox.Text, TypeCode.String).ToString();
                ChargePriceEntity.Price_dec            = (Nullable <Decimal>)Hepsa.Core.Common.PersentationController.GetEntityValue(Price_decNumericTextBox.NumericText, TypeCode.Decimal);
                ChargePriceEntity.Date_nvc             = Hepsa.Core.Common.PersentationController.GetEntityValue(Date_nvcTextBox.Text, TypeCode.String).ToString();
                ChargePriceEntity.Time_nvc             = Hepsa.Core.Common.PersentationController.GetEntityValue(Time_nvcTextBox.Text, TypeCode.String).ToString();
                ChargePriceEntity.UserName_nvc         = Hepsa.Core.Common.PersentationController.GetEntityValue(UserName_nvcTextBox.Text, TypeCode.String).ToString();
                ChargePriceEntity.Description_nvc      = Hepsa.Core.Common.PersentationController.GetEntityValue(Description_nvcTextBox.Text, TypeCode.String).ToString();

                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    ChargePriceFactory.BeginProc();
                    ChargePriceFactory.Update(ChargePriceEntity, (HPS.BLL.ChargePriceBLL.BLLChargePrice_TKeys)Key);
                    ChargePriceFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.ChargePriceID_int.ToString() + "='" + ((HPS.BLL.ChargePriceBLL.BLLChargePrice_TKeys)Key).ChargePriceID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0]["DriverID_bintFirstName_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(DriverID_bintComboBox);
                            dr[0][HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.DriverName_nvc.ToString()]       = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ChargePriceEntity.DriverName_nvc, TypeCode.String);
                            dr[0][HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.DriverCardNumber_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ChargePriceEntity.DriverCardNumber_nvc, TypeCode.String);
                            dr[0][HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.Price_dec.ToString()]            = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ChargePriceEntity.Price_dec, TypeCode.Decimal);
                            dr[0][HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.Date_nvc.ToString()]             = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ChargePriceEntity.Date_nvc, TypeCode.String);
                            dr[0][HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.Time_nvc.ToString()]             = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ChargePriceEntity.Time_nvc, TypeCode.String);
                            dr[0][HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.UserName_nvc.ToString()]         = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ChargePriceEntity.UserName_nvc, TypeCode.String);
                            dr[0][HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.Description_nvc.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ChargePriceEntity.Description_nvc, TypeCode.String);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                ChargePriceFactory.RollBackProc();
                throw ex;
            }
        }
Example #8
0
        protected override void Insert()
        {
            HPS.BLL.ChargePriceBLL.BLLChargePrice_TFactory ChargePriceFactory = new HPS.BLL.ChargePriceBLL.BLLChargePrice_TFactory();
            try
            {
                HPS.BLL.ChargePriceBLL.BLLChargePrice_T ChargePriceEntity = new HPS.BLL.ChargePriceBLL.BLLChargePrice_T();
                ChargePriceEntity.DriverID_bint        = (Int64?)Hepsa.Core.Common.PersentationController.GetEntityValue(DriverID_bintComboBox.SelectedValue, TypeCode.Int64);
                ChargePriceEntity.DriverName_nvc       = Hepsa.Core.Common.PersentationController.GetEntityValue(DriverName_nvcTextBox.Text, TypeCode.String).ToString();
                ChargePriceEntity.DriverCardNumber_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(DriverCardNumber_nvcTextBox.Text, TypeCode.String).ToString();
                ChargePriceEntity.Price_dec            = (Nullable <Decimal>)Hepsa.Core.Common.PersentationController.GetEntityValue(Price_decNumericTextBox.NumericText, TypeCode.Decimal);
                ChargePriceEntity.Date_nvc             = Hepsa.Core.Common.PersentationController.GetEntityValue(Date_nvcTextBox.Text, TypeCode.String).ToString();
                ChargePriceEntity.Time_nvc             = Hepsa.Core.Common.PersentationController.GetEntityValue(Time_nvcTextBox.Text, TypeCode.String).ToString();
                ChargePriceEntity.UserName_nvc         = Hepsa.Core.Common.PersentationController.GetEntityValue(UserName_nvcTextBox.Text, TypeCode.String).ToString();
                ChargePriceEntity.Description_nvc      = Hepsa.Core.Common.PersentationController.GetEntityValue(Description_nvcTextBox.Text, TypeCode.String).ToString();

                ChargePriceFactory.BeginProc();
                ChargePriceFactory.Insert(ChargePriceEntity);
                ChargePriceFactory.CommitProc();
                if (DataTable != null)
                {
                    DataRow dr = this.DataTable.NewRow();
                    dr[HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.ChargePriceID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ChargePriceEntity.ChargePriceID_int, TypeCode.Int32);
                    dr[HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.DriverID_bint.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ChargePriceEntity.DriverID_bint, TypeCode.Int64);
                    dr["DriverID_bintFirstName_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(DriverID_bintComboBox);
                    dr[HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.DriverName_nvc.ToString()]       = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ChargePriceEntity.DriverName_nvc, TypeCode.String);
                    dr[HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.DriverCardNumber_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ChargePriceEntity.DriverCardNumber_nvc, TypeCode.String);
                    dr[HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.Price_dec.ToString()]            = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ChargePriceEntity.Price_dec, TypeCode.Decimal);
                    dr[HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.Date_nvc.ToString()]             = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ChargePriceEntity.Date_nvc, TypeCode.String);
                    dr[HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.Time_nvc.ToString()]             = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ChargePriceEntity.Time_nvc, TypeCode.String);
                    dr[HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.UserName_nvc.ToString()]         = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ChargePriceEntity.UserName_nvc, TypeCode.String);
                    dr[HPS.BLL.ChargePriceBLL.BLLChargePrice_T.ChargePrice_TField.Description_nvc.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ChargePriceEntity.Description_nvc, TypeCode.String);

                    DataTable.Rows.Add(dr);
                    DataTable.AcceptChanges();
                }
                this.ClearForm(this);
            }
            catch (Exception ex)
            {
                ChargePriceFactory.RollBackProc();
                throw ex;
            }
        }
Example #9
0
        public void Insert(HPS.BLL.ChargePriceBLL.BLLChargePrice_T businessObject)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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

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

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

                SqlParameter DriverCardNumber_nvc = new SqlParameter();
                DriverCardNumber_nvc.ParameterName = "@DriverCardNumber_nvc";
                DriverCardNumber_nvc.SqlDbType     = SqlDbType.NVarChar;
                DriverCardNumber_nvc.Direction     = ParameterDirection.Input;
                DriverCardNumber_nvc.IsNullable    = true;
                if (String.IsNullOrEmpty(businessObject.DriverCardNumber_nvc))
                {
                    DriverCardNumber_nvc.Value = DBNull.Value;
                }
                else
                {
                    DriverCardNumber_nvc.Value = businessObject.DriverCardNumber_nvc;
                }
                this.Command.Parameters.Add(DriverCardNumber_nvc);

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

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

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

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

                SqlParameter Description_nvc = new SqlParameter();
                Description_nvc.ParameterName = "@Description_nvc";
                Description_nvc.SqlDbType     = SqlDbType.NVarChar;
                Description_nvc.Direction     = ParameterDirection.Input;
                Description_nvc.IsNullable    = true;
                if (String.IsNullOrEmpty(businessObject.Description_nvc))
                {
                    Description_nvc.Value = DBNull.Value;
                }
                else
                {
                    Description_nvc.Value = businessObject.Description_nvc;
                }
                this.Command.Parameters.Add(Description_nvc);



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

                this.Command.ExecuteNonQuery();

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

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex) {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }