public bool UpdateOrder(string transaction_info, string order_code, string payment_id, string payment_type, string secure_code) { OrderModels orderModels = new OrderModels(); ////Get Invoice by Order_code C_Invoices invoice = orderModels.GetInvoicesbyOrderCode(order_code); ////Create Payment C_Payment payment = new C_Payment(); string secure_code_ws = this.GetMD5Hash(transaction_info + " " + order_code + " " + payment_id + " " + payment_type + " " + this.securepass); if (secure_code == secure_code_ws) { payment.Amount = 0; payment.CreateDate = DateTime.Now; payment.InvoiceID = invoice.id; payment.Payment_type = int.Parse(payment_type); //// 1 - Thanh toán bằng số dư TK NgânLượng.vn; 2 – Thanh toán bằng tiền mặt hoặc qua NH payment.TranscactionStatus = string.Empty; ////1 – Giao dịch mới tạo, chưa thanh toán; ////2 – Đã thanh toán, đang bị tạm giữ; ////3 – Giao dịch bị huỷ/hoàn trả; ////4 – Giao dịch hoàn thành, tiền đã chuyển vào tài khoản NganLuong.vn của người nhận (trường hợp thanh toán ngay hoặc thanh toán tạm giữ nhưng người mua đã phê chuẩn) payment.TransactionInfor = CommonGlobal.PaygateNganLuong + " - call services auto update - please check page NganluongResult - payment status undifined"; payment.PaymentMenthod = string.Empty; ////1 – Thanh toán ngay, 2 – Thanh toán tạm giữ payment.Customer_name = string.Empty; payment.Customer_email = string.Empty; payment.Customer_phone = string.Empty; orderModels.Add_Payment(payment); var orders = orderModels.GetOrdersbyCode(order_code); orders.Payment = CommonGlobal.PaymentFull.ToString(); orders.LName = CommonGlobal.PaygateNganLuong; orderModels.Edit_Orders(orders); return(true); } else { ////Payment fail no create invoice and payment var orders = orderModels.GetOrdersbyCode(order_code); orders.Payment = CommonGlobal.PaymentFail.ToString(); orders.LName = CommonGlobal.PaygateNganLuong; orderModels.Edit_Orders(orders); return(false); } }
/// <summary> /// Orders the view. /// </summary> /// <param name="fcode">The order code.</param> /// <returns>Order view</returns> public ActionResult Order_view(string fcode) { if (!this.CheckMemberlogin()) { return(this.RedirectToAction("login", "account", new { return_url = string.Empty + Url.Action("order_view", "account", new { fcode = fcode }) })); } else { var order_view = new Order_register_view(); string strBread; ViewBag.Title = App_GlobalResources.Lang.strOrderCode + " " + fcode; strBread = string.Format("<li><a href=\"" + Url.Action("my_account", "account") + "\">" + App_GlobalResources.Lang.strPersonalInformation + "</a></li>"); strBread = string.Format("<li><a href=\"" + Url.Action("order_history", "account") + "\">" + App_GlobalResources.Lang.strOrderHistory + "</a></li>"); strBread += "<li>" + fcode + "</li>"; ViewBag.heading = App_GlobalResources.Lang.strOrderCode + " " + fcode; ViewBag.str_breadcrumbs = strBread; this.AddMeta(CommonGlobal.Keyword, App_GlobalResources.Lang.strOrderCode + " " + fcode); this.AddMeta(CommonGlobal.Description, App_GlobalResources.Lang.strOrderCode + " " + fcode); DetailOrderModels detailsv = new DetailOrderModels(); OrderModels orderModels = new OrderModels(); if (string.IsNullOrEmpty(fcode)) { return(this.HttpNotFound()); } C_User usr = new C_User(); order_view.Parent_action = HttpContext.Request.RequestContext.RouteData.Values["action"].ToString(); order_view.Parent_controller = HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString(); order_view.ContentShipping = GeneralModels.GetContent(CommonGlobal.ContentShipping, this.Lang); UserModels sv = new UserModels(); usr = sv.GetUserbyUserName(Session["mem"].ToString()); var orders = orderModels.GetOrdersbyCode(fcode, usr.Username); if (orders == null) { order_view.Message = App_GlobalResources.Lang.messOrderNotFound; return(this.PartialView("../page/order_view", order_view)); } order_view.Message = string.Empty; order_view.Email = orders.Email; order_view.Name = orders.Name; order_view.Phone = orders.Phone; order_view.Address = orders.Address; order_view.Gender = orders.Gender; order_view.Sub_total = CommonGlobal.FormatMoney(orders.Total); order_view.Content = orders.Note; order_view.Order_code = fcode; order_view.Payment_status_text = CommonGlobal.GetPaymentStatusString(int.Parse(orders.Payment ?? "0")); order_view.Process_status_text = CommonGlobal.GetOrderStatusString(orders.Process ?? 0); var list_order_detail = detailsv.GetAllOrderDetail(fcode); if (list_order_detail.Count > 0) { order_view.ShoppingCart = new ArrayList(list_order_detail.ToArray()); } return(this.PartialView("../page/order_view", order_view)); } }