Пример #1
0
        public int CompareTo(object obj)
        {
            TeamPrint tp = obj as TeamPrint;

            if (this.TeamScore > tp.TeamScore)
            {
                return(1);
            }
            else if (this.TeamScore < tp.TeamScore)
            {
                return(-1);
            }
            else if (this.TeamScore == tp.TeamScore)
            {
                for (int i = 0; i < this.Hits.Count; i++)
                {
                    if (this.Hits[i] == tp.Hits[i])
                    {
                        continue;
                    }
                    else if (this.Hits[i] < tp.Hits[i])
                    {
                        return(-1);
                    }
                    else if (this.Hits[i] > tp.Hits[i])
                    {
                        return(1);
                    }
                }
            }
            return(0);
        }
Пример #2
0
        // Create single text
        private void FillTextSingle()
        {
            int rank = 1;

            TeamPrint.CheckIfEqualSingle(singlePrintList);

            txbSingle.Text += cname + ", " + cdate.ToShortDateString() + "\n\n";

            txbSingle.Text += String.Format("{0,10}{1,25}{2,30}{3,15}{4,15}{5,15}\n\n", "MESTO", "IME IN PRIIMEK", "STRELI", "ŠT.STRELOV", "ODBITEK", "REZULTAT");

            foreach (singleprintview spv in singlePrintList)
            {
                //txbSingle.Text += rank.ToString() + ". " + spv.name + " " + spv.surname + " (" + spv.score.ToString() + ")\n";
                txbSingle.Text += String.Format("{0,10}{1,25}{2,30}{3,15}{4,15}{5,15}\n\n", rank + ".", spv.name + " " + spv.surname, string.Join(":", spv.hits.Split(':').Reverse().ToArray()), spv.shots, spv.penal, spv.score);
                rank++;
            }
        }
Пример #3
0
        //CODE FOR CREATING FIXED DOCUMENT SINGLE
        private void FillTextSingle()
        {
            int rank           = 1;
            int blocks_on_page = 34;
            int counter        = 34;

            FixedPage   page        = null;
            TextBlock   pageText    = null;
            PageContent pageContent = null;

            TeamPrint.CheckIfEqualSingle(singlePrintList);

            foreach (singleprintview spv in singlePrintList)
            {
                if (counter % blocks_on_page == 0)
                {
                    page        = new FixedPage();
                    pageText    = new TextBlock();
                    pageContent = new PageContent();

                    pageText.FontFamily = new FontFamily("Consolas");

                    pageText.Text = String.Format("\n   {0}, {1}{2,70}. stran\n\n", cname, cdate.ToShortDateString(), counter / blocks_on_page);

                    pageText.Text += String.Format("{0,10}{1,25}{2,30}{3,15}{4,15}\n\n", "MESTO", "IME IN PRIIMEK", "STRELI", "ŠT.STRELOV", "REZULTAT");
                }

                pageText.Text += String.Format("{0,10}{1,25}{2,30}{3,15}{4,15}\n\n", rank + ".", spv.name + " " + spv.surname, string.Join(":", spv.hits.Split(':').Reverse().ToArray()), spv.shots, spv.score);

                if (counter % blocks_on_page == 0)
                {
                    page.Children.Add(pageText);
                    ((IAddChild)pageContent).AddChild(page);
                    fixed_doc_single.Pages.Add(pageContent);
                }

                rank++;
                counter++;
            }
        }
Пример #4
0
        // Create teams and text
        private void FillTextTeam()
        {
            txbTeam.Text = String.Format("{0}, {1}\n\n", cname, cdate.ToShortDateString());

            txbTeam.Text += String.Format("{0} {1}{2,20}{3,4}{4,4}{5,4}{6,4}{7,4}{8,4}{9,4}{10,4}{11,4}{12,4}{13,4}{14,10}{15,10}{16,10}\n", "MESTO", "EKIPA", "M", 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, "X", "STRELI", "ODBITEK", "REZULTAT");

            TeamPrint tp;

            using (ShootappDBEntities context = new ShootappDBEntities())
            {
                foreach (teamdistview tdw in teamIds)
                {
                    List <teamprintview> tempTeam = context.teamprintviews.Where(t => t.tid == tdw.tid && t.cid == compId && t.hits != null).ToList();

                    if (tempTeam.Count == 0)
                    {
                        continue;
                    }
                    else
                    {
                        tp = new TeamPrint(tempTeam);
                        TeamsL.Add(tp);
                    }
                }
            }

            TeamsL.Sort();
            TeamsL.Reverse();

            int rank = 1;

            foreach (TeamPrint t in TeamsL)
            {
                t.GlobalRank  = rank;
                txbTeam.Text += t.ToString();
                rank++;
            }
        }
Пример #5
0
        //CODE FOR CREATING FIXED DOCUMENT
        private void FillTextTeam()
        {
            int rank           = 1;
            int blocks_on_page = 10;
            int counter        = 10;

            FixedPage   page        = null;
            TextBlock   pageText    = null;
            PageContent pageContent = null;
            TeamPrint   tp;

            using (ShootappDBEntities context = new ShootappDBEntities())
            {
                foreach (teamdistview tdw in teamIds)
                {
                    List <teamprintview> tempTeam = context.teamprintviews.Where(t => t.tid == tdw.tid && t.cid == compId && t.hits != null).ToList();

                    if (tempTeam.Count == 0)
                    {
                        continue;
                    }
                    else
                    {
                        tp = new TeamPrint(tempTeam);
                        TeamsL.Add(tp);
                    }
                }
            }

            TeamsL.Sort();
            TeamsL.Reverse();

            foreach (TeamPrint t in TeamsL)
            {
                t.GlobalRank = rank;

                if (counter % blocks_on_page == 0)
                {
                    page                = new FixedPage();
                    pageText            = new TextBlock();
                    pageContent         = new PageContent();
                    pageText.FontFamily = new FontFamily("Consolas");

                    pageText.Text = String.Format("\n   {0}, {1}{2,70}. stran\n\n", cname, cdate.ToShortDateString(), counter / blocks_on_page);

                    pageText.Text += String.Format("   {0} {1}{2,20}{3,4}{4,4}{5,4}{6,4}{7,4}{8,4}{9,4}{10,4}{11,4}{12,4}{13,4}{14,13}{15,13}\n", "MESTO", "EKIPA", "M", 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, "STRELI", "REZULTAT");
                }

                pageText.Text += t.ToString();

                if (counter % blocks_on_page == 0)
                {
                    page.Children.Add(pageText);
                    ((IAddChild)pageContent).AddChild(page);
                    fixed_document.Pages.Add(pageContent);
                }

                rank++;
                counter++;
            }
        }