Ejemplo n.º 1
0
        private void cbxPromos_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbxPromos.SelectedItem.ToString() == "All Promotions")
            {
                List <CardsEntity> sortedCard = storeHelper.CardsList.OrderByDescending(c => c.FinalCardRating).ToList();

                isBrandSorted = false;

                SetButonsOutput(sortedCard);
            }
            else
            {
                string selItem = cbxPromos.SelectedItem.ToString();

                PromotionsEntity promo = storeHelper.PromotionsList.FirstOrDefault(p => p.Name == selItem);

                List <CardsEntity> promoCards = storeHelper.CardsList.Where(c => c.ConnOrgName == promo.Name).ToList();

                List <CardsEntity> sortedCard = promoCards.OrderByDescending(c => c.FinalCardRating).ToList();

                isBrandSorted = true;

                SetButonsOutput(sortedCard);
            }
        }
Ejemplo n.º 2
0
        private List <MatchesEntity> SortedMatchOutput()
        {
            List <MatchesEntity> sortedMatches = new List <MatchesEntity>();

            if (!isBrandSorted)
            {
                sortedMatches = storeHelper.MatchesList.OrderByDescending(c => c.MatchRating).ToList();
            }
            else
            {
                string selItem = cbxPromos.SelectedItem.ToString();

                PromotionsEntity promo = storeHelper.PromotionsList.FirstOrDefault(p => p.Name == selItem);

                List <CardsEntity> promoCards = storeHelper.CardsList.Where(c => c.ConnOrgName == promo.Name).ToList();

                List <MatchesEntity> matches = new List <MatchesEntity>();

                foreach (CardsEntity c in promoCards)
                {
                    MatchesEntity match = mHelper.PopulateMatchesList().FirstOrDefault(m => m.AttachedCardName == c.CardName);

                    matches.Add(match);
                }

                sortedMatches = matches.OrderByDescending(m => m.MatchRating).ToList();
            }

            return(sortedMatches);
        }
Ejemplo n.º 3
0
        public ModTitles(string orgName)
        {
            InitializeComponent();

            OrgName = orgName;

            PromotionsEntity promo = pHelper.PopulatePromotionsList().FirstOrDefault(p => p.Name == OrgName);

            storeHelper.BrandsList = bHelper.PopulateBrandsList().Where(b => b.ConnOrgName == promo.Name).Distinct().ToList();
            storeHelper.TitlesList = tHelper.PopulateTitlesList().Where(t => t.OwnerOrgName == promo.Name).Distinct().ToList();

            foreach (TitlesEntity t in storeHelper.TitlesList)
            {
                cbxTitles.Items.Add(t.Name);
            }

            if (storeHelper.BrandsList.Count > 0)
            {
                cbxAsscBrand.Items.Add("");
                foreach (BrandsEntity b in storeHelper.BrandsList)
                {
                    cbxAsscBrand.Items.Add(b.Name);
                }
            }
        }
Ejemplo n.º 4
0
        public ModTeamsAdjMems(string orgName, string teamName)
        {
            InitializeComponent();

            OrgName  = orgName;
            TeamName = teamName;

            PromotionsEntity promo = pHelper.PopulatePromotionsList().FirstOrDefault(p => p.Name == OrgName);
            TeamsEntity      team  = tHelper.PopulateTeamsList().FirstOrDefault(t => t.TeamName == TeamName);

            storeHelper.BrandsList    = bHelper.PopulateBrandsList().Where(b => b.ConnOrgName == promo.Name).ToList();
            storeHelper.WrestlersList = wHelper.PopulateWrestlersList().Where(w => w.CurrentCompanyName == promo.Name).ToList();

            List <WrestlersEntity> teamW  = storeHelper.WrestlersList.Where(w => w.TeamName != "").ToList();
            List <WrestlersEntity> roster = storeHelper.WrestlersList.Except(teamW).ToList();

            foreach (WrestlersEntity w in roster)
            {
                lbRoster.Items.Add(w.Name);
            }


            foreach (WrestlersEntity w in teamW)
            {
                if (w.TeamName == TeamName)
                {
                    lbSelWrestlers.Items.Add(w.Name);
                }
            }

            lbRoster.Enabled       = false;
            lbSelWrestlers.Enabled = false;
            btnSave.Enabled        = false;
        }
Ejemplo n.º 5
0
        public TitlesMain(string orgName)
        {
            InitializeComponent();

            OrgName = orgName;

            PromotionsEntity promo = pHelper.PopulatePromotionsList().FirstOrDefault(p => p.Name == OrgName);

            storeHelper.BrandsList = bHelper.PopulateBrandsList().Where(b => b.ConnOrgName == promo.Name).ToList();

            if (storeHelper.BrandsList.Count == 0)
            {
                cbxAsscBrand.Enabled = false;
            }
            else
            {
                cbxAsscBrand.Enabled = true;

                cbxAsscBrand.Items.Add("");
                foreach (BrandsEntity b in storeHelper.BrandsList)
                {
                    cbxAsscBrand.Items.Add(b.Name);
                }
            }
        }
Ejemplo n.º 6
0
        private void cbxPromos_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbxPromos.SelectedItem.ToString() == "All Promotions")
            {
                List <MatchesEntity> matches = new List <MatchesEntity>();

                foreach (CardsEntity c in storeHelper.CardsList)
                {
                    MatchesEntity match = mHelper.PopulateMatchesList().FirstOrDefault(m => m.AttachedCardName == c.CardName);
                    matches.Add(match);
                }

                List <MatchesEntity> sortedMatches = matches.OrderByDescending(m => m.MatchRating).ToList();

                isBrandSorted = false;

                List <MatchesEntity> Top10 = new List <MatchesEntity>();

                for (int i = 0; i < 10; i++)
                {
                    Top10.Add(sortedMatches[i]);
                }


                SetButonsOutput(Top10);
            }
            else
            {
                string selItem = cbxPromos.SelectedItem.ToString();

                PromotionsEntity promo = storeHelper.PromotionsList.FirstOrDefault(p => p.Name == selItem);

                List <CardsEntity> promoCards = storeHelper.CardsList.Where(c => c.ConnOrgName == promo.Name).ToList();

                List <MatchesEntity> matches = new List <MatchesEntity>();

                foreach (CardsEntity c in promoCards)
                {
                    MatchesEntity match = mHelper.PopulateMatchesList().FirstOrDefault(m => m.AttachedCardName == c.CardName);

                    matches.Add(match);
                }

                List <MatchesEntity> sortedMatches = matches.OrderByDescending(m => m.MatchRating).ToList();

                isBrandSorted = true;

                List <MatchesEntity> Top10 = new List <MatchesEntity>();

                for (int i = 0; i < 10; i++)
                {
                    Top10.Add(sortedMatches[i]);
                }


                SetButonsOutput(Top10);
            }
        }
