コード例 #1
0
        protected override void Edit()
        {
            HPS.BLL.GoodBLL.BLLGood_TFactory GoodFactory = new HPS.BLL.GoodBLL.BLLGood_TFactory();
            try
            {
                HPS.BLL.GoodBLL.BLLGood_T GoodEntity = new HPS.BLL.GoodBLL.BLLGood_T();
                GoodEntity.GoodCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(GoodCode_nvcTextBox.Text, TypeCode.String).ToString();
                GoodEntity.Good_nvc     = Hepsa.Core.Common.PersentationController.GetEntityValue(Good_nvcTextBox.Text, TypeCode.String).ToString();
                GoodEntity.Avtive_bit   = Avtive_bitCheckBox.Checked;

                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    GoodFactory.BeginProc();
                    GoodFactory.Update(GoodEntity, (HPS.BLL.GoodBLL.BLLGood_TKeys)Key);
                    GoodFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.GoodBLL.BLLGood_T.Good_TField.GoodID_int.ToString() + "='" + ((HPS.BLL.GoodBLL.BLLGood_TKeys)Key).GoodID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0][HPS.BLL.GoodBLL.BLLGood_T.Good_TField.GoodCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(GoodEntity.GoodCode_nvc, TypeCode.String);
                            dr[0][HPS.BLL.GoodBLL.BLLGood_T.Good_TField.Good_nvc.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(GoodEntity.Good_nvc, TypeCode.String);
                            dr[0][HPS.BLL.GoodBLL.BLLGood_T.Good_TField.Avtive_bit.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(GoodEntity.Avtive_bit, TypeCode.Boolean);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                GoodFactory.RollBackProc();
                throw ex;
            }
        }
コード例 #2
0
 public void PopulateBusinessObjectFromReader(HPS.BLL.GoodBLL.BLLGood_T businessObject, IDataReader dataReader)
 {
     businessObject.GoodID_int   = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.GoodBLL.BLLGood_T.Good_TField.GoodID_int.ToString()));
     businessObject.GoodCode_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.GoodBLL.BLLGood_T.Good_TField.GoodCode_nvc.ToString()));
     businessObject.Good_nvc     = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.GoodBLL.BLLGood_T.Good_TField.Good_nvc.ToString()));
     businessObject.Avtive_bit   = dataReader.GetBoolean(dataReader.GetOrdinal(HPS.BLL.GoodBLL.BLLGood_T.Good_TField.Avtive_bit.ToString()));
 }
