Пример #1
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Prepods p = new Prepods();

            p.OpenConnection(connectionString);
            People pe     = p.GetPrepodByFIO(comboBox1.SelectedItem.ToString());
            int    idprep = p.GetIdByFIO(pe.name, pe.surname, pe.patronumic);

            p.CloseConnection();
            this.label_Fio.Text        = pe.surname + " " + pe.name[0] + '.' + pe.patronumic[0];
            this.label_birthday.Text   = pe.ConvertDate();
            this.richTextBox_Info.Text = pe.information;
            Predmets pr = new Predmets();

            pr.OpenConnection(connectionString);
            this.richTextBox1.Text = "";
            this.richTextBox1.Text = String.Join("\n", pr.GetPredmetsByPrepodId(idprep));
            pr.CloseConnection();
            this.Text                = comboBox1.Text;
            pictureBox1.Visible      = true;
            label_Fio.Visible        = true;
            label_birthday.Visible   = true;
            label1.Visible           = true;
            richTextBox_Info.Visible = true;
            richTextBox1.Visible     = true;
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox_Group.Text == "Выберите группу" || comboBox_Predmet.Text == "Выберите предмет")
            {
                MessageBox.Show("Выберите группу и предмет!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            DateTime date = DateTime.Now;
            Predmets pr   = new Predmets();

            pr.OpenConnection(connectionString);
            int idprd = pr.GetIdByName(comboBox_Predmet.Text);

            pr.CloseConnection();
            Marks m = new Marks();
            int   j = 1;

            m.OpenConnection(connectionString);
            foreach (var item in d)
            {
                if (this.Controls["t" + j].Text == "")
                {
                    continue;
                }
                int  nzach = item.Key;
                char mark  = this.Controls["t" + j].Text[0];
                m.InsertMark(nzach, id, idprd, mark, date);
                j++;
            }
            m.CloseConnection();
            MessageBox.Show("Оценки были успешно сохранены!");
            this.Close();
        }
Пример #3
0
        private void View_Journal_Load(object sender, EventArgs e)
        {
            Predmets pr = new Predmets();

            pr.OpenConnection(connectionString);
            comboBox1.Items.AddRange(pr.GetPredmetsByNzach(nzach));
            pr.CloseConnection();
        }
Пример #4
0
        public DeletePredmet()
        {
            InitializeComponent();
            connectionString = ConfigurationManager.AppSettings["connectionString"];
            Predmets p = new Predmets();

            p.OpenConnection(connectionString);
            comboBox1.Items.AddRange(p.GetAllPredmets());
            p.CloseConnection();
        }
Пример #5
0
        private void button_Add_Click(object sender, EventArgs e)
        {
            if (textBox_Name.Text == "" || comboBox_Prepods.Text == "Выберите")
            {
                MessageBox.Show("Повторите ввод!");
                return;
            }
            Predmets p = new Predmets();

            p.OpenConnection(connectionString);
            p.InsertPredmet(textBox_Name.Text, comboBox_Prepods.Text, connectionString);
            p.CloseConnection();
            MessageBox.Show("Предмет был добавлен успешно!");
            this.Close();
        }
Пример #6
0
        public EnterMarks(int id)
        {
            InitializeComponent();
            this.id          = id;
            connectionString = ConfigurationManager.AppSettings["connectionString"];
            Predmets pr = new Predmets();

            pr.OpenConnection(connectionString);
            comboBox_Predmet.Items.AddRange(pr.GetPredmetsByPrepodId(id));
            pr.CloseConnection();
            Grups g = new Grups();

            g.OpenConnection(connectionString);
            comboBox_Group.Items.AddRange(g.GetAllGrups());
            g.CloseConnection();
        }
Пример #7
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Grups g = new Grups();

            g.OpenConnection(connectionString);
            int idgr = g.GetIdByNzach(nzach);

            g.CloseConnection();
            Predmets p = new Predmets();

            p.OpenConnection(connectionString);
            int idprd = p.GetIdByName(comboBox1.Text);

            p.CloseConnection();
            Marks m = new Marks();

            m.OpenConnection(connectionString);
            dataGridView1.DataSource = m.GetMarksByGroupAndPredmet(idgr, idprd);
            m.CloseConnection();
        }