Ejemplo n.º 7
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (isEditOrg)
            {
                if (tbInitals.Text == "" || tbNewName.Text == "" || cbxLoc.SelectedItem == null)
                {
                    tbNewName.BackColor = Color.MistyRose;
                    tbInitals.BackColor = Color.MistyRose;
                    cbxLoc.BackColor    = Color.MistyRose;
                }
                else
                {
                    PromotionsEntity promo = shHelper.PromotionsList.FirstOrDefault(p => p.Name == lbOrgList.SelectedItem.ToString());

                    foreach (PromotionsEntity p in shHelper.PromotionsList)
                    {
                        if (p.OrgID == promo.OrgID)
                        {
                            promo.Name     = tbNewName.Text;
                            promo.Initals  = tbInitals.Text;
                            promo.Location = cbxLoc.SelectedItem.ToString();

                            pHelper.SavePromotionsList(promo);
                        }
                    }

                    EditMain main = new EditMain();
                    main.Show();
                    this.Hide();
                }
            }
            else
            {
                if (tbInitals.Text == "" || tbNewName.Text == "" || cbxLoc.SelectedItem == null)
                {
                    tbNewName.BackColor = Color.MistyRose;
                    tbInitals.BackColor = Color.MistyRose;
                    cbxLoc.BackColor    = Color.MistyRose;
                }
                else
                {
                    PromotionsEntity promo = new PromotionsEntity()
                    {
                        OrgID    = idHelper.CurrentID(false, false, false, true, false, false, false),
                        Name     = tbNewName.Text,
                        Initals  = tbInitals.Text,
                        Location = cbxLoc.SelectedItem.ToString()
                    };

                    pHelper.SavePromotionsList(promo);

                    EditMain main = new EditMain();
                    main.Show();
                    this.Hide();
                }
            }
        }
Ejemplo n.º 8
0
        public TeamsMain(string orgName)
        {
            InitializeComponent();

            OrgName = orgName;

            PromotionsEntity promo = pHelper.PopulatePromotionsList().FirstOrDefault(p => p.Name == OrgName);

            storeHelper.BrandsList    = bHelper.PopulateBrandsList().Where(b => b.ConnOrgName == promo.Name).ToList();
            storeHelper.WrestlersList = wHelper.PopulateWrestlersList().Where(w => w.CurrentCompanyName == promo.Name).ToList();

            if (storeHelper.BrandsList.Count == 0)
            {
                cbxAsscBrand.Enabled = false;
            }
            else
            {
                cbxAsscBrand.Enabled = true;

                cbxAsscBrand.Items.Add("");
                foreach (BrandsEntity b in storeHelper.BrandsList)
                {
                    cbxAsscBrand.Items.Add(b.Name);
                }
            }


            //Limit the radio buttons dependent on if we have enough wrestlers for the team
            if (storeHelper.WrestlersList.Count < 2)
            {
                rbTagTeam.Enabled     = false;
                rb6ManTagTeam.Enabled = false;
                rb8ManTagTeam.Enabled = false;
            }
            else if (storeHelper.WrestlersList.Count >= 2 && storeHelper.WrestlersList.Count <= 3)
            {
                rbTagTeam.Enabled     = true;
                rb6ManTagTeam.Enabled = true;
                rb8ManTagTeam.Enabled = false;
            }
            else if (storeHelper.WrestlersList.Count > 3)
            {
                rbTagTeam.Enabled     = true;
                rb6ManTagTeam.Enabled = true;
                rb8ManTagTeam.Enabled = true;
            }

            foreach (WrestlersEntity w in storeHelper.WrestlersList)
            {
                lbRoster.Items.Add(w.Name);
            }

            lbRoster.Enabled   = false;
            lbSelected.Enabled = false;
            btnSave.Enabled    = false;
        }
Ejemplo n.º 9
0
        public ModTeamsTitles(string teamName, string orgName)
        {
            InitializeComponent();

            TeamName = teamName;
            OrgName  = orgName;

            PromotionsEntity promo = pHelper.PopulatePromotionsList().FirstOrDefault(p => p.Name == OrgName);
            TeamsEntity      team  = teHelper.PopulateTeamsList().FirstOrDefault(t => t.TeamName == TeamName);
            BrandsEntity     brand = bHelper.PopulateBrandsList().FirstOrDefault(b => b.ConnOrgName == promo.Name && b.Name == team.BrandName);

            storeHelper.TitlesList = tHelper.PopulateTitlesList().Where(t => t.OwnerOrgName == promo.Name).ToList();

            if (brand == null)
            {
                List <TitlesEntity> titles      = storeHelper.TitlesList.Where(t => t.Specialization != "Singles Championship").ToList();
                List <TitlesEntity> ownedTitles = storeHelper.TitlesList.Where(t => t.Specialization != "Singles Championship" &&
                                                                               !String.IsNullOrWhiteSpace(t.HolderName1) &&
                                                                               !String.IsNullOrWhiteSpace(t.HolderName2) ||
                                                                               !String.IsNullOrWhiteSpace(t.HolderName3) ||
                                                                               !String.IsNullOrWhiteSpace(t.HolderName4)).ToList();

                foreach (TitlesEntity t in titles)
                {
                    lbAllTeamTitles.Items.Add(t.Name);
                }

                foreach (TitlesEntity ot in ownedTitles)
                {
                    if (lbSelTeamTitles.Items.Count < 7)
                    {
                        lbSelTeamTitles.Items.Add(ot.Name);
                    }
                }
            }
            else
            {
                List <TitlesEntity> titles      = storeHelper.TitlesList.Where(t => t.Specialization != "Singles Championship" && t.BrandName == brand.Name).ToList();
                List <TitlesEntity> ownedTitles = storeHelper.TitlesList.Where(t => t.Specialization != "Singles Championship" &&
                                                                               t.BrandName == brand.Name &&
                                                                               !String.IsNullOrWhiteSpace(t.HolderName1) &&
                                                                               !String.IsNullOrWhiteSpace(t.HolderName2) ||
                                                                               !String.IsNullOrWhiteSpace(t.HolderName3) ||
                                                                               !String.IsNullOrWhiteSpace(t.HolderName4)).ToList();

                foreach (TitlesEntity t in titles)
                {
                    lbAllTeamTitles.Items.Add(t.Name);
                }

                foreach (TitlesEntity ot in ownedTitles)
                {
                    lbSelTeamTitles.Items.Add(ot.Name);
                }
            }
        }
