public JsonResult confirmOrder([System.Web.Http.FromBody] ConfirmOrderPaymentScreenModel data) { OrderBO bo = new OrderBO(); var res = bo.updateOrderPayment(data); return(Json(res)); }
public bool updateOrderPayment(ConfirmOrderPaymentScreenModel data) { try { var order = this.dao.getOrders().Where(m => m.code == data.orderCode).FirstOrDefault(); if (order == null) { return(false); } dao.makeOrderPay(data.orderCode, data.payment.paymentDate); if (order.isShipping == true) { new ShippingBO().addShipping(new Shipping() { address = order.address, createBy = data.userId, createDate = DateTime.Now, email = order.email, firstName = order.firstName, isActive = true, isShipping = false, lastName = order.lastName, orderCode = order.code, printCoverQty = 0, province = order.province, select = false, shippingDate = null, tel = order.tel, trackingCode = "", updateBy = data.userId, updateDate = DateTime.Now, zipCode = order.zipCode }); } return(true); } catch (Exception ex) { JLog.write(LOG_TYPE.ERROR, LOG_POSITION.BO, this, JLog.GetCurrentMethod(), ex); return(false); } }
public List <ConfirmOrderPaymentScreenModel> getOrderForConfirmPayments(List <Order> datas) { try { PaymentNotificationDAO pdao = new PaymentNotificationDAO(); List <ConfirmOrderPaymentScreenModel> results = new List <ConfirmOrderPaymentScreenModel>(); var codes = datas.Select(m => m.code).ToList(); var orders = dao.getOrders().Where(m => codes.Contains(m.code)).ToList(); foreach (var c in codes) { var os = orders.Where(m => m.code == c).ToList(); ConfirmOrderPaymentScreenModel confirmPayment = new ConfirmOrderPaymentScreenModel(); if (confirmPayment == null) { continue; } confirmPayment.orders = os.Select(m => ConvertToScreenModel.Transactions.order(m)).ToList(); confirmPayment.totalPrice = os.Select(m => m.totalPrice).Sum(); confirmPayment.shippingPrice = os.Select(m => m.shippingPrice).Sum(); confirmPayment.productPrice = os.Select(m => m.totalProductPrice).Sum(); confirmPayment.qty = os.Select(m => m.qty).Sum(); confirmPayment.orderCode = c; confirmPayment.payment = ConvertToScreenModel.Transactions.paymentNotification(pdao.getPaymentNotificationFromOrderCode(confirmPayment.orderCode)); results.Add(confirmPayment); } return(results); } catch (Exception ex) { JLog.write(LOG_TYPE.ERROR, LOG_POSITION.BO, this, JLog.GetCurrentMethod(), ex); return(null); } }