Esempio n. 1
0
        private void buttonDel_Click(object sender, EventArgs e)
        {
            try
            {
                if (comboBoxTip_uslugi.SelectedIndex == 0)
                {
                    if (listViewProdazha.SelectedItems.Count == 1)
                    {
                        Table_1 table_1 = listViewProdazha.SelectedItems[0].Tag as Table_1;
                        Program.rbs.Table_1.Remove(table_1);
                        Program.rbs.SaveChanges();
                        Show1();
                    }

                    comboBoxNazvaniyeProgrammy.Text = "";
                    textBoxPrice.Text = "";
                }

                else if (comboBoxTip_uslugi.SelectedIndex == 1)
                {
                    if (listViewNastroyka.SelectedItems.Count == 1)
                    {
                        Table_1 table_1 = listViewNastroyka.SelectedItems[0].Tag as Table_1;
                        Program.rbs.Table_1.Remove(table_1);
                        Program.rbs.SaveChanges();
                        Show1();
                    }

                    comboBoxTipZadachi.Text = "";
                }

                else
                {
                    if (listViewObsluzhivaniye.SelectedItems.Count == 1)
                    {
                        Table_1 table_1 = listViewObsluzhivaniye.SelectedItems[0].Tag as Table_1;
                        Program.rbs.Table_1.Remove(table_1);
                        Program.rbs.SaveChanges();
                        Show1();
                    }

                    comboBoxTipObsluzhivaniya.Text = "";
                    textBoxPrice.Text = "";
                }
            }

            catch
            {
                MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        private void listViewNastroyka_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewNastroyka.SelectedItems.Count == 1)
            {
                Table_1 table_1 = listViewNastroyka.SelectedItems[0].Tag as Table_1;

                comboBoxTipZadachi.Text = table_1.TipZadachi;
            }
            else
            {
                comboBoxTipZadachi.Text = "";
            }
        }
Esempio n. 3
0
        private void listViewObsluzhivaniye_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewObsluzhivaniye.SelectedItems.Count == 1)
            {
                Table_1 table_1 = listViewObsluzhivaniye.SelectedItems[0].Tag as Table_1;

                comboBoxTipObsluzhivaniya.Text = table_1.TipObsluzhivaniya;
                textBoxPrice.Text = table_1.Price.ToString();
            }
            else
            {
                comboBoxTipObsluzhivaniya.Text = "";
                textBoxPrice.Text = "";
            }
        }
Esempio n. 4
0
        private void listViewProdazha_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewProdazha.SelectedItems.Count == 1)
            {
                Table_1 table_1 = listViewProdazha.SelectedItems[0].Tag as Table_1;

                comboBoxNazvaniyeProgrammy.Text = table_1.NazvaniyeProgrammy;
                textBoxPrice.Text = table_1.Price.ToString();
            }
            else
            {
                comboBoxNazvaniyeProgrammy.Text = "";
                textBoxPrice.Text = "";
            }
        }
Esempio n. 5
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            if (comboBoxTip_uslugi.SelectedIndex == 0)
            {
                if (listViewProdazha.SelectedItems.Count == 1)
                {
                    try
                    {
                        Table_1 table_1 = listViewProdazha.SelectedItems[0].Tag as Table_1;

                        table_1.NazvaniyeProgrammy = comboBoxNazvaniyeProgrammy.Text;
                        table_1.Price = Convert.ToInt64(textBoxPrice.Text);

                        if (comboBoxNazvaniyeProgrammy.Text != "")
                        {
                            table_1.NazvaniyeProgrammy = comboBoxNazvaniyeProgrammy.Text;
                        }
                        else
                        {
                            table_1.NazvaniyeProgrammy = null;
                        }
                        if (comboBoxNazvaniyeProgrammy.Text != "")
                        {
                            table_1.Price = Convert.ToInt64(textBoxPrice.Text);
                        }
                        else
                        {
                            table_1.Price = null;
                        }


                        Program.rbs.SaveChanges();
                        Show1();
                    }
                    catch (Exception ex)
                    { MessageBox.Show("" + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); }
                }
            }

            else if (comboBoxTip_uslugi.SelectedIndex == 1)
            {
                if (listViewNastroyka.SelectedItems.Count == 1)
                {
                    try
                    {
                        Table_1 table_1 = listViewNastroyka.SelectedItems[0].Tag as Table_1;

                        table_1.TipZadachi = comboBoxTipZadachi.Text;

                        if (comboBoxTipZadachi.Text != "")
                        {
                            table_1.TipZadachi = comboBoxTipZadachi.Text;
                        }
                        else
                        {
                            table_1.TipZadachi = null;
                        }


                        Program.rbs.SaveChanges();
                        Show1();
                    }
                    catch (Exception ex)
                    { MessageBox.Show("" + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); }
                }
            }
            else
            {
                if (listViewObsluzhivaniye.SelectedItems.Count == 1)
                {
                    try
                    {
                        Table_1 table_1 = listViewObsluzhivaniye.SelectedItems[0].Tag as Table_1;

                        table_1.TipObsluzhivaniya = comboBoxTipObsluzhivaniya.Text;
                        table_1.Price             = Convert.ToInt64(textBoxPrice.Text);

                        if (comboBoxTipObsluzhivaniya.Text != "")
                        {
                            table_1.TipObsluzhivaniya = comboBoxTipObsluzhivaniya.Text;
                        }
                        else
                        {
                            table_1.TipObsluzhivaniya = null;
                        }
                        if (comboBoxTipObsluzhivaniya.Text != "")
                        {
                            table_1.Price = Convert.ToInt64(textBoxPrice.Text);
                        }
                        else
                        {
                            table_1.Price = null;
                        }


                        Program.rbs.SaveChanges();
                        Show1();
                    }
                    catch (Exception ex)
                    { MessageBox.Show("" + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); }
                }
            }
        }