public void Load() { Datum datum = new Datum("storages"); try { datum.Populate("AccountID = {0} AND WorldID = {1}", this.Parent.AccountID, this.Parent.WorldID); } catch { datum["AccountID"] = this.Parent.AccountID; datum["WorldID"] = this.Parent.WorldID; datum["Slots"] = (byte)4; datum["Meso"] = 0; datum.Insert(); } this.Slots = (byte)datum["Slots"]; this.Meso = (int)datum["Meso"]; this.Items = new List <Item>(); Datums charDatums = new Datums("characters").Populate("AccountID = {0} AND WorldID = {1}", this.Parent.AccountID, this.Parent.WorldID); foreach (int charId in (charDatums.Count == 0) ? new[] { this.Parent.ID } : charDatums.Select((cd) => (int)cd["ID"])) { foreach (Datum itemDatum in new Datums("items").Populate("CharacterID = {0} AND IsStored = True", charId)) { this.Items.Add(new Item(itemDatum)); } } }
//*****CONSTRUCTOR***** public ResultaatWindowViewModel() { //laden data AlgorithmDataService ads = new AlgorithmDataService(); Algorithms = ads.GetAlgorithms(0); ResultaatDataService rds = new ResultaatDataService(); Resultaten = rds.GetResultaten(); // unieke datums uit de collection halen en opslaan in 'Datums' DateTime _vorigeDatum = new DateTime().Date; foreach (Resultaat Resultaat in Resultaten) { if (Resultaat.Datum.Date != _vorigeDatum) { Datums.Add(Resultaat); _vorigeDatum = Resultaat.Datum.Date; } } //koppelen commands ExitCommand = new BaseCommand(Exit); WijzigResultaatCommand = new BaseCommand(WijzigResultaat); VoegResultaatToeCommand = new BaseCommand(VoegResultaatToe); DeleteResultaatCommand = new BaseCommand(DeleteResultaat); //instantiëren DialogService als singleton _dialogService = new DialogService(); }
//*****PROGRAMMA***** public void refreshResutaten() { Resultaten.Clear(); ResultaatDataService rds = new ResultaatDataService(); Resultaten = rds.GetResultaten(); Datums.Clear(); // unieke datums uit de collection halen en opslaan in 'Datums' DateTime _vorigeDatum = new DateTime().Date; foreach (Resultaat Resultaat in Resultaten) { if (Resultaat.Datum.Date != _vorigeDatum) { Datums.Add(Resultaat); _vorigeDatum = Resultaat.Datum.Date; } } }
public CreationData() { MaleSkins = new List <Tuple <CharacterConstants.JobType, byte> >(); FemaleSkins = new List <Tuple <CharacterConstants.JobType, byte> >(); MaleFaces = new List <Tuple <CharacterConstants.JobType, int> >(); FemaleFaces = new List <Tuple <CharacterConstants.JobType, int> >(); MaleHairs = new List <Tuple <CharacterConstants.JobType, int> >(); FemaleHairs = new List <Tuple <CharacterConstants.JobType, int> >(); MaleHairColors = new List <Tuple <CharacterConstants.JobType, byte> >(); FemaleHairColors = new List <Tuple <CharacterConstants.JobType, byte> >(); MaleTops = new List <Tuple <CharacterConstants.JobType, int> >(); FemaleTops = new List <Tuple <CharacterConstants.JobType, int> >(); MaleBottoms = new List <Tuple <CharacterConstants.JobType, int> >(); FemaleBottoms = new List <Tuple <CharacterConstants.JobType, int> >(); MaleShoes = new List <Tuple <CharacterConstants.JobType, int> >(); FemaleShoes = new List <Tuple <CharacterConstants.JobType, int> >(); MaleWeapons = new List <Tuple <CharacterConstants.JobType, int> >(); FemaleWeapons = new List <Tuple <CharacterConstants.JobType, int> >(); using (Log.Load("Character Creation Data")) { ForbiddenNames = new Datums("character_forbidden_names").Populate().Select(x => (string)x["forbidden_name"]).ToList(); foreach (Datum datum in new Datums("character_creation_data").Populate()) { string gender = (string)datum["gender"]; string charType = (string)datum["character_type"]; CharacterConstants.JobType jobType = charType == "aran" ? CharacterConstants.JobType.Aran : (charType == "cygnus" ? CharacterConstants.JobType.Cygnus : CharacterConstants.JobType.Explorer); switch ((string)datum["object_type"]) { case "skin": if (gender == "male" || gender == "both") { MaleSkins.Add(new Tuple <CharacterConstants.JobType, byte>(jobType, (byte)(int)datum["objectid"])); } if (gender == "female" || gender == "both") { FemaleSkins.Add(new Tuple <CharacterConstants.JobType, byte>(jobType, (byte)(int)datum["objectid"])); } break; case "face": if (gender == "male" || gender == "both") { MaleFaces.Add(new Tuple <CharacterConstants.JobType, int>(jobType, (int)datum["objectid"])); } if (gender == "female" || gender == "both") { FemaleFaces.Add(new Tuple <CharacterConstants.JobType, int>(jobType, (int)datum["objectid"])); } break; case "hair": if (gender == "male" || gender == "both") { MaleHairs.Add(new Tuple <CharacterConstants.JobType, int>(jobType, (int)datum["objectid"])); } if (gender == "female" || gender == "both") { FemaleHairs.Add(new Tuple <CharacterConstants.JobType, int>(jobType, (int)datum["objectid"])); } break; case "haircolor": if (gender == "male" || gender == "both") { MaleHairColors.Add(new Tuple <CharacterConstants.JobType, byte>(jobType, (byte)(int)datum["objectid"])); } if (gender == "female" || gender == "both") { FemaleHairColors.Add(new Tuple <CharacterConstants.JobType, byte>(jobType, (byte)(int)datum["objectid"])); } break; case "top": if (gender == "male" || gender == "both") { MaleTops.Add(new Tuple <CharacterConstants.JobType, int>(jobType, (int)datum["objectid"])); } if (gender == "female" || gender == "both") { FemaleTops.Add(new Tuple <CharacterConstants.JobType, int>(jobType, (int)datum["objectid"])); } break; case "bottom": if (gender == "male" || gender == "both") { MaleBottoms.Add(new Tuple <CharacterConstants.JobType, int>(jobType, (int)datum["objectid"])); } if (gender == "female" || gender == "both") { FemaleBottoms.Add(new Tuple <CharacterConstants.JobType, int>(jobType, (int)datum["objectid"])); } break; case "shoes": if (gender == "male" || gender == "both") { MaleShoes.Add(new Tuple <CharacterConstants.JobType, int>(jobType, (int)datum["objectid"])); } if (gender == "female" || gender == "both") { FemaleShoes.Add(new Tuple <CharacterConstants.JobType, int>(jobType, (int)datum["objectid"])); } break; case "weapon": if (gender == "male" || gender == "both") { MaleWeapons.Add(new Tuple <CharacterConstants.JobType, int>(jobType, (int)datum["objectid"])); } if (gender == "female" || gender == "both") { FemaleWeapons.Add(new Tuple <CharacterConstants.JobType, int>(jobType, (int)datum["objectid"])); } break; } } } }