예제 #1
0
 public void PopulateBusinessObjectFromReader(HPS.BLL.ProvinceBLL.BLLProvince_T businessObject, IDataReader dataReader)
 {
     businessObject.Province_int     = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.ProvinceBLL.BLLProvince_T.Province_TField.Province_int.ToString()));
     businessObject.ProvinceCode_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.ProvinceBLL.BLLProvince_T.Province_TField.ProvinceCode_nvc.ToString()));
     businessObject.Province_nvc     = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.ProvinceBLL.BLLProvince_T.Province_TField.Province_nvc.ToString()));
     businessObject.Active_bit       = dataReader.GetBoolean(dataReader.GetOrdinal(HPS.BLL.ProvinceBLL.BLLProvince_T.Province_TField.Active_bit.ToString()));
 }
예제 #2
0
        public void Update(HPS.BLL.ProvinceBLL.BLLProvince_T businessObject, HPS.BLL.ProvinceBLL.BLLProvince_TKeys businessObjectKey)
        {
            try
            {
                if (businessObject.Province_int == businessObjectKey.Province_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueProvince_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 Edit()
        {
            HPS.BLL.ProvinceBLL.BLLProvince_TFactory ProvinceFactory = new HPS.BLL.ProvinceBLL.BLLProvince_TFactory();
            try
            {
                HPS.BLL.ProvinceBLL.BLLProvince_T ProvinceEntity = new HPS.BLL.ProvinceBLL.BLLProvince_T();
                ProvinceEntity.ProvinceCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(ProvinceCode_nvcTextBox.Text, TypeCode.String).ToString();
                ProvinceEntity.Province_nvc     = Hepsa.Core.Common.PersentationController.GetEntityValue(Province_nvcTextBox.Text, TypeCode.String).ToString();
                ProvinceEntity.Active_bit       = Active_bitCheckBox.Checked;

                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    ProvinceFactory.BeginProc();
                    ProvinceFactory.Update(ProvinceEntity, (HPS.BLL.ProvinceBLL.BLLProvince_TKeys)Key);
                    ProvinceFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.ProvinceBLL.BLLProvince_T.Province_TField.Province_int.ToString() + "='" + ((HPS.BLL.ProvinceBLL.BLLProvince_TKeys)Key).Province_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0][HPS.BLL.ProvinceBLL.BLLProvince_T.Province_TField.ProvinceCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ProvinceEntity.ProvinceCode_nvc, TypeCode.String);
                            dr[0][HPS.BLL.ProvinceBLL.BLLProvince_T.Province_TField.Province_nvc.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ProvinceEntity.Province_nvc, TypeCode.String);
                            dr[0][HPS.BLL.ProvinceBLL.BLLProvince_T.Province_TField.Active_bit.ToString()]       = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ProvinceEntity.Active_bit, TypeCode.Boolean);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                ProvinceFactory.RollBackProc();
                throw ex;
            }
        }
예제 #4
0
        protected override void Insert()
        {
            HPS.BLL.ProvinceBLL.BLLProvince_TFactory ProvinceFactory = new HPS.BLL.ProvinceBLL.BLLProvince_TFactory();
            try
            {
                HPS.BLL.ProvinceBLL.BLLProvince_T ProvinceEntity = new HPS.BLL.ProvinceBLL.BLLProvince_T();
                ProvinceEntity.ProvinceCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(ProvinceCode_nvcTextBox.Text, TypeCode.String).ToString();
                ProvinceEntity.Province_nvc     = Hepsa.Core.Common.PersentationController.GetEntityValue(Province_nvcTextBox.Text, TypeCode.String).ToString();
                ProvinceEntity.Active_bit       = Active_bitCheckBox.Checked;

                ProvinceFactory.BeginProc();
                ProvinceFactory.Insert(ProvinceEntity);
                ProvinceFactory.CommitProc();
                if (DataTable != null)
                {
                    DataRow dr = this.DataTable.NewRow();
                    dr[HPS.BLL.ProvinceBLL.BLLProvince_T.Province_TField.Province_int.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ProvinceEntity.Province_int, TypeCode.Int32);
                    dr[HPS.BLL.ProvinceBLL.BLLProvince_T.Province_TField.ProvinceCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ProvinceEntity.ProvinceCode_nvc, TypeCode.String);
                    dr[HPS.BLL.ProvinceBLL.BLLProvince_T.Province_TField.Province_nvc.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ProvinceEntity.Province_nvc, TypeCode.String);
                    dr[HPS.BLL.ProvinceBLL.BLLProvince_T.Province_TField.Active_bit.ToString()]       = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(ProvinceEntity.Active_bit, TypeCode.Boolean);

                    DataTable.Rows.Add(dr);
                    DataTable.AcceptChanges();
                }
                this.ClearForm(this);
            }
            catch (Exception ex)
            {
                ProvinceFactory.RollBackProc();
                throw ex;
            }
        }
예제 #5
0
        public HPS.BLL.ProvinceBLL.BLLProvince_T SelectByPrimaryKey(HPS.BLL.ProvinceBLL.BLLProvince_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.ProvinceBLL.BLLProvince_T businessObject = new HPS.BLL.ProvinceBLL.BLLProvince_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;
            }
        }