Ejemplo n.º 10
0
        public ModWrestlerTitles(string wrestName, string orgName)
        {
            InitializeComponent();

            WrestName = wrestName;
            OrgName   = orgName;

            WrestlersEntity  wrest = wHelper.PopulateWrestlersList().FirstOrDefault(w => w.Name == WrestName);
            PromotionsEntity promo = pHelper.PopulatePromotionsList().FirstOrDefault(p => p.Name == OrgName);
            BrandsEntity     brand = bHelper.PopulateBrandsList().FirstOrDefault(b => b.ConnOrgName == promo.Name && b.Name == wrest.BrandName);

            storeHelper.TitlesList = tHelper.PopulateTitlesList().Where(t => t.OwnerOrgName == promo.Name).ToList();

            if (brand == null)
            {
                List <TitlesEntity> ownedTitles = storeHelper.TitlesList.Where(t => t.Specialization == "Singles Championship" &&
                                                                               t.WeightClass == wrest.WeightClass &&
                                                                               t.HolderName1 == wrest.Name).ToList();
                List <TitlesEntity> titles = storeHelper.TitlesList.Where(t => t.Specialization == "Singles Championship" &&
                                                                          t.WeightClass == wrest.WeightClass).Except(ownedTitles).ToList();

                foreach (TitlesEntity t in titles)
                {
                    lbAllTitles.Items.Add(t.Name);
                }

                foreach (TitlesEntity o in ownedTitles)
                {
                    lbSelTitles.Items.Add(o.Name);
                }
            }
            else
            {
                List <TitlesEntity> ownedTitles = storeHelper.TitlesList.Where(t => t.Specialization == "Singles Championship" &&
                                                                               t.WeightClass == wrest.WeightClass &&
                                                                               t.BrandName == brand.Name &&
                                                                               t.HolderName1 == wrest.Name).ToList();
                List <TitlesEntity> titles = storeHelper.TitlesList.Where(t => t.Specialization == "Singles Championship" &&
                                                                          t.WeightClass == wrest.WeightClass &&
                                                                          t.BrandName == brand.Name).Except(ownedTitles).ToList();

                foreach (TitlesEntity t in titles)
                {
                    lbAllTitles.Items.Add(t.Name);
                }

                foreach (TitlesEntity o in ownedTitles)
                {
                    lbSelTitles.Items.Add(o.Name);
                }
            }

            lbAllTitles.Enabled = true;
            lbSelTitles.Enabled = true;
        }
Ejemplo n.º 11
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            string orgToBeDELETED = lbOrgList.SelectedItem.ToString();

            List <WrestlersEntity> selW     = shHelper.WrestlersList.Where(w => w.CurrentCompanyName == orgToBeDELETED).ToList();
            List <TitlesEntity>    selT     = shHelper.TitlesList.Where(t => t.OwnerOrgName == orgToBeDELETED).ToList();
            List <TeamsEntity>     selTeams = shHelper.TeamsList.Where(te => te.OrgName == orgToBeDELETED).ToList();

            foreach (WrestlersEntity w in selW)
            {
                w.CurrentCompanyName = "";
                w.BrandName          = "";

                w.TeamName = "";


                wHelper.SaveWrestlersList(w);
            }

            foreach (TitlesEntity t in selT)
            {
                t.OwnerOrgName = "";

                tHelper.SaveTitlesList(t);
            }

            //Delete Teams attached to Org (cannot have team w/o org it performs in)
            foreach (TeamsEntity t in selTeams)
            {
                string teamFile = string.Concat(Directory.GetCurrentDirectory(), "\\Saves\\Main\\Teams\\" + t.TeamID + ".dat");

                if (File.Exists(teamFile))
                {
                    File.Delete(teamFile);
                }
            }

            PromotionsEntity promo = shHelper.PromotionsList.FirstOrDefault(p => p.Name == lbOrgList.SelectedItem.ToString());

            string file = string.Concat(Directory.GetCurrentDirectory(), "\\Saves\\Main\\Promotions\\" + promo.OrgID + ".dat");

            if (File.Exists(file))
            {
                File.Delete(file);
            }

            EditMain main = new EditMain();

            main.Show();
            this.Hide();
        }
Ejemplo n.º 12
0
        public void SavePromotionsList(PromotionsEntity promotion)
        {
            FileStream   stream = new FileStream(Directory.GetCurrentDirectory() + "\\Saves\\Main\\Promotions\\" + promotion.OrgID + ".dat", FileMode.Create, FileAccess.Write);
            StreamWriter writer = new StreamWriter(stream);

            writer.WriteLine(promotion.OrgID);

            writer.WriteLine(promotion.Name);
            writer.WriteLine(promotion.Initals);
            writer.WriteLine(promotion.Location);

            writer.Close();
            stream.Close();
        }
Ejemplo n.º 13
0
 public bool Delete(Guid Id)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         PromotionsEntity _PromotionsEntity = new PromotionsEntity(Id);
         if (adapter.FetchEntity(_PromotionsEntity))
         {
             adapter.DeleteEntity(_PromotionsEntity);
             toReturn = true;
         }
     }
     return toReturn;
 }
