public static AgendaMapper GetData(string Data, User User) { XDocument d = XDocument.Parse(Data); var LolData = Convert.FromBase64String(d.Descendants(User.tempuri + "VulAgendaCDSResult").First().Value); BinairFormaat For = new BinairFormaat(LolData); return new AgendaMapper(For, User); }
public AgendaMapper(BinairFormaat Formaat, User User) { Dictionary<int, string> TypeMappings = new Dictionary<int, string>(); TypeMappings[0] = "Niks"; foreach (var Item in User.InitData.Descendants(User.d2p1 + "AgendaLessoort")) { var Lessoort = int.Parse(Item.Descendants(User.d2p1 + "IdAgendaLessoort").First().Value); var Omschrijving = Item.Descendants(User.d2p1 + "Omschrijving").First().Value; TypeMappings[Lessoort] = Omschrijving; } Dictionary<string, Tuple<int, string>> Mappings = new Dictionary<string, Tuple<int, string>>(Formaat.Fields.Count); for (var i = 0; i < Formaat.Fields.Count; i++) { Mappings[Formaat.Fields[i].Name] = new Tuple<int, string>(i, Formaat.Fields[i].Description); } AgendaItems = new List<AgendaItem>(); foreach (var AgIt in Formaat.Rows) { int lesuurvan = (int) AgIt.Objects[Mappings["lesuurvan"].Item1]; int lesuurtm = (int)AgIt.Objects[Mappings["lesuurtm"].Item1]; for (int i = lesuurvan; i <= lesuurtm; i++) { AgendaItem Item = new AgendaItem(); Item.Start = (DateTime)AgIt.Objects[Mappings["dStart"].Item1]; Item.End = (DateTime)AgIt.Objects[Mappings["dFinish"].Item1]; Item.Lokatie = AgIt.Objects[Mappings["Lokatie"].Item1] as string; Item.Beschrijving = AgIt.Objects[Mappings["Omschrijving"].Item1] as string; Item.Actie = TypeMappings[(int)AgIt.Objects[Mappings["idAgendalessoort"].Item1]]; Item.Bericht = AgIt.Objects[Mappings["Bericht"].Item1] as string; Item.Lesuur = i+""; if(i == 0) Item.Lesuur = "!"; Item.RawData = new Dictionary<string,object>(Mappings.Count); foreach (var D in Mappings) { Item.RawData[D.Value.Item2] = AgIt.Objects[D.Value.Item1]; } AgendaItems.Add(Item); } } DataItems = new Dictionary<DateTime, List<AgendaItem>>(); foreach (var item in AgendaItems) { if (!DataItems.ContainsKey(item.Start.Date)) DataItems[item.Start.Date] = new List<AgendaItem>(); DataItems[item.Start.Date].Add(item); } }
static void Main(string[] args) { Poehoe.Crypto.ZipCrypto = new PoehoeZipWin32.ZipCrypto(); Poehoe.Crypto.AesKey = "087EC4624E964AE27DBDFE03279A2EE4"; Poehoe.Crypto.ZipKey = "yawUBRu+reduka5UPha2#=cRUc@ThekawEvuju&?g$dru9ped=a@REQ!7h_?anut"; Poehoe.Crypto.AesCrypto = new AesCrypto(); var Sch = new School("$SCHOOL"); var T = Sch.Login("$USER", "$PASS"); T.Wait(); var DDFR = GetLeerlingenDataRequest.Create(T.Result, new int[] {int.Parse(T.Result.InitData.Descendants(User.d2p1+"MijnTabelID").First().Value)}).Send(T.Result); DDFR.Wait(); XDocument D = XDocument.Parse(DDFR.Result); var Data = new BinairFormaat(Convert.FromBase64String(D.Descendants(User.tempuri + "GetLeerlingenDataResult").First().Value)); foreach(var F in Data.Fields) { Debug.WriteLine("public object {0} {1}\n\tget;\n\tprivate set;\n{2}", F.Name, "{", "}"); } Console.ReadLine(); }
public async Task<LeerlingData> GetLeerlingData() { if (_data != null) return _data; var Data = await GetLeerlingenDataRequest.Create(this, new int[] { int.Parse(InitData.Descendants(User.d2p1 + "MijnTabelID").First().Value) }).Send(this); XDocument D = XDocument.Parse(Data); var BinFor = new BinairFormaat(Convert.FromBase64String(D.Descendants(User.tempuri + "GetLeerlingenDataResult").First().Value)); _data = LeerlingData.Get(BinFor, BinFor.Rows[0]); return _data; }
public static LeerlingData Get(BinairFormaat Formaat, Row Row) { LeerlingData D = new LeerlingData(); for (var i = 0; i < Row.Objects.Count; i++) { string Param = Formaat.Fields[i].Name; switch (Param) { case "idleer": D.idleer = (int)Row.Objects[i]; break; case "stamnr": D.stamnr = (int)Row.Objects[i]; break; case "achternaam": D.achternaam = (string)Row.Objects[i]; break; case "roepnaam": D.roepnaam = (string)Row.Objects[i]; break; case "naam_vol": D.naam_vol = (object)Row.Objects[i]; break; case "tussenvoeg": D.tussenvoeg = (string)Row.Objects[i]; break; case "woonplaats": D.woonplaats = (string)Row.Objects[i]; break; case "straat": D.straat = (string)Row.Objects[i]; break; case "huisnr": D.huisnr = (string)Row.Objects[i]; break; case "huisnr_tv": D.huisnr_tv = (object)Row.Objects[i]; break; case "postcode": D.postcode = (string)Row.Objects[i]; break; case "medisch": D.medisch = (object)Row.Objects[i]; break; case "memo": D.memo = (object)Row.Objects[i]; break; case "geb_datum": D.geb_datum = (DateTime)Row.Objects[i]; break; case "idGebr": D.idGebr = (int)Row.Objects[i]; break; case "idAanm": D.idAanm = (int)Row.Objects[i]; break; case "idStud": D.idStud = (int)Row.Objects[i]; break; case "C_PROFIEL": D.C_PROFIEL = (object)Row.Objects[i]; break; case "C_PROFIEL2": D.C_PROFIEL2 = (object)Row.Objects[i]; break; case "idBgrp": D.idBgrp = (int)Row.Objects[i]; break; case "STUDIE": D.STUDIE = (string)Row.Objects[i]; break; case "dBegin": D.dBegin = (DateTime)Row.Objects[i]; break; case "dEinde": D.dEinde = (DateTime)Row.Objects[i]; break; case "studieslu": D.studieslu = (int)Row.Objects[i]; break; case "groep": D.groep = (string)Row.Objects[i]; break; } } return D; }