Exemple #1
0
        public void Update(HPS.BLL.CompanyBLL.BLLCompany_T businessObject, HPS.BLL.CompanyBLL.BLLCompany_TKeys businessObjectKey)
        {
            try
            {
                if (businessObject.CompanyID_int == businessObjectKey.CompanyID_int)
                {
                    if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "UniqueCompanyID_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);
            }
        }
Exemple #2
0
        public HPS.BLL.CompanyBLL.BLLCompany_T SelectByPrimaryKey(HPS.BLL.CompanyBLL.BLLCompany_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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



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

                IDataReader dataReader = this.Command.ExecuteReader();
                HPS.BLL.CompanyBLL.BLLCompany_T businessObject = new HPS.BLL.CompanyBLL.BLLCompany_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 #3
0
 private void CompanyID_intShowButton_Click(object sender, EventArgs e)
 {
     HPS.Present.SearchForm.CompanySearch frm = new HPS.Present.SearchForm.CompanySearch();
     frm.ShowDialog();
     if (frm != null)
     {
         CompanyEntity = frm.SelectedCompanyEntity;
         CompanyID_intComboBox.Text = frm.SelectedCompanyEntity.Company_nvc;
     }
 }
Exemple #4
0
 protected override void Edit()
 {
     HPS.BLL.CompanyBLL.BLLCompany_TFactory CompanyFactory = new HPS.BLL.CompanyBLL.BLLCompany_TFactory();
     try
     {
         HPS.BLL.CompanyBLL.BLLCompany_T CompanyEntity = new HPS.BLL.CompanyBLL.BLLCompany_T();
         CompanyEntity.CompanyCode_nvc       = Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyCode_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.Company_nvc           = Hepsa.Core.Common.PersentationController.GetEntityValue(Company_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.DirectorName_nvc      = Hepsa.Core.Common.PersentationController.GetEntityValue(DirectorName_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.DirectorMobile_nvc    = Hepsa.Core.Common.PersentationController.GetEntityValue(DirectorMobile_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.Phone_nvc             = Hepsa.Core.Common.PersentationController.GetEntityValue(Phone_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.Fax_nvc               = Hepsa.Core.Common.PersentationController.GetEntityValue(Fax_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.Email_nvc             = Hepsa.Core.Common.PersentationController.GetEntityValue(Email_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.WebAddress_nvc        = Hepsa.Core.Common.PersentationController.GetEntityValue(WebAddress_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.Active_bit            = Active_bitCheckBox.Checked;
         CompanyEntity.InfractionGroupID_int = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionGroupID_intComboBox.SelectedValue, TypeCode.Int32);
         CompanyEntity.Address_nvc           = Hepsa.Core.Common.PersentationController.GetEntityValue(Address_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.CityID_int            = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(CityID_intComboBox.SelectedValue, TypeCode.Int32);
         CompanyEntity.CityCode_nvc          = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CityEntity.CityCode_nvc, TypeCode.String));
         CompanyEntity.GroupID_int           = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyGroupComboBox.SelectedValue, TypeCode.Int32);
         if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
         {
             CompanyFactory.BeginProc();
             CompanyFactory.Update(CompanyEntity, (HPS.BLL.CompanyBLL.BLLCompany_TKeys)Key);
             CompanyFactory.CommitProc();
             if (DataTable != null)
             {
                 DataRow[] dr = DataTable.Select(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CompanyID_int.ToString() + "='" + ((HPS.BLL.CompanyBLL.BLLCompany_TKeys)Key).CompanyID_int.ToString() + "'");
                 if (dr.Length > 0)
                 {
                     dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CompanyCode_nvc.ToString()]    = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.CompanyCode_nvc, TypeCode.String);
                     dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Company_nvc.ToString()]        = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Company_nvc, TypeCode.String);
                     dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.DirectorName_nvc.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.DirectorName_nvc, TypeCode.String);
                     dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.DirectorMobile_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.DirectorMobile_nvc, TypeCode.String);
                     dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Phone_nvc.ToString()]          = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Phone_nvc, TypeCode.String);
                     dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Fax_nvc.ToString()]            = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Fax_nvc, TypeCode.String);
                     dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Email_nvc.ToString()]          = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Email_nvc, TypeCode.String);
                     dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.WebAddress_nvc.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.WebAddress_nvc, TypeCode.String);
                     dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Active_bit.ToString()]         = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Active_bit, TypeCode.Boolean);
                     dr[0]["InfractionGroupID_intInfractionGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(InfractionGroupID_intComboBox);
                     dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Address_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Address_nvc, TypeCode.String);
                     dr[0]["CityID_intCity_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(CityID_intComboBox);
                     dr[0][HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CityCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.CityCode_nvc, TypeCode.String);
                     dr[0]["GroupName_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(CompanyGroupComboBox);
                 }
                 DataTable.AcceptChanges();
             }
         }
     }
     catch (Exception ex)
     {
         CompanyFactory.RollBackProc();
         throw ex;
     }
 }
