Beispiel #1
0
        private void go_service(object sender, RoutedEventArgs e)
        {
            WindowAdminService service = new WindowAdminService();

            this.Close();
            service.Show();
        }
Beispiel #2
0
        private void go_back(object sender, RoutedEventArgs e)
        {
            WindowAdminService winadm = new WindowAdminService();

            this.Close();
            winadm.Show();
        }
Beispiel #3
0
        private void go_add(object sender, RoutedEventArgs e)
        {
            string title  = title_box.Text.Trim();
            string cost   = cost_box.Text.Trim();
            string time   = time_box.Text.Trim();
            string skidka = skidka_box.Text.Trim();
            //GenderCode



            DB         db      = new DB();
            SqlCommand command = new SqlCommand("INSERT INTO Service ( Name, Price, Time, Discount, ImagePath)"
                                                + "VALUES (@title, @cost, @time,  @skidka, @path)", db.getConnection());

            command.Parameters.Add("@title", SqlDbType.VarChar).Value  = title;
            command.Parameters.Add("@cost", SqlDbType.VarChar).Value   = cost;
            command.Parameters.Add("@time", SqlDbType.Int).Value       = time;
            command.Parameters.Add("@skidka", SqlDbType.VarChar).Value = skidka;
            command.Parameters.Add("@path", SqlDbType.VarChar).Value   = imagepath;
            db.openConnection();
            if (imagepath.ToString() != "")
            {
                if (CheckTextBoxes())
                {
                    if (command.ExecuteNonQuery() == 1)
                    {
                        WindowAdminService winadm = new WindowAdminService();
                        MessageBox.Show("Услуга успешно добавлена!");
                        this.Close();
                        winadm.Show();
                    }
                    else
                    {
                        MessageBox.Show("Проверьте правильность введеных данных");
                    }
                }
                else
                {
                    MessageBox.Show("Заполните пустые поля");
                }
            }
            else
            {
                MessageBox.Show("Выберите изображение");
            }
        }
Beispiel #4
0
        private void go_save(object sender, RoutedEventArgs e)
        {
            DB         db      = new DB();
            SqlCommand command = new SqlCommand("UPDATE Service SET Name = @title, Price = @cost, Time = @time, Discount = @skidka, ImagePath = @image Where ID = @ids", db.getConnection());

            command.Parameters.AddWithValue("@title", title_box.Text);
            command.Parameters.AddWithValue("@cost", cost_box.Text);
            command.Parameters.AddWithValue("@time", time_box.Text);
            command.Parameters.AddWithValue("@skidka", skidka_box.Text);
            command.Parameters.AddWithValue("@image", Service.MainImagePath);
            command.Parameters.AddWithValue("@ids", Service.ID);
            db.openConnection();

            if (command.ExecuteNonQuery() == 1)
            {
                WindowAdminService winadm = new WindowAdminService();
                MessageBox.Show("Услуга успешно отредактирована!");
                this.Close();
                winadm.Show();
            }
        }