Ejemplo n.º 14
0
        public BrandsMain(string orgName)
        {
            InitializeComponent();

            OrgName = orgName;

            PromotionsEntity promo = pHelper.PopulatePromotionsList().FirstOrDefault(p => p.Name == OrgName);

            storeHelper.WrestlersList = wHelper.PopulateWrestlersList().Where(w => w.CurrentCompanyName == promo.Name).ToList();

            foreach (var w in storeHelper.WrestlersList)
            {
                lbAllRoster.Items.Add(w.Name);
            }
        }
Ejemplo n.º 15
0
        private void lbOrgList_SelectedIndexChanged(object sender, EventArgs e)
        {
            tbNewName.Text      = "";
            tbInitals.Text      = "";
            cbxLoc.SelectedItem = null;

            PromotionsEntity promo = shHelper.PromotionsList.FirstOrDefault(p => p.Name == lbOrgList.SelectedItem.ToString());

            tbNewName.Text      = promo.Name;
            tbInitals.Text      = promo.Initals;
            cbxLoc.SelectedItem = promo.Location;

            btnEditOrg.Enabled   = true;
            btnCreateOrg.Enabled = false;
            btnDelete.Enabled    = true;
        }
Ejemplo n.º 16
0
        public PastCardsMain(CardsEntity card)
        {
            InitializeComponent();

            CardName = card.CardName;
            OrgName  = card.ConnOrgName;

            PromotionsEntity promo = pHelper.PopulatePromotionsList().FirstOrDefault(p => p.Name == OrgName);

            CardsEntity c = cHelper.PopulateCardsList().FirstOrDefault(ca => ca.CardName == CardName && ca.ConnOrgName == promo.Name);

            lblPromoName.Text    = promo.Name;
            lblCardLocation.Text = card.Location;

            lblCardTitle.Text    = card.CardName;
            lblCardSubTitle.Text = card.SubTitle;

            lblTotalMatches.Text = card.NumOfMatches.ToString();
            lblFinalRating.Text  = card.FinalCardRating.ToString();
        }
Ejemplo n.º 17
0
        private List <CardsEntity> SortedCardOutput()
        {
            List <CardsEntity> sortedCard = new List <CardsEntity>();

            if (!isBrandSorted)
            {
                sortedCard = storeHelper.CardsList.OrderByDescending(c => c.FinalCardRating).ToList();
            }
            else
            {
                string selItem = cbxPromos.SelectedItem.ToString();

                PromotionsEntity promo = storeHelper.PromotionsList.FirstOrDefault(p => p.Name == selItem);

                List <CardsEntity> promoCards = storeHelper.CardsList.Where(c => c.ConnOrgName == promo.Name).ToList();

                sortedCard = promoCards.OrderByDescending(c => c.FinalCardRating).ToList();
            }

            return(sortedCard);
        }
Ejemplo n.º 18
0
        public ModTeams(string orgName)
        {
            InitializeComponent();

            OrgName = orgName;

            PromotionsEntity promo = pHelper.PopulatePromotionsList().FirstOrDefault(p => p.Name == OrgName);

            storeHelper.BrandsList = bHelper.PopulateBrandsList().Where(b => b.ConnOrgName == promo.Name).ToList();
            storeHelper.TeamsList  = tHelper.PopulateTeamsList().Where(t => t.OrgName == promo.Name).ToList();

            foreach (TeamsEntity t in storeHelper.TeamsList)
            {
                cbxTeams.Items.Add(t.TeamName);
            }

            foreach (BrandsEntity b in storeHelper.BrandsList)
            {
                cbxAsscBrand.Items.Add(b.Name);
            }
        }
Ejemplo n.º 19
0
        public CurrentRankings(string orgName)
        {
            InitializeComponent();

            OrgName = orgName;

            PromotionsEntity promo = pHelper.PopulatePromotionsList().FirstOrDefault(p => p.Name == OrgName);

            storeHelper.BrandsList = bHelper.PopulateBrandsList().Where(b => b.ConnOrgName == promo.Name).ToList();
            storeHelper.TitlesList = tiHelper.PopulateTitlesList().Where(ti => ti.OwnerOrgName == promo.Name).ToList();

            storeHelper.WrestlersList = wHelper.PopulateWrestlersList().Where(w => w.CurrentCompanyName == promo.Name).Distinct().ToList();
            storeHelper.TeamsList     = tHelper.PopulateTeamsList().Where(t => t.OrgName == promo.Name).Distinct().ToList();

            lblCompanyName.Text = promo.Name;

            cbxBrands.Items.Add("");
            foreach (BrandsEntity b in storeHelper.BrandsList)
            {
                cbxBrands.Items.Add(b.Name);
            }
        }
Ejemplo n.º 20
0
        public ModBrands(string orgName)
        {
            InitializeComponent();

            OrgName = orgName;

            PromotionsEntity promo = pHelper.PopulatePromotionsList().FirstOrDefault(p => p.Name == OrgName);

            storeHelper.BrandsList    = bHelper.PopulateBrandsList().Where(b => b.ConnOrgName == promo.Name).ToList();
            storeHelper.WrestlersList = wHelper.PopulateWrestlersList().Where(w => w.CurrentCompanyName == promo.Name).ToList();

            foreach (BrandsEntity bAll in storeHelper.BrandsList)
            {
                cbxOvrBrands.Items.Add(bAll.Name);
            }

            if (storeHelper.BrandsList.Count < 1)
            {
                lbBrand1.Enabled = false;
                lbBrand2.Enabled = false;

                cbxBrand1.Enabled = false;
                cbxBrand2.Enabled = false;
            }
            else
            {
                lbBrand1.Enabled = true;
                lbBrand2.Enabled = true;

                foreach (BrandsEntity b in storeHelper.BrandsList)
                {
                    cbxBrand1.Items.Add(b.Name);
                    cbxBrand2.Items.Add(b.Name);
                }

                cbxBrand1.Enabled = true;
                cbxBrand2.Enabled = true;
            }
        }