Exemple #5
0
 protected override void Insert()
 {
     HPS.BLL.CompanyBLL.BLLCompany_TFactory CompanyFactory = new HPS.BLL.CompanyBLL.BLLCompany_TFactory();
     try
     {
         HPS.BLL.CompanyBLL.BLLCompany_T CompanyEntity = new HPS.BLL.CompanyBLL.BLLCompany_T();
         CompanyEntity.CompanyCode_nvc       = Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyCode_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.Company_nvc           = Hepsa.Core.Common.PersentationController.GetEntityValue(Company_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.DirectorName_nvc      = Hepsa.Core.Common.PersentationController.GetEntityValue(DirectorName_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.DirectorMobile_nvc    = Hepsa.Core.Common.PersentationController.GetEntityValue(DirectorMobile_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.Phone_nvc             = Hepsa.Core.Common.PersentationController.GetEntityValue(Phone_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.Fax_nvc               = Hepsa.Core.Common.PersentationController.GetEntityValue(Fax_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.Email_nvc             = Hepsa.Core.Common.PersentationController.GetEntityValue(Email_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.WebAddress_nvc        = Hepsa.Core.Common.PersentationController.GetEntityValue(WebAddress_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.Active_bit            = Active_bitCheckBox.Checked;
         CompanyEntity.InfractionGroupID_int = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(InfractionGroupID_intComboBox.SelectedValue, TypeCode.Int32);
         CompanyEntity.Address_nvc           = Hepsa.Core.Common.PersentationController.GetEntityValue(Address_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.CityID_int            = (Nullable <Int32>)Hepsa.Core.Common.PersentationController.GetEntityValue(CityID_intComboBox.SelectedValue, TypeCode.Int32);
         CompanyEntity.CityCode_nvc          = Hepsa.Core.Common.PersentationController.GetEntityValue(CityCode_nvcTextBox.Text, TypeCode.String).ToString();
         CompanyEntity.GroupID_int           = (Int32?)Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyGroupComboBox.SelectedValue, TypeCode.Int32);
         CompanyFactory.BeginProc();
         CompanyFactory.Insert(CompanyEntity);
         CompanyFactory.CommitProc();
         if (DataTable != null)
         {
             DataRow dr = this.DataTable.NewRow();
             dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CompanyID_int.ToString()]         = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.CompanyID_int, TypeCode.Int32);
             dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CompanyCode_nvc.ToString()]       = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.CompanyCode_nvc, TypeCode.String);
             dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Company_nvc.ToString()]           = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Company_nvc, TypeCode.String);
             dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.DirectorName_nvc.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.DirectorName_nvc, TypeCode.String);
             dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.DirectorMobile_nvc.ToString()]    = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.DirectorMobile_nvc, TypeCode.String);
             dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Phone_nvc.ToString()]             = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Phone_nvc, TypeCode.String);
             dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Fax_nvc.ToString()]               = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Fax_nvc, TypeCode.String);
             dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Email_nvc.ToString()]             = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Email_nvc, TypeCode.String);
             dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.WebAddress_nvc.ToString()]        = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.WebAddress_nvc, TypeCode.String);
             dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Active_bit.ToString()]            = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Active_bit, TypeCode.Boolean);
             dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.InfractionGroupID_int.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.InfractionGroupID_int, TypeCode.Int32);
             dr["InfractionGroupID_intInfractionGroup_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(InfractionGroupID_intComboBox);
             dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Address_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.Address_nvc, TypeCode.String);
             dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CityID_int.ToString()]  = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.CityID_int, TypeCode.Int32);
             dr["CityID_intCity_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(CityID_intComboBox);
             dr[HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CityCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CompanyEntity.CityCode_nvc, TypeCode.String);
             dr["GroupName_nvc"] = Hepsa.Core.Common.PersentationController.GetComboBoxDisplayMember(CompanyGroupComboBox);
             DataTable.Rows.Add(dr);
             DataTable.AcceptChanges();
         }
         this.ClearForm(this);
     }
     catch (Exception ex)
     {
         CompanyFactory.RollBackProc();
         throw ex;
     }
 }
Exemple #6
0
        private void CompanyID_intNewButton_Click(object sender, EventArgs e)
        {
            HPS.Present.SearchForm.CompanySearch CompanySearch = new HPS.Present.SearchForm.CompanySearch();
            CompanySearch.ShowDialog();
            if (CompanySearch != null && CompanySearch.SelectedCompanyEntity != null)
            {
                CompanyEntity = CompanySearch.SelectedCompanyEntity;

                Company_nvcTextBox.Text = CompanyEntity.Company_nvc;
                CompanyID_int           = CompanyEntity.CompanyID_int;
            }
        }
