public void validateCommande(Command cmd) { //validate command iscomfirmed =true and substract the qte of the command from the productS IserviceProduct spp = new serviceProduct(); Command _cmd = this.GetById(cmd.idcmd); Product prod = spp.GetById(_cmd.idprod); _cmd.dateliv = cmd.dateliv; _cmd.isComfirmed = true; this.Update(_cmd); this.Commit(); prod.qteprod = prod.qteprod - cmd.qteprod; spp.Update(prod); spp.Commit(); }
public void validateCommande(int id, DateTime datee) { //validate command iscomfirmed =true and substract the qte of the command from the productS Command _cmd = new Command(); _cmd = this.Get(x => x.idcmd == id); _cmd.dateliv = datee; _cmd.isComfirmed = true; this.Update(_cmd); this.Commit(); IserviceProduct spp = new serviceProduct(); Product prod = spp.Get(x => x.idprod == _cmd.idprod); prod.qteprod = prod.qteprod - _cmd.qteprod; spp.Update(prod); spp.Commit(); IserviceMail sm = new serviceMail(); sm.sendMail(_cmd.email, "order from ri9 Tounsi have been reviewed", "your order have been reviewed and it will be delievered " + datee.ToShortDateString() + "<br>We will call you as soon as possible"); }