public static void InventoryLimit(InventoryLimitModel table) { string insert = SqliteQuery.Create("InventoryLimit", table.Headers); SqliteDataAccess.ExecuteQuery(insert, table); }
private void WinLoadButton() { Items = null; All = SqliteDataAccess.LoadContact(); Items = All; }
private void LoadPeopleList() { people = SqliteDataAccess.LoadPeople(); WireUpPeopleList(); }
public void Reload() { outcomeItemsModelViews = SqliteDataAccess.LoadOutcometemsView(baseLogID); dgvInventorizationItems.DataSource = null; dgvInventorizationItems.DataSource = outcomeItemsModelViews; }
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(); }
private void LoadItemsList() { items = SqliteDataAccess.LoadAllItems(); dgvItems.DataSource = items; }
/// <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); }
public static void Employee(EmployeeModel table) { string update = SqliteQuery.Update("Employee", table.Headers, table.ID); SqliteDataAccess.ExecuteQuery(update, table); }
public static void InventoryLimit(InventoryLimitModel table) { string update = SqliteQuery.Update("InventoryLimit", table.Headers, table.ID); SqliteDataAccess.ExecuteQuery(update, table); }
public static void BillOfMaterials(BillOfMaterialsModel table) { string insert = SqliteQuery.Create("BillOfMaterials", table.Headers); SqliteDataAccess.ExecuteQuery(insert, table); }
public static void Database(DatabaseModel table) { string update = SqliteQuery.Update("Database", table.Headers, table.ID); SqliteDataAccess.ExecuteQuery(update, table); }
public static void User(UserModel table) { string insert = SqliteQuery.Create("User", table.Headers); SqliteDataAccess.ExecuteQuery(insert, table); }
public static void UnitProgress(UnitProgressModel table) { string insert = SqliteQuery.Create("UnitProgress", table.Headers); SqliteDataAccess.ExecuteQuery(insert, table); }
public static void Transaction(Transaction table) { string insert = SqliteQuery.Create("Transaction", table.Headers); SqliteDataAccess.ExecuteQuery(insert, table); }
public override void Refresh() { clients = SqliteDataAccess.LoadAllClients(); dgvUsers.DataSource = null; dgvUsers.DataSource = clients; }
public static void Transaction(Transaction table) { string update = SqliteQuery.Update("Transaction", table.Headers, table.ID); SqliteDataAccess.ExecuteQuery(update, table); }
public void SaveStationButtonClick(StationModel stationClicked) { SqliteDataAccess.SaveStation(stationClicked); OnPropertyChanged("Stations"); }
public static void BillOfMaterials(BillOfMaterialsModel table) { string update = SqliteQuery.Update("BillOfMaterials", table.Headers, table.ID); SqliteDataAccess.ExecuteQuery(update, table); }
public override void Refresh() { items = SqliteDataAccess.LoadAllItems(); dgvItems.DataSource = items; }
public static void UnitProgress(UnitProgressModel table) { string update = SqliteQuery.Update("UnitProgress", table.Headers, table.ID); SqliteDataAccess.ExecuteQuery(update, table); }
/// <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); }
public static void User(UserModel table) { string update = SqliteQuery.Update("User", table.Headers, table.ID); SqliteDataAccess.ExecuteQuery(update, table); }
public UserController() { _dataAccess = new SqliteDataAccess(); }
public static void Dropdown(DropdownModel table) { string update = SqliteQuery.Update("Dropdown", "Name", table.ID); SqliteDataAccess.ExecuteQuery(update, table); }
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); } } }
public void Handle(EntryModel entryModel) { CarEntrys = new ObservableCollection <EntryModel>(SqliteDataAccess.LoadEntrysForCar(CarModel.Id)); CarModel.Entries = CarEntrys; CalculateAverages(); }
private void LoadExsistTodoList() { //Load Data From SQLite PublicTodoListModule.TodoList = SqliteDataAccess.LoadTodo(); WireUpTodoList(); }
public void SaveGame() { SqliteDataAccess.SaveGame(NewGame); Game.gamesList.Add(NewGame); }
private void CargaListaEmpleados() { empleado = SqliteDataAccess.CargaEmpleados(); EnlazaListaEmpleados(); }
public static void Employee(EmployeeModel table) { string insert = SqliteQuery.Create("Employee", table.Headers); SqliteDataAccess.ExecuteQuery(insert, table); }