コード例 #1
0
        private void btmSearchVarata_Click(object sender, EventArgs e) // New order
        {
            // Check date again, if user change data, and no do search
            if (!OrderUtils.CheckCottageBookDate(Convert.ToInt32(dgSearchTable.CurrentRow.Cells[0].Value), dtpSearchFROM.Text, dtpSearchTO.Text))
            {
                btnSearchHae_Click(sender, e);
                return;
            }

            ConnectionUtils.OpenConnection();
            MySqlCommand command = new MySqlCommand("SELECT toimintaalue_id FROM toimintaalue WHERE nimi Like '" +
                                                    dgSearchTable.CurrentRow.Cells[1].Value.ToString() + "'", ConnectionUtils.connection);
            int toimintaalueid = Convert.ToInt32(command.ExecuteScalar().ToString());
            // Make object to send on Booking window
            Cottage cottage = new Cottage(Convert.ToInt32(dgSearchTable.CurrentRow.Cells[0].Value), toimintaalueid,
                                          dgSearchTable.CurrentRow.Cells[2].Value.ToString(), dgSearchTable.CurrentRow.Cells[3].Value.ToString(),
                                          dgSearchTable.CurrentRow.Cells[4].Value.ToString(), dgSearchTable.CurrentRow.Cells[5].Value.ToString(),
                                          Convert.ToInt32(dgSearchTable.CurrentRow.Cells[6].Value.ToString()), dgSearchTable.CurrentRow.Cells[7].Value.ToString(),
                                          Convert.ToDouble(dgSearchTable.CurrentRow.Cells[8].Value.ToString()));

            ConnectionUtils.CloseConnection();
            NewBook newbook = new NewBook(cottage, dtpSearchFROM.Value.Date, dtpSearchTO.Value.Date);
            Booking booking = new Booking(newbook);

            booking.ShowDialog();
        }
コード例 #2
0
 private void btnModifyCottage_Click(object sender, EventArgs e)
 {
     try
     {
         Cottage cottage = new Cottage(Convert.ToInt32(dgvCottage.CurrentRow.Cells[0].Value), Convert.ToInt32(dgvCottage.CurrentRow.Cells[1].Value),
                                       dgvCottage.CurrentRow.Cells[2].Value.ToString(), dgvCottage.CurrentRow.Cells[3].Value.ToString(), dgvCottage.CurrentRow.Cells[4].Value.ToString(),
                                       dgvCottage.CurrentRow.Cells[5].Value.ToString(), Convert.ToInt32(dgvCottage.CurrentRow.Cells[6].Value), Convert.ToDouble(dgvCottage.CurrentRow.Cells[8].Value),
                                       dgvCottage.CurrentRow.Cells[7].Value.ToString());
         ModifyCottageForm MCF = new ModifyCottageForm(cottage);
         MCF.ShowDialog();
         PopulateDGVCottage();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Mökin valinta epäonnistui. Yritä kohta uudelleen. Lisätietoja: " + ex.Message);
     }
 }
コード例 #3
0
ファイル: NewBook.cs プロジェクト: LarePaharinen/RentCottage
 public NewBook(Cottage cottage, DateTime startday, DateTime endday)
 {
     this.cottage = cottage;
     this.dayFrom = startday;
     this.dayTo   = endday;
 }