public static void SendLog(string msg, LogType lt) { var ctx = new eBrochureDomainContext(); ServerLog sl = new ServerLog(); var MSG = ""; switch (lt) { case LogType.status: MSG += @"[STATUS]-"; break; case LogType.activity: MSG += @"[ACTIVITY]-"; break; case LogType.error: MSG += @"[ERROR]-"; break; } MSG += @"-[MSG]- " + msg + " -[END]"; sl.logmsg = MSG; sl.TimeStamp = DateTime.Now; ctx.GetServerTime(operation => { sl.TimeStamp = operation.Value; CompleteSendLog(sl); }, null); //ctx.ServerLogs.Add(sl); // ctx.SubmitChanges(); }
private static void CompleteSendLog(ServerLog sl) { var ctx = new eBrochureDomainContext(); ctx.ServerLogs.Add(sl); ctx.SubmitChanges(); }
public NewUserControl(DetailsWindow parentwindow) { InitializeComponent(); ctx = Acumulator.Instance().ctx; ParentWindow = parentwindow; ParentWindow.MaxHeight = 450; LoadRolCBB(); LoadProjLB(); LoadBouwNRCBB(); LoadColBouwnrLB(); }
private void loadProj(UserRole ur) { eBrochureDomainContext ctx; if (Acumulator.Instance().ctx == null) { ctx = new eBrochureDomainContext(); Acumulator.Instance().ctx = ctx; } else { ctx = Acumulator.Instance().ctx; } if (ur == UserRole.Admin) { ctx.Load(ctx.GetPRojectQuery()).Completed += (sender, args) => { ProjectNrCbb.ItemsSource = ctx.PRojects; ProjectNrCbb.SelectedValuePath = "PR_ID"; ProjectNrCbb.DisplayMemberPath = "Omschrijving"; KiesProject = true; }; } else if (ur == UserRole.Adviseur || ur == UserRole.Demo || ur == UserRole.Showroom) { ctx.Load(ctx.GetPRojectQuery()).Completed += (sender1, args1) => { ctx.Load(ctx.GetGebruikersQuery()).Completed += (sender2, args2) => { ctx.Load(ctx.GetProjectSetOpbouwQuery()).Completed += (sender, args) => { var pros = (from p in ctx.PRojects join pso in ctx.ProjectenSetOpbouws on p.PR_ID equals pso.Project_NR join g in ctx.Gebruikers on pso.ProjectenSet_NR equals g.ProjectenSet_NR where g.GebruikersID == Acumulator.Instance().HuidigGebruiker.ID select p).ToList(); ProjectNrCbb.ItemsSource = pros; ProjectNrCbb.SelectedValuePath = "PR_ID"; ProjectNrCbb.DisplayMemberPath = "Omschrijving"; KiesProject = true; if (ProjectNrCbb.Items.Count == 1) { ProjectNrCbb.SelectedIndex = 0; ProjectNrCbb.IsEnabled = false; //ProjectNrCbb.Visibility = System.Windows.Visibility.Collapsed; //projlabel.Visibility = System.Windows.Visibility.Collapsed; } }; }; }; } }
public void MeerprijsInPakket(eBrochureDomainContext ctx) { var mp = from m in ctx.MeerPrijzenRuimteOpties where m.R_NR == OptieID && m.PP_NR == PakketPg select m.meerprijs; foreach (var x in mp) { BasisPrijs = (double)x; } BasisPrijs = Acumulator.Instance().BerekenEindPrijs(BasisPrijs); }
public double getMeerprijs(eBrochureDomainContext ctx, string pakketprijs_nr) { var mp = (from m in ctx.MeerPrijzenRuimteOpties where m.R_NR == OptieID && m.PP_NR == pakketprijs_nr select m.meerprijs).FirstOrDefault(); double prijs = 0; if (mp != null) { prijs = Acumulator.Instance().BerekenEindPrijs((double)mp); } return(prijs); }
public void GetPrijs(string rid, eBrochureDomainContext ctx) { double PakketPrijs = 0; var prijzen = from mpro in ctx.MeerPrijzenRuimteOpties where mpro.PP_NR == PakketPrijsgroep_NR && rid == mpro.R_NR select mpro.meerprijs; foreach (decimal mp in prijzen) { PakketPrijs += (double)mp; } PakketPrijs = Acumulator.Instance().BerekenEindPrijs(PakketPrijs); PrijsHuidig = PakketPrijs; }
private void Getsubs(eBrochureDomainContext ctx) { var subs = from scp in ctx.SubCatPerPakkets where scp.P_NR == Pakket_ID select new SubCatPerPakket() { PakketNR = scp.P_NR, SubCatNR = scp.SCB_NR, ID = scp.SCBP_ID, ProductSetNR = scp.PD_SET_NR }; foreach (var x in subs) { Add(x); } }
private SubPage SwitchStart4User() { SubPage sp = new SubPage(); switch (Acumulator.Instance().HuidigGebruiker.Rol) { case UserRole.Admin: sp.Titel = "Kies Project en Bouwnummer"; sp.Addcontrol(new InputBouwNr(Acumulator.Instance().HuidigGebruiker.Rol)); NewUserBtn.Visibility = Visibility.Visible; SwitchBnrBtn.Visibility = Visibility.Visible; AfspraakBtn.Visibility = Visibility.Visible; break; case UserRole.Showroom: case UserRole.Demo: case UserRole.Adviseur: sp.Titel = "Kies Bouwnummer"; sp.Addcontrol(new InputBouwNr(Acumulator.Instance().HuidigGebruiker.Rol)); SwitchBnrBtn.Visibility = Visibility.Visible; AfspraakBtn.Visibility = Visibility.Visible; break; case UserRole.Bewoner: var ctx = new eBrochureDomainContext(); Acumulator.Instance().ctx = ctx; ctx.Load(ctx.GetGebruikersQuery()).Completed += (sender, args) => { ctx.Load(ctx.GetBouwnummerSetOpbouwQuery()).Completed += (sender2, args2) => { ctx.Load(ctx.GetBouwnummersQuery()).Completed += (sender3, args3) => { var bnr = (from b in ctx.BouwnummerSetOpbouws join g in ctx.Gebruikers on b.BouwnummerSet_NR equals g.BouwnummerSet_NR join baseb in ctx.Bouwnummers on b.Bouwnummer_NR equals baseb.B_ID where g.Naam.ToLower() == Acumulator.Instance().GebruikersNaam.ToLower() select new { b.Bouwnummer_NR, baseb.PR_NR }).FirstOrDefault(); Acumulator.Instance().Bouwnr = bnr.Bouwnummer_NR; Acumulator.Instance().Projectnr = bnr.PR_NR; BB.GeenInputBouwnummer(); }; }; }; AfspraakBtn.Visibility = Visibility.Visible; break; } return(sp); }
private void getpakketprijs(PakketKeuze pk, eBrochureDomainContext ctx) { if (pk != null) { double PakketPrijs = 0; var prijzen = from mpro in ctx.MeerPrijzenRuimteOpties where mpro.PP_NR == pk.PakketPrijsgroep_NR && RuimteHuidig.RuimteID == mpro.R_NR select mpro.meerprijs; foreach (decimal mp in prijzen) { PakketPrijs += (double)mp; } PakketPrijs = Acumulator.Instance().BerekenEindPrijs(PakketPrijs); pk.PrijsHuidig = PakketPrijs; } }
public void qrySubCat(eBrochureDomainContext ctx) { var subcats = (from sc in ctx.SubCatPerRuimteDeels where sc.R_NR == OptieID select new SubCatPerRuimteDeel() { ID = sc.SCPR_ID, RuimteDeelNR = sc.R_NR, SubCatNR = sc.SCB_NR, Meters = (double)sc.meters }); foreach (var x in subcats) { Add(x); } }
private void qryRuimtes(string t_id, eBrochureDomainContext ctx) { // Children.Clear(); if (t_id != null && t_id != String.Empty) { var rooms = (from r in ctx.RuimteDelens join rpt in ctx.RuimtesPerTypes on r.R_ID equals rpt.R_NR join br in ctx.Bron_Ruimtes on rpt.R_NR equals br.R_NR where rpt.T_NR == t_id // select r.R_ID).ToList(); select new Ruimte(r.R_ID, r.Omschrijving, (int)br.PLAFONDHOOGTE)); foreach (var x in rooms) { Add(x); } } }
private string qryType(eBrochureDomainContext ctx) { if (BouwNummer != null) { string s = String.Empty; var type = (from t in ctx.Bouwnummers where t.B_ID == BouwNummer select t.T_NR); foreach (var item in type) { s = item; } return(s); } else { return(String.Empty); } }
public ProjectFase(string Bouwnr, eBrochureDomainContext ctx) { var fase = (from f in ctx.Fases join bn in ctx.Bouwnummers on f.F_ID equals bn.F_NR where bn.B_ID == Bouwnr select f).FirstOrDefault(); _fid = fase.F_ID; _omschrijving = fase.Omschrijving; _afrondingboven = (double)fase.AfrondingBoven; _opslag = (double)fase.Opslag; _indexering = (double)fase.Indexering; _btw = (double)fase.BTW; _toonnegatieveprijzen = (bool)fase.ToonNegatievePrijzen; _filterdorpels = (bool)fase.FilterDorpels; if (Acumulator.Instance().HuidigGebruiker.Rol != UserRole.Showroom) { _korting = (double)fase.Korting; } }
private void init() { eBrochureDomainContext ctx = Acumulator.Instance().ctx; var ppgnrs = from mpro in ctx.MeerPrijzenRuimteOpties where mpro.R_NR == OptieID && mpro.meerprijs > 0 select mpro; string Pakpg = ""; double prijs = 9999999; foreach (var mpro in ppgnrs) { if ((double)mpro.meerprijs < prijs) { prijs = (double)mpro.meerprijs; Pakpg = mpro.PP_NR; } } PakketPg = Pakpg; OptType = OptieType.Unknown; qrySubCat(Acumulator.Instance().ctx); }
private void HandleCompletionEvent(object sender, EventArgs e) { try { if (_op.HasError) { MessageBox.Show(_op.Error.Message.ToString()); this.DialogResult = false; LogHelper.SendLog("Login Failed: " + _op.Error.Message.ToString(), LogType.error); } else if (_op.User != null && _op.User.Identity.IsAuthenticated) { eBrochureDomainContext ctx = new eBrochureDomainContext(); ctx.Load(ctx.GetGebruikersQuery()).Completed += (args, sender0) => { var gebr = (from g in ctx.Gebruikers where g.Naam.ToLower() == NaamBox.Text.ToLower() select new LoggedInUser() { GebruikersNaam = g.Naam, Rol = (UserRole)g.Rol_NR, ID = g.GebruikersID }).FirstOrDefault(); Acumulator.Instance().HuidigGebruiker = gebr; this.DialogResult = true; LogHelper.SendLog("Login by User: "******" - " + gebr.Rol.ToString(), LogType.activity); LogHelper.SendLog("Site accessed from: " + Application.Current.Resources["ClientIP"] + " by user: "******"Login Failed", LogType.error); this.DialogResult = false; } this._op = null; BusyIndie.IsBusy = false; } catch (Exception ex) { MessageBox.Show("Handle Complete Catched: " + ex.Message); } }
private CustomListItem mkListItem_multi(IOfferte item, eBrochureDomainContext ctx, string gpnm) { //invulling aan listItem geven, wss var optie = item as OptieKeuze; if (optie != null) { var mli = new CustomListItem(optie.Omschrijving, optie.OptieID, item.IsEnabled, false, this, gpnm); //var mli = new MultiListItem(optie.Omschrijving + " - €" + String.Format("{0:0.00}",optie.BasisPrijs), optie.OptieID, item.IsEnabled); //mli.Checked += new RoutedEventHandler(mli_Checked); //mli.Unchecked += new RoutedEventHandler(mli_Unchecked); var opb = new List <OpbouwItem>(); var basispakket = (from rpt in ctx.RuimtesPerTypes where rpt.R_NR == RuimteHuidig.RuimteID select rpt.BasisPakket_NR).FirstOrDefault(); var optiebasisprijs = 0.0; if (basispakket != null) { var basispakprijs = (from pr in ctx.MeerPrijzenRuimteOpties where pr.R_NR == optie.OptieID && pr.PP_NR == (from p in ctx.Pakkettens where p.P_ID == basispakket select p.PP_NR).FirstOrDefault() select pr.meerprijs).FirstOrDefault(); if (basispakprijs != null) { optiebasisprijs = Acumulator.Instance().BerekenEindPrijs((double)basispakprijs); } } if (optiebasisprijs == 0) { optiebasisprijs = optie.BasisPrijs; } opb.Add(new OpbouwItem("", "€" + String.Format("{0:0.00}", optiebasisprijs), "vanaf") { TextStijl = FontStyles.Italic }); mli.Opbouw = opb; // add excludes var exc = from e in ctx.OngeldigeCombinatieOpbouws where e.R_NR == optie.OptieID select e.OC_NR; foreach (string s in exc) { var foo = (from ex in ctx.OngeldigeCombinatieOpbouws where ex.OC_NR == s && ex.R_NR != optie.OptieID select ex.R_NR).ToList <string>(); foreach (string bar in foo) { mli.Excludes.Add(bar); } } /////////////////// var verplichtesetid = (from vcs in ctx.VerplichteCombinatieOpbouws where vcs.R_NR == optie.OptieID select vcs.VC_NR).FirstOrDefault(); var combis = (from vco in ctx.VerplichteCombinatieOpbouws where vco.VC_NR == verplichtesetid && vco.R_NR != optie.OptieID select vco.R_NR).ToList(); if (combis.Count > 0) { foreach (string c in combis) { mli.Combines.Add(c); } } /////////////////// var grayed = (from r in ctx.MeervoudigeCombinatiesOpbouws where r.R_NR == optie.OptieID select r.IsAfhankelijk).FirstOrDefault(); var mcset = (from mc in ctx.MeervoudigeCombinatiesOpbouws where mc.R_NR == optie.OptieID select mc.MC_NR).ToList(); var mcrids = (from mr in ctx.MeervoudigeCombinatiesOpbouws where mcset.Contains(mr.MC_NR) select mr.R_NR).ToList(); int cntr = 0; foreach (OptieKeuze ok in Inputlist) { if (mcrids.Contains(ok.OptieID)) { cntr++; } } if (cntr == mcrids.Count && grayed != null) { mli.Beschikbaar = !(bool)grayed; } //add unlocks var multi = from m in ctx.MeervoudigeCombinatiesOpbouws where m.R_NR == optie.OptieID && m.IsAfhankelijk == false select m.MC_NR; foreach (string s in multi) { var foo = (from mu in ctx.MeervoudigeCombinatiesOpbouws where mu.MC_NR == s && mu.R_NR != optie.OptieID select mu.R_NR).ToList(); foreach (string bar in foo) { mli.Unlocks.Add(bar); } } if (!mli.Beschikbaar) { Disabled.Add(mli); } return(mli); } var ruimte = item as RuimteOfferte; if (ruimte != null) { var mli = new CustomListItem(ruimte.Omschrijving, ruimte.Omschrijving, item.IsEnabled, false, this, gpnm); //var sli = new MultiListItem(ruimte.Omschrijving, ruimte.Omschrijving, item.IsEnabled); if (!mli.Beschikbaar) { Disabled.Add(mli); } //add excludes return(mli); } return(null); }
private CustomListItem mkListItem_single(IOfferte item, eBrochureDomainContext ctx, string grpnm) { //invulling aan listItem geven, wss var optie = item as OptieKeuze; if (optie != null) { var sli = new CustomListItem(optie.Omschrijving, optie.OptieID, item.IsEnabled, true, this, grpnm); //var sli = new SingleListItem(optie.Omschrijving + " - €"+ String.Format("{0:0.00}",optie.BasisPrijs), optie.OptieID, item.IsEnabled); if (!sli.Beschikbaar) { Disabled.Add(sli); } return(sli); } var ruimte = item as RuimteOfferte; if (ruimte != null) { var sli = new CustomListItem(ruimte.Omschrijving, ruimte.Omschrijving, item.IsEnabled, true, this, grpnm); //var sli = new SingleListItem(ruimte.Omschrijving, ruimte.Omschrijving, item.IsEnabled); if (!sli.Beschikbaar) { Disabled.Add(sli); } return(sli); } var pakket = item as PakketKeuze; if (pakket != null) { var sli = new CustomListItem(pakket.Omschrijving, pakket.Pakket_ID, pakket.IsEnabled, true, this, grpnm); var oli = new List <OpbouwItem>(); oli.Add(new OpbouwItem("pakket " + pakket.Omschrijving.ToLower(), "€" + string.Format("{0:0.00}", pakket.PrijsHuidig), "")); foreach (OptieKeuze ok in RuimteHuidig.GekozenOpties) { if (ok.OptieSoort != "OT3") { oli.Add(new OpbouwItem(ok.Omschrijving, "€" + string.Format("{0:0.00}", (ok.getMeerprijs(Acumulator.Instance().ctx, pakket.PakketPrijsgroep_NR))), "")); } } if (oli.Count > 0) { sli.Opbouw = oli; } //var sli = new SingleListItem(pakket.Omschrijving + " - €"+ String.Format("{0:0.00}",pakket.PrijsHuidig), pakket.Pakket_ID, item.IsEnabled); if (!sli.Beschikbaar) { Disabled.Add(sli); } return(sli); } var bewerking = item as Nabewerking; if (bewerking != null) { var sli = new CustomListItem(bewerking.Omschrijving, bewerking.Nabewerking_ID, true, true, this, grpnm); //var sli = new SingleListItem(bewerking.Omschrijving, bewerking.Nabewerking_ID, true); if (!sli.Beschikbaar) { Disabled.Add(sli); } return(sli); } var product = item as Product; if (product != null) { var sli = new CustomListItem(product.Omschrijving, product.ID, true, true, this, grpnm); //var sli = new SingleListItem(product.Omschrijving, product.ID, true); if (!sli.Beschikbaar) { Disabled.Add(sli); } return(sli); } return(null); }
private CustomListItem mkListItem_multi(IOfferte item, eBrochureDomainContext ctx, string gpnm) { //invulling aan listItem geven, wss var optie = item as OptieKeuze; if (optie != null) { var mli = new CustomListItem(optie.Omschrijving, optie.OptieID, item.IsEnabled, false, this, gpnm); //var mli = new MultiListItem(optie.Omschrijving + " - €" + String.Format("{0:0.00}",optie.BasisPrijs), optie.OptieID, item.IsEnabled); //mli.Checked += new RoutedEventHandler(mli_Checked); //mli.Unchecked += new RoutedEventHandler(mli_Unchecked); var opb = new List <OpbouwItem>(); opb.Add(new OpbouwItem("", "€" + String.Format("{0:0.00}", optie.BasisPrijs), "vanaf") { TextStijl = FontStyles.Italic }); mli.Opbouw = opb; // add excludes var exc = from e in ctx.OngeldigeCombinatieOpbouws where e.R_NR == optie.OptieID select e.OC_NR; foreach (string s in exc) { var foo = (from ex in ctx.OngeldigeCombinatieOpbouws where ex.OC_NR == s && ex.R_NR != optie.OptieID select ex.R_NR).ToList <string>(); foreach (string bar in foo) { mli.Excludes.Add(bar); } } var grayed = (from r in ctx.MeervoudigeCombinatiesOpbouws where r.R_NR == optie.OptieID select r.IsAfhankelijk).FirstOrDefault(); var mcset = (from mc in ctx.MeervoudigeCombinatiesOpbouws where mc.R_NR == optie.OptieID select mc.MC_NR).ToList(); var mcrids = (from mr in ctx.MeervoudigeCombinatiesOpbouws where mcset.Contains(mr.MC_NR) select mr.R_NR).ToList(); int cntr = 0; foreach (OptieKeuze ok in Inputlist) { if (mcrids.Contains(ok.OptieID)) { cntr++; } } if (cntr == mcrids.Count && grayed != null) { mli.Beschikbaar = !(bool)grayed; } //add unlocks var multi = from m in ctx.MeervoudigeCombinatiesOpbouws where m.R_NR == optie.OptieID && m.IsAfhankelijk == false select m.MC_NR; foreach (string s in multi) { var foo = (from mu in ctx.MeervoudigeCombinatiesOpbouws where mu.MC_NR == s && mu.R_NR != optie.OptieID select mu.R_NR).ToList(); foreach (string bar in foo) { mli.Unlocks.Add(bar); } } if (!mli.Beschikbaar) { Disabled.Add(mli); } return(mli); } var ruimte = item as RuimteOfferte; if (ruimte != null) { var mli = new CustomListItem(ruimte.Omschrijving, ruimte.Omschrijving, item.IsEnabled, false, this, gpnm); //var sli = new MultiListItem(ruimte.Omschrijving, ruimte.Omschrijving, item.IsEnabled); if (!mli.Beschikbaar) { Disabled.Add(mli); } //add excludes return(mli); } return(null); }