Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Mapping.Metveshinomera metvn = new Mapping.Metveshinomera();
            Mapping.Metrezerv      metr  = new Mapping.Metrezerv();
            var linq = from n in dbvn.veshinomera
                       where n.id == hotel.Program.Pole.id
                       select n;

            foreach (var i in linq)
            {
                var linq2 = from n in dbr.rezerv
                            where n.idveshi == i.idveshi
                            select n;
                foreach (var j in linq2)
                {
                    if (i.kolichestvo >= Convert.ToInt32(numericUpDown1.Value) && j.kolichestvo > Convert.ToInt32(numericUpDown1.Value))
                    {
                        metr.Edit(j.id, i.idveshi, j.kolichestvo - Convert.ToInt32(numericUpDown1.Value));
                    }
                    else
                    {
                        if (i.kolichestvo >= Convert.ToInt32(numericUpDown1.Value) && j.kolichestvo == Convert.ToInt32(numericUpDown1.Value))
                        {
                            metr.Delete(j.id);
                        }
                        else
                        {
                            MessageBox.Show("Не хватает резервов");
                        }
                    }
                }
            }
            this.Close();
        }
Exemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         Mapping.Metrezerv metclient = new Mapping.Metrezerv();
         metclient.Delete(Program.Pole.id);
         this.Close();
     }
     catch { MessageBox.Show("Error"); }
 }