protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                string         sStyles = String.Empty;
                ONLCompetition comp;
                if (String.IsNullOrEmpty(lblCompIid.Text))
                {
                    comp = ONLCompetition.CreateONLCompetition(SortingClass.GetNextIID("ONLCompetitions", "iid", cn, null));
                }
                else
                {
                    comp = GetCompByIid(long.Parse(lblCompIid.Text));
                }
                if (comp == null)
                {
                    lblErrMsg.Text = "Ошибка создания объекта";
                    return;
                }
                if (String.IsNullOrWhiteSpace(tbCompPlace.Text))
                {
                    lblErrMsg.Text = "Место проведения не введено";
                    return;
                }
                if (String.IsNullOrWhiteSpace(tbCompShort.Text))
                {
                    lblErrMsg.Text = "Краткое наименование соревнований не введено";
                    return;
                }
                if (String.IsNullOrWhiteSpace(tbCompTitle.Text))
                {
                    lblErrMsg.Text = "Наименование соревнований не введено";
                    return;
                }
                foreach (ListItem li in cbListStyles.Items)
                {
                    if (li.Selected)
                    {
                        sStyles += li.Value;
                    }
                }
                if (sStyles.Equals(String.Empty))
                {
                    lblErrMsg.Text = "Виды не выбраны";
                    return;
                }
                CultureInfo ci = new CultureInfo("ru-RU");
                string      dateTotal = String.Empty;
                DateTime    from = clndFrom.SelectedDate, to = clndTo.SelectedDate;
                if (from.Equals(to))
                {
                    dateTotal = from.ToString("d MMMM yyyy", ci);
                }
                else if (from.Year.Equals(to.Year))
                {
                    if (from.Month.Equals(to.Month))
                    {
                        dateTotal = from.Day.ToString() + " - " + to.ToString("d MMMM yyyy", ci) + " г.";
                    }
                    else
                    {
                        dateTotal = from.ToString("d MMMM", ci) + " - " +
                                    to.ToString("d MMMM yyyy", ci) + " г.";
                    }
                }
                else
                {
                    dateTotal = from.ToString("d MMMM yyyy", ci) + " г. - " +
                                to.ToString("d MMMM yyyy", ci) + " г.";
                }

                comp.name       = tbCompTitle.Text;
                comp.short_name = tbCompShort.Text;
                comp.place      = tbCompPlace.Text;
                comp.date       = dateTotal;

                long?nextIid = null;
                nextIid = comp.SetDateParam(Constants.PDB_COMP_START_DATE, from, nextIid);
                nextIid = (nextIid <= 0 ? null : new long?(nextIid.Value + 1));

                nextIid = comp.SetDateParam(Constants.PDB_COMP_END_DATE, to, nextIid);
                nextIid = (nextIid <= 0 ? null : new long?(nextIid.Value + 1));

                nextIid = comp.SetDateParam(Constants.PDB_COMP_DEADLINE, clndDeadLine.SelectedDate, nextIid);
                nextIid = (nextIid <= 0 ? null : new long?(nextIid.Value + 1));

                nextIid = comp.SetDateParam(Constants.PDB_COMP_DEADLINE_CHANGE, clndCorrectionDeadLine.SelectedDate, nextIid);
                nextIid = (nextIid <= 0 ? null : new long?(nextIid.Value + 1));

                nextIid = comp.SetStringParam(Constants.PDB_COMP_STYLES, sStyles, nextIid);
                nextIid = (nextIid <= 0 ? null : new long?(nextIid.Value + 1));

                nextIid = comp.SetObjectParam(Constants.PDB_COMP_ALLOW_AFTER_DEADLINE,
                                              cbAllowAfterDeadline.Checked, (o => ((bool)o).ToString()), nextIid);

                if (String.IsNullOrWhiteSpace(lblCompIid.Text))
                {
                    dc.ONLCompetitions.AddObject(comp);
                }
                dc.SaveChanges();
                LoadCompList();
                lblErrMsg.Text     = "Соревнования созданы/обновлены";
                panelComps.Visible = !(panelSelectedComp.Visible = false);
            }
            catch (Exception ex)
            {
                lblErrMsg.Text = "Ошибка обновления соревнований:\r\n" + ex.ToString();
            }
        }