//This method is reponsible to create a paymentBill with the transaction ID and status completed == false public void createPaymentBill(PaymentInfo info, string transactionID) { try { using (conferenceadminContext context = new conferenceadminContext()) { double quantity = info.amount * 100; paymentbill bill = new paymentbill(); bill.AmountPaid = info.amount; bill.paymentID = info.paymentID; bill.completed = false; bill.transactionid = transactionID; bill.quantity = (int)quantity; bill.deleted = false; bill.date = DateTime.Now; bill.telephone = info.phone; context.paymentbills.Add(bill); context.SaveChanges(); } } catch (Exception ex) { Console.Write("PaymentManager.makePayment error " + ex); } }
public SponsorQuery addSponsor(SponsorQuery x) { try { using (conferenceadminContext context = new conferenceadminContext()) { address address = new address(); address.city = x.city; address.country = x.country; address.state = x.state; address.zipcode = x.zipcode; address.line1 = x.line1; address.line2 = x.line2; context.addresses.Add(address); context.SaveChanges(); user user = new user(); user.membershipID = 1; user.firstName = x.firstName; user.lastName = x.lastName; user.userFax = x.userFax; user.phone = x.phone; user.addressID = address.addressID; user.affiliationName = x.company; user.userTypeID = 7; user.deleted = false; context.users.Add(user); context.SaveChanges(); payment payment2 = new payment(); payment2.paymentTypeID = 1; payment2.deleted = false; payment2.creationDate = DateTime.Now; context.payments.Add(payment2); context.SaveChanges(); paymentbill bill = new paymentbill(); bill.AmountPaid = (double)x.amount; bill.paymentID = payment2.paymentID; bill.methodOfPayment = x.method; bill.transactionid = x.transactionID; bill.completed = true; bill.quantity = (int)(x.amount * 100); bill.deleted = false; bill.date = DateTime.Now; context.paymentbills.Add(bill); context.SaveChanges(); sponsor2 sponsor = new sponsor2(); sponsor.userID = user.userID; sponsor.emailInfo = x.email; sponsor.logo = x.logo; sponsor.sponsorType = x.sponsorType; sponsor.totalAmount = x.amount; sponsor.deleted = false; sponsor.byAdmin = true; sponsor.active = true; sponsor.paymentID = payment2.paymentID; context.sponsor2.Add(sponsor); context.SaveChanges(); x.sponsorID = sponsor.sponsorID; x.addressID = address.addressID; x.byAdmin = true; return x; } } catch (Exception ex) { Console.Write("AdminManager.addSponsor error " + ex); return null; } }
public bool makePaymentFree(UserInfo user) { try { using (conferenceadminContext context = new conferenceadminContext()) { payment payment = new payment { paymentTypeID = 1, deleted = false, creationDate = DateTime.Now.Date }; context.payments.Add(payment); context.SaveChanges(); registration registration = new registration { userID = user.userID, paymentID = payment.paymentID, date1 = user.date1, date2 = user.date2, date3 = user.date3, byAdmin = false, deleted = false, note = user.notes }; user saveUser = context.users.Where(u => u.userID == user.userID).FirstOrDefault(); saveUser.registrationStatus = "Accepted"; paymentbill bill = new paymentbill { paymentID = payment.paymentID, addressID = saveUser.addressID, deleted = false, AmountPaid = (double)saveUser.usertype.registrationCost, transactionid = "N/A", methodOfPayment = "N/A", tandemID ="N/A", batchID ="N/A", completed=true, date =DateTime.Now, firstName=saveUser.firstName, lastName=saveUser.lastName, email=saveUser.membership.email, telephone =saveUser.phone, }; context.registrations.Add(registration); context.paymentbills.Add(bill); context.SaveChanges(); return true; } } catch (Exception ex) { Console.Write("ProfileAuthorizationManager.MakePaymentFree error " + ex); return false; } }