Exemple #7
0
        public List <HPS.BLL.CompanyBLL.BLLCompany_T> PopulateObjectsFromReader(IDataReader dataReader)
        {
            List <HPS.BLL.CompanyBLL.BLLCompany_T> list = new List <HPS.BLL.CompanyBLL.BLLCompany_T>();

            while (dataReader.Read())
            {
                HPS.BLL.CompanyBLL.BLLCompany_T businessObject = new HPS.BLL.CompanyBLL.BLLCompany_T();
                PopulateBusinessObjectFromReader(businessObject, dataReader);
                list.Add(businessObject);
            }
            return(list);
        }
Exemple #8
0
 private void CompanySearch_Load(object sender, EventArgs e)
 {
     try
     {
         this.LoadCompany();
         this.CompanyGridView.Focus();
         this.CompanyEntity = null;
     }
     catch (Exception ex)
     {
         Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
         this.Close();
     }
 }
Exemple #9
0
        public void Insert(HPS.BLL.CompanyBLL.BLLCompany_T businessObject)
        {
            try
            {
                if (businessObject.IsValid(Hepsa.Core.Validation.ValidationExceptionType.Except, "CompanyID_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 #10
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            if (CompanyGridView.CurrentRow != null)
            {
                HPS.BLL.CompanyBLL.BLLCompany_TFactory CompanyFactory = new HPS.BLL.CompanyBLL.BLLCompany_TFactory();
                HPS.BLL.CompanyBLL.BLLCompany_TKeys    CompanyKey     = new HPS.BLL.CompanyBLL.BLLCompany_TKeys();
                CompanyKey.CompanyID_int = (Int32)CompanyGridView.CurrentRow.Cells[colCompanyID_int.Name].Value;
                CompanyEntity            = CompanyFactory.GetBy(CompanyKey);

                if (string.IsNullOrEmpty(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyGridView.CurrentRow.Cells[colCompanyID_int.Name].Value, TypeCode.String).ToString()) == false)
                {
                    CompanyEntity.Company_nvc = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyGridView.CurrentRow.Cells[colCompany_nvc.Name].Value, TypeCode.String));
                }
            }
            this.Close();
        }
Exemple #11
0
 protected override void ShowForm()
 {
     this.FillCombo();
     HPS.BLL.CompanyBLL.BLLCompany_TFactory CompanyFactory = new HPS.BLL.CompanyBLL.BLLCompany_TFactory();
     HPS.BLL.CompanyBLL.BLLCompany_T        CompanyEntity  = CompanyFactory.GetBy((HPS.BLL.CompanyBLL.BLLCompany_TKeys)Key);
     if (CompanyEntity == null)
     {
         throw new HPS.Exceptions.CompanyNotFound();
     }
     CompanyCode_nvcTextBox.Text    = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyEntity.CompanyCode_nvc, TypeCode.String));
     Company_nvcTextBox.Text        = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyEntity.Company_nvc, TypeCode.String));
     DirectorName_nvcTextBox.Text   = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyEntity.DirectorName_nvc, TypeCode.String));
     DirectorMobile_nvcTextBox.Text = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyEntity.DirectorMobile_nvc, TypeCode.String));
     Phone_nvcTextBox.Text          = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyEntity.Phone_nvc, TypeCode.String));
     Fax_nvcTextBox.Text            = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyEntity.Fax_nvc, TypeCode.String));
     Email_nvcTextBox.Text          = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyEntity.Email_nvc, TypeCode.String));
     WebAddress_nvcTextBox.Text     = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyEntity.WebAddress_nvc, TypeCode.String));
     Active_bitCheckBox.Checked     = (Boolean)Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyEntity.Active_bit, TypeCode.Boolean);
     Hepsa.Core.Common.PersentationController.SetComboBoxValue(ref InfractionGroupID_intComboBox, CompanyEntity.InfractionGroupID_int, TypeCode.Int32);
     Address_nvcTextBox.Text = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyEntity.Address_nvc, TypeCode.String));
     Hepsa.Core.Common.PersentationController.SetComboBoxValue(ref CityID_intComboBox, CompanyEntity.CityID_int, TypeCode.Int32);
     CityCode_nvcTextBox.Text = Convert.ToString(Hepsa.Core.Common.PersentationController.GetEntityValue(CompanyEntity.CityCode_nvc, TypeCode.String));
 }
