public void BillMerchant(MerchantFeePayment payment, string id) //id: user identity id, used to find supplierId { var userInfo = UserManager.FindById(id); var profileId = userInfo.UserProfile.Id; var supplier = _merchantServie.FindSupplierBy(profileId); var supplierId = supplier.Id; var supplierEmail = supplier.CompanyIconImgUrl; var newPayment = new MerchantFeePayment(); if (ModelState.IsValid) { try { newPayment.BillingDate = DateTime.Now; newPayment.IsPaid = false; newPayment.MerchantFeeTypeId = 2; newPayment.FeeAmount = payment.FeeAmount; newPayment.SupplierId = supplierId; newPayment.BillingYear = payment.BillingYear; newPayment.BillingMonth = payment.BillingMonth; newPayment.Notes = payment.Notes; _merchantServie.AddBillPayment(newPayment); //Send invoice and email notification // var month = ""; switch (newPayment.BillingMonth) { case "January": month = "1"; break; case "February": month = "2"; break; case "March": month = "3"; break; case "April": month = "4"; break; case "May": month = "5"; break; case "June": month = "6"; break; case "July": month = "7"; break; case "August": month = "8"; break; case "September": month = "9"; break; case "October": month = "10"; break; case "November": month = "11"; break; case "December": month = "12"; break; } var allTransactions = GetTransactionsByVendor(newPayment.SupplierId, month); var emailNotification = new EmailNotification(); string message = this.RenderView("~/Views/Admin/_TransactionSummary.cshtml", allTransactions); emailNotification.SendEmail(supplierEmail, "Merchant Management Fee Bill: " + newPayment.BillingMonth + " " + newPayment.BillingYear, message); } catch (Exception) { throw; } } }
public void AddBillPayment(MerchantFeePayment payment) { _merchanteFeeRepository.Add(payment); }
public void BillMerchant(MerchantFeePayment payment, string id) { var userInfo = UserManager.FindById(id); var profileId = userInfo.UserProfile.Id; var supplier = _merchantServie.FindSupplierBy(profileId); var supplierId =supplier.Id; var supplierEmail = supplier.CompanyIconImgUrl; var newPayment = new MerchantFeePayment(); if (ModelState.IsValid) { try { newPayment.BillingDate = DateTime.Now; newPayment.IsPaid = false; newPayment.MerchantFeeTypeId = 2; newPayment.FeeAmount = payment.FeeAmount; newPayment.SupplierId = supplierId; newPayment.BillingYear = payment.BillingYear; newPayment.BillingMonth = payment.BillingMonth; newPayment.Notes = payment.Notes; _merchantServie.AddBillPayment(newPayment); //Send invoice and email notification // var month = ""; switch ( newPayment.BillingMonth) { case "January": month = "1"; break; case "February": month = "2"; break; case "March": month = "3"; break; case "April": month = "4"; break; case "May": month = "5"; break; case "June": month = "6"; break; case "July": month = "7"; break; case "August": month = "8"; break; case "September": month = "9"; break; case "October": month = "10"; break; case "November": month = "11"; break; case "December": month = "12"; break; } var allTransactions = GetTransactionsByVendor(newPayment.SupplierId, month); var emailNotification = new EmailNotification(); string message = this.RenderView("~/Views/Admin/_TransactionSummary.cshtml", allTransactions); emailNotification.SendEmail(supplierEmail, "Merchant Management Fee Bill: " + newPayment.BillingMonth + " " + newPayment.BillingYear, message); } catch (Exception) { throw; } } }