private UsersPersonalModelView GetContributionData(string memberid = "") { UsersPersonalModelView usersPersonalModelView = null; var IsRenewPinAvailable = _valleyDreamsIndiaDBEntities.RenewalPinDetails.Where(x => x.SponsoredId == CurrentUser.CurrentUserId && x.IsPinUsed == 0).Count(); if (IsRenewPinAvailable != 0) { ViewBag.Title = "Admin: Renewal"; usersPersonalModelView = new UsersPersonalModelView(); usersPersonalModelView.RenewalPinDetails = _valleyDreamsIndiaDBEntities.RenewalPinDetails.Where(x => x.SponsoredId == CurrentUser.CurrentUserId).FirstOrDefault(); usersPersonalModelView.UserDetails = _valleyDreamsIndiaDBEntities.UsersDetails.Where(x => x.Id == CurrentUser.CurrentUserId).FirstOrDefault(); usersPersonalModelView.ContributionDetails = _valleyDreamsIndiaDBEntities.ContributionDetails.Where(x => x.UserDetailsId == CurrentUser.CurrentUserId).OrderByDescending(x => x.NextContribNumber).FirstOrDefault(); ViewBag.RenewalPinAvailable = IsRenewPinAvailable; if (memberid != null && memberid != "" && memberid != string.Empty) { var otherMemberUserDetails = _valleyDreamsIndiaDBEntities.UsersDetails.Where(x => x.UserName == memberid).FirstOrDefault(); var otherMemberContributionDetails = _valleyDreamsIndiaDBEntities.ContributionDetails.Where(x => x.UserDetailsId == otherMemberUserDetails.Id).OrderByDescending(x => x.NextContribNumber).FirstOrDefault(); ViewBag.OtherContributionNumber = otherMemberContributionDetails.NextContribNumber; ViewBag.OtherContributionDate = otherMemberContributionDetails.NextContribDate; ViewBag.OtherSponsoredId = otherMemberUserDetails.UsersDetail1.UserName; } } return(usersPersonalModelView); }
public ActionResult Search(int userId) { UsersPersonalModelView usersPersonalModelView = new UsersPersonalModelView(); usersPersonalModelView.UserDetails = _valleyDreamsIndiaDBEntities.UsersDetails.Where(x => x.Id == userId).FirstOrDefault(); usersPersonalModelView.PersonalDetails = _valleyDreamsIndiaDBEntities.PersonalDetails.Where(x => x.UsersDetailsId == userId).FirstOrDefault(); usersPersonalModelView.BankDetails = _valleyDreamsIndiaDBEntities.BankDetails.Where(x => x.UsersDetailsId == userId).FirstOrDefault(); return(View("~/Views/Members/Team/Create.cshtml", usersPersonalModelView)); }
public ActionResult CreateMember(UsersPersonalModelView usersPersonalModelView) { UsersDetail userDetail = new UsersDetail(); userDetail.SponsoredId = CurrentUser.CurrentUserId; userDetail.Password = Guid.NewGuid().ToString().Substring(0, 6); userDetail.Deleted = 0; userDetail.CreatedOn = DateTime.Now; _valleyDreamsIndiaDBEntities.Entry(userDetail).State = EntityState.Added; _valleyDreamsIndiaDBEntities.SaveChanges(); int legId = _valleyDreamsIndiaDBEntities.UsersDetails .Where(x => x.UserName == usersPersonalModelView.UserDetails.UserName).FirstOrDefault().Id; usersPersonalModelView.PersonalDetails.UsersDetailsId = userDetail.Id; usersPersonalModelView.PersonalDetails.JoinedOn = DateTime.Now.ToString(); usersPersonalModelView.PersonalDetails.CreatedOn = DateTime.Now; usersPersonalModelView.PersonalDetails.SponsoredId = CurrentUser.CurrentUserId; usersPersonalModelView.PersonalDetails.LegId = legId; usersPersonalModelView.PersonalDetails.Deleted = 0; usersPersonalModelView.PersonalDetails.ProfilePic = "/UploadedTeamImages/default1_avatar_small.png"; _valleyDreamsIndiaDBEntities.PersonalDetails.Add(usersPersonalModelView.PersonalDetails); _valleyDreamsIndiaDBEntities.SaveChanges(); usersPersonalModelView.BankDetails.UsersDetailsId = userDetail.Id; usersPersonalModelView.BankDetails.CreatedOn = DateTime.Now; usersPersonalModelView.BankDetails.TransactionPassword = Guid.NewGuid().ToString().Substring(0, 6); usersPersonalModelView.BankDetails.Deleted = 0; _valleyDreamsIndiaDBEntities.BankDetails.Add(usersPersonalModelView.BankDetails); _valleyDreamsIndiaDBEntities.SaveChanges(); ContributionDetail contributionDetails = new ContributionDetail(); contributionDetails.ContribNumber = 1; contributionDetails.ContribDate = DateTime.Now; contributionDetails.ContribAmount = 1000; contributionDetails.NextContribNumber = 2; contributionDetails.NextContribDate = new DateTime(DateTime.Now.AddMonths(1).Year, DateTime.Now.AddMonths(1).Month, 20); contributionDetails.RemainingContrib = 15 - 1; contributionDetails.UserDetailsId = userDetail.Id; contributionDetails.SponsoredId = CurrentUser.CurrentUserId; contributionDetails.PayedBy = "ADMIN"; contributionDetails.IsCompleted = 0; _valleyDreamsIndiaDBEntities.ContributionDetails.Add(contributionDetails); _valleyDreamsIndiaDBEntities.SaveChanges(); password = userDetail.Password; transactionpassword = usersPersonalModelView.BankDetails.TransactionPassword; username = userDetail.UserName; return(RedirectToAction("CreateMember")); }
public ActionResult CreateMember() { ViewBag.Username = username; ViewBag.Password = password; ViewBag.TransactionPassword = transactionpassword; ViewBag.Title = "SuperAdmin: Add New Member"; UsersPersonalModelView usersPersonalModelView = new UsersPersonalModelView(); return(View(usersPersonalModelView)); }
public ActionResult Contribution(string memberid) { UsersPersonalModelView usersPersonalModelView = GetContributionData(memberid); if (usersPersonalModelView != null) { return(View("~/Views/Members/Renewal/Contribution.cshtml", usersPersonalModelView)); } else { return(Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString())); } }
private UsersPersonalModelView GetPersonalAndUserDetails(int userDetailsId) { UsersPersonalModelView usersPersonalModelView = new UsersPersonalModelView(); usersPersonalModelView.UserDetails = _valleyDreamsIndiaDBEntities.UsersDetails .First(x => x.Id == userDetailsId && x.Deleted == 0); usersPersonalModelView.PersonalDetails = _valleyDreamsIndiaDBEntities.PersonalDetails .First(x => x.UsersDetailsId == userDetailsId && x.Deleted == 0); usersPersonalModelView.BankDetails = _valleyDreamsIndiaDBEntities.BankDetails .First(x => x.UsersDetailsId == userDetailsId && x.Deleted == 0); usersPersonalModelView.ContributionDetails = _valleyDreamsIndiaDBEntities.ContributionDetails .Where(x => x.UserDetailsId == userDetailsId).OrderByDescending(x => x.Id).FirstOrDefault(); return(usersPersonalModelView); }
public ActionResult Edit(UsersPersonalModelView usersPersonalModelView, HttpPostedFileBase memberImage) { ViewBag.Title = "Admin: Profile Settings"; try { PersonalDetail personalDetails = _valleyDreamsIndiaDBEntities.PersonalDetails .Where(x => x.UsersDetailsId == usersPersonalModelView.UserDetails.Id).FirstOrDefault(); BankDetail bankDetails = _valleyDreamsIndiaDBEntities.BankDetails .Where(x => x.UsersDetailsId == usersPersonalModelView.UserDetails.Id).FirstOrDefault(); if (memberImage != null) { string randomImageName = Guid.NewGuid().ToString().Substring(0, 5) + memberImage.FileName; personalDetails.ProfilePic = "/UploadedTeamImages/" + randomImageName; memberImage.SaveAs(Server.MapPath("~/UploadedTeamImages/") + randomImageName); } personalDetails.BirthDate = usersPersonalModelView.PersonalDetails.BirthDate; personalDetails.PhoneNumber2 = usersPersonalModelView.PersonalDetails.PhoneNumber2; personalDetails.Email = usersPersonalModelView.PersonalDetails.Email; personalDetails.State = usersPersonalModelView.PersonalDetails.State; personalDetails.District = usersPersonalModelView.PersonalDetails.District; personalDetails.City = usersPersonalModelView.PersonalDetails.City; personalDetails.PinCode = usersPersonalModelView.PersonalDetails.PinCode; personalDetails.UpdatedOn = DateTime.Now; _valleyDreamsIndiaDBEntities.Entry(personalDetails).State = EntityState.Modified; bankDetails.NomineeName = usersPersonalModelView.BankDetails.NomineeName; bankDetails.NomineeRelation = usersPersonalModelView.BankDetails.NomineeRelation; bankDetails.BankName = usersPersonalModelView.BankDetails.BankName; bankDetails.AccountHolderName = usersPersonalModelView.BankDetails.AccountHolderName; bankDetails.AccountNumber = usersPersonalModelView.BankDetails.AccountNumber; bankDetails.IFSCCode = usersPersonalModelView.BankDetails.IFSCCode; bankDetails.PANNumber = usersPersonalModelView.BankDetails.PANNumber; bankDetails.UpdatedOn = DateTime.Now; _valleyDreamsIndiaDBEntities.Entry(bankDetails).State = EntityState.Modified; _valleyDreamsIndiaDBEntities.SaveChanges(); return(RedirectToAction("ViewProfile", new { currentId = usersPersonalModelView.UserDetails.Id })); } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult ContributionPost(string transactionPassword) { try { BankDetail bankDetail = _valleyDreamsIndiaDBEntities.BankDetails.First(x => x.UsersDetailsId == CurrentUser.CurrentUserId && x.Deleted == 0); if (bankDetail.TransactionPassword == transactionPassword) { ContributionDetail ContributionDetails = _valleyDreamsIndiaDBEntities.ContributionDetails .Where(x => x.UserDetailsId == CurrentUser.CurrentUserId) .OrderByDescending(x => x.NextContribNumber).FirstOrDefault(); ContributionDetail contributionDetails = new ContributionDetail(); contributionDetails.ContribNumber = ContributionDetails.NextContribNumber; contributionDetails.ContribDate = DateTime.Now; contributionDetails.ContribAmount = 1000; contributionDetails.NextContribNumber = ContributionDetails.NextContribNumber + 1; contributionDetails.NextContribDate = new DateTime(DateTime.Now.AddMonths(1).Year, DateTime.Now.AddMonths(1).Month, 20); contributionDetails.RemainingContrib = 15 - ContributionDetails.NextContribNumber; contributionDetails.UserDetailsId = CurrentUser.CurrentUserId; contributionDetails.SponsoredId = bankDetail.UsersDetail.SponsoredId; contributionDetails.PayedBy = "SELF"; contributionDetails.IsCompleted = (contributionDetails.ContribNumber != 15) ? 0 : 1; _valleyDreamsIndiaDBEntities.ContributionDetails.Add(contributionDetails); _valleyDreamsIndiaDBEntities.SaveChanges(); RenewalPinDetail renewalPinDetail = _valleyDreamsIndiaDBEntities.RenewalPinDetails.Where(x => x.SponsoredId == CurrentUser.CurrentUserId && x.IsPinUsed == 0).OrderBy(x => x.PinCreatedOn).FirstOrDefault(); renewalPinDetail.IsPinUsed = 1; _valleyDreamsIndiaDBEntities.Entry(renewalPinDetail).State = System.Data.Entity.EntityState.Modified; _valleyDreamsIndiaDBEntities.SaveChanges(); ViewBag.OwnRenewalMessage = "Renewal Transfer Successfully "; UsersPersonalModelView usersPersonalModelView = GetContributionData(); return(View("~/Views/Members/Renewal/Contribution.cshtml", usersPersonalModelView)); } ViewBag.OwnRenewalMessage = "Mismatched Transaction Password"; UsersPersonalModelView usersPersonalModelView1 = GetContributionData(); return(View("~/Views/Members/Renewal/Contribution.cshtml", usersPersonalModelView1)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult Create() { ViewBag.Username = username; ViewBag.Password = password; ViewBag.TransactionPassword = transactionpassword; ViewBag.SmsStatus = smsstatus; var IsNewPinAvailable = _valleyDreamsIndiaDBEntities.UsersDetails.Where(x => x.SponsoredId == CurrentUser.CurrentUserId && x.PinType == "NEW" && x.IsPinUsed == 0).Count(); if (IsNewPinAvailable != 0) { ViewBag.Title = "Admin: Add New Member"; UsersPersonalModelView usersPersonalModelView = new UsersPersonalModelView(); usersPersonalModelView.UserDetails = _valleyDreamsIndiaDBEntities.UsersDetails.Where(x => x.Id == CurrentUser.CurrentUserId).FirstOrDefault(); return(View("~/Views/Members/Team/Create.cshtml", usersPersonalModelView)); } else { return(Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString())); } }
public ActionResult Create(UsersPersonalModelView usersPersonalModelView) { ViewBag.Title = "Admin: Add New Member"; UsersDetail userDetail = _valleyDreamsIndiaDBEntities.UsersDetails .Where(x => x.SponsoredId == CurrentUser.CurrentUserId && x.PinType == "NEW" && x.IsPinUsed == 0).OrderBy(x => x.UserName).FirstOrDefault(); userDetail.IsPinUsed = 1; userDetail.Password = Guid.NewGuid().ToString().Substring(0, 6); userDetail.Deleted = 0; userDetail.CreatedOn = DateTime.Now; _valleyDreamsIndiaDBEntities.Entry(userDetail).State = EntityState.Modified; _valleyDreamsIndiaDBEntities.SaveChanges(); int legId = _valleyDreamsIndiaDBEntities.UsersDetails .Where(x => x.UserName == usersPersonalModelView.UserDetails.UserName).FirstOrDefault().Id; usersPersonalModelView.PersonalDetails.UsersDetailsId = userDetail.Id; usersPersonalModelView.PersonalDetails.JoinedOn = DateTime.Now.ToString(); usersPersonalModelView.PersonalDetails.CreatedOn = DateTime.Now; usersPersonalModelView.PersonalDetails.SponsoredId = CurrentUser.CurrentUserId; usersPersonalModelView.PersonalDetails.LegId = legId; usersPersonalModelView.PersonalDetails.Deleted = 0; usersPersonalModelView.PersonalDetails.ProfilePic = "/UploadedTeamImages/default1_avatar_small.png"; _valleyDreamsIndiaDBEntities.PersonalDetails.Add(usersPersonalModelView.PersonalDetails); _valleyDreamsIndiaDBEntities.SaveChanges(); usersPersonalModelView.BankDetails.UsersDetailsId = userDetail.Id; usersPersonalModelView.BankDetails.CreatedOn = DateTime.Now; usersPersonalModelView.BankDetails.TransactionPassword = Guid.NewGuid().ToString().Substring(0, 6); usersPersonalModelView.BankDetails.Deleted = 0; _valleyDreamsIndiaDBEntities.BankDetails.Add(usersPersonalModelView.BankDetails); _valleyDreamsIndiaDBEntities.SaveChanges(); ContributionDetail contributionDetails = new ContributionDetail(); contributionDetails.ContribNumber = 1; contributionDetails.ContribDate = DateTime.Now; contributionDetails.ContribAmount = 1000; contributionDetails.NextContribNumber = 2; contributionDetails.NextContribDate = new DateTime(DateTime.Now.AddMonths(1).Year, DateTime.Now.AddMonths(1).Month, 20); contributionDetails.RemainingContrib = 15 - 1; contributionDetails.UserDetailsId = userDetail.Id; contributionDetails.SponsoredId = CurrentUser.CurrentUserId; contributionDetails.PayedBy = "SPONSOR"; contributionDetails.IsCompleted = 0; _valleyDreamsIndiaDBEntities.ContributionDetails.Add(contributionDetails); _valleyDreamsIndiaDBEntities.SaveChanges(); password = userDetail.Password; transactionpassword = usersPersonalModelView.BankDetails.TransactionPassword; username = userDetail.UserName; string textMessage = String.Format("Your username is {0}, password is {1} and transactionpassword is {2}", username, password, transactionpassword); string smsStatus = SmsProvider.SendSms(usersPersonalModelView.PersonalDetails.PhoneNumber1, textMessage); if (smsStatus == "Success") { smsstatus = "Credentials Sent To Your Registered Mobile Number Successfully"; } else { smsstatus = "Sended Sms Failed"; } return(RedirectToAction("Create")); }