Ejemplo n.º 1
0
        private STDivision read_data()
        {
            STDivision ret = new STDivision();

            try
            {
                /* основные параметры */
                ret.idseason = (int)IS.idseason;

                if (gstDivision.id != 0)
                {
                    ret.id = gstDivision.id;
                }
                else
                {
                    ret.id = clDivision.GetFreeId((int)IS.idseason);
                }

                if (textBoxName.Text.Length > 0)
                {
                    ret.name = textBoxName.Text.Trim();
                }
                else
                {
                    ret.name = null;
                }

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

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

                /* игры регул¤рки */
                if (checkBoxReg.CheckState == CheckState.Checked)
                {
                    ret.flag_reg = 1;

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

                    if (checkBoxWinsReg.CheckState == CheckState.Checked)
                    {
                        ret.flag_wins_reg = 1;
                    }
                    else
                    {
                        ret.flag_wins_reg = 0;
                    }
                }
                else
                {
                    ret.flag_reg      = 0;
                    ret.cntstagereg   = 0;
                    ret.flag_wins_reg = 0;
                }

                /* игры плей-офф */
                if (checkBoxPO.CheckState == CheckState.Checked)
                {
                    ret.flag_po = 1;

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

                    if (textBoxCntTeamPO.Text.Length > 0)
                    {
                        ret.cntteampo = int.Parse(textBoxCntTeamPO.Text.Trim());
                    }
                    else
                    {
                        ret.cntteampo = 0;
                    }
                }
                else
                {
                    ret.flag_po    = 0;
                    ret.cntstagepo = 0;
                    ret.cntteampo  = 0;
                }

                /* стыковые игры */
                if (checkBoxStyk.CheckState == CheckState.Checked)
                {
                    ret.flag_styk = 1;

                    if (textBoxCntTeamStyk.Text.Length > 0)
                    {
                        ret.cntteamstyk = int.Parse(textBoxCntTeamStyk.Text.Trim());
                    }
                    else
                    {
                        ret.cntteamstyk = 0;
                    }
                }
                else
                {
                    ret.flag_styk   = 0;
                    ret.cntteamstyk = 0;
                }

                /* ротаци¤ */

                if (checkBoxTeamIn.CheckState == CheckState.Checked)
                {
                    ret.flag_in = 1;

                    if (textBoxCntTeamIn.Text.Length > 0)
                    {
                        ret.cntteamin = int.Parse(textBoxCntTeamIn.Text.Trim());
                    }
                    else
                    {
                        ret.cntteamin = 0;
                    }
                }
                else
                {
                    ret.flag_in   = 0;
                    ret.cntteamin = 0;
                }

                if (checkBoxTeamOut.CheckState == CheckState.Checked)
                {
                    ret.flag_out = 1;

                    if (textBoxCntTeamOut.Text.Length > 0)
                    {
                        ret.cntteamout = int.Parse(textBoxCntTeamOut.Text.Trim());
                    }
                    else
                    {
                        ret.cntteamout = 0;
                    }
                }
                else
                {
                    ret.flag_out   = 0;
                    ret.cntteamout = 0;
                }

                ret.deadline = new DateTime(dateTimePickerDead.Value.Year, dateTimePickerDead.Value.Month,
                                            dateTimePickerDead.Value.Day, 0, 0, 0, 0);
            }
            catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); }

            return(ret);
        }