コード例 #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Country country = new Country();

            CountryDialog             = new CountryDialog();
            country.PKCountryId       = Convert.ToInt32(dgvCountry.SelectedRows[0].Cells[0].Value);
            CountryDialog.CountryName = dgvCountry.SelectedRows[0].Cells[1].Value.ToString();
            CountryDialog.ZipStart    = Convert.ToInt32(dgvCountry.SelectedRows[0].Cells[2].Value);
            CountryDialog.ZipEnd      = Convert.ToInt32(dgvCountry.SelectedRows[0].Cells[3].Value);
            CountryDialog.IsActive    = Convert.ToBoolean(dgvCountry.SelectedRows[0].Cells[4].Value);
            if (CountryDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    country.CountryName  = CountryDialog.CountryName;
                    country.ZipCodeStart = CountryDialog.ZipStart;
                    country.ZipCodeEnd   = CountryDialog.ZipEnd;
                    country.IsActive     = CountryDialog.IsActive;
                    Interaction.Update(country, 1);
                }
                catch (Exception)
                {
                    MessageBox.Show("In update button of the country");
                }
            }
            dgvCountry.DataSource = Interaction.Getdetails(1);
        }
コード例 #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            CountryDialog dlgCountry = new CountryDialog();

            if (dlgCountry.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    CountryBO objCountryBO = new CountryBO();
                    objCountryBO.InsertInCountry(dlgCountry.CountryName, dlgCountry.ZipCodeStart, dlgCountry.ZipCodeEnd, dlgCountry.IsActive);
                    dgvCountry.DataSource = CountryBO.GetCountries();
                }
                catch (Exception)
                {
                    MessageBox.Show("It under testing 1");
                }
            }
        }
コード例 #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            Country country = new Country();

            CountryDialog = new CountryDialog();
            if (CountryDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    country.CountryName  = CountryDialog.CountryName;
                    country.ZipCodeStart = CountryDialog.ZipStart;
                    country.ZipCodeEnd   = CountryDialog.ZipEnd;
                    country.IsActive     = CountryDialog.IsActive;
                    Interaction.AddData(country, 1);
                }
                catch (Exception)
                {
                    MessageBox.Show("In add button of the country");
                }
                dgvCountry.DataSource = Interaction.Getdetails(1);
            }
        }
コード例 #4
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (dgvCountry.RowCount != 0)
     {
         int           countryId      = (int)(dgvCountry.SelectedRows[0].Cells[0].Value);
         CountryDialog dlgCountry     = new CountryDialog();
         CountryBO     objCountryBO   = new CountryBO();
         Countrydata   objCountryData = new Countrydata();
         dlgCountry.CountryName  = (dgvCountry.SelectedRows[0].Cells[1].Value).ToString();
         dlgCountry.ZipCodeStart = (long)(dgvCountry.SelectedRows[0].Cells[2].Value);
         dlgCountry.ZipCodeEnd   = (long)(dgvCountry.SelectedRows[0].Cells[3].Value);
         dlgCountry.IsActive     = (bool)(dgvCountry.SelectedRows[0].Cells[4].Value);
         if (dlgCountry.ShowDialog() == DialogResult.OK)
         {
             objCountryData.PKCountry    = countryId;
             objCountryData.CountryName  = dlgCountry.CountryName;
             objCountryData.ZipCodeStart = dlgCountry.ZipCodeStart;
             objCountryData.ZipCodeEnd   = dlgCountry.ZipCodeEnd;
             objCountryData.IsActive     = dlgCountry.IsActive;
             objCountryBO.UpdateInCountry(objCountryData);
         }
         dgvCountry.DataSource = CountryBO.GetCountries();
     }
 }