Esempio n. 1
0
        private void edit()
        {
            try
            {
                STDraftPlayer data = GetSelectionData();

                if (data.idplayer > 0)
                {
                    DlgDraft wnd = new DlgDraft(connect, IS, data);

                    if (wnd.ShowDialog() == DialogResult.OK)
                    {
                        flawour = wnd.GetFl();

                        init_data();

                        if (gpos >= 0 && dataGridViewDraft.Rows.Count > 0)
                        {
                            dataGridViewDraft.Rows[gpos].Selected             = true;
                            dataGridViewDraft.FirstDisplayedScrollingRowIndex = gpos;
                        }
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Esempio n. 2
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            try
            {
                rData = read_data();

                if (rData.idplayer > 0)
                {
                    if (mode == 1)
                    {
                        STDraftPlayer od = (STDraftPlayer)oldData;
                        if (clWork.Update(rData, od.idplayer, od.dtin))
                        {
                            DialogResult = DialogResult.OK;
                        }
                    }

                    if (mode == 0)
                    {
                        if (clWork.Insert(rData))
                        {
                            DialogResult = DialogResult.OK;
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Не все обязательные поля заполнены", "Внимание!", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Esempio n. 3
0
 private void del()
 {
     try
     {
         STDraftPlayer data = GetSelectionData();
         if (data.idplayer > 0)
         {
             if (MessageBox.Show("Вы действиетльно желаете удалить данную запись?", "Внимание!",
                                 MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
             {
                 clWork.Delete(data.idplayer, data.dtin);
                 init_data();
             }
         }
     }
     catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
 }
Esempio n. 4
0
        private STDraftPlayer GetSelectionData()
        {
            STDraftPlayer ret = new STDraftPlayer();

            int      idplayer;
            DateTime datein;

            try
            {
                foreach (DataGridViewRow item in dataGridViewDraft.SelectedRows)
                {
                    idplayer = int.Parse(item.Cells[10].Value.ToString().Trim());
                    datein   = DateTime.Parse(item.Cells[6].Value.ToString().Trim());

                    ret = clWork.GetRecord(idplayer, datein);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }

            return(ret);
        }
Esempio n. 5
0
        private void set_data(STDraftPlayer data)
        {
            string text = null;

            try
            {
                CPlayer part = new CPlayer(connect, data.idplayer);

                text = string.Format("{0} {1} ({2})", data.family, data.name,
                                     data.personalnum);

                comboBoxName.Text = text;

                dateTimePickerDateIn.Value = data.dtin;

                textBoxGrowing.Text = data.growing.ToString();
                textBoxWeight.Text  = data.weight.ToString();

                if (data.amplua == 1 || data.amplua == 4 || data.amplua == 5 || data.amplua == 7)
                {
                    checkBoxAD.Checked = true;
                }
                if (data.amplua == 2 || data.amplua == 4 || data.amplua == 6 || data.amplua == 7)
                {
                    checkBoxAF.Checked = true;
                }
                if (data.amplua == 3 || data.amplua == 5 || data.amplua == 6 || data.amplua == 7)
                {
                    checkBoxAC.Checked = true;
                }

                comboBoxIdLastTeam.Text = data.namelastteam;
                comboBoxIdNextTeam.Text = data.namenextteam;
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }
        }
Esempio n. 6
0
        private void comboBoxName_SelectedIndexChanged(object sender, EventArgs e)
        {
            bDraft  = false;
            stDraft = new STDraftPlayer();
            try
            {
                if (comboBoxName.Text.Length > 0)
                {
                    char[] del = { ' ', '(', ')' };

                    string s = comboBoxName.Text.Trim();

                    string[] words = s.Split(del);

                    clPlayer = new CPlayer(connect, words[0].Trim(), words[1].Trim(), words[3].Trim());
                    CEntryPlayers cl = new CEntryPlayers(connect);

                    int idt = cl.IsEntryPlayer(IS.idseason, clPlayer.stPlayer.idplayer);


                    if (idt != 0)
                    {
                        CTeam tm = new CTeam(connect, idt);
                        labelIsDemind.ForeColor = Color.Red;
                        labelIsDemind.Text      = string.Format("{0}", tm.stTeam.name);
                    }
                    else
                    {
                        stDraft = clDraft.IsDraftPlayer(clPlayer.stPlayer.idplayer, DateTime.Now);
                        if (stDraft.idplayer > 0)
                        {
                            labelIsDemind.ForeColor = Color.BlueViolet;
                            labelIsDemind.Text      = "драфт";
                            bDraft = true;
                        }
                        else
                        {
                            labelIsDemind.ForeColor = Color.DarkGreen;
                            labelIsDemind.Text      = "свободен";
                        }
                    }


                    string str1 = string.Format("{0} {1} {2}", clPlayer.stPlayer.family, clPlayer.stPlayer.name,
                                                clPlayer.stPlayer.payname);

                    labelFIO.Text = str1;

                    CAge age = new CAge();

                    if (clPlayer.stPlayer.datebirth != null)
                    {
                        DateTime dte = (DateTime)clPlayer.stPlayer.datebirth;
                        string   sm  = age.GetFullAge(dte, DateTime.Now);

                        string str2 = string.Format("{0}, {1}", dte.ToLongDateString(), sm);

                        labelDate.Text = str2;
                    }

                    CCountry clCountry = new CCountry(connect);

                    string str3 = string.Format("{0}, {1}", clPlayer.stPlayer.personalnum,
                                                clCountry.stCountry.shortname);

                    labelPersNum.Text = str3;
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }
        }
Esempio n. 7
0
        private STDraftPlayer read_data()
        {
            STDraftPlayer ret = new STDraftPlayer();

            try
            {
                if (comboBoxName.Text.Length > 0)
                {
                    ret.idplayer = clPlayer.stPlayer.idplayer;
                }
                else
                {
                    ret.idplayer = 0;
                }

                ret.dtin = new DateTime(dateTimePickerDateIn.Value.Year, dateTimePickerDateIn.Value.Month,
                                        dateTimePickerDateIn.Value.Day, 0, 0, 0, 0);

                if (comboBoxIdLastTeam.Text.Length > 0)
                {
                    clTeam         = new CTeam(connect, comboBoxIdLastTeam.Text.Trim());
                    ret.idlastteam = clTeam.stTeam.id;
                }
                else
                {
                    ret.idlastteam = 0;
                }

                if (textBoxGrowing.Text.Length > 0)
                {
                    ret.growing = int.Parse(textBoxGrowing.Text.Trim());
                }
                else
                {
                    ret.growing = 0;
                }

                if (textBoxWeight.Text.Length > 0)
                {
                    ret.weight = int.Parse(textBoxWeight.Text.Trim());
                }
                else
                {
                    ret.weight = 0;
                }

                ret.amplua = 0;

                if (checkBoxAD.Checked == true)
                {
                    ret.amplua = 1;
                }
                if (checkBoxAF.Checked == true)
                {
                    ret.amplua = 2;
                }
                if (checkBoxAC.Checked == true)
                {
                    ret.amplua = 3;
                }
                if (checkBoxAD.Checked == true && checkBoxAF.Checked == true)
                {
                    ret.amplua = 4;
                }
                if (checkBoxAF.Checked == true && checkBoxAC.Checked == true)
                {
                    ret.amplua = 5;
                }
                if (checkBoxAF.Checked == true && checkBoxAC.Checked == true)
                {
                    ret.amplua = 6;
                }
                if (checkBoxAD.Checked == true && checkBoxAF.Checked == true && checkBoxAC.Checked == true)
                {
                    ret.amplua = 7;
                }

                if (checkBoxOut.Checked == true)
                {
                    ret.dtout = new DateTime(dateTimePickerDateOut.Value.Year, dateTimePickerDateOut.Value.Month,
                                             dateTimePickerDateOut.Value.Day, 0, 0, 0, 0);

                    if (comboBoxIdNextTeam.Text.Length > 0)
                    {
                        clTeam         = new CTeam(connect, comboBoxIdNextTeam.Text.Trim());
                        ret.idnextteam = clTeam.stTeam.id;
                    }
                    else
                    {
                        ret.idnextteam = 0;
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); }

            return(ret);
        }