//accent private void BewerkingHoekprofielRegelAccent(HoekProfiel accentProfiel, ExtraMeters accentInfo) { var nRegel = new NabewerkingUiRegel { Meters = accentInfo.Meters, Eenheid = GetEenheid(accentProfiel.LinkedSubCat), InfoText = accentProfiel.Omschrijving.Split('€')[0], IsBasis = false, SubCat = TranslateSubCat(accentProfiel.LinkedSubCat) }; UiRegelCollection.Add(nRegel); }
//hoekprofiel regels //normaal private void BewerkingHoekprofielRegel(SubCatPerPakket scpp, HoekProfiel profiel, ExtraMeters accentInfo) { var nRegel = new NabewerkingUiRegel { Meters = accentInfo != null ? accentInfo.Meters : scpp.TotaalMeters, Eenheid = GetEenheid(profiel.LinkedSubCat), InfoText = profiel.Omschrijving.Split('€')[0], IsBasis = accentInfo == null, SubCat = accentInfo != null ? accentInfo.LinkedSubCat : scpp.SubCatNR }; UiRegelCollection.Add(nRegel); }
public void InitHoek(HoekProfiel h) { hoekprofiel = h; productNR.Text = hoekprofiel.Omschrijving; productKleur.Text = ""; // hoekprofiel.Kleur.TrimStart(' '); /*string path = "default image"; * if (hoekprofiel.ProfielImg != null) * { * path = "https://mybouwapp.nl/Images/ProductImgStorage/" + hoekprofiel.ProfielImg; * LoadImageHoek(new Uri(path, UriKind.Absolute)); * }*/ }
int IComparer <T> .Compare(T a, T b) { OptieKeuze opta = a as OptieKeuze; OptieKeuze optb = b as OptieKeuze; Classes.SubCatPerPakket scppA = a as Classes.SubCatPerPakket; Classes.SubCatPerPakket scppB = b as Classes.SubCatPerPakket; Product prodA = a as Product; Product prodB = b as Product; BouwnummerItem bnrA = a as BouwnummerItem; BouwnummerItem bnrB = b as BouwnummerItem; HoekProfiel hoekA = a as HoekProfiel; HoekProfiel hoekB = b as HoekProfiel; PakketKeuze pakA = a as PakketKeuze; PakketKeuze pakB = b as PakketKeuze; Bouwnummers BnrsA = a as Bouwnummers; Bouwnummers BnrsB = b as Bouwnummers; if (opta != null && optb != null) { var ctx = Acumulator.Instance().ctx; var rdVolgA = (from rd in ctx.RuimteDelens where rd.R_ID == opta.OptieID select rd.volgorde).FirstOrDefault(); var rdVolgB = (from rd in ctx.RuimteDelens where rd.R_ID == optb.OptieID select rd.volgorde).FirstOrDefault(); if (rdVolgA != null && rdVolgB != null) { int ia = (int)rdVolgA; var ib = (int)rdVolgB; if (ia > ib) { return(1); } if (ia < ib) { return(-1); } else { return(0); } } else { var maxmeters = (from spr in ctx.SubCatPerRuimteDeels where spr.R_NR == opta.OptieID && spr.SCB_NR != "SCB4" select new KeyValuePair <string, double>(spr.SCB_NR, (double)spr.meters)).ToList(); var max = 0.0; var scbA = ""; foreach (var x in maxmeters) { var getal = Math.Abs(x.Value); if (getal > max) { max = getal; scbA = x.Key; } } /*var subcpnrA = (from spr in ctx.SubCatPerRuimteDeels * where spr.R_NR == opta.OptieID * select spr.SCB_NR).FirstOrDefault();*/ int volgnrA; if (scbA != null) { volgnrA = (int)(from sc in ctx.SubCats where sc.SCB_ID == scbA select sc.volgorde).FirstOrDefault(); } else { volgnrA = 9999; } var maxmetersB = (from spr in ctx.SubCatPerRuimteDeels where spr.R_NR == opta.OptieID && spr.SCB_NR != "SCB4" select new KeyValuePair <string, double>(spr.SCB_NR, (double)spr.meters)).ToList(); var maxB = 0.0; var scbB = ""; foreach (var x in maxmetersB) { var getal = Math.Abs(x.Value); if (getal > maxB) { maxB = getal; scbB = x.Key; } } /*var subcpnrB = (from spr in ctx.SubCatPerRuimteDeels * where spr.R_NR == optb.OptieID * select spr.SCB_NR).FirstOrDefault();*/ int volgnrB; if (scbB != null) { volgnrB = (int)(from sc in ctx.SubCats where sc.SCB_ID == scbB select sc.volgorde).FirstOrDefault(); } else { volgnrB = 9999; } int ia = volgnrA; var ib = volgnrB; if (ia > ib) { return(1); } if (ia < ib) { return(-1); } else { return(0); } } } else if (scppA != null && scppB != null) { if (scppA != null && scppB != null) { var ctx = Acumulator.Instance().ctx; var subcnrA = (from sc in ctx.SubCats where sc.SCB_ID == scppA.SubCatNR select sc.volgorde).FirstOrDefault(); int volgA = (int)subcnrA; var subcnrB = (from sc in ctx.SubCats where sc.SCB_ID == scppB.SubCatNR select sc.volgorde).FirstOrDefault(); int volgB = (int)subcnrB; if (volgA > volgB) { return(1); } if (volgA < volgB) { return(-1); } else { return(0); } } else { return(0); } } else if (prodA != null && prodB != null) { int maatA = prodA.Lengte + prodA.Breedte; int maatB = prodB.Lengte + prodB.Breedte; int volgA = prodA.kleurVolgorde; int volgB = prodB.kleurVolgorde; if (maatA > maatB) { return(1); } if (maatA < maatB) { return(-1); } else { if (volgA > volgB) { return(1); } if (volgA < volgB) { return(-1); } else { return(0); } } } else if (bnrA != null && bnrB != null) { int ia = int.Parse(bnrA.B_ID.TrimStart('B')); int ib = int.Parse(bnrB.B_ID.TrimStart('B')); if (ia > ib) { return(1); } if (ia < ib) { return(-1); } else { return(0); } } else if (hoekA != null && hoekB != null) { int volgA = hoekA.KleurVolgorde; int volgB = hoekB.KleurVolgorde; if (hoekA.ProfielType == hoekB.ProfielType) { if (volgA > volgB) { return(1); } if (volgA < volgB) { return(-1); } else { return(0); } } else if (hoekA.ProfielType == "Recht") { return(-1); } else { return(1); } } else if (BnrsA != null && BnrsB != null) { var ia = int.Parse(BnrsA.B_ID.TrimStart('B')); var ib = int.Parse(BnrsB.B_ID.TrimStart('B')); if (ia > ib) { return(1); } if (ia < ib) { return(-1); } else { return(0); } } else if (pakA != null && pakB != null) { var ctx = Acumulator.Instance().ctx; var pgo_a = (from pgo in ctx.PakketGroepOpbouws join br in ctx.Bron_Ruimtes on pgo.PG_NR equals br.PG_NR where br.R_NR == Acumulator.Instance().BB.HuidigRuimte.RuimteID&& pgo.P_NR == pakA.Pakket_ID select pgo.PGO_ID).FirstOrDefault(); var pgo_b = (from pgo in ctx.PakketGroepOpbouws join br in ctx.Bron_Ruimtes on pgo.PG_NR equals br.PG_NR where br.R_NR == Acumulator.Instance().BB.HuidigRuimte.RuimteID&& pgo.P_NR == pakB.Pakket_ID select pgo.PGO_ID).FirstOrDefault(); var SA = pgo_a.Split('O'); var IA = int.Parse(SA[1]); var SB = pgo_b.Split('O'); var IB = int.Parse(SB[1]); if (IA > IB) { return(1); } else if (IA < IB) { return(-1); } else { return(0); } } else { return(0); } }
public static AdvancedTegelSubCatInfo GetNewAccentModel(SubCatPerPakket subc, HoekProfiel gekozenProfiel, double totaalMeters) { // var ctx = Acumulator.Instance().ctx; var data = new AdvancedTegelSubCatInfo(); data.TotaalMeters = totaalMeters; var HC = (from cc in ctx.Categorieëns where cc.C_ID == subc.CategorieNR select cc.HC_NR).FirstOrDefault(); if (subc.SubCatNR == "SCB3" || subc.SubCatNR == "SCB10" || subc.SubCatNR == "SCB12") { HC = "HC3"; } data.HCNR = HC; data.SubCatNR = subc.SubCatNR; var sctitle = (from c in ctx.HoofdCategorieëns where c.HC_ID == HC select c.Omschrijving).FirstOrDefault().ToString(); data.SubCatTitle = sctitle; var prodCheck = (from vapp in ctx.VrijAccentProductInfos where vapp.PD_NR == gekozenProfiel.ProfielID && vapp.HC_NR == HC select vapp).FirstOrDefault(); if (prodCheck != null) { var ppm = (from acprod in ctx.VrijAccentProductInfos where acprod.PD_NR == gekozenProfiel.ProfielID && acprod.HC_NR == HC select(from or in acprod.AccentSetOpbouw where or.VrijAccentRegel_NR == or.VrijAccentProductInfo.VAPP_ID select or.Prijs).FirstOrDefault()).FirstOrDefault(); var prodCode = (from p in ctx.Productens where p.PD_ID == gekozenProfiel.ProfielID select p.productcode).FirstOrDefault(); data.BasisTegel = new AdvancedTegelInfo { ImgPath = gekozenProfiel.ProfielImg, TegelOmschrijving = gekozenProfiel.Omschrijving, TegelDetails = prodCode, InwisselPrijs = (double)ppm, PrijsPerMeter = (double)ppm - (double)ppm, InstapPrijs = 0.0, IsGekozen = true, ProductId = gekozenProfiel.ProfielID, Lengte = gekozenProfiel.Lengte, Breedte = gekozenProfiel.Breedte, NSNR = (from acprod in ctx.VrijAccentProductInfos where acprod.PD_NR == gekozenProfiel.ProfielID && acprod.HC_NR == HC select acprod.NS_NR).FirstOrDefault(), ProdSoort = ProductSoort.HoekProfiel }; if (HC == null) { return(null); } if (Acumulator.Instance().BB.HuidigRuimte == null || Acumulator.Instance().BB.HuidigRuimte.GekozenPakket == null) { return(null); } var validpdinf = (from prds in ctx.VrijAccentProductInfos where prds.HC_NR == HC && prds.PD_NR != data.BasisTegel.ProductId select prds); if (validpdinf == null || validpdinf.Count() <= 0) { return(null); } data.TegelInput = validpdinf; var atiList = GetTegelColl(validpdinf, (double)ppm, ProductSoort.HoekProfiel); atiList.Insert(0, data.BasisTegel); // atiList.Reverse(); var eh = (from x in ctx.SubCats where x.SCB_ID == subc.SubCatNR select x.eenheidMETERS).FirstOrDefault().ToString(); data.Regels = new ObservableCollection <AdvancedVervangRegel> { new AdvancedVervangRegel { GekozenTegel = data.BasisTegel, Status = StatusType.Basis, RegelIndex = 0, VervangInfo = new AdvancedVervangActie { Wijzigstand = false, GekozenMeters = data.TotaalMeters, //Opmerking ="Standaard keuze uit pakket", Tegels = atiList }, Eenheid = eh, }, AdvancedVervangRegel.GetNewTegelRegel(GetTegelColl(validpdinf, (double)ppm, ProductSoort.HoekProfiel), 1, eh) }; // return(data); } else { return(null); } }