Ejemplo n.º 21
0
        public ModWrestler(string orgName)
        {
            InitializeComponent();

            OrgName = orgName;

            PromotionsEntity promo = pHelper.PopulatePromotionsList().FirstOrDefault(p => p.Name == OrgName);

            storeHelper.BrandsList    = bHelper.PopulateBrandsList().Where(b => b.ConnOrgName == promo.Name).ToList();
            storeHelper.WrestlersList = wHelper.PopulateWrestlersList().Where(w => w.CurrentCompanyName == promo.Name).ToList();
            storeHelper.TitlesList    = tHelper.PopulateTitlesList().Where(t => t.OwnerOrgName == promo.Name).ToList();

            foreach (WrestlersEntity w in storeHelper.WrestlersList)
            {
                cbxWrestlers.Items.Add(w.Name);
            }

            foreach (BrandsEntity b in storeHelper.BrandsList)
            {
                cbxAsscBrand.Items.Add(b.Name);
            }
        }
Ejemplo n.º 22
0
        public NewCard(string orgName, bool isNewCard = true, string cardName = "", int currWrestNum = 0)
        {
            InitializeComponent();

            this.Invalidate();

            OrgName    = orgName;
            CardName   = cardName;
            bIsNewCard = isNewCard;

            if (bIsNewCard)
            {
                storeHelper.WrestlersList  = wHelper.PopulateWrestlersList();
                storeHelper.TeamsList      = tHelper.PopulateTeamsList();
                storeHelper.TitlesList     = tiHelper.PopulateTitlesList();
                storeHelper.PromotionsList = pHelper.PopulatePromotionsList();
                storeHelper.BrandsList     = bHelper.PopulateBrandsList();
                storeHelper.CardsList      = cHelper.PopulateCardsList();

                //This gets the int id of the most recent card (aka- this one)
                int currCard = storeHelper.CardsList.Count();

                PromotionsEntity promo    = storeHelper.PromotionsList.FirstOrDefault(p => p.Name == OrgName);
                CardsEntity      thisCard = storeHelper.CardsList.FirstOrDefault(c => c.ConnOrgName == promo.Name && c.CardID == currCard);

                List <MatchesEntity> cardM = storeHelper.MatchesList.Where(m => m.AttachedCardName == thisCard.CardName).ToList();

                List <BrandsEntity> brands = storeHelper.BrandsList.Where(b => b.ConnOrgName == promo.Name).ToList();

                if (brands.Count == 0)
                {
                    cbxBrandName.Items.Add("");
                    cbxBrandName.SelectedIndex = 0;
                }
                else
                {
                    cbxBrandName.Items.Add("");
                    foreach (BrandsEntity b in brands)
                    {
                        cbxBrandName.Items.Add(b.Name);
                    }

                    cbxBrandName.SelectedIndex = 0;
                }

                button1.Enabled = false;
            }
            else
            {
                storeHelper.CardsList = cHelper.PopulateCardsList();

                //This gets the int id of the most recent card (aka- this one)
                int currCard = storeHelper.CardsList.Count();

                storeHelper.MatchesList    = mHelper.PopulateMatchesList();
                storeHelper.PromotionsList = pHelper.PopulatePromotionsList();
                storeHelper.BrandsList     = bHelper.PopulateBrandsList();

                PromotionsEntity    promo    = storeHelper.PromotionsList.FirstOrDefault(p => p.Name == OrgName);
                List <BrandsEntity> brands   = storeHelper.BrandsList.Where(b => b.ConnOrgName == promo.Name).ToList();
                CardsEntity         thisCard = storeHelper.CardsList.FirstOrDefault(c => c.ConnOrgName == promo.Name && c.CardID == currCard);

                List <MatchesEntity> cardM = storeHelper.MatchesList.Where(m => m.AttachedCardName == thisCard.CardName).ToList();

                if (brands.Count == 0)
                {
                    cbxBrandName.Items.Add("");
                    cbxBrandName.SelectedItem = "";
                }
                else
                {
                    cbxBrandName.Items.Add("");
                    foreach (BrandsEntity b in brands)
                    {
                        cbxBrandName.Items.Add(b.Name);
                    }
                }

                tbCardTitle.Text     = thisCard.CardName;
                tbCardTitle.Enabled  = false;
                cbxLocation.Text     = thisCard.Location;
                cbxLocation.Enabled  = false;
                cbxBrandName.Text    = thisCard.BrandName;
                cbxBrandName.Enabled = false;


                switch (cardM.Count)
                {
                case 1:
                    btnMatch1.Enabled = true;

                    btnMatch1.Text       = ButtonTextOutput(cardM, 0);
                    btnMatch1Clr.Enabled = true;

                    btnMatch2.Enabled = true;
                    break;

                case 2:
                    btnMatch1.Enabled = true;
                    btnMatch2.Enabled = true;
                    btnMatch3.Enabled = true;

                    btnMatch1.Text = ButtonTextOutput(cardM, 0);
                    btnMatch2.Text = ButtonTextOutput(cardM, 1);

                    btnMatch1Clr.Enabled = true;
                    btnMatch2Clr.Enabled = true;
                    break;

                case 3:
                    btnMatch1.Enabled = true;
                    btnMatch2.Enabled = true;
                    btnMatch3.Enabled = true;
                    btnMatch4.Enabled = true;

                    btnMatch1.Text = ButtonTextOutput(cardM, 0);
                    btnMatch2.Text = ButtonTextOutput(cardM, 1);
                    btnMatch3.Text = ButtonTextOutput(cardM, 2);

                    btnMatch1Clr.Enabled = true;
                    btnMatch2Clr.Enabled = true;
                    btnMatch3Clr.Enabled = true;
                    break;

                case 4:
                    btnMatch1.Enabled = true;
                    btnMatch2.Enabled = true;
                    btnMatch3.Enabled = true;
                    btnMatch4.Enabled = true;
                    btnMatch5.Enabled = true;

                    btnMatch1.Text = ButtonTextOutput(cardM, 0);
                    btnMatch2.Text = ButtonTextOutput(cardM, 1);
                    btnMatch3.Text = ButtonTextOutput(cardM, 2);
                    btnMatch4.Text = ButtonTextOutput(cardM, 3);

                    btnMatch1Clr.Enabled = true;
                    btnMatch2Clr.Enabled = true;
                    btnMatch3Clr.Enabled = true;
                    btnMatch4Clr.Enabled = true;
                    break;

                case 5:
                    btnMatch1.Enabled = true;
                    btnMatch2.Enabled = true;
                    btnMatch3.Enabled = true;
                    btnMatch4.Enabled = true;
                    btnMatch5.Enabled = true;
                    btnMatch6.Enabled = true;

                    btnMatch1.Text = ButtonTextOutput(cardM, 0);
                    btnMatch2.Text = ButtonTextOutput(cardM, 1);
                    btnMatch3.Text = ButtonTextOutput(cardM, 2);
                    btnMatch4.Text = ButtonTextOutput(cardM, 3);
                    btnMatch5.Text = ButtonTextOutput(cardM, 4);

                    btnMatch1Clr.Enabled = true;
                    btnMatch2Clr.Enabled = true;
                    btnMatch3Clr.Enabled = true;
                    btnMatch4Clr.Enabled = true;
                    btnMatch5Clr.Enabled = true;
                    break;

                case 6:
                    btnMatch1.Enabled = true;
                    btnMatch2.Enabled = true;
                    btnMatch3.Enabled = true;
                    btnMatch4.Enabled = true;
                    btnMatch5.Enabled = true;
                    btnMatch6.Enabled = true;
                    btnMatch7.Enabled = true;

                    btnMatch1.Text = ButtonTextOutput(cardM, 0);
                    btnMatch2.Text = ButtonTextOutput(cardM, 1);
                    btnMatch3.Text = ButtonTextOutput(cardM, 2);
                    btnMatch4.Text = ButtonTextOutput(cardM, 3);
                    btnMatch5.Text = ButtonTextOutput(cardM, 4);
                    btnMatch6.Text = ButtonTextOutput(cardM, 5);

                    btnMatch1Clr.Enabled = true;
                    btnMatch2Clr.Enabled = true;
                    btnMatch3Clr.Enabled = true;
                    btnMatch4Clr.Enabled = true;
                    btnMatch5Clr.Enabled = true;
                    btnMatch6Clr.Enabled = true;
                    break;

                case 7:
                    btnMatch1.Enabled = true;
                    btnMatch2.Enabled = true;
                    btnMatch3.Enabled = true;
                    btnMatch4.Enabled = true;
                    btnMatch5.Enabled = true;
                    btnMatch6.Enabled = true;
                    btnMatch7.Enabled = true;
                    btnMatch8.Enabled = true;

                    btnMatch1.Text = ButtonTextOutput(cardM, 0);
                    btnMatch2.Text = ButtonTextOutput(cardM, 1);
                    btnMatch3.Text = ButtonTextOutput(cardM, 2);
                    btnMatch4.Text = ButtonTextOutput(cardM, 3);
                    btnMatch5.Text = ButtonTextOutput(cardM, 4);
                    btnMatch6.Text = ButtonTextOutput(cardM, 5);
                    btnMatch7.Text = ButtonTextOutput(cardM, 6);

                    btnMatch1Clr.Enabled = true;
                    btnMatch2Clr.Enabled = true;
                    btnMatch3Clr.Enabled = true;
                    btnMatch4Clr.Enabled = true;
                    btnMatch5Clr.Enabled = true;
                    btnMatch6Clr.Enabled = true;
                    btnMatch7Clr.Enabled = true;
                    break;

                case 8:
                    btnMatch1.Enabled = true;
                    btnMatch2.Enabled = true;
                    btnMatch3.Enabled = true;
                    btnMatch4.Enabled = true;
                    btnMatch5.Enabled = true;
                    btnMatch6.Enabled = true;
                    btnMatch7.Enabled = true;
                    btnMatch8.Enabled = true;
                    btnMatch9.Enabled = true;

                    btnMatch1.Text = ButtonTextOutput(cardM, 0);
                    btnMatch2.Text = ButtonTextOutput(cardM, 1);
                    btnMatch3.Text = ButtonTextOutput(cardM, 2);
                    btnMatch4.Text = ButtonTextOutput(cardM, 3);
                    btnMatch5.Text = ButtonTextOutput(cardM, 4);
                    btnMatch6.Text = ButtonTextOutput(cardM, 5);
                    btnMatch7.Text = ButtonTextOutput(cardM, 6);
                    btnMatch8.Text = ButtonTextOutput(cardM, 7);

                    btnMatch1Clr.Enabled = true;
                    btnMatch2Clr.Enabled = true;
                    btnMatch3Clr.Enabled = true;
                    btnMatch4Clr.Enabled = true;
                    btnMatch5Clr.Enabled = true;
                    btnMatch6Clr.Enabled = true;
                    btnMatch7Clr.Enabled = true;
                    btnMatch8Clr.Enabled = true;
                    break;

                case 9:
                    btnMatch1.Enabled  = true;
                    btnMatch2.Enabled  = true;
                    btnMatch3.Enabled  = true;
                    btnMatch4.Enabled  = true;
                    btnMatch5.Enabled  = true;
                    btnMatch6.Enabled  = true;
                    btnMatch7.Enabled  = true;
                    btnMatch8.Enabled  = true;
                    btnMatch9.Enabled  = true;
                    btnMatch10.Enabled = true;

                    btnMatch1.Text = ButtonTextOutput(cardM, 0);
                    btnMatch2.Text = ButtonTextOutput(cardM, 1);
                    btnMatch3.Text = ButtonTextOutput(cardM, 2);
                    btnMatch4.Text = ButtonTextOutput(cardM, 3);
                    btnMatch5.Text = ButtonTextOutput(cardM, 4);
                    btnMatch6.Text = ButtonTextOutput(cardM, 5);
                    btnMatch7.Text = ButtonTextOutput(cardM, 6);
                    btnMatch8.Text = ButtonTextOutput(cardM, 7);
                    btnMatch9.Text = ButtonTextOutput(cardM, 8);

                    btnMatch1Clr.Enabled = true;
                    btnMatch2Clr.Enabled = true;
                    btnMatch3Clr.Enabled = true;
                    btnMatch4Clr.Enabled = true;
                    btnMatch5Clr.Enabled = true;
                    btnMatch6Clr.Enabled = true;
                    btnMatch7Clr.Enabled = true;
                    btnMatch8Clr.Enabled = true;
                    btnMatch9Clr.Enabled = true;
                    break;

                case 10:
                    btnMatch1.Enabled  = true;
                    btnMatch2.Enabled  = true;
                    btnMatch3.Enabled  = true;
                    btnMatch4.Enabled  = true;
                    btnMatch5.Enabled  = true;
                    btnMatch6.Enabled  = true;
                    btnMatch7.Enabled  = true;
                    btnMatch8.Enabled  = true;
                    btnMatch9.Enabled  = true;
                    btnMatch10.Enabled = true;
                    btnMatch11.Enabled = true;

                    btnMatch1.Text  = ButtonTextOutput(cardM, 0);
                    btnMatch2.Text  = ButtonTextOutput(cardM, 1);
                    btnMatch3.Text  = ButtonTextOutput(cardM, 2);
                    btnMatch4.Text  = ButtonTextOutput(cardM, 3);
                    btnMatch5.Text  = ButtonTextOutput(cardM, 4);
                    btnMatch6.Text  = ButtonTextOutput(cardM, 5);
                    btnMatch7.Text  = ButtonTextOutput(cardM, 6);
                    btnMatch8.Text  = ButtonTextOutput(cardM, 7);
                    btnMatch9.Text  = ButtonTextOutput(cardM, 8);
                    btnMatch10.Text = ButtonTextOutput(cardM, 9);

                    btnMatch1Clr.Enabled  = true;
                    btnMatch2Clr.Enabled  = true;
                    btnMatch3Clr.Enabled  = true;
                    btnMatch4Clr.Enabled  = true;
                    btnMatch5Clr.Enabled  = true;
                    btnMatch6Clr.Enabled  = true;
                    btnMatch7Clr.Enabled  = true;
                    btnMatch8Clr.Enabled  = true;
                    btnMatch9Clr.Enabled  = true;
                    btnMatch10Clr.Enabled = true;
                    break;

                case 11:
                    btnMatch1.Enabled     = true;
                    btnMatch2.Enabled     = true;
                    btnMatch3.Enabled     = true;
                    btnMatch4.Enabled     = true;
                    btnMatch5.Enabled     = true;
                    btnMatch6.Enabled     = true;
                    btnMatch7.Enabled     = true;
                    btnMatch8.Enabled     = true;
                    btnMatch9.Enabled     = true;
                    btnMatch10.Enabled    = true;
                    btnMatch11.Enabled    = true;
                    btnMatch12.Enabled    = true;
                    btnMatch12Clr.Enabled = true;

                    btnMatch1.Text  = ButtonTextOutput(cardM, 0);
                    btnMatch2.Text  = ButtonTextOutput(cardM, 1);
                    btnMatch3.Text  = ButtonTextOutput(cardM, 2);
                    btnMatch4.Text  = ButtonTextOutput(cardM, 3);
                    btnMatch5.Text  = ButtonTextOutput(cardM, 4);
                    btnMatch6.Text  = ButtonTextOutput(cardM, 5);
                    btnMatch7.Text  = ButtonTextOutput(cardM, 6);
                    btnMatch8.Text  = ButtonTextOutput(cardM, 7);
                    btnMatch9.Text  = ButtonTextOutput(cardM, 8);
                    btnMatch10.Text = ButtonTextOutput(cardM, 9);
                    btnMatch11.Text = ButtonTextOutput(cardM, 10);

                    btnMatch1Clr.Enabled  = true;
                    btnMatch2Clr.Enabled  = true;
                    btnMatch3Clr.Enabled  = true;
                    btnMatch4Clr.Enabled  = true;
                    btnMatch5Clr.Enabled  = true;
                    btnMatch6Clr.Enabled  = true;
                    btnMatch7Clr.Enabled  = true;
                    btnMatch8Clr.Enabled  = true;
                    btnMatch9Clr.Enabled  = true;
                    btnMatch10Clr.Enabled = true;
                    btnMatch11Clr.Enabled = true;
                    break;

                case 12:
                    btnMatch1.Enabled  = true;
                    btnMatch2.Enabled  = true;
                    btnMatch3.Enabled  = true;
                    btnMatch4.Enabled  = true;
                    btnMatch5.Enabled  = true;
                    btnMatch6.Enabled  = true;
                    btnMatch7.Enabled  = true;
                    btnMatch8.Enabled  = true;
                    btnMatch9.Enabled  = true;
                    btnMatch10.Enabled = true;
                    btnMatch11.Enabled = true;
                    btnMatch12.Enabled = true;

                    btnMatch1.Text  = ButtonTextOutput(cardM, 0);
                    btnMatch2.Text  = ButtonTextOutput(cardM, 1);
                    btnMatch3.Text  = ButtonTextOutput(cardM, 2);
                    btnMatch4.Text  = ButtonTextOutput(cardM, 3);
                    btnMatch5.Text  = ButtonTextOutput(cardM, 4);
                    btnMatch6.Text  = ButtonTextOutput(cardM, 5);
                    btnMatch7.Text  = ButtonTextOutput(cardM, 6);
                    btnMatch8.Text  = ButtonTextOutput(cardM, 7);
                    btnMatch9.Text  = ButtonTextOutput(cardM, 8);
                    btnMatch10.Text = ButtonTextOutput(cardM, 9);
                    btnMatch11.Text = ButtonTextOutput(cardM, 10);
                    btnMatch12.Text = ButtonTextOutput(cardM, 11);

                    btnMatch1Clr.Enabled  = true;
                    btnMatch2Clr.Enabled  = true;
                    btnMatch3Clr.Enabled  = true;
                    btnMatch4Clr.Enabled  = true;
                    btnMatch5Clr.Enabled  = true;
                    btnMatch6Clr.Enabled  = true;
                    btnMatch7Clr.Enabled  = true;
                    btnMatch8Clr.Enabled  = true;
                    btnMatch9Clr.Enabled  = true;
                    btnMatch10Clr.Enabled = true;
                    btnMatch11Clr.Enabled = true;
                    btnMatch12Clr.Enabled = true;
                    break;

                default:
                    btnMatch1.Enabled  = true;
                    btnMatch2.Enabled  = false;
                    btnMatch3.Enabled  = false;
                    btnMatch4.Enabled  = false;
                    btnMatch5.Enabled  = false;
                    btnMatch6.Enabled  = false;
                    btnMatch7.Enabled  = false;
                    btnMatch8.Enabled  = false;
                    btnMatch9.Enabled  = false;
                    btnMatch10.Enabled = false;
                    btnMatch11.Enabled = false;
                    btnMatch12.Enabled = false;

                    btnMatch1Clr.Enabled  = false;
                    btnMatch2Clr.Enabled  = false;
                    btnMatch3Clr.Enabled  = false;
                    btnMatch4Clr.Enabled  = false;
                    btnMatch5Clr.Enabled  = false;
                    btnMatch6Clr.Enabled  = false;
                    btnMatch7Clr.Enabled  = false;
                    btnMatch8Clr.Enabled  = false;
                    btnMatch9Clr.Enabled  = false;
                    btnMatch10Clr.Enabled = false;
                    btnMatch11Clr.Enabled = false;
                    btnMatch12Clr.Enabled = false;
                    break;
                }

                button1.Enabled = true;
            }
        }
