internal static IList <PAYMENT> FindPaymentsByTransacId(string numTransaction) { using (IDalPayment dal = new DalPayment()) { int tr = int.Parse(numTransaction); var test = dal.GetAllPaymentsByTransacId(tr); foreach (var item in test) { string test2 = PaymentBL.FindMethodNameById(item.paymentMethodId); item.PAYMENT_METHOD.method = test2; } return(dal.GetAllPaymentsByTransacId(tr)); } }
internal static TrTicketViewModel FillTicket(string numTransaction, string language, bool?isChange) { using (IDalTransaction dal = new DalTransaction()) { //find transac var transac = TransactionBL.FindTransactionById(numTransaction); //create ticket TrTicketViewModel vm = new TrTicketViewModel(); int lang; if (int.TryParse(language, out int codeL)) { lang = codeL; } else { lang = LanguageBL.FindIdLanguageByShortForm(language); } vm.Language = lang.ToString(); //if rprint search dateTicket DateTime d = new DateTime(2000, 1, 1, 0, 0, 0); int dCompare = DateTime.Compare(transac.transactionDateEnd, d); if (dCompare == 0) { vm.DateTicket = (DateTime.Now).ToString(); } else { vm.DateTicket = transac.transactionDateEnd.ToString(); } //n° transac vm.Transaction = numTransaction; //shop informations vm.Shop = ShopBL.FindShopById(transac.shopId, lang); //detail transaction var listDetails = TransactionBL.ListDetailsWithTot(numTransaction); vm.DetailsListWithTot = TranslationBL.TranslateDetailList(listDetails, lang); //discount or not if (transac.discountGlobal == null) { vm.DiscountG = " - "; } else { var temp = (transac.discountGlobal * 100).ToString(); var tempsplit = temp.Split(','); var discount = tempsplit[0] + "%"; vm.DiscountG = discount; } ////VAT //to do --> provisoire vatId = 2 --> 21% int tva = 2; vm.VatG = VatBL.FindVatValById(tva); //Total transaction vm.TotalG = (transac.total).ToString(); //payment method & amount vm.Payments = PaymentBL.FindPaymentsByTransacId(numTransaction); ////message var messages = FindTicketMessageById(transac.idTransaction, lang, isChange); vm.Messages = messages; return(vm); } }