public static PaymentViewModel Create(EnumPaymentType paymentType, ITPaymentRepository tPaymentRepository, ITPaymentDetRepository tPaymentDetRepository) { PaymentViewModel viewModel = new PaymentViewModel(); TPayment p = new TPayment(); p.SetAssignedIdTo(Guid.NewGuid().ToString()); p.PaymentDate = DateTime.Today; p.PaymentDesc = string.Empty; p.PaymentType = paymentType.ToString(); viewModel.Payment = p; viewModel.Title = string.Format("Pembayaran {0}", paymentType.ToString()); //get label text switch (paymentType) { case EnumPaymentType.Piutang: viewModel.CashAccountLabel = "Deposit ke : "; break; case EnumPaymentType.Hutang: viewModel.CashAccountLabel = "Deposit dari : "; break; } return(viewModel); }
public ActionResult Index(EnumPaymentType paymentType, PaymentViewModel viewModel, TPayment paymentVM, FormCollection formCollection) { if (formCollection["btnSave"] != null) { return(SavePayment(paymentType, paymentVM, formCollection, false)); } else if (formCollection["btnDelete"] != null) { return(SavePayment(paymentType, paymentVM, formCollection, true)); } return(View()); }
public static PaymentViewModel Create(EnumPaymentType paymentType, ITPaymentRepository tPaymentRepository, ITPaymentDetRepository tPaymentDetRepository, IMSupplierRepository mSupplierRepository, IMCustomerRepository mCustomerRepository, IMCostCenterRepository mCostCenterRepository) { PaymentViewModel viewModel = new PaymentViewModel(); TPayment p = new TPayment(); p.SetAssignedIdTo(Guid.NewGuid().ToString()); p.PaymentDate = DateTime.Today; p.PaymentDesc = string.Empty; p.PaymentType = paymentType.ToString(); viewModel.Payment = p; viewModel.Title = string.Format("Pembayaran {0}", paymentType.ToString()); IList <MCostCenter> list = mCostCenterRepository.GetAll(); MCostCenter costCenter = new MCostCenter(); costCenter.CostCenterName = "-Pilih Cost Center-"; list.Insert(0, costCenter); viewModel.CostCenterList = new SelectList(list, "Id", "CostCenterName"); //get label text switch (paymentType) { case EnumPaymentType.Piutang: viewModel.CashAccountLabel = "Deposit ke : "; //fill cust var values = from MCustomer cust in mCustomerRepository.GetAll() select new { Id = cust.Id, Name = cust.PersonId != null ? cust.PersonId.PersonName : "-Pilih Konsumen-" }; viewModel.TransByList = new SelectList(values, "Id", "Name"); break; case EnumPaymentType.Hutang: viewModel.CashAccountLabel = "Deposit dari : "; IList <MSupplier> listAcc = mSupplierRepository.GetAll(); MSupplier supplier = new MSupplier(); supplier.SupplierName = "-Pilih Supplier-"; listAcc.Insert(0, supplier); viewModel.TransByList = new SelectList(listAcc, "Id", "SupplierName"); break; } return(viewModel); }
public static TransactionPayment AddTransactionPayment(this Transaction currentTransaction, EnumPaymentType paymentType, decimal amount, DateTime timeStamp, DateTime datePaid, string notes) { TransactionPayment newTransactionPayment = new TransactionPayment(); newTransactionPayment.GUID = Guid.NewGuid().ToString(); newTransactionPayment.TransactionID = currentTransaction.TransactionID; newTransactionPayment.PaymentType = paymentType.ToString(); newTransactionPayment.Amount = amount; newTransactionPayment.TimeStamp = timeStamp; newTransactionPayment.DatePaid = datePaid; newTransactionPayment.Notes = notes; newTransactionPayment.Transaction = currentTransaction; return(newTransactionPayment); }
public void SetParameters(string hotelId, string roomTypeId, int rpId, DateTime cin, DateTime cout, decimal totalPrice, EnumGuestTypeCode guestType, EnumCurrencyCode currency, EnumPaymentType paymentType, int numOfRooms) { this.hotelId = hotelId; this.roomTypeId = roomTypeId; this.rpId = rpId; this.cin = cin; this.cout = cout; this.totalPrice = totalPrice; this.guestType = guestType; this.currency = currency; this.paymentType = paymentType; this.numOfRooms = numOfRooms; _isInited = true; }
private ActionResult SavePayment(EnumPaymentType paymentType, TPayment paymentVM, FormCollection formCollection, bool isDelete) { string Message = string.Empty; bool Success = true; try { _tPaymentRepository.DbContext.BeginTransaction(); //check first TPayment payment = _tPaymentRepository.Get(formCollection["Id"]); if (!isDelete) { bool isEdit = false; if (payment == null) { isEdit = false; //if payment = new TPayment(); payment.SetAssignedIdTo(Guid.NewGuid().ToString()); payment.CreatedDate = DateTime.Now; payment.CreatedBy = User.Identity.Name; payment.DataStatus = Enums.EnumDataStatus.New.ToString(); } else { isEdit = true; payment.ModifiedDate = DateTime.Now; payment.ModifiedBy = User.Identity.Name; payment.DataStatus = Enums.EnumDataStatus.Updated.ToString(); } payment.PaymentDate = paymentVM.PaymentDate; payment.PaymentDesc = paymentVM.PaymentDesc; payment.PaymentStatus = paymentVM.PaymentStatus; payment.PaymentType = paymentType.ToString(); SavePayment(payment, formCollection, isEdit); } else { //if (tr != null) //{ // //do delete // DeleteTransaction(tr, addStock, calculateStock); //} } _tPaymentRepository.DbContext.CommitTransaction(); TempData[EnumCommonViewData.SaveState.ToString()] = EnumSaveState.Success; if (!isDelete) { Message = "Data berhasil disimpan."; } else { Message = "Data berhasil dihapus."; } } catch (Exception ex) { Success = false; if (!isDelete) { Message = "Data gagal disimpan."; } else { Message = "Data gagal dihapus."; } Message += "Error : " + ex.GetBaseException().Message; _tPaymentRepository.DbContext.RollbackTransaction(); TempData[EnumCommonViewData.SaveState.ToString()] = EnumSaveState.Failed; } var e = new { Success, Message }; return(Json(e, JsonRequestBehavior.AllowGet)); }
public ActionResult Index(EnumPaymentType paymentType) { PaymentViewModel viewModel = PaymentViewModel.Create(paymentType, _tPaymentRepository, _tPaymentDetRepository); return(View(viewModel)); }
protected void Page_Load(object sender, EventArgs e) { this.isOfflineOrder = (base.Request.QueryString["isOffline"].ToNullString().ToLower() == "true"); bool flag = false; bool flag2 = false; string text = HttpContext.Current.Request.UserAgent; if (string.IsNullOrEmpty(text)) { text = ""; } bool flag3 = false; if (text.ToLower().IndexOf("micromessenger") > -1) { flag3 = true; } SiteSettings siteSettings = HiContext.Current.SiteSettings; if (!string.IsNullOrEmpty(siteSettings.WeixinAppId) && !string.IsNullOrEmpty(siteSettings.WeixinAppSecret) && !string.IsNullOrEmpty(siteSettings.WeixinPartnerID) && !string.IsNullOrEmpty(siteSettings.WeixinPartnerKey)) { this.hasWxPayRight.Value = "1"; flag = true; } else { this.hasWxPayRight.Value = "0"; } PaymentModeInfo paymentMode = ShoppingProcessor.GetPaymentMode("hishop.plugins.payment.ws_wappay.wswappayrequest"); if (paymentMode != null) { this.hasAliPayRight.Value = "1"; flag2 = true; } else { this.hasAliPayRight.Value = "0"; } this.sessionId = this.Page.Request["SessionId"].ToNullString(); if (!string.IsNullOrEmpty(this.sessionId)) { this.inputPanel.Visible = true; } else { this.inputPanel.Visible = false; } if (!this.isOfflineOrder) { OrderInfo orderInfo = OrderHelper.GetOrderInfo(base.Request.QueryString["OrderId"].ToNullString()); if (orderInfo == null) { this.hidErrMsg.Value = "错误的订单ID"; } else if (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay) { this.hidErrMsg.Value = "错误的订单状态"; } else { EnumPaymentType enumPaymentType = flag3 ? EnumPaymentType.WXPay : EnumPaymentType.WapAliPay; this.offlineOrder = StoresHelper.GetStoreCollectionInfo(this.OrderId); if (this.offlineOrder == null) { StoreCollectionInfo storeCollectionInfo = new StoreCollectionInfo(); storeCollectionInfo.CreateTime = orderInfo.OrderDate; storeCollectionInfo.FinishTime = DateTime.Now; storeCollectionInfo.PayTime = DateTime.Now; storeCollectionInfo.PaymentTypeId = (int)enumPaymentType; storeCollectionInfo.PaymentTypeName = EnumDescription.GetEnumDescription((Enum)(object)enumPaymentType, 0); storeCollectionInfo.GateWay = EnumDescription.GetEnumDescription((Enum)(object)enumPaymentType, 1); storeCollectionInfo.OrderId = orderInfo.OrderId; storeCollectionInfo.OrderType = 1; storeCollectionInfo.PayAmount = orderInfo.GetTotal(false); storeCollectionInfo.RefundAmount = decimal.Zero; storeCollectionInfo.Remark = "上门自提订单确认提货:" + orderInfo.OrderId; storeCollectionInfo.SerialNumber = Globals.GetGenerateId(); storeCollectionInfo.Status = 0; storeCollectionInfo.StoreId = orderInfo.StoreId; storeCollectionInfo.UserId = orderInfo.UserId; StoresHelper.AddStoreCollectionInfo(storeCollectionInfo); } else { this.offlineOrder.PaymentTypeId = (int)enumPaymentType; this.offlineOrder.PaymentTypeName = EnumDescription.GetEnumDescription((Enum)(object)enumPaymentType, 0); this.offlineOrder.GateWay = EnumDescription.GetEnumDescription((Enum)(object)enumPaymentType, 1); StoresHelper.UpdateStoreCollectionInfo(this.offlineOrder); } } } if (flag3) { if (flag && !this.inputPanel.Visible) { base.Response.Redirect("/Vshop/StoreOrderPay?OrderId=" + base.Request.QueryString["OrderId"].ToNullString() + "&IsOffline=" + base.Request.QueryString["isOffline"].ToNullString()); } } else if (flag2 && !this.inputPanel.Visible) { base.Response.Redirect("/WapShop/StoreOrderPay?OrderId=" + base.Request.QueryString["OrderId"].ToNullString() + "&IsOffline=" + base.Request.QueryString["isOffline"].ToNullString()); } }
protected void Page_Load(object sender, EventArgs e) { this.param = new NameValueCollection { base.Request.QueryString, base.Request.Form }; SiteSettings masterSettings = SettingsManager.GetMasterSettings(); NotifyClient notifyClient = null; notifyClient = ((string.IsNullOrEmpty(masterSettings.Main_Mch_ID) || string.IsNullOrEmpty(masterSettings.Main_AppId)) ? new NotifyClient(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, masterSettings.WeixinPartnerID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey, "", "") : new NotifyClient(masterSettings.Main_AppId, masterSettings.WeixinAppSecret, masterSettings.Main_Mch_ID, masterSettings.WeixinPartnerKey, masterSettings.WeixinPaySignKey, masterSettings.WeixinAppId, masterSettings.WeixinPartnerID)); NameValueCollection nameValueCollection = new NameValueCollection { base.Request.QueryString, base.Request.Form }; string sign = ""; PayNotify payNotify = notifyClient.GetPayNotify(base.Request.InputStream); if (payNotify == null) { Globals.AppendLog(this.param, "通知信息为空", sign, "", "AppStore_wxPay"); } else { this.OrderId = payNotify.PayInfo.OutTradeNo; this.Order = ShoppingProcessor.GetOrderInfo(this.OrderId); this.offlineOrder = StoresHelper.GetStoreCollectionInfo(this.OrderId); if (this.Order == null) { this.Order = ShoppingProcessor.GetOrderInfo(payNotify.PayInfo.OutTradeNo); } if (this.offlineOrder == null) { this.offlineOrder = StoresHelper.GetStoreCollectionInfo(payNotify.PayInfo.OutTradeNo); } if (this.Order == null && this.offlineOrder == null) { Globals.AppendLog(this.param, "订单信息为空", sign, "", "AppStore_wxPay"); base.Response.Write("success"); } else { EnumPaymentType enumPaymentType = EnumPaymentType.WXPay; if (this.Order == null) { this.isOfflineOrder = true; } else { this.Order.PaymentTypeId = (int)enumPaymentType; this.Order.PaymentType = EnumDescription.GetEnumDescription((Enum)(object)enumPaymentType, 0); this.Order.Gateway = EnumDescription.GetEnumDescription((Enum)(object)enumPaymentType, 1); this.Order.GatewayOrderId = payNotify.PayInfo.TransactionId; if (this.offlineOrder == null) { this.offlineOrder = StoresHelper.GetStoreCollectionInfoOfOrderId(this.Order.OrderId); } } if (this.offlineOrder != null) { this.offlineOrder.GateWayOrderId = payNotify.PayInfo.TransactionId; this.offlineOrder.PaymentTypeId = (int)enumPaymentType; this.offlineOrder.PaymentTypeName = EnumDescription.GetEnumDescription((Enum)(object)enumPaymentType, 0); this.offlineOrder.GateWay = EnumDescription.GetEnumDescription((Enum)(object)enumPaymentType, 1); } this.UserPayOrder(); base.Response.Write("success"); } } }
public static string GetPaymentGateway(EnumPaymentType paytype) { return(EnumDescription.GetEnumDescription((Enum)(object)paytype, 1)); }