public ActionResult CreateDonation(DonationModel AdminDonationModel, HttpPostedFileBase BannerImage) { DonationModel DonationCreation = new DonationModel(); if (ModelState.IsValid) { var fileName = Path.GetFileName(BannerImage.FileName); var path = Path.Combine(Server.MapPath("~/UserProfilePictures/" + fileName)); BannerImage.SaveAs(path); var FilePath = "/UserProfilePictures/" + fileName; Donation_Details Donations = new Donation_Details() { Donation_Title = AdminDonationModel.DonationTitle, Donation_Banner = FilePath, Donation_Description = AdminDonationModel.DonationDescription, Donation_Amount = AdminDonationModel.DonationAmount, Status = true, CreatedOn = DateTime.Now }; Donation_Details AdminDonations = Donationservice.Create(Donations); } return(RedirectToAction("GetDonations")); }
public ActionResult UpdateDonation(DonationModel AdminDonationModel, HttpPostedFileBase BannerImage) { if (AdminDonationModel.DonationID != null) { var FilePath = ""; if (BannerImage != null) { var fileName = Path.GetFileName(BannerImage.FileName); var path = Path.Combine(Server.MapPath("~/UserProfilePictures/" + fileName)); BannerImage.SaveAs(path); FilePath = "/UserProfilePictures/" + fileName; } Donation_Details Donations = new Donation_Details() { Donation_ID = AdminDonationModel.DonationID, Donation_Title = AdminDonationModel.DonationTitle, Donation_Description = AdminDonationModel.DonationDescription, Donation_Amount = AdminDonationModel.DonationAmount, Donation_Banner = FilePath, Status = true, UpdatedOn = DateTime.Now }; Donationservice.DonationsUpdate(Donations); } else { } TempData["SuccessMessage"] = "Donation Updated Successfully.."; return(RedirectToAction("GetDonations", "Donations", new { area = "Admin" })); }
public Alumini.Core.Donation_Details Get(int id) { using (var context = _dbContextFactory.CreateConnection()) { Donation_Details Donations = context.Donation_Details.Where(x => x.Donation_ID == id).FirstOrDefault(); return(Donations); } }
public bool Delete(int id) { using (var context = _dbContextFactory.CreateConnection()) { Donation_Details Donations = context.Donation_Details.Where(x => x.Donation_ID == id).FirstOrDefault(); Donations.Status = false; Donations.UpdatedOn = DateTime.Now; context.SaveChanges(); return(true); } }
public ActionResult DonationStatus(int DonationId, int DonorId, string DonationStatus, string DonationAmount, string Comments) { decimal Amount = Convert.ToDecimal(DonationAmount); Donor_Details data1 = DonationService.DonationStatus(DonationId, DonorId, Amount, DonationStatus, Comments); Donation_Details Donationdata = GenericMethods.GetUserDonations(DonationId); View_UserDetails UserDetails = UserDetailsViewService.GetUserByUserId(DonorId); ViewBag.Amount = data1.Donation_Amount; ViewBag.Date = data1.CreatedOn; ViewBag.DonationTitle = Donationdata.Donation_Title; ViewBag.DonorName = UserDetails.FirstName; return(View()); }
public Donation_Details DonationsUpdate(Donation_Details UpdateDonation) { using (var context = _dbContextFactory.CreateConnection()) { Donation_Details Donations = context.Donation_Details.Where(x => x.Donation_ID == UpdateDonation.Donation_ID && x.Status == true).FirstOrDefault(); Donations.Donation_Title = UpdateDonation.Donation_Title; if (UpdateDonation.Donation_Banner != "") { Donations.Donation_Banner = UpdateDonation.Donation_Banner; } Donations.Donation_Description = UpdateDonation.Donation_Description; Donations.Donation_Amount = UpdateDonation.Donation_Amount; Donations.Status = true; Donations.UpdatedOn = DateTime.Now; context.SaveChanges(); return(UpdateDonation); } }
public ActionResult PaymentGateway(int DonationId, int DonorId, string DonationStatus, string DonationAmount, string Comments) { decimal Amount = Convert.ToDecimal(DonationAmount); Donor_Details data1 = DonationService.DonationStatus(DonationId, DonorId, Amount, DonationStatus, Comments); Donation_Details Donationdata = GenericMethods.GetUserDonations(DonationId); View_UserDetails UserDetails = UserDetailsViewService.GetUserByUserId(DonorId); string hash_string = string.Empty; string[] hashVarsSeq; var Key = ConfigurationManager.AppSettings["MERCHANT_KEY"]; Random rnd = new Random(); string strHash = Generatehash512(rnd.ToString() + DateTime.Now); txnid1 = strHash.ToString().Substring(0, 20); hashVarsSeq = ConfigurationManager.AppSettings["hashSequence"].Split('|'); // spliting hash sequence from config hash_string = ""; foreach (string hash_var in hashVarsSeq) { if (hash_var == "key") { hash_string = hash_string + ConfigurationManager.AppSettings["MERCHANT_KEY"]; hash_string = hash_string + '|'; } else if (hash_var == "txnid") { hash_string = hash_string + txnid1; hash_string = hash_string + '|'; } else if (hash_var == "amount") { hash_string = hash_string + Convert.ToDecimal(DonationAmount).ToString("g29"); hash_string = hash_string + '|'; } else if (hash_var == "productinfo") { hash_string = hash_string + Donationdata.Donation_Title; hash_string = hash_string + '|'; } else if (hash_var == "firstname") { hash_string = hash_string + UserDetails.FirstName; hash_string = hash_string + '|'; } else if (hash_var == "email") { hash_string = hash_string + "*****@*****.**"; hash_string = hash_string + '|'; } else { hash_string = hash_string + (Request.Form[hash_var] != null ? Request.Form[hash_var] : "");// isset if else hash_string = hash_string + '|'; } } hash_string += ConfigurationManager.AppSettings["SALT"]; // appending SALT hash1 = Generatehash512(hash_string).ToLower(); //generating hash action1 = ConfigurationManager.AppSettings["PAYU_BASE_URL"] + "/_payment"; // setting URL System.Collections.Hashtable data = new System.Collections.Hashtable(); // adding values in gash table for data post data.Add("hash", hash1); data.Add("txnid", txnid1); data.Add("key", Key); string AmountForm = Convert.ToDecimal(DonationAmount).ToString("g29");// eliminating trailing zeros data.Add("amount", AmountForm); data.Add("firstname", UserDetails.FirstName); data.Add("email", "*****@*****.**"); data.Add("phone", "8985143792"); data.Add("productinfo", Donationdata.Donation_Title); data.Add("surl", "http://www.google.com"); data.Add("furl", "http://www.google.com"); string strForm = PreparePOSTForm(action1, data); ViewBag.Form = strForm; return(View()); }
public Donation_Details DonationsUpdate(Donation_Details UpdateDonation) { return(_IDonationRepo.DonationsUpdate(UpdateDonation)); }
public Donation_Details Create(Donation_Details obj) { return(_IDonationRepo.Create(obj)); }