コード例 #1
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            HPS.BLL.CountryBLL.BLLCountry_TFactory CountryFactory = new HPS.BLL.CountryBLL.BLLCountry_TFactory();

            try
            {
                if (Hepsa.Core.Common.MessageBox.ConfirmDeleteMessage() == false)
                {
                    return;
                }


                HPS.BLL.CountryBLL.BLLCountry_TFactory Country_TFactory = new HPS.BLL.CountryBLL.BLLCountry_TFactory();
                HPS.BLL.CountryBLL.BLLCountry_TKeys    CountryKey       = new HPS.BLL.CountryBLL.BLLCountry_TKeys();

                CountryKey.CountryID_int = (Int32?)CountryGridView.CurrentRow.Cells["colCountryID_int"].Value;
                CountryFactory.Delete(CountryKey);

                DataRow[] dr = ((DataTable)this.CountryGridView.DataSource).Select(HPS.BLL.CountryBLL.BLLCountry_T.Country_TField.CountryID_int.ToString() + "='" + CountryKey.CountryID_int.ToString() + "'");
                if (dr.Length > 0)
                {
                    dr[0].Delete();
                }
                ((DataTable)this.CountryGridView.DataSource).AcceptChanges();
            }

            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
コード例 #2
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;
            }
        }