Exemple #12
0
        public void Update(HPS.BLL.CompanyBLL.BLLCompany_T businessObject, HPS.BLL.CompanyBLL.BLLCompany_TKeys businessObjectKey)
        {
            bool ControlConnection = !(this.ConnectionState == System.Data.ConnectionState.Open);

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

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

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

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

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

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

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

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

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

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

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

                SqlParameter InfractionGroupID_int = new SqlParameter();
                InfractionGroupID_int.ParameterName = "@InfractionGroupID_int";
                InfractionGroupID_int.SqlDbType     = SqlDbType.Int;
                InfractionGroupID_int.Direction     = ParameterDirection.Input;
                InfractionGroupID_int.IsNullable    = false;
                if (businessObject.InfractionGroupID_int.HasValue == false)
                {
                    InfractionGroupID_int.Value = DBNull.Value;
                }
                else
                {
                    InfractionGroupID_int.Value = businessObject.InfractionGroupID_int;
                }
                this.Command.Parameters.Add(InfractionGroupID_int);

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

                SqlParameter CityID_int = new SqlParameter();
                CityID_int.ParameterName = "@CityID_int";
                CityID_int.SqlDbType     = SqlDbType.Int;
                CityID_int.Direction     = ParameterDirection.Input;
                CityID_int.IsNullable    = true;
                if (businessObject.CityID_int.HasValue == false)
                {
                    CityID_int.Value = DBNull.Value;
                }
                else
                {
                    CityID_int.Value = businessObject.CityID_int;
                }
                this.Command.Parameters.Add(CityID_int);

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


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


                SqlParameter GroupID_intParam = new SqlParameter();
                GroupID_intParam.ParameterName = "@GroupID_int";
                GroupID_intParam.SqlDbType     = SqlDbType.Int;
                GroupID_intParam.Direction     = ParameterDirection.Input;
                GroupID_intParam.IsNullable    = true;
                if (!businessObject.GroupID_int.HasValue)
                {
                    GroupID_intParam.Value = DBNull.Value;
                }
                else
                {
                    GroupID_intParam.Value = businessObject.GroupID_int;
                }
                this.Command.Parameters.Add(GroupID_intParam);


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

                this.Command.ExecuteNonQuery();

                if (ControlConnection)
                {
                    this.Commit();
                }
            }
            catch (System.Exception ex)
            {
                if (ControlConnection)
                {
                    this.RollBack();
                }
                throw ex;
            }
        }
Exemple #13
0
        public void PopulateBusinessObjectFromReader(HPS.BLL.CompanyBLL.BLLCompany_T businessObject, IDataReader dataReader)
        {
            businessObject.CompanyID_int    = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CompanyID_int.ToString()));
            businessObject.CompanyCode_nvc  = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CompanyCode_nvc.ToString()));
            businessObject.Company_nvc      = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Company_nvc.ToString()));
            businessObject.DirectorName_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.DirectorName_nvc.ToString()));
            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.DirectorMobile_nvc.ToString())) == false)
            {
                businessObject.DirectorMobile_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.DirectorMobile_nvc.ToString()));
            }
            else
            {
                businessObject.DirectorMobile_nvc = String.Empty;
            }

            businessObject.Phone_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Phone_nvc.ToString()));
            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Fax_nvc.ToString())) == false)
            {
                businessObject.Fax_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Fax_nvc.ToString()));
            }
            else
            {
                businessObject.Fax_nvc = String.Empty;
            }

            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Email_nvc.ToString())) == false)
            {
                businessObject.Email_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Email_nvc.ToString()));
            }
            else
            {
                businessObject.Email_nvc = String.Empty;
            }

            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.WebAddress_nvc.ToString())) == false)
            {
                businessObject.WebAddress_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.WebAddress_nvc.ToString()));
            }
            else
            {
                businessObject.WebAddress_nvc = String.Empty;
            }

            businessObject.Active_bit = dataReader.GetBoolean(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Active_bit.ToString()));
            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.InfractionGroupID_int.ToString())) == false)
            {
                businessObject.InfractionGroupID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.InfractionGroupID_int.ToString()));
            }
            else
            {
                businessObject.InfractionGroupID_int = null;
            }

            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Address_nvc.ToString())) == false)
            {
                businessObject.Address_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.Address_nvc.ToString()));
            }
            else
            {
                businessObject.Address_nvc = String.Empty;
            }

            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CityID_int.ToString())) == false)
            {
                businessObject.CityID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CityID_int.ToString()));
            }
            else
            {
                businessObject.CityID_int = null;
            }

            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CityCode_nvc.ToString())) == false)
            {
                businessObject.CityCode_nvc = dataReader.GetString(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.CityCode_nvc.ToString()));
            }
            else
            {
                businessObject.CityCode_nvc = String.Empty;
            }

            if (dataReader.IsDBNull(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.GroupID_int.ToString())) == false)
            {
                businessObject.GroupID_int = dataReader.GetInt32(dataReader.GetOrdinal(HPS.BLL.CompanyBLL.BLLCompany_T.Company_TField.GroupID_int.ToString()));
            }
            else
            {
                businessObject.GroupID_int = null;
            }
        }