Пример #1
0
 public void PopulateBusinessObjectFromReader(HPS.BLL.SaloonBLL.BLLSaloon_T businessObject, IDataReader dataReader)
 {
     businessObject.SaloonID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.SaloonID_int.ToString()));
     businessObject.Saloon_nvc   = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.Saloon_nvc.ToString()));
     businessObject.TurnDistinictAfterCredit_int     = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.TurnDistinictAfterCredit_int.ToString()));
     businessObject.TurnNumberInLadeAnnouncement_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.TurnNumberInLadeAnnouncement_int.ToString()));
 }
Пример #2
0
        public void Update(HPS.BLL.SaloonBLL.BLLSaloon_T businessObject, HPS.BLL.SaloonBLL.BLLSaloon_TKeys businessObjectKey)
        {
            try
            {
                if (businessObject.SaloonID_int == businessObjectKey.SaloonID_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueSaloonID_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);
            }
        }
Пример #3
0
        protected override void ShowForm()
        {
            HPS.BLL.SaloonBLL.BLLSaloon_TFactory SaloonFactory = new HPS.BLL.SaloonBLL.BLLSaloon_TFactory();
            HPS.BLL.SaloonBLL.BLLSaloon_T        SaloonEntity  = SaloonFactory.GetBy((HPS.BLL.SaloonBLL.BLLSaloon_TKeys)Key);

            this.FillListBox();

            if (SaloonEntity == null)
            {
                throw new Exceptions.SaloonNotFound();
            }
            Saloon_nvcTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(SaloonEntity.Saloon_nvc, TypeCode.String).ToString();
            TurnDistinictAfterCredit_intNumericTextBox.Text     = Hepsa.Core.Common.PersentationController.GetEntityValue(SaloonEntity.TurnDistinictAfterCredit_int, TypeCode.Int32).ToString();
            TurnNumberInLadeAnnouncement_intNumericTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(SaloonEntity.TurnNumberInLadeAnnouncement_int, TypeCode.Int32).ToString();
            HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory LaderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory();
            List <HPS.BLL.LaderTypeBLL.BLLLaderType_T> LaderTypeList    = LaderTypeFactory.GetAllBy(HPS.BLL.LaderTypeBLL.BLLLaderType_T.LaderType_TField.SaloonID_int, SaloonEntity.SaloonID_int);

            if (LaderTypeList != null && LaderTypeList.Count > 0)
            {
                for (int i = 0; i < lstLaderTypeCheckBox.Items.Count; i++)
                {
                    if (LaderTypeList.FindAll(c => c.LaderTypeID_int == (((HPS.BLL.LaderTypeBLL.BLLLaderType_T) this.lstLaderTypeCheckBox.Items[i]).LaderTypeID_int)).Count > 0)
                    {
                        this.lstLaderTypeCheckBox.SetItemChecked(i, true);
                    }
                    else
                    {
                        this.lstLaderTypeCheckBox.SetItemChecked(i, false);
                    }
                }
            }
        }
Пример #4
0
        public HPS.BLL.SaloonBLL.BLLSaloon_T SelectByPrimaryKey(HPS.BLL.SaloonBLL.BLLSaloon_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.SaloonBLL.BLLSaloon_T businessObject = new HPS.BLL.SaloonBLL.BLLSaloon_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;
            }
        }
