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 metr = new Mapping.Metrezerv();
                Mapping.Metveshi  metv = new Mapping.Metveshi();
                openFileDialog1.InitialDirectory = Application.StartupPath.ToString();
                openFileDialog1.Filter           = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
                openFileDialog1.ShowDialog();
                string predmet = rsf.outFile2(openFileDialog1.FileName);

                string[] masstrok = predmet.Split(new char[] { '\n' });
                int      schet    = 0;
                foreach (var i in masstrok)
                {
                    schet = 0;
                    if (i != "")
                    {
                        string[] masslov = i.Split(new char[] { '|' });
                        if (masslov[0] != "" && masslov[1] != "")
                        {
                            var linq = from n in dbv.veshi
                                       where n.nazvanie == masslov[0]
                                       select n;

                            foreach (var j in linq)
                            {
                                schet += 1;

                                var linq2 = from n in dbr.rezerv
                                            where n.idveshi == j.id
                                            select n;
                                foreach (var k in linq2)
                                {
                                    metr.Edit(k.id, k.idveshi, k.kolichestvo + Convert.ToInt32(masslov[1]));
                                }
                            }
                            if (schet == 0)
                            {
                                metv.ADD(masslov[0]);
                                var linq3 = from n in dbv.veshi
                                            where n.nazvanie == masslov[0]
                                            select n;
                                MessageBox.Show(masslov[0]);
                                foreach (var k in linq3)
                                {
                                    metr.ADD(k.id, Convert.ToInt32(masslov[1]));
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            catch (IndexOutOfRangeException) {
                string predmet = rsf.outFile2(openFileDialog1.FileName);
                MessageBox.Show("Пополнено на " + predmet);
                this.Close();
            }
        }
Exemplo n.º 3
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"); }
 }
Exemplo n.º 4
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         VisibleReserv     vc  = new VisibleReserv();
         Mapping.Metrezerv d   = new Mapping.Metrezerv();
         string[]          str = comboBox1.Items[comboBox1.SelectedIndex].ToString().Split(new char[] { ' ' });
         d.Edit(Program.Pole.id, Convert.ToInt32(str[0]), Convert.ToInt32(numericUpDown1.Value));
         this.Close();
     }
     catch (ArgumentOutOfRangeException) { MessageBox.Show("Не все поля заполнены"); }
     catch { MessageBox.Show("Error"); }
 }
Exemplo n.º 5
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         VisibleReserv     vc = new VisibleReserv();
         Mapping.Metrezerv d  = new Mapping.Metrezerv();
         var linq             = from n in dbdopuslugi.veshi
                                where n.nazvanie == comboBox1.Items[comboBox1.SelectedIndex].ToString()
                                select n;
         foreach (var i in linq)
         {
             d.ADD(i.id, Convert.ToInt32(numericUpDown1.Value));
             break;
         }
         this.Close();
     }
     catch (ArgumentOutOfRangeException) { MessageBox.Show("Не все поля заполнены"); }
     catch { MessageBox.Show("Error"); }
 }