Ejemplo n.º 23
0
        public bool Update(Guid Id, string PromotionName, decimal Price, string Note, string Photo, bool IsActive)
        {
            bool toReturn = false;
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                PromotionsEntity _PromotionsEntity = new PromotionsEntity(Id);
                if (adapter.FetchEntity(_PromotionsEntity))
                {

                    _PromotionsEntity.PromotionName = PromotionName;
                    _PromotionsEntity.Price = Price;
                    _PromotionsEntity.Note = Note;
                    _PromotionsEntity.Photo = Photo;
                    _PromotionsEntity.IsActive = IsActive;
                    adapter.SaveEntity(_PromotionsEntity, true);
                    toReturn = true;
                }
            }
            return toReturn;
        }
Ejemplo n.º 24
0
 public bool Update(PromotionsEntity _PromotionsEntity, RelationPredicateBucket filter)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.UpdateEntitiesDirectly(_PromotionsEntity, filter);
         toReturn = true;
     }
     return toReturn;
 }
Ejemplo n.º 25
0
        public bool Update(PromotionsEntity _PromotionsEntity)
        {
            bool toReturn = false;
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                RelationPredicateBucket filter = new RelationPredicateBucket();
                IPredicateExpression _PredicateExpression = new PredicateExpression();
                _PredicateExpression.Add(PromotionsFields.Id == _PromotionsEntity.Id);

                filter.PredicateExpression.Add(_PredicateExpression);

                adapter.UpdateEntitiesDirectly(_PromotionsEntity, filter);
                toReturn = true;
            }
            return toReturn;
        }
