private PaginaBlok MakeHoekProfielBlok(Ruimte r) { var pBlok = new PaginaBlok(15); pBlok.LinkedRuimteId = r.RuimteID; pBlok.AddRegel(Environment.NewLine, Environment.NewLine, false); pBlok.AddRegel(null, "Hoekprofiel", true); var basisRegelFinished = false; List <int> accIndexDone = new List <int>(); var nabew = r.qryNabewerkingen(Acumulator.Instance().ctx); foreach (var hkprof in r.GekozenProfielen) { var scppd = nabew.Where(n => n.ID == hkprof.LinkedSubCat).FirstOrDefault() as Classes.SubCatPerPakket; if (scppd != null) { if (!basisRegelFinished) { var accHprof = r.AanvullendeMeters.FirstOrDefault(x => x.ProdSoort == ExpertControls.Models.ProductSoort.HoekProfiel && x.LinkedHoekProf.ProfielID == hkprof.ProfielID && x.RegelIndex == 0); if (accHprof != null) // basis vervangen/aangepast in accent pagina { pBlok.AddRegel(accHprof.Meters + "m", accHprof.LinkedHoekProf.Omschrijving, false); if (!String.IsNullOrEmpty(accHprof.Opmerking)) { pBlok.AddRegel(null, accHprof.Opmerking, false); } accIndexDone.Add(accHprof.RegelIndex); } else//basis nog standaard { pBlok.AddRegel(/*hkprof.Meters*/ scppd.TotaalMeters + "m", hkprof.Omschrijving, false); } basisRegelFinished = true; } else { var anvHprof = r.AanvullendeMeters.FirstOrDefault(x => x.ProdSoort == ProductSoort.HoekProfiel && x.LinkedHoekProf.ProfielID == hkprof.ProfielID && !accIndexDone.Contains(x.RegelIndex)); if (anvHprof != null) { pBlok.AddRegel(anvHprof.Meters + "m", anvHprof.LinkedHoekProf.Omschrijving, false); if (!String.IsNullOrEmpty(anvHprof.Opmerking)) { pBlok.AddRegel(null, anvHprof.Opmerking, false); } accIndexDone.Add(anvHprof.RegelIndex); pBlok.AddRegel(Environment.NewLine, Environment.NewLine, false); } } } } pBlok.AddRegel(Environment.NewLine, Environment.NewLine, false); return(pBlok); }
private PaginaBlok MakeDorpelBlok(Ruimte r) { var pBlok = new PaginaBlok(15); pBlok.LinkedRuimteId = r.RuimteID; var nabew = r.qryNabewerkingen(Acumulator.Instance().ctx); var hasdorp = false; foreach (var pDorp in r.GekozenTegels) { var cat = (from pd in Acumulator.Instance().ctx.Productens where pd.PD_ID == pDorp.ID select pd.PC_NR).FirstOrDefault(); if (int.Parse(cat) == 3) { hasdorp = true; //pBlok.AddRegel(Environment.NewLine, Environment.NewLine, false); //pBlok.AddRegel(null, "Dorpel", true); //var scppd = nabew.Where(n => n.ID == pDorp.LinkedSubCat).FirstOrDefault() as Classes.SubCatPerPakket; //if (scppd != null) //{ // pBlok.AddRegel(scppd.TotaalMeters + "st", pDorp.productcode.TrimStart(' ') + " " + pDorp.Kleur, false); // pBlok.AddRegel(null, "Verwerken ter plaatse van de douchevloer", false); //} } } if (hasdorp == true) { pBlok.AddRegel(Environment.NewLine, Environment.NewLine, false); pBlok.AddRegel(null, "Dorpel", true); } foreach (var exDorp in r.AanvullendeMeters.Where(e => e.ProdSoort == ProductSoort.Dorpel)) { // pBlok.AddRegel(Environment.NewLine, Environment.NewLine, false); pBlok.AddRegel(exDorp.Meters + "st", exDorp.LinkedProduct.productcode.TrimStart(' ') + " " + exDorp.LinkedProduct.Kleur, false); if (String.IsNullOrEmpty(exDorp.Opmerking)) { // pBlok.AddRegel(Environment.NewLine, Environment.NewLine, false); pBlok.AddRegel(null, "Verwerken ter plaatse van de douchevloer", false); } else { //pBlok.AddRegel(Environment.NewLine, Environment.NewLine, false); pBlok.AddRegel(null, exDorp.Opmerking, false); } pBlok.AddRegel(Environment.NewLine, Environment.NewLine, false); } return(pBlok); }
private PaginaBlok MakeAccentBlok(Ruimte r, string MainCatNr) { var pBlok = new PaginaBlok(15); /////////////// var ctx = Acumulator.Instance().ctx; var nabew = r.qryNabewerkingen(Acumulator.Instance().ctx); foreach (var ac in r.GekozenAccenten.Where(x => x.LinkedSubCat.StartsWith("Sub4Accent"))) { if (MainCatNr == ac.LinkedMainCat) { if (r.AanvullendeMeters.Count(x => x.LinkedProduct != null && x.LinkedProduct.ID == ac.ID && x.IsBasis == false) > 0) { var scb_ax_s = (from sc in ctx.SubCatPerPakkets where sc.SCBP_ID == ac.LinkedSubCat select sc.SCB_NR).FirstOrDefault();// var scb_ax = ""; var foo = ""; if (scb_ax_s != null) { scb_ax = scb_ax_s.ToString(); foo = ac.LinkedSubCat; } else { scb_ax = ac.LinkedSubCat.StartsWith("Sub4Accent") ? ac.LinkedSubCat : "Sub4Accent" + Ruimte.GenerateScbNr4Accent(ac.LinkedSubCat).SCB_ID; foo = scb_ax; } //var bew_ax = r.GekozenBewerkingen.Where(b => b.LinkedSubcatNr == scb_ax).ToList(); var bew_ax = r.GekozenBewerkingen.Where(b => b.Kenmerk != null && b.Kenmerk.StartsWith(ac.ID + NabewerkingHandler.TranslateSubCat(scb_ax))).ToList(); if (bew_ax.Count == 0) { bew_ax = r.GekozenBewerkingen.Where(b => b.LinkedSubcatNr == NabewerkingHandler.TranslateSubCat(scb_ax)).ToList(); } if (bew_ax.Count > 0) { var scpp_ax = nabew.Where(n => n.ID == foo).FirstOrDefault() as Classes.SubCatPerPakket; var vExM = r.AanvullendeMeters.FirstOrDefault(x => x.LinkedProduct != null && x.LinkedProduct.ID == ac.ID); var vAccTgl = vExM.LinkedProduct; string oms_ax = ""; var eenheid_ax = "m²"; if (scpp_ax != null) { oms_ax = (from c in ctx.Categorieëns join sbct in ctx.SubCats on c.C_ID equals sbct.C_NR where sbct.SCB_ID == scpp_ax.SubCatNR select c.Omschrijving).FirstOrDefault(); eenheid_ax = (from e in ctx.SubCats where e.SCB_ID == scpp_ax.SubCatNR select e.eenheidMETERS).FirstOrDefault(); } if (oms_ax.ToLower().StartsWith("accent") == false) { pBlok.AddRegel(Environment.NewLine, Environment.NewLine, false); pBlok.AddRegel(null, oms_ax, true); } var meters_ax = vExM.Meters; pBlok.AddRegel(Math.Round(meters_ax, 2) + eenheid_ax, vAccTgl.productcode.TrimStart(' ') + " " + vAccTgl.Kleur + " " + vAccTgl.Breedte.ToString().Substring(0, 2) + "x" + vAccTgl.Lengte.ToString().Substring(0, 2) + "cm", false); string lijm_ax = "", verwerking_ax = ""; foreach (var b in bew_ax.Where(x => x.NabewerkingSetNr == vExM.NabewerkingSetNR)) { if (lijm_ax == "") { lijm_ax = b.TextVoorZin; } else { verwerking_ax = b.Omschrijving; } } if (String.IsNullOrEmpty(lijm_ax)) { var b = bew_ax.Where(x => x.BewerkingCat_NR == "NC1").FirstOrDefault(); if (b != null) { lijm_ax = b.TextVoorZin; } } if (String.IsNullOrEmpty(verwerking_ax)) { var b = bew_ax.Where(x => x.BewerkingCat_NR != "NC1").FirstOrDefault(); if (b != null) { verwerking_ax = b.Omschrijving; } } string zin_ax = verwerking_ax + " verwerken met " + lijm_ax + " voeg"; pBlok.AddRegel(null, zin_ax, false); var OpmText = vExM.Opmerking; if (OpmText != null && OpmText.Count() > 45) { var za = OpmText.Substring(0, OpmText.IndexOf(' ', 45)); var zb = OpmText.Substring(za.Length + 1, OpmText.Length - za.Length - 1); if (!String.IsNullOrEmpty(za)) { pBlok.AddRegel(null, za, false); } if (!String.IsNullOrEmpty(zb)) { pBlok.AddRegel(null, zb, false); } } else { if (!String.IsNullOrEmpty(vExM.Opmerking)) { pBlok.AddRegel(null, vExM.Opmerking, false); } } } } } } ////////////// return(pBlok); }
private PaginaBlok MakeTegelBlok(Ruimte r, string MainCatNr) { var pBlok = new PaginaBlok(15); var ctx = Acumulator.Instance().ctx; var nabew = r.qryNabewerkingen(ctx); /////////////////////////////// foreach (Product P in r.GekozenTegels) { if (P.LinkedMainCat == MainCatNr) { if (P.Lengte <= 0 && P.Breedte <= 0) { continue; } var scb = (from sc in ctx.SubCatPerPakkets where sc.SCBP_ID == P.LinkedSubCat select sc.SCB_NR).FirstOrDefault().ToString(); //var bew = r.GekozenBewerkingen.Where(b => b.LinkedSubcatNr == scb).ToList(); var bew = r.GekozenBewerkingen.Where(b => b.Kenmerk != null && b.Kenmerk.StartsWith(P.ID + scb)).ToList(); //var prodtoon = false; if (bew.Count > 0) { //prodtoon = true; var scpp = nabew.Where(n => n.ID == P.LinkedSubCat).FirstOrDefault() as Classes.SubCatPerPakket; if (scpp.TotaalMeters > 0) { if (scpp == null) { continue; } var oms = (from c in ctx.Categorieëns join sbct in ctx.SubCats on c.C_ID equals sbct.C_NR where sbct.SCB_ID == scpp.SubCatNR select c.Omschrijving).FirstOrDefault(); pBlok.AddRegel(Environment.NewLine, Environment.NewLine, false); pBlok.AddRegel(null, oms, true); var meters = scpp.TotaalMeters; var eenheid = (from e in ctx.SubCats where e.SCB_ID == scpp.SubCatNR select e.eenheidMETERS).FirstOrDefault(); pBlok.AddRegel(Math.Round(meters, 2) + eenheid, P.productcode.TrimStart(' ') + " " + P.Kleur + " " + P.Breedte.ToString().Substring(0, 2) + "x" + P.Lengte.ToString().Substring(0, 2) + "cm", false); string lijm = "", verwerking = "", plaatsing = ""; foreach (var b in bew) { switch (b.BewerkingCat_NR) { case "NC1": lijm = b.TextVoorZin; break; case "NC2": verwerking = b.Omschrijving; break; case "NC3": plaatsing = b.TextVoorZin; break; } } string zin = ""; if (lijm == "" && verwerking == "") { zin = plaatsing; } else { zin = verwerking + " verwerken met " + lijm + " voeg"; } if (!String.IsNullOrEmpty(zin)) { pBlok.AddRegel(null, zin, false); } // pBlok.AddRegel(null, null, false); } else { var vervangTegel = r.AanvullendeMeters.FirstOrDefault(am => am.LinkedSubCat == scb); if (vervangTegel != null) { var lP = vervangTegel.LinkedProduct; var oms = (from c in ctx.Categorieëns join sbct in ctx.SubCats on c.C_ID equals sbct.C_NR where sbct.SCB_ID == scb select c.Omschrijving).FirstOrDefault(); pBlok.AddRegel(null, oms, true); var meters = vervangTegel.Meters; var eenheid = (from e in ctx.SubCats where e.SCB_ID == scpp.SubCatNR select e.eenheidMETERS).FirstOrDefault(); pBlok.AddRegel(Math.Round(meters, 2) + eenheid, lP.productcode.TrimStart(' ') + " " + lP.Kleur + " " + lP.Breedte.ToString().Substring(0, 2) + "x" + lP.Lengte.ToString().Substring(0, 2) + "cm", false); string lijm = "", verwerking = "", plaatsing = ""; var bew_a = r.GekozenBewerkingen.Where(x => x.NabewerkingSetNr == vervangTegel.NabewerkingSetNR); foreach (var b in bew_a) { switch (b.BewerkingCat_NR) { case "NC1": lijm = b.TextVoorZin; break; case "NC2": verwerking = b.Omschrijving; break; case "NC3": plaatsing = b.TextVoorZin; break; } } string zin = ""; if (lijm == "" && verwerking == "") { zin = plaatsing; } else { zin = verwerking + " verwerken met " + lijm + " voeg"; } if (!String.IsNullOrEmpty(zin)) { pBlok.AddRegel(null, zin, false); } if (!String.IsNullOrEmpty(vervangTegel.Opmerking)) { pBlok.AddRegel(null, vervangTegel.Opmerking, false); } // pBlok.AddRegel(Environment.NewLine, Environment.NewLine, false); } } } } } ////////////////////////////// return(pBlok); }
public bool InitNewRuimte(int ruimteCntr, Ruimte r) { var ctx = Acumulator.Instance().ctx; var nabew = r.qryNabewerkingen(ctx); ArticleRowCounter++; ContentGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); var secndlinetext = ""; if (nabew.Count == 0) { return(false); //skip if empty //secndlinetext = "Geen tegelwerk"; //MessageBox.Show("geentegelwerk"); } else { var tbP = new TextBlock // product text { FontFamily = new FontFamily("Lucida Grande"), FontSize = 14, FontWeight = FontWeights.Bold, TextWrapping = TextWrapping.Wrap, HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new Thickness(45, 15, 0, 15), Text = Acumulator.Instance().MaakStartZin(r.Omschrijving) }; tbP.SetValue(Grid.ColumnProperty, 0); tbP.SetValue(Grid.RowProperty, ArticleRowCounter); ContentGrid.Children.Add(tbP); //tegel hoogte var tegelh = (from h in r.Children where h.GetType() == typeof(Classes.SubCatPerRuimteDeel) && (h as Classes.SubCatPerRuimteDeel).SubCatNR == "SCB4" select(h as Classes.SubCatPerRuimteDeel).Meters).Sum(); if (r.PlafondHoogte == tegelh) { secndlinetext = "Betegelen tot plafond"; } else if (tegelh > 0) { secndlinetext = "Betegelen tot " + tegelh + "mm"; } else { var ruimtenaam = (from br in ctx.Bron_Ruimtes where br.R_NR == r.RuimteID select br.RuimteNaam).FirstOrDefault(); secndlinetext = "Betegelen " + ruimtenaam; } ArticleRowCounter++; ContentGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); var tb0 = new TextBlock { FontFamily = new FontFamily("Lucida Grande"), FontSize = 12, FontWeight = FontWeights.Bold, TextWrapping = TextWrapping.Wrap, HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new Thickness(0, 0, 45, 0), Text = "Info" }; tb0.SetValue(Grid.ColumnProperty, 1); tb0.SetValue(Grid.RowProperty, ArticleRowCounter); ContentGrid.Children.Add(tb0); } ArticleRowCounter++; ContentGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); var tb1 = new TextBlock // product text { FontFamily = new FontFamily("Lucida Grande"), FontSize = 12, //FontWeight = FontWeights.Bold, TextWrapping = TextWrapping.Wrap, HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new Thickness(0, 0, 45, 0), Text = secndlinetext, }; tb1.SetValue(Grid.ColumnProperty, 1); tb1.SetValue(Grid.RowProperty, ArticleRowCounter); ContentGrid.Children.Add(tb1); ArticleRowCounter++; return(true); }