Exemplo n.º 1
0
Arquivo: Del.cs Projeto: Kari937/RBS
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            DelovoePO delovoePO = new DelovoePO();



            if (comboBoxTip.SelectedIndex == 0)
            {
                delovoePO.Type   = 0;
                delovoePO.Sistem = comboBoxSis.Text;
            }
            else if (comboBoxTip.SelectedIndex == 1)
            {
                delovoePO.Type     = 1;
                delovoePO.Bezopasn = comboBoxBez.Text;
            }
            else
            {
                delovoePO.Type    = 2;
                delovoePO.Project = comboBoxProect.Text;
            }
            Program.rbs.DelovoePO.Add(delovoePO);
            Program.rbs.SaveChanges();
            ShowDel();
        }
Exemplo n.º 2
0
Arquivo: Del.cs Projeto: Kari937/RBS
        private void listViewBez_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewBez.SelectedItems.Count == 1)
            {
                DelovoePO delovoePO = listViewBez.SelectedItems[0].Tag as DelovoePO;

                comboBoxBez.Text = delovoePO.Bezopasn;
            }
            else
            {
                comboBoxBez.Text = "";
            }
        }
Exemplo n.º 3
0
Arquivo: Del.cs Projeto: Kari937/RBS
        private void listViewSis_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewSis.SelectedItems.Count == 1)
            {
                DelovoePO delovoePO = listViewSis.SelectedItems[0].Tag as DelovoePO;

                comboBoxSis.Text = delovoePO.Sistem;
            }
            else
            {
                comboBoxSis.Text = "";
            }
        }
Exemplo n.º 4
0
Arquivo: Del.cs Projeto: Kari937/RBS
        private void buttonDel_Click(object sender, EventArgs e)
        {
            try
            {
                if (comboBoxTip.SelectedIndex == 0)
                {
                    if (listViewSis.SelectedItems.Count == 1)
                    {
                        DelovoePO delovoePO = listViewSis.SelectedItems[0].Tag as DelovoePO;
                        Program.rbs.DelovoePO.Remove(delovoePO);
                        Program.rbs.SaveChanges();
                        ShowDel();
                    }

                    comboBoxSis.Text = "";
                }

                else if (comboBoxTip.SelectedIndex == 1)
                {
                    if (listViewBez.SelectedItems.Count == 1)
                    {
                        DelovoePO delovoePO = listViewBez.SelectedItems[0].Tag as DelovoePO;
                        Program.rbs.DelovoePO.Remove(delovoePO);
                        Program.rbs.SaveChanges();
                        ShowDel();
                    }

                    comboBoxBez.Text = "";
                }

                else
                {
                    if (listViewProect.SelectedItems.Count == 1)
                    {
                        DelovoePO delovoePO = listViewProect.SelectedItems[0].Tag as DelovoePO;
                        Program.rbs.DelovoePO.Remove(delovoePO);
                        Program.rbs.SaveChanges();
                        ShowDel();
                    }

                    comboBoxProect.Text = "";
                }
            }

            catch
            {
                MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 5
0
Arquivo: Del.cs Projeto: Kari937/RBS
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            if (comboBoxTip.SelectedIndex == 0)
            {
                if (listViewSis.SelectedItems.Count == 1)
                {
                    try
                    {
                        DelovoePO delovoePO = listViewSis.SelectedItems[0].Tag as DelovoePO;

                        delovoePO.Sistem = comboBoxSis.Text;


                        if (comboBoxSis.Text != "")
                        {
                            delovoePO.Sistem = comboBoxSis.Text;
                        }
                        else
                        {
                            delovoePO.Sistem = null;
                        }



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

            else if (comboBoxTip.SelectedIndex == 1)
            {
                if (listViewBez.SelectedItems.Count == 1)
                {
                    try
                    {
                        DelovoePO delovoePO = listViewBez.SelectedItems[0].Tag as DelovoePO;

                        delovoePO.Bezopasn = comboBoxBez.Text;

                        if (comboBoxBez.Text != "")
                        {
                            delovoePO.Bezopasn = comboBoxBez.Text;
                        }
                        else
                        {
                            delovoePO.Bezopasn = null;
                        }


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

                        delovoePO.Project = comboBoxProect.Text;


                        if (comboBoxProect.Text != "")
                        {
                            delovoePO.Project = comboBoxProect.Text;
                        }
                        else
                        {
                            delovoePO.Project = null;
                        }



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