private void ActivateStatus()
        {
            tournamentDetails.tournamentStatus = 2;
            List <Team>         team         = TeamHelper.GetTeam(tournamentDetails);
            List <GameOfficial> gameofficial = GameOfficialHelper.GetAllGameOfficial(tournamentDetails);
            List <Player>       player       = PlayerHelper.GetPlayer(tournamentDetails);
            List <Venue>        venue        = VenueHelper.GetVenue();

            /* if(tournamentDetails.ValidationOfActivation(team,gameofficial,player) != true)
             * {
             *   MessageBox.Show("Error Activating");
             *   return;
             * }
             */

            List <Match> match = Match.GenerateMatch(team, venue, tournamentDetails);

            foreach (Match m in match)
            {
                MatchHelper.SaveMatch(m);
            }

            if (TournamentHelper.UpdateTournamentStatus(tournamentDetails) == 0)
            {
                //report an error
                MessageBox.Show("Error activating tournament");
                this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Beispiel #2
0
    /// <inheritdoc />
    protected override async IAsyncEnumerable <string> ExecuteUnregister(
        IQueryCompounded <IDistributedQueryAtom> distQuery, DateFilter rng,
        IQueryCompounded <IVoucherQueryAtom> query, Session session)
    {
        await foreach (var a in Sort(session.Accountant.SelectAmortizationsAsync(distQuery)))
        {
            foreach (var item in a.Schedule.Where(item => item.Date.Within(rng)))
            {
                if (query != null)
                {
                    if (item.VoucherID == null)
                    {
                        continue;
                    }

                    var voucher = await session.Accountant.SelectVoucherAsync(item.VoucherID);

                    if (voucher != null)
                    {
                        if (!MatchHelper.IsMatch(query, voucher.IsMatch))
                        {
                            continue;
                        }
                    }
                }

                item.VoucherID = null;
            }

            yield return(await ListAmort(a, session));

            await session.Accountant.UpsertAsync(a);
        }
    }
 public void DetailMatchTestRemark()
 => StringMatchTest(
     (v, f) => MatchHelper.IsMatch(new VoucherDetail {
     Remark = v
 }, new VoucherDetail {
     Remark = f
 }));
Beispiel #4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            MatchItem matchNew = new MatchItem(
                txtTeam1.Text,
                txtTeam2.Text,
                MatchHelper.MergeDate(dtpDateBegin.Value, dtpTimeBegin.Value),
                (int)nudDuration.Value);

            if (matchNew.DateBegin < DateTime.Now)
            {
                MessageBox.Show(Strings.NotAdd, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            string matchIntersects = MatchHelper.ToIntersectsString(matchProvider, matchNew);

            if (matchIntersects == string.Empty ||
                MessageBox.Show(Strings.IntersectAdd + matchIntersects, Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                matchProvider.Add(matchNew);

                matchProvider.Save();
                lstMatches.Items.Clear();
                matchProvider.Load();
                lstMatches.SetSelected(matchProvider.Count - 1, true);
            }
        }
 public void DetailMatchTestNull()
 => Assert.True(
     MatchHelper.IsMatch(
         new VoucherDetail {
     Content = "cnt", Fund = 10, Remark = "rmk"
 },
         (VoucherDetail)null));
 public void DetailMatchTestContent()
 => StringMatchTest(
     (v, f) => MatchHelper.IsMatch(new VoucherDetail {
     Content = v
 }, new VoucherDetail {
     Content = f
 }));
Beispiel #7
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            int selected = lstMatches.SelectedIndex;

            if (selected > -1 && selected < matchProvider.Count)
            {
                MatchItem matchUpdate = matchProvider[selected];
                matchUpdate.Team1     = txtTeam1.Text;
                matchUpdate.Team2     = txtTeam2.Text;
                matchUpdate.DateBegin = MatchHelper.MergeDate(dtpDateBegin.Value, dtpTimeBegin.Value);
                matchUpdate.Duration  = (int)nudDuration.Value;

                if (matchUpdate.DateBegin < DateTime.Now)
                {
                    MessageBox.Show(Strings.NotUpdate, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                string matchIntersects = MatchHelper.ToIntersectsString(matchProvider, matchUpdate);
                if (matchIntersects == string.Empty ||
                    MessageBox.Show(Strings.IntersectUpdate + matchIntersects, Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    matchProvider.Save();
                    lstMatches.Items.Clear();
                    matchProvider.Load();
                    lstMatches.SetSelected(selected, true);
                }
            }
        }
        public void LoadGame(
            out List <Brands> brands,
            out List <Cards> cards,
            out List <Matches> matches,
            out List <Promotions> promotions,
            out List <Teams> teams,
            out List <TitlesMain> titles,
            out List <WrestlersMain> wrestlers
            )
        {
            BrandHelper     bHelper  = new BrandHelper();
            CardHelper      cHelper  = new CardHelper();
            MatchHelper     mHelper  = new MatchHelper();
            PromotionHelper pHelper  = new PromotionHelper();
            TeamHelper      tHelper  = new TeamHelper();
            TitleHelper     tlHelper = new TitleHelper();
            WrestlerHelper  wHelper  = new WrestlerHelper();

            brands     = bHelper.PopulateBrandsList();
            cards      = cHelper.PopulateCardsList();
            matches    = mHelper.PopulateMatchesList();
            promotions = pHelper.PopulatePromotionsList();
            teams      = tHelper.PopulateTeamsList();
            titles     = tlHelper.PopulateTitlesList();
            wrestlers  = wHelper.PopulateWrestlersList();
        }
 public void DetailMatchTestFund(bool expected, double?value, double?filter)
 => Assert.Equal(
     expected,
     MatchHelper.IsMatch(new VoucherDetail {
     Fund = value
 }, new VoucherDetail {
     Fund = filter
 }));
 public void DetailMatchTestCurrency(bool expected, string value, string filter)
 => Assert.Equal(
     expected,
     MatchHelper.IsMatch(new VoucherDetail {
     Currency = value
 }, new VoucherDetail {
     Currency = filter
 }));
Beispiel #11
0
 public void VoucherMatchTestType(bool expected, VoucherType?value, VoucherType?filter)
 {
     Assert.Equal(expected, MatchHelper.IsMatch(new Voucher {
         Type = value
     }, new Voucher {
         Type = filter
     }));
 }
Beispiel #12
0
 public void VoucherMatchTestID(bool expected, string value, string filter)
 {
     Assert.Equal(expected, MatchHelper.IsMatch(new Voucher {
         ID = value
     }, new Voucher {
         ID = filter
     }));
 }
Beispiel #13
0
 public void VoucherMatchTestRemark()
 {
     StringMatchTest((v, f) => MatchHelper.IsMatch(new Voucher {
         Remark = v
     }, new Voucher {
         Remark = f
     }));
 }
 public void DetailMatchTestSubTitle(bool expected, int?value, int?filter)
 => Assert.Equal(
     expected,
     MatchHelper.IsMatch(new VoucherDetail {
     SubTitle = value
 }, new VoucherDetail {
     SubTitle = filter
 }));
Beispiel #15
0
        private int GetTopPostionIndex(List <InsertElement> ElementList, List <State> StateList)
        {
            MatchHelper.Assert(ElementList.Count != StateList.Count,
                               @" FUCTION GetTopPostionIndex ERROR, 
                                                         ElementList's Length not equal to StateList's Length   ");
            int index = -1;

            for (int i = 0; i < ElementList.Count; i++)
            {
                // is new place and  index = 0, inserted node is root
                if ((ElementList[i].Mode & PlaceMask) == (UInt16)InsertMode.NewPlace)
                {
                    index = i;
                    break;
                }
                if ((ElementList[i].Mode & PlaceMask) == (UInt16)InsertMode.OldPlace)
                {
                    if (StateList[i].NodeCount > 1)
                    {
                        throw new TrainException(ElementList[i], "Top Insert position is multi-matched, insert failed");
                    }
                    else if (StateList[i].NodeCount == 0)
                    {
                        throw new TrainException(ElementList[i], "Top Insert position is non-matched, insert failed");
                    }
                    else
                    {
                        index = i + 1;
                        // continue loop
                        continue;
                    }
                }
                if ((ElementList[i].Mode & PlaceMask) == (UInt16)InsertMode.AutoPlace)
                {
                    if (StateList[i].NodeCount == 1)
                    {
                        index = i + 1;
                        continue;
                    }
                    else if (StateList[i].NodeCount > 1)
                    {
                        throw new TrainException(ElementList[i], "Insert element list is not sufficient, insert failed");
                    }
                    else if (StateList[i].NodeCount == 0)
                    {
                        index = i;
                        break;
                    }
                }
            }

            MatchHelper.Assert(index == -1,
                               @" FUCTION GetTopPostionIndex ERROR, 
                                                         judge position index error, skip all if statement  ");

            return(index);
        }
 public void DetailMatchTestUser(bool expected, string value, string filter)
 {
     Assert.Equal(
         expected,
         MatchHelper.IsMatch(new VoucherDetail {
         User = value
     }, new VoucherDetail {
         User = filter
     }));
 }
        private static void Match()
        {
            AddrSet addrset = AddrSet.GetInstance();

            //Match
            MatchMachine m = new MatchMachine(addrset);

            MatchResult result = m.Match(new string[] { "B" });

            MatchHelper.rwLockDashboard(addrset);
        }
Beispiel #18
0
        public void VoucherMatchTestDate(bool expected, string valueS, string filterS)
        {
            var value  = valueS.ToDateTime();
            var filter = filterS.ToDateTime();

            Assert.Equal(expected, MatchHelper.IsMatch(new Voucher {
                Date = value
            }, new Voucher {
                Date = filter
            }));
        }
Beispiel #19
0
        public static void TestRef()
        {
            UInt16        a = 0x200;
            InsertElement e = new InsertElement("", LEVEL.Building, InsertMode.AutoLevel | InsertMode.AutoPlace);

            Console.WriteLine("a is  = " + Convert.ToString(a, 2));


            MatchHelper.Assert(true, "aaaa");
            Console.ReadLine();
        }
Beispiel #20
0
        private void dtpBegin_ValueChanged(object sender, EventArgs e)
        {
            if (dtpDateBegin.Value < DateTime.Today)
            {
                dtpDateBegin.Value = DateTime.Today;
            }

            DateTime dateBegin = MatchHelper.MergeDate(dtpDateBegin.Value, dtpTimeBegin.Value);

            dtpDateBegin.Value = dateBegin;
            dtpTimeBegin.Value = dateBegin;
        }
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
     DontDestroyOnLoad(this);
 }
        private PtsAndGoalsDto GetPtsAndGoals(MatchDto match)
        {
            var homeTeamPts = MatchHelper.GetNumberOfHomeTeamPoints(match.Score);

            return(new PtsAndGoalsDto
            {
                HomeTeamPts = homeTeamPts,
                AwayTeamPts = homeTeamPts == 3 ? 0 : homeTeamPts == 1 ? 1 : 3,
                HomeTeamGoals = MatchHelper.GetNumberOfGoals(match.Score, homeTeam: true),
                AwayTeamGoals = MatchHelper.GetNumberOfGoals(match.Score, homeTeam: false)
            });
        }
Beispiel #23
0
        private void frmMatch_Load(object sender, EventArgs e)
        {
            lblTournament.Text = tournament.tournamentTitle + " " + tournament.tournamentStart.Year;
            this.Visible       = false;
            List <Match> list = MatchHelper.GetMatch(tournament);

            foreach (var m in list)
            {
                var match = new UCMatch(m, tournament);

                flowLayoutPanel1.Controls.Add(match);
            }
            this.Visible = true;
        }
Beispiel #24
0
 // Use this for initialization
 void Start()
 {
     mh = GameObject.FindGameObjectWithTag ("MatchHelper").GetComponent ("MatchHelper") as MatchHelper;
     numPos = 4;
     menuSel = 0;
     vThresh = 0.5f;
     mLoc = new SPoint [4];
     mLoc [0] = new SPoint (-280.0f, 120.0f);
     mLoc [1] = new SPoint (-280.0f, 60.0f);
     mLoc [2] = new SPoint (-280.0f, 0.0f);
     mLoc [3] = new SPoint (-280.0f, -100.0f);
     inputTmr = new STimer (0.2f);
     isSelected = false;
 }
Beispiel #25
0
        public async Task <IActionResult> GetMatchList(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }


            //Recolher dados estatisticos do Match feito anteriormente.
            var matchStatsInfoDb = _context.MatchStats.ToList();
            var matchStatsInfo   = new MatchStatsInfo
            {
                //NrRecords = matchStatsInfoDb.Count(),
                GrupoSanguineoMulher = matchStatsInfoDb.Count(x => x.GrupoSanguineoMulher),
                GrupoSanguineoHomem  = matchStatsInfoDb.Count(x => x.GrupoSanguineoHomem),
                CorOlhosMulher       = matchStatsInfoDb.Count(x => x.CorOlhosMulher),
                CorCabeloMulher      = matchStatsInfoDb.Count(x => x.CorCabeloMulher),
                RacaHomem            = matchStatsInfoDb.Count(x => x.RacaHomem),
                CorPeleMulher        = matchStatsInfoDb.Count(x => x.CorPeleMulher),
                CorOlhosHomem        = matchStatsInfoDb.Count(x => x.CorOlhosHomem),
                CorCabeloHomem       = matchStatsInfoDb.Count(x => x.CorCabeloHomem),
                CorPeleHomem         = matchStatsInfoDb.Count(x => x.CorPeleHomem),
                TexturaCabeloHomem   = matchStatsInfoDb.Count(x => x.TexturaCabeloHomem),
                TexturaCabeloMulher  = matchStatsInfoDb.Count(x => x.TexturaCabeloMulher),
                RacaMulher           = matchStatsInfoDb.Count(x => x.RacaMulher),
            };

            //Recolher dados do casal e lista de dadores filtrados com factor de exclusao
            var casal     = _context.Casal.FirstOrDefault(x => x.CasalID == id);
            var matchList = _context.Dador
                            .Where(x => x.Amostras.Any(y => y.PedidoGametas == null))
                            .Where(x => casal.GamMatch(x))
                            .ToList();

            //Mecanismo de ordenação baseada nas escolhas frequentes do utilizador
            var listaOrdenada = MatchHelper.GetOrdedList(matchList, casal, matchStatsInfo);

            if (!listaOrdenada.Any())
            {
                casal.PedidoGametas.EstadoProcessoPedido = EstadoProcesso.EmListaEspera;

                //TODO apresentar mensagem utilizador de "sem match possiveis de momento"
                return(NotFound());
            }

            ViewBag.CasalId = id;
            return(View("ListaDadores", listaOrdenada));
        }
Beispiel #26
0
        public async Task <IActionResult> CreateMatch([FromBody] PostMatch model)
        {
            using MatchHelper mh = new MatchHelper(_dbcontext, _matchRepository, _oddRepository);

            if (ModelState.IsValid)
            {
                //model.MatchDate = DateTime.Today;
                //model.MatchTime = DateTime.Now.TimeOfDay;
                //model.Sport = (int)Sports.Football;
                return(Ok(await mh.InsertMatchWithOdd(model)));
            }
            else
            {
                return(BadRequest(ModelState));
            }
        }
        private static void Train()
        {
            AddrSet addrset = AddrSet.GetInstance();

            TrainMachine t = new TrainMachine(addrset);

            List <InsertElement> list = new List <InsertElement>();

            Random rnd = new Random();

            list.Add(new InsertElement(rnd.Next().ToString("0.00"), LEVEL.City, InsertMode.AutoPlace | InsertMode.ExactlyLevel));

            t.Train(list, true);

            MatchHelper.rwLockDashboard(addrset);
        }
Beispiel #28
0
 // Use this for initialization
 void Start()
 {
     numPos = 3;
     menuSel = 0;
     vThresh = 0.5f;
     mLoc = new SPoint [numPos];
     mLoc [0] = new SPoint (100.0f, 5.0f);
     mLoc [1] = new SPoint (100.0f, -15.0f);
     mLoc [2] = new SPoint (100.0f, -35.0f);
     inputTmr = new STimer (lTime);
     selTmr = new STimer (lTime);
     mh = GameObject.FindGameObjectWithTag ("MatchHelper").GetComponent ("MatchHelper") as MatchHelper;
     DebugSelDisplay (mh.GetDebugMode ());
     stockNum = mh.GetStocks ();
     stockDisp.text=stockNum.ToString();
 }
Beispiel #29
0
        public async Task <IActionResult> SelectMatch(int?id, int?casalid)
        {
            if (id == null || casalid == null)
            {
                return(NotFound());
            }

            var casalMatch = _context.Casal.Include(x => x.PedidoGametas).FirstOrDefault(x => x.CasalID == casalid);
            var dadorMatch = _context.Dador.Include(x => x.Amostras).FirstOrDefault(x => x.DadorId == id);

            if (dadorMatch == null || casalMatch == null)
            {
                return(NoContent());
            }



            var pedidoAssociado = _context.PedidoGametas
                                  .Find(casalMatch.PedidoGametas.PedidoGametasId);

            pedidoAssociado.EstadoProcessoPedido = EstadoProcesso.EncontrouMatch;
            var amostraSelecionada = _context.Amostra.Where(x => x.PedidoGametas == null)
                                     .Where(x => x.DadorId == dadorMatch.DadorId).OrderByDescending(x => x.AmostraId).FirstOrDefault();

            //var amostraSelecionada2 = dadorMatch.Amostras.Where(x=>x.PedidoGametas==null)
            //    .OrderByDescending(x => x.AmostraId).FirstOrDefault();

            if (amostraSelecionada == null)
            {
                //TODO Mensagem erro no processo
                return(NoContent());
            }

            pedidoAssociado.AmostraId = amostraSelecionada.AmostraId;

            //pedidoAssociado.Casal
            //_context.PedidoGametas.Update(pedidoAssociado);
            _context.PedidoGametas.Update(pedidoAssociado);

            var match = MatchHelper.GetMatchStats(casalMatch, dadorMatch);
            await _context.MatchStats.AddAsync(match);

            await _context.SaveChangesAsync();


            return(RedirectToAction("Index"));
        }
        private void ActivateStatus()
        {
            int si = 0;

            try
            {
                si = lvwTournaments.SelectedItems[0].Index;
            }
            catch { return; }

            Tournament selectedTournament = list[si];

            selectedTournament.tournamentStatus = 2;
            List <Team>         team         = TeamHelper.GetTeam(selectedTournament);
            List <GameOfficial> gameofficial = GameOfficialHelper.GetAllGameOfficial(selectedTournament);
            List <Player>       player       = PlayerHelper.GetPlayer(selectedTournament);
            List <Venue>        venue        = VenueHelper.GetVenue();

            if (selectedTournament.ValidationOfActivation(team, gameofficial, player) != true)
            {
                MessageBox.Show("Cannot Activate because you need follow the rules activating the tourmament[2 Teams] And [2 Game Official] require");
                return;
            }


            List <Match> match = Match.GenerateMatch(team, venue, selectedTournament);

            foreach (Match m in match)
            {
                MatchHelper.SaveMatch(m);
            }

            if (TournamentHelper.UpdateTournamentStatus(selectedTournament) == 0)
            {
                //report an error
                MessageBox.Show("Error activating tournament");
                this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            }
            lblStatus.Text               = "Activate";
            btnActivate.Visible          = false;
            btnPrint.Visible             = false;
            btnExportTeamRooster.Visible = true;
            btnClose.Visible             = true;
            displayTournament();
        }
Beispiel #31
0
        public void Match()
        {
            //start
            AddrSet addrset = AddrSet.GetInstance();

            //Match
            MatchMachine m = new MatchMachine(addrset);

            // Custom the MatchRule
            //m.SetMatchRule(rule);

            MatchResult result = m.Match(new string[] { "B" });


            MatchHelper.PrintResult(result);

            //close
            //addrset.Dump();
        }
Beispiel #32
0
        /// <summary>
        /// 县
        /// </summary>
        /// <param name="uri">页面URL地址</param>
        /// <param name="domCode">HTML代码</param>
        /// <param name="parentNode">父节点</param>
        private void GetCounty(Uri uri, string domCode, TreeNode parentNode)
        {
            string _pattern = "<tr class=(\"|')countytr(\"|')>([\\s\\S]*?)<\\/tr>";

            string[] _trDoms = MatchHelper.GetStrings(domCode, _pattern);

            foreach (string _trDomStr in _trDoms)
            {
                ArrayList _alLinks = MatchHelper.GetHTMLATag(_trDomStr);
                if (_alLinks.Count > 0 && _alLinks.Count % 2 == 0)
                {
                    string _strCUrl  = MatchHelper.GetHrefString(_alLinks[0].ToString());
                    string _areaId   = MatchHelper.RemoveHtmlTag(_alLinks[0].ToString()).Substring(0, 6);
                    string _areaName = MatchHelper.RemoveHtmlTag(_alLinks[1].ToString());

                    TreeNode _treeNode = new TreeNode()
                    {
                        Text = $"{_areaName}({_areaId})"
                    };

                    AddNodeToAreaTreeView(_treeNode, parentNode);

                    if (_treeNode != null)
                    {
                        // 获取下级区域信息,如果有则加载
                        Uri _uriChildren; // 下级区域的Url地址
                        if (Uri.TryCreate(uri, _strCUrl, out _uriChildren))
                        {
                            string _url = _uriChildren.AbsoluteUri;

                            // 获取数据
                            string _childrenPageDom = _httpHelper.GetHtml(_url, encode, false);

                            if (!string.IsNullOrWhiteSpace(_childrenPageDom) && !_childrenPageDom.Equals("404"))
                            {
                                GetTown(_uriChildren, _childrenPageDom, _treeNode);
                            }
                        }
                    }
                }
            }
        }