Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (dateTimePicker1.Value <= dateTimePicker2.Value)
                {
                    Mapping.Metjurnalnomera met       = new Mapping.Metjurnalnomera();
                    Mapping.Metnomera       metnomera = new Mapping.Metnomera();

                    met.ADD("Нет", 1, Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value), Convert.ToInt32(dataGridView2.CurrentRow.Cells[0].Value), dateTimePicker1.Value, dateTimePicker2.Value);

                    metnomera.Zan(Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value), "занят");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Дата заезда не может быть больше даты выезда");
                }
            }
            catch { MessageBox.Show("Error"); }
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try

            {
                hotel.Program.Pole.id = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value);

                Mapping.Metnomera       met = new Mapping.Metnomera();
                Mapping.Metjurnalnomera d   = new Mapping.Metjurnalnomera();
                var linq = from n in db.bron
                           where n.id == hotel.Program.Pole.id
                           select n;
                foreach (var i in linq)
                {
                    d.ADD("Да", i.id, i.idnomera, i.idclienta, i.datazaezda, i.dataviezda);
                    met.Zan(i.idnomera, "занят");
                    //MessageBox.Show(("да " + i.id + " " + i.idnomera + " " + i.idclienta + " " + i.datazaezda + " " + i.dataviezda).ToString());
                }
                this.Close();
            }
            catch (ArgumentOutOfRangeException) { MessageBox.Show("Не все поля заполнены"); }
            catch { MessageBox.Show("Error"); }
        }