Пример #8
0
        private void button_Delete_Click(object sender, EventArgs e)
        {
            if (comboBox1.Text == "Выберите предмет")
            {
                MessageBox.Show("Вы не предмет!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Predmets p     = new Predmets();
            int      idprd = -1;

            try
            {
                p.OpenConnection(connectionString);
                idprd = p.GetIdByName(comboBox1.Text);
                p.DeletePredmet(comboBox1.Text);
                p.CloseConnection();
            }
            catch (SqlException ex)
            {
                DialogResult result = MessageBox.Show("Невозможно удалить предмет!\nВ журнале присутствуют оценки!\nУдалить все оценки?", "Error!", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
                if (result == DialogResult.Yes)
                {
                    Marks m = new Marks();
                    m.OpenConnection(connectionString);
                    m.DeleteMarksByPredmetId(idprd);
                    m.CloseConnection();
                    p.DeletePredmet(comboBox1.Text);
                    MessageBox.Show("Предмет был успешно удален!");
                }
                p.CloseConnection();
                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            MessageBox.Show("Предмет был успешно удален!");
            this.Close();
        }
Пример #9
0
    //************************ Выполняется при обновлении кадра ****************
    void Update()
    {
        Vector3 cour = Camera.main.ScreenToWorldPoint(Input.mousePosition); // Позиция курсора



        //Округленные до целого координаты
        //*********************** Выбор объекта *************************************
        if (Input.GetKeyDown(KeyCode.Mouse0) && cloSeF == false)// Выбор предмета на игровом поле
        {
            Collider2D all = Physics2D.OverlapCircle((Vector2)cour, 0.25f);

            if (all.GetComponent <Ball>())
            {
                SelectedBall = all.GetComponent <Ball>();
            }
            else if (all.GetComponent <Predmets>())
            {
                SelectedBalka = all.GetComponent <Predmets>();
            }

            else if (all.GetComponent <Teleport>())
            {
                selectTeleport = all.GetComponent <Teleport>();
            }
            else if (all.GetComponent <Bubble>())
            {
                selectBubble = all.GetComponent <Bubble>();
            }
            else if (all.GetComponent <Fan>())
            {
                selectFan = all.GetComponent <Fan>();
            }
            else if (all.GetComponent <Komveer>())
            {
                selectKomv = all.GetComponent <Komveer>();
            }
            else if (all.GetComponent <Konveer>())
            {
                selectKonv = all.GetComponent <Konveer>();
            }
        }
        //********************** Установка таймера если объект выбран **************
        if (SelectedBalka != null && Input.GetKeyDown(KeyCode.Mouse0))
        {
            timer = 70;
        }

        if (selectFan != null && Input.GetKeyDown(KeyCode.Mouse0))
        {
            timer = 70;
        }
        //**** Перемещение объекта ******************************************
        if (selectKonv != null)//предмет
        {
            if (OnMouseDrag() < 15 && cloSeF == false && cour.y <= 4f)
            {
                selectKonv.transform.position = Vector2.MoveTowards(selectKonv.transform.position, cour, Time.deltaTime * speed1);
            }
            else if (OnMouseDrag() < 15 && cloSeF == false && cour.y >= 4f)
            {
                selectKonv.transform.position = Vector2.MoveTowards(selectKonv.transform.position, new Vector3(cour.x, 4f, 0), Time.deltaTime * speed1);
            }
        }
        if (selectKomv != null)//предмет
        {
            if (OnMouseDrag() < 15 && cloSeF == false && cour.y <= 4f)
            {
                selectKomv.transform.position = Vector2.MoveTowards(selectKomv.transform.position, cour, Time.deltaTime * speed1);
            }
            else if (OnMouseDrag() < 15 && cloSeF == false && cour.y >= 4f)
            {
                selectKomv.transform.position = Vector2.MoveTowards(selectKomv.transform.position, new Vector3(cour.x, 4f, 0), Time.deltaTime * speed1);
            }
        }
        if (SelectedBalka != null)//предмет
        {
            if (OnMouseDrag() < 15 && cloSeF == false && cour.y <= 4f)
            {
                SelectedBalka.transform.localScale = new Vector3(0.42f, 0.14f, 1);
                SelectedBalka.transform.position   = Vector2.MoveTowards(SelectedBalka.transform.position, cour, Time.deltaTime * speed1);
            }
            else if (OnMouseDrag() < 15 && cloSeF == false && cour.y >= 4f)
            {
                SelectedBalka.transform.localScale = new Vector3(0.4f, 0.13f, 1);
                SelectedBalka.transform.position   = Vector2.MoveTowards(SelectedBalka.transform.position, new Vector3(cour.x, 4f, 0), Time.deltaTime * speed1);
            }
        }

        if (selectTeleport != null)//предмет
        {
            if (cloSeF == false && cour.y <= 4f)
            {
                selectTeleport.transform.position = Vector2.MoveTowards(selectTeleport.transform.position, cour, Time.deltaTime * speed1);
            }
            else if (cloSeF == false && cour.y >= 4f)
            {
                selectTeleport.transform.position = Vector2.MoveTowards(selectTeleport.transform.position, new Vector3(cour.x, 4f, 0), Time.deltaTime * speed1);
            }
        }
        if (selectBubble != null)//предмет
        {
            if (cloSeF == false && cour.y <= 4f)
            {
                selectBubble.transform.position = Vector2.MoveTowards(selectBubble.transform.position, cour, Time.deltaTime * speed1);
            }
            else if (cloSeF == false && cour.y >= 4f)
            {
                selectBubble.transform.position = Vector2.MoveTowards(selectBubble.transform.position, new Vector3(cour.x, 4f, 0), Time.deltaTime * speed1);
            }
        }
        if (selectFan != null)//предмет
        {
            if (OnMouseDrag() < 15 && cloSeF == false && cour.y <= 4f)
            {
                selectFan.transform.position = Vector2.MoveTowards(selectFan.transform.position, cour, Time.deltaTime * speed1);
            }
            else if (OnMouseDrag() < 15 && cloSeF == false && cour.y >= 4f)
            {
                selectFan.transform.position = Vector2.MoveTowards(selectFan.transform.position, new Vector3(cour.x, 4f, 0), Time.deltaTime * speed1);
            }
        }
        //**************************************************************************************************************************************


        if (Input.GetKeyUp(KeyCode.Mouse0))
        {
            if (selectKonv != null)
            {
                if (OnMouseDrag() >= 15 && cloSeF == false)
                {
                    selectKonv.GetComponent <SurfaceEffector2D>().speed = -selectKonv.GetComponent <SurfaceEffector2D>().speed;
                    ukaz1[0].tilt = -ukaz1[0].tilt;
                    ukaz1[1].tilt = -ukaz1[1].tilt;
                    ukaz1[2].tilt = -ukaz1[2].tilt;
                }
                selectKonv.transform.localScale = new Vector3(0.9f, 0.73f, 1f);
                selectKonv = null;
            }

            if (selectKomv != null)
            {
                if (OnMouseDrag() >= 15 && cloSeF == false)
                {
                    selectKomv.GetComponent <SurfaceEffector2D>().speed = -selectKomv.GetComponent <SurfaceEffector2D>().speed;
                    ukaz[0].tilt = -ukaz[0].tilt;
                    ukaz[1].tilt = -ukaz[1].tilt;
                    ukaz[2].tilt = -ukaz[2].tilt;
                }
                selectKomv.transform.localScale = new Vector3(0.9f, 0.73f, 1f);
                selectKomv = null;
            }
            if (SelectedBalka != null)
            {
                if (OnMouseDrag() >= 15 && cloSeF == false)
                {
                    SelectedBalka.transform.Rotate(new Vector3(0, 0, 22.5f), Space.Self);
                }
                SelectedBalka.transform.localScale = new Vector3(0.4f, 0.13f, 1f);
                SelectedBalka = null;
            }

            if (SelectedBall != null)// при нажатии на шар - включить физику
            {
                SelectedBall.GetComponent <Rigidbody2D>().isKinematic = false;
                SelectedBall = null;
                cloSeF       = true;
                teleport     = true;
                bubbleBlok   = false;
                starCollider = true;
            }
            if (selectTeleport != null)
            {
                selectTeleport = null;
            }
            if (selectBubble != null)
            {
                selectBubble.savePosition();
                selectBubble = null;
            }
            if (selectFan != null)
            {
                if (OnMouseDrag() >= 15 && cloSeF == false)
                {
                    selectFan.transform.Rotate(new Vector3(0, 0, 180f), Space.Self);
                }

                selectFan = null;
            }
            timer = 70;
        }
    }