private void btnLoadOneList_Click(object sender, EventArgs e)
        {
            int       iid;
            string    style, round;
            DataTable dtL = this.dt.Clone();

            dtL.Rows.Clear();
            try
            {
                int curRInd = dg.Rows.IndexOf(dg.CurrentRow);
                if (curRInd < 0 || curRInd >= dt.Rows.Count)
                {
                    return;
                }
                object[] row = dt.Rows[curRInd].ItemArray;
                dtL.Rows.Add(row);
                iid = Convert.ToInt32(dg.CurrentRow.Cells["№"].Value);

                style = dg.CurrentRow.Cells["Вид"].Value.ToString();
                round = dg.CurrentRow.Cells["Раунд"].Value.ToString();
                dg.CurrentRow.Cells["Доступ на сайте"].Value = true;
                dtL.Rows[0]["Доступ на сайте"] = true;
            }
            catch
            {
                MessageBox.Show("Протокол не выбран");
                return;
            }
            OnlineUpdater2.GetUpdater(cn).LoadSingleList(iid, true);
            MessageBox.Show("Протокол загружен");
            return;

            if (client != null)
            {
                OnlineUpdater.ReloadOneList(iid, cn, client);
                return;
            }
            SqlCommand cmd = new SqlCommand();

            try
            {
                if (cn.State != ConnectionState.Open)
                {
                    cn.Open();
                }
                cmd.Connection  = cn;
                cmd.CommandText = "UPDATE lists SET online = 1, changed = 0 WHERE iid = " + iid.ToString();
                cmd.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            try
            {
                startBroadcast = StaticClass.ReloadListsFromTable(false, dtL, cn, remoteConnection, compForService, client);
                if (startBroadcast)
                {
                    StaticClass.UpdateListData(iid, cn, remoteConnection, true, true, compForService, client);
                    MessageBox.Show("Протокол загружен");
                }
                else
                {
                    throw new Exception();
                }
            }
            catch (Exception ex) { MessageBox.Show("Ошибка добавления протокола\r\n" + ex.Message); }
        }
 private void ReloadClimbersList()
 {
     OnlineUpdater2.GetUpdater(this.cn).PostAllGroups();
     OnlineUpdater2.Instance.PostAllClimbers();
     MessageBox.Show("Список участников успешно загружен");
 }
        private void btnReloadLists_Click(object sender, EventArgs e)
        {
            try
            {
                if (da.UpdateCommand.Connection.State != ConnectionState.Open)
                {
                    da.UpdateCommand.Connection.Open();
                }
                da.Update(this.dt);
                //SqlCommand cmd = new SqlCommand("UPDATE lists SET changed = 0", da.UpdateCommand.Connection);
                //cmd.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            try
            {
                OnlineUpdater2.GetUpdater(this.cn).PostUpdatedGroups();
                OnlineUpdater2.Instance.PostChangedClimbers();
                if (OnlineUpdater2.Instance.LoadAllLists() > 0)
                {
                    MessageBox.Show("Протоколы загружены");
                    startBroadcast = true;
                    this.Close();
                    return;
                }
                startBroadcast = false;
                if (MessageBox.Show("Протоколы для загрузки на сайт не выбраны. Выбрать протоколы?", "", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("Ошибка загрузки: {0}", ex));
                return;
            }

            return;

            if (client != null)
            {
                OnlineUpdater.BeginFullUpdate(true, cn, client, OnlineStarted,
                                              String.Format("Данные на сайте перезагружены{0}Трансляция успешно запущена", Environment.NewLine),
                                              OnlineUpdater.UpdateStartMode.AskForWait);
                this.Close();
                startBroadcast = true;
                return;
            }
            startBroadcast = StaticClass.ReloadListsFromTable(true, dt, cn, remoteConnection, compForService, client);
            try
            {
                if (startBroadcast)
                {
                    StaticClass.UpdateListData(true, cn, remoteConnection, true, compForService, client);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ошибка запуска трансляции\r\n" + ex.Message);
                return;
            }
            if (!startBroadcast)
            {
                if (MessageBox.Show("Протоколы для загрузки на сайт не выбраны. Выбрать протоколы?", "", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    this.Close();
                }
            }
            else
            {
                this.Close();
            }
        }
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            DataTable dtL = null;

            try
            {
                if (da.UpdateCommand.Connection.State != ConnectionState.Open)
                {
                    da.UpdateCommand.Connection.Open();
                }
                da.Update(this.dt);

                startBroadcast = OnlineUpdater2.GetUpdater(cn).LoadLiveLists() > 0;
                if (startBroadcast)
                {
                    this.Close();
                    return;
                }

                if (MessageBox.Show("Протоколы для загрузки на сайт не выбраны. Выбрать протоколы?", "", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    this.Close();
                }
                return;

                //SqlCommand cmd = new SqlCommand("UPDATE lists SET changed = 0", da.UpdateCommand.Connection);
                //cmd.ExecuteNonQuery();

                dtL = dt.Clone();
                dtL.Rows.Clear();
                foreach (DataRow dr in dt.Rows)
                {
                    if (Convert.ToBoolean(dr["Прямая трансляция"]) &&
                        Convert.ToBoolean(dr["Доступ на сайте"]))
                    {
                        dtL.Rows.Add(dr.ItemArray);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            if (client != null)
            {
                OnlineUpdater.BeginFullUpdate(false, cn, client, OnlineStarted, "Трансляция успешно запущена", OnlineUpdater.UpdateStartMode.AskForWait);
                this.Close();
                startBroadcast = true;
                return;
            }
            if (dtL != null && dtL.Rows.Count > 0)
            {
                startBroadcast = StaticClass.ReloadListsFromTable(false, dtL, cn, remoteConnection, compForService, client);
            }
            else
            {
                startBroadcast = false;
            }
            try
            {
                if (startBroadcast)
                {
                    StaticClass.UpdateListData(false, cn, remoteConnection, true, compForService, client);
                }
            }
            catch { }
            if (!startBroadcast)
            {
                if (MessageBox.Show("Протоколы для загрузки на сайт не выбраны. Выбрать протоколы?", "", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    this.Close();
                }
            }
            else
            {
                this.Close();
            }
        }