Ejemplo n.º 26
0
 public PromotionsEntity SelectOne(Guid Id)
 {
     PromotionsEntity toReturn = null;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         PromotionsEntity _PromotionsEntity = new PromotionsEntity(Id);
         if (adapter.FetchEntity(_PromotionsEntity))
         {
             toReturn = _PromotionsEntity;
         }
     }
     return toReturn;
 }
Ejemplo n.º 27
0
        public PromotionsEntity Insert(string PromotionName, decimal Price, string Note, string Photo, bool IsActive)
        {
            PromotionsEntity _PromotionsEntity = new PromotionsEntity();
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {

                _PromotionsEntity.PromotionName = PromotionName;
                _PromotionsEntity.Price = Price;
                _PromotionsEntity.Note = Note;
                _PromotionsEntity.Photo = Photo;
                _PromotionsEntity.IsActive = IsActive;
                adapter.SaveEntity(_PromotionsEntity, true);
            }
            return _PromotionsEntity;
        }
Ejemplo n.º 28
0
 public PromotionsEntity Insert(PromotionsEntity _PromotionsEntity)
 {
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.SaveEntity(_PromotionsEntity, true);
     }
     return _PromotionsEntity;
 }
Ejemplo n.º 29
0
        public List <PromotionsEntity> PopulatePromotionsList()
        {
            List <PromotionsEntity> promotionList = new List <PromotionsEntity>();

            string dir = string.Concat(Directory.GetCurrentDirectory(), "\\Saves\\Main\\Promotions");

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(string.Concat(Directory.GetCurrentDirectory(), "\\Saves\\Main\\Promotions"));
            }
            else
            {
                FileInfo[] files = (new DirectoryInfo(dir).GetFiles("*.dat"));

                if (files.Length > 0)
                {
                    for (int i = 0; i < files.Length; i++)
                    {
                        try
                        {
                            FileInfo info = files[i];

                            using (StreamReader reader = new StreamReader(info.FullName))
                            {
                                PromotionsEntity promotion = new PromotionsEntity();

                                string id = reader.ReadLine();
                                promotion.OrgID = Convert.ToInt32(id);

                                promotion.Name     = reader.ReadLine();
                                promotion.Initals  = reader.ReadLine();
                                promotion.Location = reader.ReadLine();

                                promotionList.Add(promotion);

                                reader.Close();
                                //stream.Close();
                            }
                        }
                        catch (Exception e)
                        {
                            dir = string.Concat(Directory.GetCurrentDirectory(), "\\Logs");

                            if (!Directory.Exists(dir))
                            {
                                Directory.CreateDirectory(string.Concat(Directory.GetCurrentDirectory(), "\\Logs"));
                            }

                            string log = "Log - " + DateTime.Today.Ticks.ToString();

                            FileStream   stream = new FileStream(Directory.GetCurrentDirectory() + "\\Logs\\" + log + ".dat", FileMode.Create, FileAccess.Write);
                            StreamWriter writer = new StreamWriter(stream);

                            string err = e.ToString();
                            writer.WriteLine(err + "\n");

                            writer.Close();
                            stream.Close();
                        }
                    }
                }
            }

            return(promotionList);
        }