コード例 #3
0
        protected override void Insert()
        {
            HPS.BLL.GoodBLL.BLLGood_TFactory GoodFactory = new HPS.BLL.GoodBLL.BLLGood_TFactory();
            try
            {
                HPS.BLL.GoodBLL.BLLGood_T GoodEntity = new HPS.BLL.GoodBLL.BLLGood_T();
                GoodEntity.GoodCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(GoodCode_nvcTextBox.Text, TypeCode.String).ToString();
                GoodEntity.Good_nvc     = Hepsa.Core.Common.PersentationController.GetEntityValue(Good_nvcTextBox.Text, TypeCode.String).ToString();
                GoodEntity.Avtive_bit   = Avtive_bitCheckBox.Checked;

                GoodFactory.BeginProc();
                GoodFactory.Insert(GoodEntity);
                GoodFactory.CommitProc();
                if (DataTable != null)
                {
                    DataRow dr = this.DataTable.NewRow();
                    dr[HPS.BLL.GoodBLL.BLLGood_T.Good_TField.GoodID_int.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(GoodEntity.GoodID_int, TypeCode.Int32);
                    dr[HPS.BLL.GoodBLL.BLLGood_T.Good_TField.GoodCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(GoodEntity.GoodCode_nvc, TypeCode.String);
                    dr[HPS.BLL.GoodBLL.BLLGood_T.Good_TField.Good_nvc.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(GoodEntity.Good_nvc, TypeCode.String);
                    dr[HPS.BLL.GoodBLL.BLLGood_T.Good_TField.Avtive_bit.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(GoodEntity.Avtive_bit, TypeCode.Boolean);

                    DataTable.Rows.Add(dr);
                    DataTable.AcceptChanges();
                }
                this.ClearForm(this);
            }
            catch (Exception ex)
            {
                GoodFactory.RollBackProc();
                throw ex;
            }
        }
コード例 #4
0
        public void Update(HPS.BLL.GoodBLL.BLLGood_T businessObject, HPS.BLL.GoodBLL.BLLGood_TKeys businessObjectKey)
        {
            try
            {
                if (businessObject.GoodID_int == businessObjectKey.GoodID_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueGoodID_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);
            }
        }
コード例 #5
0
        public HPS.BLL.GoodBLL.BLLGood_T SelectByPrimaryKey(HPS.BLL.GoodBLL.BLLGood_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.GoodBLL.BLLGood_T businessObject = new HPS.BLL.GoodBLL.BLLGood_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
        private void GoodID_intNewButton_Click(object sender, EventArgs e)
        {
            HPS.Present.SearchForm.GoodSearch frm = new HPS.Present.SearchForm.GoodSearch();
            frm.ShowDialog();
            if (frm != null)
            {
                GoodEntity = frm.SelectedGoodEntity;

                GoodID_intComboBox.Text = GoodEntity.Good_nvc;
            }
        }
コード例 #7
0
        public List <HPS.BLL.GoodBLL.BLLGood_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.GoodBLL.BLLGood_T> list = new List <HPS.BLL.GoodBLL.BLLGood_T>();

            while (dataReader.Read())
            {
                HPS.BLL.GoodBLL.BLLGood_T businessObject = new HPS.BLL.GoodBLL.BLLGood_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
コード例 #8
0
 protected override void ShowForm()
 {
     this.FillCombo();
     HPS.BLL.GoodBLL.BLLGood_TFactory GoodFactory = new HPS.BLL.GoodBLL.BLLGood_TFactory();
     HPS.BLL.GoodBLL.BLLGood_T        GoodEntity  = GoodFactory.GetBy((HPS.BLL.GoodBLL.BLLGood_TKeys)Key);
     if (GoodEntity == null)
     {
         throw new HPS.Exceptions.GoodNotFound();
     }
     GoodCode_nvcTextBox.Text   = Hepsa.Core.Common.PersentationController.GetEntityValue(GoodEntity.GoodCode_nvc, TypeCode.String).ToString();
     Good_nvcTextBox.Text       = Hepsa.Core.Common.PersentationController.GetEntityValue(GoodEntity.Good_nvc, TypeCode.String).ToString();
     Avtive_bitCheckBox.Checked = (Boolean)Hepsa.Core.Common.PersentationController.GetEntityValue(GoodEntity.Avtive_bit, TypeCode.Boolean);
 }
コード例 #9
0
        public void Insert(HPS.BLL.GoodBLL.BLLGood_T businessObject)
        {
            try
            {
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "GoodID_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);
            }
        }
コード例 #10
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            if (GoodGridView.CurrentRow != null)
            {
                HPS.BLL.GoodBLL.BLLGood_TFactory GoodFactory = new HPS.BLL.GoodBLL.BLLGood_TFactory();
                HPS.BLL.GoodBLL.BLLGood_TKeys    GoodKey     = new HPS.BLL.GoodBLL.BLLGood_TKeys();
                GoodKey.GoodID_int = (Int32)GoodGridView.CurrentRow.Cells[colGoodID_int.Name].Value;
                GoodEntity         = GoodFactory.GetBy(GoodKey);

                if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetEntityValue(GoodGridView.CurrentRow.Cells[colGoodID_int.Name].Value, TypeCode.String).ToString()) == false)
                {
                    GoodEntity.Good_nvc     = Hepsa.Core.Common.PersentationController.GetEntityValue(GoodGridView.CurrentRow.Cells[colGood_nvc.Name].Value, TypeCode.String).ToString();
                    GoodEntity.GoodCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(GoodGridView.CurrentRow.Cells[colGoodCode_nvc.Name].Value, TypeCode.String).ToString();
                }
            }
            this.Close();
        }
コード例 #11
0
        public void Update(HPS.BLL.GoodBLL.BLLGood_T businessObject, HPS.BLL.GoodBLL.BLLGood_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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

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

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


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



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

                this.Command.ExecuteNonQuery();

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