Ejemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Context context = new Context();

            try
            {
                Entities.Bludo bludo = new Entities.Bludo();
                bludo.BludoName     = name.Text;
                bludo.BludoPrice    = System.Convert.ToDecimal(double.Parse(price.Text));
                bludo.BludoCategory = (category.SelectedItem).ToString();
                bludo.BludoWeight   = double.Parse(weight.Text);
                bludo.BludoTime     = DateTime.Parse("2000-12-12 10:00");

                Requests.MethodsAdmininstrator.InsertBludo(context, bludo);

                name.Text             = "";
                price.Text            = "";
                category.SelectedItem = null;
                weight.Text           = "";
                time.Text             = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show("Проверьте правильность ввода данных.");
            }
        }
Ejemplo n.º 2
0
        public UpdatingDish(string bludoname)
        {
            bludon = bludoname;
            InitializeComponent();

            bludo = Requests.MethodsOrder.GetBludoByName(context, bludon);

            name.Text = bludo.BludoName;
            price.Text = (bludo.BludoPrice).ToString();
            foreach (var c in category.Items)
            {
                if (bludo.BludoCategory == c.ToString())
                category.SelectedItem = c;
            }
            weight.Text = (bludo.BludoWeight).ToString();
        }
Ejemplo n.º 3
0
        public UpdatingDish(string bludoname)
        {
            bludon = bludoname;
            InitializeComponent();

            bludo = Requests.MethodsOrder.GetBludoByName(context, bludon);

            name.Text  = bludo.BludoName;
            price.Text = (bludo.BludoPrice).ToString();
            foreach (var c in category.Items)
            {
                if (bludo.BludoCategory == c.ToString())
                {
                    category.SelectedItem = c;
                }
            }
            weight.Text = (bludo.BludoWeight).ToString();
        }
Ejemplo n.º 4
0
        public List<Entities.Bludo> GetAllBludos()
        {
            List<Entities.Bludo> listBludos = new List<Entities.Bludo>();
            using (TeamProjectEntities6 entities = new TeamProjectEntities6())
            {
                var bludos = from r in entities.Bludo
                             select r;
                foreach (Bludo singleBludo in bludos)
                {
                    Entities.Bludo b = new Entities.Bludo();
                    b.BludoID = singleBludo.id;
                    b.BludoName = singleBludo.name_Bludo;
                    b.BludoPrice = decimal.Parse(singleBludo.price_Bludo.ToString());
                    b.BludoWeight = double.Parse(singleBludo.weight_Bludo.ToString());
                    b.BludoCategory = singleBludo.category_Bludo;
                    //b.BludoTime = int.Parse(singleBludo.time_Bludo.ToString());

                    listBludos.Add(b);
                }
            }
            return listBludos;
        }
Ejemplo n.º 5
0
        public List <Entities.Bludo> GetAllBludos()
        {
            List <Entities.Bludo> listBludos = new List <Entities.Bludo>();

            using (TeamProjectEntities6 entities = new TeamProjectEntities6())
            {
                var bludos = from r in entities.Bludo
                             select r;
                foreach (Bludo singleBludo in bludos)
                {
                    Entities.Bludo b = new Entities.Bludo();
                    b.BludoID       = singleBludo.id;
                    b.BludoName     = singleBludo.name_Bludo;
                    b.BludoPrice    = decimal.Parse(singleBludo.price_Bludo.ToString());
                    b.BludoWeight   = double.Parse(singleBludo.weight_Bludo.ToString());
                    b.BludoCategory = singleBludo.category_Bludo;
                    //b.BludoTime = int.Parse(singleBludo.time_Bludo.ToString());

                    listBludos.Add(b);
                }
            }
            return(listBludos);
        }