public async Task <ActionResult> Edit([Bind(Include = "id,SerialNo,StudentName,FatherName,MotherName,Religion,Address,ContactNo,Email,Nationality,Dateofbirth,BirthCertificate,Passport,NationalId,Ielts,Sat,Tofel,Gre,PrefCountry,PrefCollege,PrefSubject,Sponsorship,SponsorshipType,RefferedName,Comments")] PreForm preForm, Helper help) { if (ModelState.IsValid) { preForm.ActivationCode = activationCode.ToString(); db.Entry(preForm).State = EntityState.Modified; await db.SaveChangesAsync(); // Send Confirm Email Address // SendActivationEmail(preForm.Email); // var url = string.Format("{ 0}://{1}/PreForms/Activation/{2}", Request.Url.Scheme, Request.Url.Authority, activationCode); if (preForm.Email != null) { var temp = db.EmailTemplates.FirstOrDefault(x => x.id == 1); if (temp != null) { string body = help.PopulateBody("Official Visa", "Verify Email", "", temp.Template); help.SendHtmlFormattedEmail(preForm.Email, temp.Title, body); } else { this.SetNotification("Enter The Email Address For Get More Updates", NotificationEnumeration.Warning); } } return(RedirectToAction("Index")); } return(View(preForm)); }
// GET: PreForms/Create public ActionResult Create() { PreForm pp = new PreForm(); var check = db.PreForms.ToList(); if (check.Count > 0) { var p = db.PreForms.ToList().Max(x => x.SerialNo); if (p != null) { pp.SerialNo = p + 1; } else { pp.SerialNo = 1001; } } else { pp.SerialNo = 1001; } return(View(pp)); }
public async Task <ActionResult> Create([Bind(Include = "Preformid,SerialNo,Date,StudentName,FatherName,MotherName,Gender,Address,ContactNo,Email,Nationality,Dateofbirth,Passport,NationalId,Ielts,PrefCountry,PrefCollege,PrefSubject,RefferedName,Comments,Status,Qualification")] PreForm preForm, Helper help) { if (ModelState.IsValid) { var a = db.PreForms.FirstOrDefault(x => x.Email == preForm.Email); if (a == null) { preForm.Status = "Pending"; db.PreForms.Add(preForm); await db.SaveChangesAsync(); if (preForm.Email != null) { var temp = db.Templates.FirstOrDefault(x => x.Templateid == 1); if (temp != null) { string body = help.PopulateBody(preForm.StudentName, "Thanks For Registeration", "", temp.Template); help.SendHtmlFormattedEmail(preForm.Email, temp.Title, body); } } TempData["Sucess"] = "Your Data Submitted Successfully"; return(RedirectToAction("Index")); } else { TempData["Error"] = "Sorry Your Email Id Is already in Used"; // this.SetNotification("Sorry Your Email Id Is already in Used", NotificationEnumeration.Error); return(View()); } } return(View(preForm)); }
public async Task <ActionResult> Create([Bind(Include = "Logsid,Date,Time,Templateid,Message,Sender,Preformid")] LogsDetails logsDetails, string message, Helper help, string email) { if (ModelState.IsValid) { logsDetails.Date = System.DateTime.Now.ToShortDateString(); logsDetails.Time = System.DateTime.Now.ToShortTimeString(); logsDetails.Message = message; db.LogsDetails.Add(logsDetails); await db.SaveChangesAsync(); if (email != null) { PreForm stud = db.PreForms.Find(logsDetails.Preformid); Templates tt = db.Templates.Find(logsDetails.Templateid); if (stud.Email != null) { // send logs to client by email string body = help.PopulateBody(stud.StudentName, tt.Title, "", logsDetails.Message); help.SendHtmlFormattedEmail(stud.Email, tt.Template, body); } } return(RedirectToAction("Index")); } ViewBag.Preformid = new SelectList(db.PreForms, "Preformid", "StudentName", logsDetails.Preformid); ViewBag.Templateid = new SelectList(db.Templates, "Templateid", "Title", logsDetails.Templateid); return(View(logsDetails)); }
public async Task <ActionResult> DeleteConfirmed(int id) { PreForm preForm = await db.PreForms.FindAsync(id); db.PreForms.Remove(preForm); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> ChangeStatus([Bind(Include = "Preformid,Status")] PreForm preForm, Helper help) { SQLHelper objsql = new SQLHelper(); objsql.ExecuteNonQuery("update preforms set Status='" + preForm.Status + "' where Preformid='" + preForm.Preformid + "'"); return(RedirectToAction("Index", "PreForms")); // return View(preForm); }
// GET: PreForms/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PreForm preForm = await db.PreForms.FindAsync(id); if (preForm == null) { return(HttpNotFound()); } return(View(preForm)); }
//public ActionResult Activation() //{ // ViewBag.Message = "Invalid Activation code."; // if (RouteData.Values["id"] != null) // { // Guid activationCode = new Guid(RouteData.Values["id"].ToString()); // string code = activationCode.ToString(); // usersEntities = db.PreForms.Where(p => p.ActivationCode == code).FirstOrDefault(); // if (usersEntities != null) // { // usersEntities.ConfirmStatus = "Confirmed"; // db.Entry(usersEntities).State = EntityState.Modified; // db.SaveChanges(); // ViewBag.Message = "Activation successful."; // } // } // else // { // ViewBag.Message = "Invalid Activation code."; // } // return View(); //} public ActionResult ChangeStatus(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PreForm preForm = db.PreForms.Find(id); if (preForm == null) { return(HttpNotFound()); } return(View(preForm)); }
// GET: PreForms/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PreForm preForm = await db.PreForms.FindAsync(id); if (preForm == null) { return(HttpNotFound()); } preForm.Date = System.DateTime.Now; return(View(preForm)); }
public ActionResult SMS(int id, Helper help, string Message, int status) { PreForm pp = db.PreForms.Where(x => x.Preformid == id).First(); ProcessingForm pf = db.ProcessingForms.Where(x => x.Preformid == id).First(); OfficeDetail of = db.OfficeDetails.FirstOrDefault(); if (status == 1) { // processing fee sms output = help.smssetting(pp.ContactNo, "Dear " + pp.StudentName + ". Your Processing Fees is:" + pf.ProcessingFee + " and your Due Date Is : " + pf.ProcessAlertDate + " Thanks and Regards " + of.CompanyName + ""); } else if (status == 2) { // college fee alert output = help.smssetting(pp.ContactNo, "Dear " + pp.StudentName + ". Your College Fees is:" + pf.CollegeFee + " and your Due Date Is : " + pf.CollegeAlertDate + " Thanks and Regards " + of.CompanyName + ""); } else if (status == 3) { // GIC fee alert output = help.smssetting(pp.ContactNo, "Dear " + pp.StudentName + ". Your GIC Fees is:" + pf.GICFee + " and your Due Date Is : " + pf.GICAlertDate + " Thanks and Regards " + of.CompanyName + ""); } else if (status == 3) { // Embassy fee alert output = help.smssetting(pp.ContactNo, "Dear " + pp.StudentName + ". Your Embassy Fees is:" + pf.EmbassyFee + " and your Due Date Is : " + pf.EmbassyAlertDate + " Thanks and Regards " + of.CompanyName + ""); } if (output == "Done") { this.SetNotification("Your Alert Message Send Sucessfully To " + pp.StudentName + "", NotificationEnumeration.Success); } else if (output == "SMS Not Activated") { this.SetNotification("SMS Sending Failed", NotificationEnumeration.Warning); } else { this.SetNotification("Message Not Send !", NotificationEnumeration.Error); } return(RedirectToAction("Index")); }
public async Task <ActionResult> Create([Bind(Include = "id,SerialNo,StudentName,FatherName,MotherName,Religion,Address,ContactNo,Email,Nationality,Dateofbirth,BirthCertificate,Passport,NationalId,Ielts,Sat,Tofel,Gre,PrefCountry,PrefCollege,PrefSubject,Sponsorship,SponsorshipType,RefferedName,Comments")] PreForm preForm) { if (ModelState.IsValid) { var a = db.PreForms.FirstOrDefault(x => x.Email == preForm.Email); if (a == null) { preForm.Status = "Pending"; db.PreForms.Add(preForm); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } else { ViewBag.Message = "Email Already In Used"; return(RedirectToAction("Create")); } } return(View(preForm)); }
public ActionResult Activation() { ViewBag.Message = "Invalid Activation code."; if (RouteData.Values["id"] != null) { Guid activationCode = new Guid(RouteData.Values["id"].ToString()); string code = activationCode.ToString(); usersEntities = db.PreForms.Where(p => p.ActivationCode == code).FirstOrDefault(); if (usersEntities != null) { usersEntities.ConfirmStatus = "Confirmed"; db.Entry(usersEntities).State = EntityState.Modified; db.SaveChanges(); ViewBag.Message = "Activation successful."; } } else { ViewBag.Message = "Invalid Activation code."; } return(View()); }