public ActionResult ChangeRole(tblreceptionist model, string returnUrl, Helper Help, int id) { dbcontext db = new dbcontext(); var passw = model.password; string ids = id.ToString(); var dataItem = db.tblreceptionists.Where(x => x.rid == ids).FirstOrDefault(); if (dataItem != null) { FormsAuthentication.SetAuthCookie(dataItem.rid, false); if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) { return(Redirect(returnUrl)); } else { TempData["Success"] = "Login Successfully"; Session["User"] = dataItem.Id; Session["admin"] = dataItem.Id; return(RedirectToAction("Dashaboard", "Default")); } } else { // ModelState.AddModelError("", "Invalid user/pass"); TempData["Success"] = "Invalid user/pass"; return(View()); } }
public ActionResult Create() { tblreceptionist receptionist = new tblreceptionist(); receptionist.date = System.DateTime.Now; return(View(receptionist)); }
public ActionResult Create([Bind(Include = "Id,date,name,email,contact,login,password,rid,image,Type,status,StartTime,EndTime")] tblreceptionist tblreceptionist, HttpPostedFileBase file, Helper Help) { if (ModelState.IsValid) { tblreceptionist recp = db.tblreceptionists.FirstOrDefault(); if (recp == null) { tblreceptionist.rid = "1001"; } else { var valc = db.tblreceptionists.Max(x => x.rid); tblreceptionist.rid = (Convert.ToInt32(valc) + 1).ToString(); } if (User.IsInRole("Franchisee")) { tblreceptionist.franchid = Help.Franchisee(); } else { tblreceptionist.franchid = Help.Franchisee(); } tblreceptionist.status = true; tblreceptionist.image = Help.uploadfile(file); tblreceptionist.password = tblreceptionist.password; db.tblreceptionists.Add(tblreceptionist); db.SaveChanges(); TempData["Success"] = "Saved Successfully"; return(RedirectToAction("Index")); } return(View(tblreceptionist)); }
public string Teacher() { var name = (HttpContext.Current.User.Identity.IsAuthenticated ? HttpContext.Current.User.Identity.Name : "Guest"); tblreceptionist rr = db.tblreceptionists.Where(x => x.rid == name).FirstOrDefault(); return(rr.rid); }
public ActionResult Edit([Bind(Include = "Id,date,name,email,contact,login,password,rid,image,Type,status,StartTime,EndTime")] tblreceptionist tblreceptionist, HttpPostedFileBase file, Helper Help) { if (ModelState.IsValid) { tblreceptionist.image = file != null?Help.uploadfile(file) : img; #region delete file string fullPath = Request.MapPath("~/UploadedFiles/" + img); if (img == tblreceptionist.image) { } else { if (System.IO.File.Exists(fullPath)) { System.IO.File.Delete(fullPath); } } #endregion db.Entry(tblreceptionist).State = EntityState.Modified; db.SaveChanges(); TempData["Success"] = "Updated Successfully"; return(RedirectToAction("Index")); } return(View(tblreceptionist)); }
public string Receptionist() { string a = HttpContext.Current.User.Identity.Name; tblreceptionist rr = db.tblreceptionists.Where(x => x.rid == a).First(); return(rr.franchid.ToString()); }
public ActionResult Login(tblreceptionist model, string returnUrl, Helper Help, string ddltype) { dbcontext db = new dbcontext(); var passw = model.password; var dataItem = db.tblreceptionists.Where(x => x.login == model.login && x.password == passw && x.Type == ddltype).FirstOrDefault(); if (dataItem != null) { FormsAuthentication.SetAuthCookie(dataItem.rid, false); if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) { TempData["danger"] = "Invalid user/pass"; return(Redirect(returnUrl)); } else if (ddltype == "Processing") { TempData["Success"] = "Login Successfully"; return(RedirectToAction("AllApplication", "Processing")); } else if (ddltype == "Gic") { TempData["Success"] = "Login Successfully"; return(RedirectToAction("AllApplication", "Processing")); } else if (ddltype == "Consoller") { TempData["Success"] = "Login Successfully"; return(RedirectToAction("Index", "Consoller")); } else if (ddltype == "Chandigarh") { TempData["Success"] = "Login Successfully"; return(RedirectToAction("AllApplication", "Processing")); } else if (ddltype == "Admin") { TempData["Success"] = "Login Successfully"; return(RedirectToAction("Dashaboard", "Admin/Default")); } else { TempData["Success"] = "Login Successfully"; Session["User"] = dataItem.Id; Session["Franchisee"] = dataItem.franchid; return(RedirectToAction("Index", "Auth/Default")); } } else { // ModelState.AddModelError("", "Invalid user/pass"); TempData["danger"] = "Invalid user/pass"; return(View()); } }
public async Task <ActionResult> DeleteConfirmed(int id) { tblreceptionist tblreceptionist = await db.tblreceptionists.FindAsync(id); db.tblreceptionists.Remove(tblreceptionist); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,date,name,email,contact,login,password,rid,image,Type,franchid,status")] tblreceptionist tblreceptionist) { if (ModelState.IsValid) { db.Entry(tblreceptionist).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(tblreceptionist)); }
// GET: Auth/tblreceptionists/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tblreceptionist tblreceptionist = await db.tblreceptionists.FindAsync(id); if (tblreceptionist == null) { return(HttpNotFound()); } return(View(tblreceptionist)); }
// GET: Auth/Account/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tblreceptionist tblreceptionist = db.tblreceptionists.Find(id); if (tblreceptionist == null) { return(HttpNotFound()); } return(View(tblreceptionist)); }
public async Task <ActionResult> Create([Bind(Include = "Id,date,name,email,contact,login,password,rid,image,Type,franchid,status")] tblreceptionist tblreceptionist) { if (ModelState.IsValid) { var rid = db.tblreceptionists.Max(x => x.rid); tblreceptionist.rid = (Convert.ToInt32(rid) + 1).ToString(); tblreceptionist.franchid = HttpContext.User.Identity.Name; db.tblreceptionists.Add(tblreceptionist); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(tblreceptionist)); }
public async Task <ActionResult> Create([Bind(Include = "Id,Date,Item,Amount,Method,Ref,franchid,Name")] Expense expense) { if (ModelState.IsValid) { DateTime today = System.DateTime.Now; // ExpenseLock Locks = db.ExpenseLocks.FirstOrDefault(x => x.LockDate == today); DataTable dt = objsql.GetTable("select * from expenselocks where lockdate='" + today + "'"); if (dt.Rows.Count > 0) { TempData["danger"] = "Sorry DayEnd"; return(View()); } else { string franchid = help.Permission(); tblreceptionist re = db.tblreceptionists.FirstOrDefault(x => x.rid == franchid); if (re.StartTime != null || re.EndTime != null) { if (help.Checklock() == true) { db.Expenses.Add(expense); expense.franchid = User.IsInRole("franchisee") ? help.Franchisee() : help.Receptionist(); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } else { TempData["danger"] = "Sorry DayEnd"; return(View()); } } else { db.Expenses.Add(expense); expense.franchid = User.IsInRole("franchisee") ? help.Franchisee() : help.Receptionist(); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } } } return(View(expense)); }
public ActionResult Login(tblreceptionist model, string returnUrl, Helper Help, string ddltype) { dbcontext db = new dbcontext(); var otp = Help.otp(); tblreceptionist rr = db.tblreceptionists.FirstOrDefault(x => x.rid == model.rid); tbldetail dd = db.tbldetails.FirstOrDefault(); Help.sendsms(rr.contact, "Dear, " + rr.name + ". Login OTP Is " + otp + " "); tblreceptionist data = new tblreceptionist() { Type = ddltype, rid = model.rid, OTP = Convert.ToInt32(otp) }; Session["mydata"] = data; return(RedirectToAction("OTP", "Accounts")); }
public ActionResult Index() { string a = HttpContext.User.Identity.Name; if (User.IsInRole("Admin")) { var studentdata = db.tblstudentdata.Where(x => x.Status == true).ToList(); return(View(studentdata)); } else if (User.IsInRole("Franchisee")) { var studentdata = db.tblstudentdata.Where(x => x.Status == true && x.uid == a).ToList(); return(View(studentdata)); } else { tblreceptionist rr = db.tblreceptionists.Where(x => x.rid == a).First(); var studentdata = db.tblstudentdata.Where(x => x.Status == true && x.uid == (rr.franchid).ToString()).ToList(); return(View(studentdata)); } }
public ActionResult Index() { DateTime date = System.DateTime.Now; string a = HttpContext.User.Identity.Name; if (User.IsInRole("Admin")) { return(View(db.Fees_Master.Where(x => x.AlertDate <= date).ToList())); } else if (User.IsInRole("Franchisee")) { return(View(db.Fees_Master.Where(x => x.AlertDate <= date && x.franchid == a && x.Status == true).ToList())); } else { tblreceptionist rr = db.tblreceptionists.Where(x => x.rid == a).First(); string b = rr.franchid.ToString(); var studentdata = db.Fees_Master.Where(x => x.AlertDate <= date && x.franchid == b && x.Status == true).ToList(); return(View(studentdata)); // return View(db.Fees_Master.Where(x => x.AlertDate <= date).ToList()); } }
public ActionResult DeleteConfirmed(int id) { tblreceptionist tblreceptionist = db.tblreceptionists.Find(id); img = tblreceptionist.image; #region delete file string fullPath = Request.MapPath("~/UploadedFiles/" + img); if (img == tblreceptionist.image) { } else { if (System.IO.File.Exists(fullPath)) { System.IO.File.Delete(fullPath); } } #endregion db.tblreceptionists.Remove(tblreceptionist); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult OTP(tblreceptionist recp, string returnUrl, Helper Help, string ddltype) { dbcontext db = new dbcontext(); tblreceptionist data = Session["mydata"] as tblreceptionist; string login = data.rid; int otp = data.OTP; ddltype = data.Type; //string login = TempData["Rid"].ToString(); if (otp == recp.OTP) { var dataItem = db.tblreceptionists.Where(x => x.rid == login).FirstOrDefault(); if (dataItem != null) { FormsAuthentication.SetAuthCookie(dataItem.rid, false); if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) { TempData["danger"] = "Invalid user/pass"; return(Redirect(returnUrl)); } else if (ddltype == "Processing") { TempData["Success"] = "Login Successfully"; return(RedirectToAction("AllApplication", "Processing")); } else if (ddltype == "Gic") { TempData["Success"] = "Login Successfully"; return(RedirectToAction("AllApplication", "Processing")); } else if (ddltype == "Consoller") { TempData["Success"] = "Login Successfully"; return(RedirectToAction("Index", "Consoller")); } else if (ddltype == "Chandigarh") { TempData["Success"] = "Login Successfully"; return(RedirectToAction("AllApplication", "Processing")); } else if (ddltype == "Admin") { TempData["Success"] = "Login Successfully"; return(RedirectToAction("Dashaboard", "Admin/Default")); } else { TempData["Success"] = "Login Successfully"; Session["User"] = dataItem.Id; Session["Franchisee"] = dataItem.franchid; return(RedirectToAction("Index", "Auth/Default")); } } else { // ModelState.AddModelError("", "Invalid user/pass"); TempData["danger"] = "Invalid user/pass"; return(View()); } } else { // ModelState.AddModelError("", "Invalid user/pass"); TempData["danger"] = "Invalid OTP"; return(View()); } }
public ActionResult Create([Bind(Include = "Type")] Recipt_Details receiptdetail, int Amount, int Discount, int CourseId, DateTime?Alert, DateTime date, Helper Help) { using (TransactionScope ts = new TransactionScope()) { try { DateTime today = System.DateTime.Now; DataTable dt = objsql.GetTable("select * from expenselocks where lockdate='" + today + "'"); if (dt.Rows.Count > 0) { TempData["danger"] = "Sorry DayEnd"; return(View()); } else { string franchid = help.Permission(); tblreceptionist re = db.tblreceptionists.FirstOrDefault(x => x.rid == franchid); if (re.StartTime != null || re.EndTime != null) { if (help.Checklock() == true) { #region data string a = User.IsInRole("Franchisee") ? help.Franchisee() : help.Receptionist(); // TODO: Add insert logic here Fees_Master feesmaster = db.Fees_Master.FirstOrDefault(x => x.RollNo == rollno && x.franchid == a && x.Status == true && x.CourseId == CourseId); int pending = (Convert.ToInt32(feesmaster.TotalFees) - Convert.ToInt32(feesmaster.PaidFees)); if (feesmaster.PaidFees < feesmaster.TotalFees) { #region condition greater than feesmaster.discount = (Convert.ToInt32(feesmaster.discount) + Convert.ToInt32(Discount)); feesmaster.Date = date; feesmaster.AlertDate = Alert; feesmaster.PaidFees += Amount; feesmaster.Status = true; db.Entry(feesmaster).State = EntityState.Modified; db.SaveChanges(); receiptdetail.RollNo = rollno; receiptdetail.ReciptNo = receiptno; receiptdetail.discount = Discount; receiptdetail.CourseId = CourseId; receiptdetail.Date = date; receiptdetail.role = HttpContext.User.Identity.Name; receiptdetail.Amount = Amount; receiptdetail.Active = true; receiptdetail.franchid = User.IsInRole("Franchisee") ? Help.Franchisee() : Help.Receptionist(); db.Recipt_Details.Add(receiptdetail); db.SaveChanges(); TempData["roll"] = rollno; ViewData["Receipt"] = recp1; TempData["Success"] = "Saved Successfully"; tblsms sms = db.tblsms.FirstOrDefault(); tblstudentdata ss = db.tblstudentdata.FirstOrDefault(x => x.rollno == rollno); if (ss.phone != null) { if (sms != null) { string msg = "Dear, " + Convert.ToString(ss.name) + ". Thank You for Deposit Rs." + Amount + ". Thanks for Joining Us."; string result = Help.apicall("http://sms.sms.officialsolutions.in/sendSMS?username="******"&message=" + msg + "&sendername=" + sms.Senderid + "&smstype=TRANS&numbers=" + ss.phone + "&apikey=" + sms.Api + ""); } TempData["Success"] = "SMS Send Successfully"; } StudentCourse course = db.StudentCourses.Where(x => x.RollNo == rollno && x.Status == true).FirstOrDefault(); var courses = db.Courses.Where(x => x.CourseId == course.CourseId); ViewBag.CourseId = new SelectList(courses, "CourseId", "CourseName"); ts.Complete(); ts.Dispose(); return(RedirectToAction("invoice", new { id = receiptno })); #endregion } else { TempData["danger"] = "Please Check Amount First"; return(View()); } #endregion } else { TempData["danger"] = "Sorry DayEnd"; return(View()); } } else { #region data string a = User.IsInRole("Franchisee") ? help.Franchisee() : help.Receptionist(); // TODO: Add insert logic here Fees_Master feesmaster = db.Fees_Master.FirstOrDefault(x => x.RollNo == rollno && x.franchid == a && x.Status == true && x.CourseId == CourseId); int pending = (Convert.ToInt32(feesmaster.TotalFees) - Convert.ToInt32(feesmaster.PaidFees)); if (feesmaster.PaidFees < feesmaster.TotalFees) { #region condition greater than feesmaster.discount = (Convert.ToInt32(feesmaster.discount) + Convert.ToInt32(Discount)); feesmaster.Date = date; feesmaster.AlertDate = Alert; feesmaster.PaidFees += Amount; feesmaster.Status = true; db.Entry(feesmaster).State = EntityState.Modified; db.SaveChanges(); receiptdetail.RollNo = rollno; receiptdetail.ReciptNo = receiptno; receiptdetail.discount = Discount; receiptdetail.CourseId = CourseId; receiptdetail.Date = date; receiptdetail.Amount = Amount; receiptdetail.Active = true; receiptdetail.franchid = User.IsInRole("Franchisee") ? Help.Franchisee() : Help.Receptionist(); db.Recipt_Details.Add(receiptdetail); db.SaveChanges(); TempData["roll"] = rollno; ViewData["Receipt"] = recp1; TempData["Success"] = "Saved Successfully"; tblsms sms = db.tblsms.FirstOrDefault(); tblstudentdata ss = db.tblstudentdata.FirstOrDefault(x => x.rollno == rollno); if (ss.phone != null) { if (sms != null) { string msg = "Dear " + Convert.ToString(ss.name) + ". Thank You for Deposit Rs." + Amount + ". Thanks for Joining Us."; string result = Help.apicall("http://sms.sms.officialsolutions.in/sendSMS?username="******"&message=" + msg + "&sendername=" + sms.Senderid + "&smstype=TRANS&numbers=" + ss.phone + "&apikey=" + sms.Api + ""); } TempData["Success"] = "SMS Send Successfully"; } StudentCourse course = db.StudentCourses.Where(x => x.RollNo == rollno && x.Status == true).FirstOrDefault(); var courses = db.Courses.Where(x => x.CourseId == course.CourseId); ViewBag.CourseId = new SelectList(courses, "CourseId", "CourseName"); ts.Complete(); ts.Dispose(); return(RedirectToAction("invoice", new { id = receiptno })); #endregion } else { TempData["danger"] = "Please Check Amount First"; return(View()); } #endregion } } } catch (Exception a) { return(View()); } } }
public ActionResult UpdateAssignTeacher([Bind(Include = "inquiryid")] tblinquiry online, string assign, AssignIelts assign1, Helper help, tblreceptionist tblreceptionist) { SQLHelper objsql = new SQLHelper(); objsql.ExecuteNonQuery("update AssignIelts set status='0' where inquiryid='" + assign1.inquiryid + "'"); assign1.Date = System.DateTime.Now; assign1.inquiryid = Convert.ToInt32(online.inquiryid); assign1.teacher = assign1.teacher; assign1.franchid = help.Permission(); assign1.Status = true; db.AssignIelts.Add(assign1); db.SaveChanges(); var result1 = db.tblinquiries.SingleOrDefault(b => b.inquiryid == online.inquiryid && b.franchid == assign1.franchid); if (result1 != null) { result1.teacher = assign1.teacher; db.SaveChanges(); } TempData["Success"] = "Update Lead Successfully"; return(RedirectToAction("Index", "Auth/Inquiry")); }