Exemple #1
0
        private void bunifuFlatButton6_Click(object sender, EventArgs e)
        {
            DataClasses1DataContext databaseConnection = new DataClasses1DataContext(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\shadman\Desktop\RUBER\Assets\RMS\RMS\RMSDB.mdf;Integrated Security=True;Connect Timeout=30");

            try
            {
                var simg = (from img in databaseConnection.menus
                            where img.Id == bunifuDropdown2.selectedIndex + 1
                            select img).Single();

                var stitle = (from Name in databaseConnection.menus
                              where Name.Id == bunifuDropdown2.selectedIndex + 1
                              select Name).Single();

                var sprice = (from Price in databaseConnection.menus
                              where Price.Id == bunifuDropdown2.selectedIndex + 1
                              select Price).Single();

                var sdesc = (from Desc in databaseConnection.menus
                             where Desc.Id == bunifuDropdown2.selectedIndex + 1
                             select Desc).Single();


                selectedmenu newmenu = databaseConnection.selectedmenus.Single(selectedmenus => selectedmenus.Id == Convert.ToInt32(bunifuDropdown3.selectedIndex + 1));

                newmenu.img   = simg.img;
                newmenu.Name  = stitle.Name;
                newmenu.Price = Convert.ToString(sprice.Price);
                newmenu.Desc  = sdesc.Desc;
            }
            finally
            {
                // Save
                databaseConnection.SubmitChanges();
                MessageBox.Show("Menu Item is Featured Now");
            }
        }
 partial void Updateselectedmenu(selectedmenu instance);
 partial void Deleteselectedmenu(selectedmenu instance);
 partial void Insertselectedmenu(selectedmenu instance);