Esempio n. 1
0
        protected override void Insert()
        {
            HPS.BLL.CountryBLL.BLLCountry_TFactory CountryFactory = new HPS.BLL.CountryBLL.BLLCountry_TFactory();
            try
            {
                HPS.BLL.CountryBLL.BLLCountry_T CountryEntity = new HPS.BLL.CountryBLL.BLLCountry_T();
                CountryEntity.CountryCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(CountryCode_nvcTextBox.Text, TypeCode.String).ToString();
                CountryEntity.Country_nvc     = Hepsa.Core.Common.PersentationController.GetEntityValue(Country_nvcTextBox.Text, TypeCode.String).ToString();
                CountryEntity.Active_bit      = Active_bitCheckBox.Checked;

                CountryFactory.BeginProc();
                CountryFactory.Insert(CountryEntity);
                CountryFactory.CommitProc();
                if (DataTable != null)
                {
                    DataRow dr = this.DataTable.NewRow();
                    dr[HPS.BLL.CountryBLL.BLLCountry_T.Country_TField.CountryID_int.ToString()]   = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CountryEntity.CountryID_int, TypeCode.Int32);
                    dr[HPS.BLL.CountryBLL.BLLCountry_T.Country_TField.CountryCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CountryEntity.CountryCode_nvc, TypeCode.String);
                    dr[HPS.BLL.CountryBLL.BLLCountry_T.Country_TField.Country_nvc.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CountryEntity.Country_nvc, TypeCode.String);
                    dr[HPS.BLL.CountryBLL.BLLCountry_T.Country_TField.Active_bit.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CountryEntity.Active_bit, TypeCode.Boolean);

                    DataTable.Rows.Add(dr);
                    DataTable.AcceptChanges();
                }
                this.ClearForm(this);
            }
            catch (Exception ex)
            {
                CountryFactory.RollBackProc();
                throw ex;
            }
        }
Esempio n. 2
0
        protected override void Edit()
        {
            HPS.BLL.CountryBLL.BLLCountry_TFactory CountryFactory = new HPS.BLL.CountryBLL.BLLCountry_TFactory();
            try
            {
                HPS.BLL.CountryBLL.BLLCountry_T CountryEntity = new HPS.BLL.CountryBLL.BLLCountry_T();
                CountryEntity.CountryCode_nvc = Hepsa.Core.Common.PersentationController.GetEntityValue(CountryCode_nvcTextBox.Text, TypeCode.String).ToString();
                CountryEntity.Country_nvc     = Hepsa.Core.Common.PersentationController.GetEntityValue(Country_nvcTextBox.Text, TypeCode.String).ToString();
                CountryEntity.Active_bit      = Active_bitCheckBox.Checked;

                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.EditMessage) == true)
                {
                    CountryFactory.BeginProc();
                    CountryFactory.Update(CountryEntity, (HPS.BLL.CountryBLL.BLLCountry_TKeys)Key);
                    CountryFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.CountryBLL.BLLCountry_T.Country_TField.CountryID_int.ToString() + "='" + ((HPS.BLL.CountryBLL.BLLCountry_TKeys)Key).CountryID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0][HPS.BLL.CountryBLL.BLLCountry_T.Country_TField.CountryCode_nvc.ToString()] = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CountryEntity.CountryCode_nvc, TypeCode.String);
                            dr[0][HPS.BLL.CountryBLL.BLLCountry_T.Country_TField.Country_nvc.ToString()]     = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CountryEntity.Country_nvc, TypeCode.String);
                            dr[0][HPS.BLL.CountryBLL.BLLCountry_T.Country_TField.Active_bit.ToString()]      = Hepsa.Core.Common.PersentationController.GetEntityValueInDatabaseFormat(CountryEntity.Active_bit, TypeCode.Boolean);
                        }
                        DataTable.AcceptChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                CountryFactory.RollBackProc();
                throw ex;
            }
        }
Esempio n. 3
0
        protected override void Delete()
        {
            HPS.BLL.CountryBLL.BLLCountry_TFactory CountryFactory = new HPS.BLL.CountryBLL.BLLCountry_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmMessage(HPS.Exceptions.ExceptionCs.DeleteMessage) == true)
                {
                    CountryFactory.BeginProc();
                    CountryFactory.Delete((HPS.BLL.CountryBLL.BLLCountry_TKeys)Key);
                    CountryFactory.CommitProc();
                    if (DataTable != null)
                    {
                        DataRow[] dr = DataTable.Select(HPS.BLL.CountryBLL.BLLCountry_T.Country_TField.CountryID_int.ToString() + "='" + ((HPS.BLL.CountryBLL.BLLCountry_TKeys)Key).CountryID_int.ToString() + "'");
                        if (dr.Length > 0)
                        {
                            dr[0].Delete();
                        }
                        DataTable.AcceptChanges();
                    }
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                CountryFactory.RollBackProc();
                throw ex;
            }
        }