Пример #1
0
        public static void InventoryLimit(InventoryLimitModel table)
        {
            string insert = SqliteQuery.Create("InventoryLimit", table.Headers);

            SqliteDataAccess.ExecuteQuery(insert, table);
        }
Пример #2
0
 private void WinLoadButton()
 {
     Items = null;
     All   = SqliteDataAccess.LoadContact();
     Items = All;
 }
Пример #3
0
        private void LoadPeopleList()
        {
            people = SqliteDataAccess.LoadPeople();

            WireUpPeopleList();
        }
Пример #4
0
 public void Reload()
 {
     outcomeItemsModelViews             = SqliteDataAccess.LoadOutcometemsView(baseLogID);
     dgvInventorizationItems.DataSource = null;
     dgvInventorizationItems.DataSource = outcomeItemsModelViews;
 }
Пример #5
0
        private void savePicture_Click_1(object sender, EventArgs e)
        {
            userclosing = false;

            if (ValidateForm())
            {
                UpdateCurrentItem();

                if (newitem == true)
                {
                    if (currentItem is AnimeModel)
                    {
                        if (SqliteDataAccess.LoadAnimeGroup("SELECT 1 FROM Anime WHERE Title='" + currentItem.Title.Replace("'", "'+CHAR(39)+'") + "' LIMIT 1").Count == 1)
                        {
                            txbTitle.BackColor = Color.LightCoral;
                            MessageBox.Show("Title already Exists", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                        else
                        {
                            SqliteDataAccess.SaveAnime((AnimeModel)currentItem, 1);
                            currentItem.ID = SqliteDataAccess.GetLastAnimeID();
                        }
                    }
                    else if (currentItem is SeriesModel)
                    {
                        if (SqliteDataAccess.LoadSeriesGroup("SELECT 1 FROM Series WHERE Title='" + txbTitle.Text.Replace("'", "'+CHAR(39)+'") + "' LIMIT 1").Count == 1)
                        {
                            txbTitle.BackColor = Color.LightCoral;
                            MessageBox.Show("Title already Exists", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                        else
                        {
                            SqliteDataAccess.SaveSeries((SeriesModel)currentItem, 1);
                            currentItem.ID = SqliteDataAccess.GetLastSeriesID();
                        }
                    }
                    else if (currentItem is GameModel)
                    {
                        if (SqliteDataAccess.LoadGameGroup("SELECT 1 FROM Games WHERE Title='" + txbTitle.Text.Replace("'", "'+CHAR(39)+'") + "' LIMIT 1").Count == 1)
                        {
                            txbTitle.BackColor = Color.LightCoral;
                            MessageBox.Show("Title already Exists", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                        else
                        {
                            SqliteDataAccess.SaveGame((GameModel)currentItem, 1);
                            currentItem.ID = SqliteDataAccess.GetLastGameID();
                        }
                    }
                }
                else
                {
                    if (currentItem is AnimeModel)
                    {
                        SqliteDataAccess.UpdateAnime((AnimeModel)currentItem);
                    }
                    else if (currentItem is SeriesModel)
                    {
                        SqliteDataAccess.UpdateSeries((SeriesModel)currentItem);
                    }
                    else if (currentItem is GameModel)
                    {
                        SqliteDataAccess.UpdateGame((GameModel)currentItem);
                    }
                }

                if (pictureChange == ChangeType.update)
                {
                    SaveItemPicture();
                }
                else if (pictureChange == ChangeType.delete)
                {
                    DeleteItemPicture();
                }
            }
            else
            {
                MessageBox.Show("Inputs are invalid!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            //TODO: modify according to listitem index

            this.Close();
        }
Пример #6
0
 private void LoadItemsList()
 {
     items = SqliteDataAccess.LoadAllItems();
     dgvItems.DataSource = items;
 }
Пример #7
0
        /// <summary>
        /// Get Weeks Matchups and Scores
        /// </summary>
        /// <param name="year"></param>
        /// <param name="week"></param>
        /// <param name="season"></param>
        /// <returns>List</returns>
        #region GET SCORES

        public static List <Matchup> Get_Week_Scores(string year, string week, SeasonType season)
        {
            //List<string> pageCountLinks = new List<string>();
            string seasonType = "";

            switch (season)
            {
            case SeasonType.PRE:
                seasonType = "pre";
                break;

            case SeasonType.POST:
                seasonType = "post";
                break;

            case SeasonType.REG:
                seasonType = "reg";
                break;
            }


            string         url      = "https://www.footballdb.com/scores/index.html?lg=NFL&yr=" + year + "&type=" + seasonType + "&wk=" + week;
            List <Matchup> matchups = new List <Matchup>();

            HtmlWeb      page = new HtmlWeb();
            HtmlDocument doc  = page.Load(url);

            //pageCountLinks = Get_PageCountNodes(url);
            HtmlNodeCollection teamNodes = doc.DocumentNode.SelectNodes("//table//tbody//tr");

            //tmlNodeCollection details = doc.DocumentNode.SelectNodes("//div[@class='divider']//h2");
            if (teamNodes != null)
            {
                for (int i = 0; i < teamNodes.Count - 1; i += 2)
                {
                    try
                    {
                        //away team data
                        string   awayTeamName      = teamNodes[i].ChildNodes[1].InnerText;
                        int      awayIndex         = awayTeamName.LastIndexOf('(');
                        string   awayRecord        = awayTeamName.Substring(awayIndex);
                        string   awayTeamNameFinal = awayTeamName.Replace(awayRecord, "").Trim();
                        string   aqOneScore        = teamNodes[i].ChildNodes[3].InnerText;
                        string   aqTwoScore        = teamNodes[i].ChildNodes[4].InnerText;
                        string   aqThreeScore      = teamNodes[i].ChildNodes[5].InnerText;
                        string   aqFourScore       = teamNodes[i].ChildNodes[6].InnerText;
                        string   aFinalScore       = teamNodes[i].ChildNodes[7].InnerText;
                        string[] awayQuarterScores = new string[] { aqOneScore, aqTwoScore, aqThreeScore, aqFourScore };

                        //home team data
                        string   homeTeamName      = teamNodes[i + 1].ChildNodes[1].InnerText;
                        int      homeIndex         = homeTeamName.LastIndexOf('(');
                        string   homeRecord        = homeTeamName.Substring(homeIndex);
                        string   homeTeamNameFinal = homeTeamName.Replace(homeRecord, "").Trim();
                        string   hqOneScore        = teamNodes[i + 1].ChildNodes[3].InnerText;
                        string   hqTwoScore        = teamNodes[i + 1].ChildNodes[4].InnerText;
                        string   hqThreeScore      = teamNodes[i + 1].ChildNodes[5].InnerText;
                        string   hqFourScore       = teamNodes[i + 1].ChildNodes[6].InnerText;
                        string   hFinalScore       = teamNodes[i + 1].ChildNodes[7].InnerText;
                        string[] homeQuarterScores = new string[] { hqOneScore, hqTwoScore, hqThreeScore, hqFourScore };

                        SqliteDataAccess.Save_Game(new Game(awayTeamNameFinal, homeTeamNameFinal, aFinalScore, hFinalScore, awayRecord, homeRecord, aqOneScore, aqTwoScore, aqThreeScore, aqFourScore,
                                                            hqOneScore, hqTwoScore, hqThreeScore, hqFourScore, year, week));
                        Thread.Sleep(200);
                    }
                    catch (Exception)
                    {
                        continue;
                    }

                    //matchups.Add(new Matchup(new Team(awayTeamNameFinal, awayRecord), new Team(homeTeamNameFinal, homeRecord), aFinalScore, hFinalScore, awayQuarterScores, homeQuarterScores));
                }
            }


            return(matchups);
        }
Пример #8
0
        public static void Employee(EmployeeModel table)
        {
            string update = SqliteQuery.Update("Employee", table.Headers, table.ID);

            SqliteDataAccess.ExecuteQuery(update, table);
        }
Пример #9
0
        public static void InventoryLimit(InventoryLimitModel table)
        {
            string update = SqliteQuery.Update("InventoryLimit", table.Headers, table.ID);

            SqliteDataAccess.ExecuteQuery(update, table);
        }
Пример #10
0
        public static void BillOfMaterials(BillOfMaterialsModel table)
        {
            string insert = SqliteQuery.Create("BillOfMaterials", table.Headers);

            SqliteDataAccess.ExecuteQuery(insert, table);
        }
Пример #11
0
        public static void Database(DatabaseModel table)
        {
            string update = SqliteQuery.Update("Database", table.Headers, table.ID);

            SqliteDataAccess.ExecuteQuery(update, table);
        }
Пример #12
0
        public static void User(UserModel table)
        {
            string insert = SqliteQuery.Create("User", table.Headers);

            SqliteDataAccess.ExecuteQuery(insert, table);
        }
Пример #13
0
        public static void UnitProgress(UnitProgressModel table)
        {
            string insert = SqliteQuery.Create("UnitProgress", table.Headers);

            SqliteDataAccess.ExecuteQuery(insert, table);
        }
Пример #14
0
        public static void Transaction(Transaction table)
        {
            string insert = SqliteQuery.Create("Transaction", table.Headers);

            SqliteDataAccess.ExecuteQuery(insert, table);
        }
Пример #15
0
 public override void Refresh()
 {
     clients             = SqliteDataAccess.LoadAllClients();
     dgvUsers.DataSource = null;
     dgvUsers.DataSource = clients;
 }
Пример #16
0
        public static void Transaction(Transaction table)
        {
            string update = SqliteQuery.Update("Transaction", table.Headers, table.ID);

            SqliteDataAccess.ExecuteQuery(update, table);
        }
Пример #17
0
 public void SaveStationButtonClick(StationModel stationClicked)
 {
     SqliteDataAccess.SaveStation(stationClicked);
     OnPropertyChanged("Stations");
 }
Пример #18
0
        public static void BillOfMaterials(BillOfMaterialsModel table)
        {
            string update = SqliteQuery.Update("BillOfMaterials", table.Headers, table.ID);

            SqliteDataAccess.ExecuteQuery(update, table);
        }
Пример #19
0
 public override void Refresh()
 {
     items = SqliteDataAccess.LoadAllItems();
     dgvItems.DataSource = items;
 }
Пример #20
0
        public static void UnitProgress(UnitProgressModel table)
        {
            string update = SqliteQuery.Update("UnitProgress", table.Headers, table.ID);

            SqliteDataAccess.ExecuteQuery(update, table);
        }
Пример #21
0
        /// <summary>
        /// Get All Player Links to their Player Page
        /// </summary>
        /// <returns>Dictionary</returns>
        #region GET PLAYER LINKS
        public static Dictionary <string, string> Get_Player_Links()
        {
            Dictionary <string, string> playerLinks = new Dictionary <string, string>();
            string lastNameLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

            for (int i = 0; i < lastNameLetters.Length; i++)
            {
                string currentLetter = lastNameLetters.Substring(i, 1);
                string mainPage      = "https://www.footballdb.com/players/players.html?letter=" + currentLetter;

                HtmlWeb      page = new HtmlWeb();
                HtmlDocument doc  = page.Load(mainPage);

                HtmlNodeCollection pagesNode = doc.DocumentNode.SelectNodes("//div[@class='dropdown']//ul//li");

                if (pagesNode != null)
                {
                    for (int x = 0; x < pagesNode.Count; x++)
                    {
                        int pageNum = x + 1;
                        mainPage = "https://www.footballdb.com/players/players.html?page=" + pageNum.ToString() + "&letter=" + currentLetter;

                        page = new HtmlWeb();
                        doc  = page.Load(mainPage);

                        HtmlNodeCollection playersTbl = doc.DocumentNode.SelectNodes("//table//tbody//tr//td//a");

                        for (int y = 0; y < playersTbl.Count; y++)
                        {
                            if (playersTbl[y].HasAttributes && playersTbl[y].Attributes.Count > 1)
                            {
                                string link       = playersTbl[y].Attributes["href"].Value;
                                string playerName = playersTbl[y].Attributes["title"].Value.Replace("Stats", "").Trim();

                                if (!playerLinks.ContainsKey(playerName))
                                {
                                    string preLink = "https://www.footballdb.com";
                                    //playerLinks.Add(playerName, preLink + link);
                                    SqliteDataAccess.Save_Player(new Player(playerName, preLink + link));
                                }
                            }
                        }
                    }
                }
                else
                {
                    mainPage = "https://www.footballdb.com/players/players.html?&letter=" + currentLetter;

                    page = new HtmlWeb();
                    doc  = page.Load(mainPage);

                    HtmlNodeCollection playersTbl = doc.DocumentNode.SelectNodes("//table//tbody//tr//td//a");

                    for (int y = 0; y < playersTbl.Count; y++)
                    {
                        if (playersTbl[y].HasAttributes && playersTbl[y].Attributes.Count > 1)
                        {
                            string link       = playersTbl[y].Attributes["href"].Value;
                            string playerName = playersTbl[y].Attributes["title"].Value.Replace("Stats", "").Trim();

                            if (!playerLinks.ContainsKey(playerName))
                            {
                                string preLink = "https://www.footballdb.com";
                                //playerLinks.Add(playerName, preLink + link);
                                SqliteDataAccess.Save_Player(new Player(playerName, preLink + link));
                            }
                        }
                    }
                }
            }
            return(playerLinks);
        }
Пример #22
0
        public static void User(UserModel table)
        {
            string update = SqliteQuery.Update("User", table.Headers, table.ID);

            SqliteDataAccess.ExecuteQuery(update, table);
        }
 public UserController()
 {
     _dataAccess = new SqliteDataAccess();
 }
Пример #24
0
        public static void Dropdown(DropdownModel table)
        {
            string update = SqliteQuery.Update("Dropdown", "Name", table.ID);

            SqliteDataAccess.ExecuteQuery(update, table);
        }
Пример #25
0
        public static async Task <Enum> TipsSystemAsync(ulong discordid, ulong mentionid, float amount)
        {
            //Let's Check if profile exists before we do anything
            var db             = new SqliteDataAccess();
            var userProfile    = new TipModel();
            var mentionProfile = new TipModel();

            userProfile = await ProfileExistsNew(discordid);

            mentionProfile = await ProfileExistsNew(mentionid);

            if (userProfile.Role == "Admin")
            {
                ///Soft Tip Cap based on available ncg - already given out tips.
                ///
                var ncg     = new NCG();
                var balance = AdminBalanceCheck();

                // Needs to check that Total balance of all users is less than Balance
                if (balance.Result < amount)
                {
                    return(Status.NEB); //Not Enough Balance
                }
                else if (userProfile.Id == mentionProfile.Id)
                {
                    return(Status.PASS); //Can't Tip yourself.
                }
                else
                {
                    //balance we are going to attribute to the receiver
                    float mentionbalance = mentionProfile.Balance + amount;
                    //verify that we managed to update the receiver.
                    bool check = await db.UpdateTipbalance(mentionProfile, mentionbalance);

                    if (check)
                    {
                        //Let's log the transaction.
                        bool done2 = await db.DumpTransfer("AdminTip", userProfile, mentionProfile, amount);

                        if (done2)
                        {
                            return(Status.ACOMPLETE);
                        }
                        else
                        {
                            //we should never see this.
                            return(Status.WTF);
                        }
                    }
                    else
                    {
                        return(Status.FAIL);
                    }
                }
            }
            else
            {
                ///Hard Tip Cap / NON-Admin Request
                ///
                if (userProfile.Balance < amount)
                {
                    return(Status.NEB); //Not Enough Balance
                }
                else if (userProfile.Id == mentionProfile.Id)
                {
                    return(Status.PASS); //Can't Tip yourself.
                }
                else
                {
                    float userbalance    = userProfile.Balance - amount;
                    float mentionblanace = mentionProfile.Balance + amount;
                    //verify that we managed to update the senders's balance
                    bool check = await db.UpdateTipbalance(userProfile, userbalance);

                    if (check)
                    {
                        //now let's add the tip to the sender's balance.
                        bool done = await db.UpdateTipbalance(mentionProfile, mentionblanace);

                        if (done)
                        {
                            //All went well, let's log transaction.
                            bool done2 = await db.DumpTransfer("UserTip", userProfile, mentionProfile, amount);

                            if (done2)
                            {
                                return(Status.COMPLETE);
                            }
                            else
                            {
                                return(Status.WTF);
                            }
                        }
                        else
                        {
                            //shit happened, revert the transaction, give the tip back to the sender and log failure.
                            await db.UpdateTipbalance(userProfile, mentionblanace - amount);

                            await db.DumpTransfer("REVERT", userProfile, mentionProfile, amount);

                            return(Status.FAIL);
                        }
                    }
                    return(Status.FAIL);
                }
            }
        }
Пример #26
0
 public void Handle(EntryModel entryModel)
 {
     CarEntrys        = new ObservableCollection <EntryModel>(SqliteDataAccess.LoadEntrysForCar(CarModel.Id));
     CarModel.Entries = CarEntrys;
     CalculateAverages();
 }
Пример #27
0
 private void LoadExsistTodoList()
 {
     //Load Data From SQLite
     PublicTodoListModule.TodoList = SqliteDataAccess.LoadTodo();
     WireUpTodoList();
 }
Пример #28
0
 public void SaveGame()
 {
     SqliteDataAccess.SaveGame(NewGame);
     Game.gamesList.Add(NewGame);
 }
Пример #29
0
        private void CargaListaEmpleados()
        {
            empleado = SqliteDataAccess.CargaEmpleados();

            EnlazaListaEmpleados();
        }
Пример #30
0
        public static void Employee(EmployeeModel table)
        {
            string insert = SqliteQuery.Create("Employee", table.Headers);

            SqliteDataAccess.ExecuteQuery(insert, table);
        }