Пример #5
0
        protected override void Edit()
        {
            HPS.BLL.SaloonBLL.BLLSaloon_TFactory SaloonFactory = new HPS.BLL.SaloonBLL.BLLSaloon_TFactory();
            try
            {
                HPS.BLL.SaloonBLL.BLLSaloon_T SaloonEntity = new HPS.BLL.SaloonBLL.BLLSaloon_T();
                SaloonEntity.SaloonID_int = ((HPS.BLL.SaloonBLL.BLLSaloon_TKeys)Key).SaloonID_int;
                SaloonEntity.Saloon_nvc   = Hepsa.Core.Common.PersentationController.GetEntityValue(Saloon_nvcTextBox.Text, TypeCode.String).ToString();
                SaloonEntity.TurnDistinictAfterCredit_int     = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(TurnDistinictAfterCredit_intNumericTextBox.NumericText, TypeCode.Int32);
                SaloonEntity.TurnNumberInLadeAnnouncement_int = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(TurnNumberInLadeAnnouncement_intNumericTextBox.NumericText, TypeCode.Int32);


                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    SaloonFactory.BeginProc();
                    SaloonFactory.Update(SaloonEntity, (HPS.BLL.SaloonBLL.BLLSaloon_TKeys)Key);
                    HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory LaderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory();
                    HPS.BLL.LaderTypeBLL.BLLLaderType_TKeys    LaderTypeKey     = new HPS.BLL.LaderTypeBLL.BLLLaderType_TKeys();
                    foreach (HPS.BLL.LaderTypeBLL.BLLLaderType_T item in LaderTypeFactory.GetAllBy(BLL.LaderTypeBLL.BLLLaderType_T.LaderType_TField.SaloonID_int, SaloonEntity.SaloonID_int))
                    {
                        item.SaloonID_int            = null;
                        LaderTypeKey.LaderTypeID_int = item.LaderTypeID_int;
                        LaderTypeFactory.Update(item, LaderTypeKey);
                    }
                    foreach (HPS.BLL.LaderTypeBLL.BLLLaderType_T item in lstLaderTypeCheckBox.CheckedItems)
                    {
                        item.SaloonID_int            = SaloonEntity.SaloonID_int;
                        LaderTypeKey.LaderTypeID_int = item.LaderTypeID_int;
                        LaderTypeFactory.Update(item, LaderTypeKey);
                    }
                    //for (int i = 0; i < lstLaderTypeCheckBox.CheckedItems.Count; i++)
                    //{
                    //    ((HPS.BLL.LaderTypeBLL.BLLLaderType_T)this.lstLaderTypeCheckBox.CheckedItems[i]).SaloonID_int = SaloonEntity.SaloonID_int;
                    //    LaderTypeKey.LaderTypeID_int = ((HPS.BLL.LaderTypeBLL.BLLLaderType_T)this.lstLaderTypeCheckBox.CheckedItems[i]).LaderTypeID_int;
                    //    LaderTypeFactory.Update(((HPS.BLL.LaderTypeBLL.BLLLaderType_T)this.lstLaderTypeCheckBox.CheckedItems[i]), LaderTypeKey);
                    //}
                    SaloonFactory.CommitProc();

                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.SaloonID_int.ToString() + " = " + ((HPS.BLL.SaloonBLL.BLLSaloon_TKeys)Key).SaloonID_int.ToString() + "");
                        if (dr.Length > 0)
                        {
                            dr[0][HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.SaloonID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(SaloonEntity.SaloonID_int, TypeCode.Int32);
                            dr[0][HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.Saloon_nvc.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(SaloonEntity.Saloon_nvc, TypeCode.String);
                            dr[0][HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.TurnDistinictAfterCredit_int.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(SaloonEntity.TurnDistinictAfterCredit_int, TypeCode.Int32);
                            dr[0][HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.TurnNumberInLadeAnnouncement_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(SaloonEntity.TurnNumberInLadeAnnouncement_int, TypeCode.Int32);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                SaloonFactory.RollBackProc();
                throw ex;
            }
        }
Пример #6
0
        public List <HPS.BLL.SaloonBLL.BLLSaloon_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.SaloonBLL.BLLSaloon_T> list = new List <HPS.BLL.SaloonBLL.BLLSaloon_T>();

            while (dataReader.Read())
            {
                HPS.BLL.SaloonBLL.BLLSaloon_T businessObject = new HPS.BLL.SaloonBLL.BLLSaloon_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
Пример #7
0
        public void Insert(HPS.BLL.SaloonBLL.BLLSaloon_T businessObject)
        {
            try
            {
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "SaloonID_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);
            }
        }
Пример #8
0
        protected override void Insert()
        {
            HPS.BLL.SaloonBLL.BLLSaloon_TFactory SaloonFactory = new HPS.BLL.SaloonBLL.BLLSaloon_TFactory();
            try
            {
                HPS.BLL.SaloonBLL.BLLSaloon_T SaloonEntity = new HPS.BLL.SaloonBLL.BLLSaloon_T();
                SaloonEntity.Saloon_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(Saloon_nvcTextBox.Text, TypeCode.String).ToString();
                SaloonEntity.TurnDistinictAfterCredit_int     = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(TurnDistinictAfterCredit_intNumericTextBox.NumericText, TypeCode.Int32);
                SaloonEntity.TurnNumberInLadeAnnouncement_int = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(TurnNumberInLadeAnnouncement_intNumericTextBox.NumericText, TypeCode.Int32);

                SaloonFactory.BeginProc();
                SaloonFactory.Insert(SaloonEntity);
                HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory LaderTypeFactory = new HPS.BLL.LaderTypeBLL.BLLLaderType_TFactory();
                HPS.BLL.LaderTypeBLL.BLLLaderType_TKeys    LaderTypeKey     = new HPS.BLL.LaderTypeBLL.BLLLaderType_TKeys();

                for (int i = 0; i < lstLaderTypeCheckBox.CheckedItems.Count; i++)
                {
                    ((HPS.BLL.LaderTypeBLL.BLLLaderType_T) this.lstLaderTypeCheckBox.CheckedItems[i]).SaloonID_int = SaloonEntity.SaloonID_int;
                    LaderTypeKey.LaderTypeID_int = ((HPS.BLL.LaderTypeBLL.BLLLaderType_T) this.lstLaderTypeCheckBox.CheckedItems[i]).LaderTypeID_int;
                    LaderTypeFactory.Update(((HPS.BLL.LaderTypeBLL.BLLLaderType_T) this.lstLaderTypeCheckBox.CheckedItems[i]), LaderTypeKey);
                }

                SaloonFactory.CommitProc();

                if (DataTable != null)
                {
                    DataRow dr = this.DataTable.NewRow();
                    dr[HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.SaloonID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(SaloonEntity.SaloonID_int, TypeCode.Int32);
                    dr[HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.Saloon_nvc.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(SaloonEntity.Saloon_nvc, TypeCode.String);
                    dr[HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.TurnDistinictAfterCredit_int.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(SaloonEntity.TurnDistinictAfterCredit_int, TypeCode.Int32);
                    dr[HPS.BLL.SaloonBLL.BLLSaloon_T.Saloon_TField.TurnNumberInLadeAnnouncement_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(SaloonEntity.TurnNumberInLadeAnnouncement_int, TypeCode.Int32);

                    DataTable.Rows.Add(dr);
                    DataTable.AcceptChanges();
                }
                this.ClearForm(this);
            }
            catch (Exception ex)
            {
                SaloonFactory.RollBackProc();
                throw ex;
            }
        }
Пример #9
0
        public void Update(HPS.BLL.SaloonBLL.BLLSaloon_T businessObject, HPS.BLL.SaloonBLL.BLLSaloon_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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

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

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


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



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

                this.Command.ExecuteNonQuery();

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