internal void Update(EntityQuotation entity) { double result0 = 0.0; Prestations.ForEach(p => result0 = result0 + p.Tarif.Value); result0 *= (1+CoeficientPrestation); Currency result = new Currency(result0); result = result + entity.CoutOperation + entity.CoutComposant*(1+CoeficientComposant) + entity.CoutMatiere * (1+CoeficientMatiere) + (entity.CoutPreparation + entity.CoutMethodes + entity.FAD + entity.Outillage) / Quantite; PuBrut = result; }
public async Task TestQuotationWithEntitiesAndDecoupeLaser() { var pcp = container.Get<IEntityProvider<PosteCharge, int>>(); var vdlp= container.Get<IEntityProvider<VitesseDecoupeLaser, string>>(); var mpp = container.Get<IEntityProvider<MaterialPrice, string>>(); var mp = container.Get<IEntityProvider<Material, string>>(); var q = new Quotation() { Numero = 1234 }; var e = new EntityQuotation(q) { Reference = "reftest", Designation = "refdesi" }; e.Outillage = 50 * Currency.Euro; var op1 = new Operation(e) { Poste = pcp.Find(300), Nombre = 2 }; Debug.WriteLine(op1); var op2 = new Operation(e) { Poste = pcp.Find(101), Nombre = 5 }; Debug.WriteLine(op2); var op3 = new Operation(e) { Poste = pcp.Find(215), Nombre = 1 }; var decoupe = new OperationLaser(op3) { Epaisseur = 1, Gaz = GazDecoupe.Oxygene, Longueur = 600 * Length.Millimetre, NombreAmorcage = 3, NombrePetitDiametre = 2 ,SqueletteX=20*Length.Millimetre,SqueletteY=20*Length.Millimetre,Pince=0*Length.Millimetre}; decoupe.FormatPiece = new Format() { Longueur = 200 * Length.Millimetre, Largeur = 100 * Length.Millimetre, Epaisseur = 1 * Length.Millimetre,/* Matiere = mp.Find("1.0035")*/ }; decoupe.FormatTole = new Format() { Longueur = 222 * Length.Millimetre, Largeur = 125 * Length.Millimetre, Epaisseur = 1 * Length.Millimetre,/* Matiere = mp.Find("1.0035"),PrixMatiere=mpp.Find("1.0035")*/ }; decoupe.Laser = vdlp.Find(215, MaterialGroup.P, 1, GazDecoupe.Oxygene); Debug.WriteLine(op3); Tarif tarif1=new Tarif(e) { Quantite = 1, CoeficientVente = 0.4 }; tarif1.Prestations.Add(new TarifPrestation() {Estime=true,Prestation="Epoxy",Tarif=Currency.Euro*80 }); new Tarif(e) { Quantite = 5, CoeficientVente = 0.35 }; new Tarif(e) { Quantite = 10, CoeficientVente = 0.30 }; new Tarif(e) { Quantite = 20, CoeficientVente = 0.20 }; new Tarif(e) { Quantite = 50, CoeficientVente = 0.20 }; new Tarif(e) { Quantite = 100, CoeficientVente = 0.20 }; Debug.WriteLine(e); var ctrl = container.Get<IEntityController<Quotation>>(); var result = await ctrl.Post(q); result.Throw(); var q1 = await ctrl.Get(q.Id); Assert.AreEqual(q.Numero, q1.Numero); Debug.WriteLine(q1.Entities[0]); }
public Tarif(EntityQuotation entity): this() { entity.Tarifs.Add(this); }
public async Task TestQuotationWithEntities() { var pcp = container.Get<IEntityProvider<PosteCharge, int>>(); var q = new Quotation() { Numero = 1234 }; var e = new EntityQuotation(q) { Reference = "reftest", Designation = "refdesi", }; var op1 = new Operation(e) {Poste=pcp.Find(300),Nombre=2 }; Debug.WriteLine(op1); var op2 = new Operation(e) { Poste =pcp.Find(101), Nombre = 5 }; Debug.WriteLine(op2); new Tarif(e) { Quantite = 1,CoeficientVente=0.4 }; new Tarif(e) { Quantite = 5, CoeficientVente = 0.35 }; new Tarif(e) { Quantite = 10, CoeficientVente = 0.30 }; new Tarif(e) { Quantite = 20, CoeficientVente = 0.20}; new Tarif(e) { Quantite = 50, CoeficientVente = 0.20}; new Tarif(e) { Quantite = 100, CoeficientVente = 0.20 }; Debug.WriteLine(e); var ctrl = container.Get<IEntityController<Quotation>>(); var result = await ctrl.Post(q); result.Throw(); var q1 = await ctrl.Get(q.Id); Assert.AreEqual(q.Numero, q1.Numero); }