예제 #6
0
        public List <HPS.BLL.ProvinceBLL.BLLProvince_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.ProvinceBLL.BLLProvince_T> list = new List <HPS.BLL.ProvinceBLL.BLLProvince_T>();

            while (dataReader.Read())
            {
                HPS.BLL.ProvinceBLL.BLLProvince_T businessObject = new HPS.BLL.ProvinceBLL.BLLProvince_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
예제 #7
0
 protected override void ShowForm()
 {
     this.FillCombo();
     HPS.BLL.ProvinceBLL.BLLProvince_TFactory ProvinceFactory = new HPS.BLL.ProvinceBLL.BLLProvince_TFactory();
     HPS.BLL.ProvinceBLL.BLLProvince_T        ProvinceEntity  = ProvinceFactory.GetBy((HPS.BLL.ProvinceBLL.BLLProvince_TKeys)Key);
     if (ProvinceEntity == null)
     {
         throw new HPS.Exceptions.ProvinceNotFound();
     }
     ProvinceCode_nvcTextBox.Text = Hepsa.Core.Common.PersentationController.GetEntityValue(ProvinceEntity.ProvinceCode_nvc, TypeCode.String).ToString();
     Province_nvcTextBox.Text     = Hepsa.Core.Common.PersentationController.GetEntityValue(ProvinceEntity.Province_nvc, TypeCode.String).ToString();
     Active_bitCheckBox.Checked   = (Boolean)Hepsa.Core.Common.PersentationController.GetEntityValue(ProvinceEntity.Active_bit, TypeCode.Boolean);
 }
예제 #8
0
        public void Insert(HPS.BLL.ProvinceBLL.BLLProvince_T businessObject)
        {
            try
            {
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "Province_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);
            }
        }
예제 #9
0
        public void Update(HPS.BLL.ProvinceBLL.BLLProvince_T businessObject, HPS.BLL.ProvinceBLL.BLLProvince_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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

                SqlParameter Province_nvc = new SqlParameter();
                Province_nvc.ParameterName = "@Province_nvc";
                Province_nvc.SqlDbType     = SqlDbType.NVarChar;
                Province_nvc.Direction     = ParameterDirection.Input;
                Province_nvc.IsNullable    = false;
                Province_nvc.Value         = businessObject.Province_nvc;
                this.Command.Parameters.Add(Province_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_Province_int = new SqlParameter();
                pk_Province_int.ParameterName = "@pk_Province_int";
                pk_Province_int.SqlDbType     = SqlDbType.Int;
                pk_Province_int.Direction     = ParameterDirection.Input;
                pk_Province_int.IsNullable    = false;
                pk_Province_int.Value         = businessObjectKey.Province_int;
                this.Command.Parameters.Add(pk_Province_int);



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

                this.Command.ExecuteNonQuery();

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