Exemplo n.º 1
0
        /// <summary>
        /// Fill match list by reading data from SoccerMatchSchedule udt
        /// </summary>
        private void FillMatchList()
        {
            try
            {
                DataSet dt = m_objUDTMatchSchedule.CurrentDataSet;
                var dtmatch = dt.Tables[1];
                AutoCompleteStringCollection cmbstr = new AutoCompleteStringCollection();
                foreach (DataRow item in dtmatch.Rows)
                {
                    cmbstr.Add(item["Name"].ToString());
                    cmbMatch.Items.Add(item["Name"].ToString());
                }
                cmbMatch.AutoCompleteCustomSource = cmbstr;
                DataRow[] dr = dtmatch.Select("Active=true");
                if (dr.Count() > 0)
                {
                    MATCHUDTNAME = dr[0]["UDT Name"].ToString();
                    int index = cmbMatch.FindString(dr[0]["Name"].ToString());
                    if (index != -1)
                    {
                        try
                        {
                            cmbMatch.SelectedIndex = index;
                        }
                        catch { }
                        UdtFilter filter = new UdtFilter();
                        filter.FilterColumn = "Name";
                        filter.FilterValue = cmbMatch.Text;
                        filter.TableIndex = 5;
                        if (!m_objUDTMatchSchedule.UdtFilters.ContainsKey("Active Match"))
                            m_objUDTMatchSchedule.UdtFilters.Add("Active Match", filter);
                        else
                            m_objUDTMatchSchedule.UdtFilters["Active Match"] = filter;
                        m_objUDTMatchSchedule.Notify("Active Match");
                    }

                }
            }
            catch (Exception ex)
            {
                LogWriter.WriteLog(ex);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Change the active match and fill the data according to the new match
        /// </summary>
        private void FillMatchDetails()
        {
            try
            {
                UdtFilter filter = new UdtFilter();
                filter.FilterColumn = "Name";
                filter.FilterValue = cmbMatch.Text;
                filter.TableIndex = 1;
                if (!m_objUDTMatchSchedule.UdtFilters.ContainsKey("Active Match"))
                    m_objUDTMatchSchedule.UdtFilters.Add("Active Match", filter);
                else
                    m_objUDTMatchSchedule.UdtFilters["Active Match"] = filter;

                foreach (string item in cmbMatch.Items)
                {
                    if (item == cmbMatch.Text)
                    {
                        m_objUDTMatchSchedule.UpdateUdt(1, new string[] { "Active" }, new string[] { "true" }, "Name", cmbMatch.Text, isformloaded);
                    }
                    else
                    {
                        m_objUDTMatchSchedule.UpdateUdt(1, new string[] { "Active" }, new string[] { "false" }, "Name", item, isformloaded);
                    }
                }
                m_objUDTMatchSchedule.Notify("Active Match");
                ActiveMatch = cmbMatch.Text;
                if (m_objUDTMatchSchedule != null)
                {
                    DataTable dt = m_objUDTMatchSchedule.CurrentDataSet.Tables[1];
                    {
                        foreach (DataRow row in dt.Rows)
                        {
                            if ((bool)row["Active"])
                            {
                                NAME = row["NAME"].ToString();
                                SetMatchUdtName();
                            }
                        }
                    }
                }
                SelectTeams(ActiveMatch);
                dgvMatchevents.Rows.Clear();
                FillMatchEvents();
                ClearPlayerControlls();
                lblMatchname.Text = lblHomeTeam.Text + " Vs " + lblAwayTeam.Text;
            }
            catch (Exception ex)
            {
                LogWriter.WriteLog(ex);
            }
        }