public List <online> GetContacts(DateTime afterDate) { using (dbcontext dc = new dbcontext()) { return(dc.onlines.Where(a => a.Date > afterDate).OrderByDescending(a => a.Date).ToList()); } }
public ActionResult Login(Registration model, string returnUrl) { dbcontext db = new dbcontext(); var dataItem = db.Registrations.Where(x => x.Email == model.Email && x.Password == model.Password).FirstOrDefault(); if (dataItem != null) { FormsAuthentication.SetAuthCookie(dataItem.Rid.ToString(), 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.Rid; return(RedirectToAction("Profiles", "Profile")); } } else { // ModelState.AddModelError("", "Invalid user/pass"); TempData["danger"] = "Invalid user/pass"; return(View()); } }
public ActionResult Edit(int id) { dbcontext db = new dbcontext(); Person p = db.Persons.Single(x => x.PersonID == id); return(View(p)); }
public ActionResult Login2(Account objUser) { using (dbcontext db = new dbcontext()) { DateTime enddate = Convert.ToDateTime(System.DateTime.Now.ToString("yyyy-MM-dd")); OfficeDetail detail = db.OfficeDetails.Where(x => x.ValidKey != "").FirstOrDefault(); if (detail != null) { var obj = db.Accounts.Where(a => a.UserName.Equals(objUser.UserName) && a.Password.Equals(objUser.Password)).FirstOrDefault(); if (obj != null) { Session["UserID"] = obj.UserName.ToString(); Session["UserName"] = obj.Password.ToString(); return(RedirectToAction("Index", "Preforms")); } } else { ViewBag.Message = string.Format("Sorry Your Licence Expire ! Please Contact to Official Solutions", DateTime.Now.ToString()); return(View("Login")); } } return(View(objUser)); }
public ActionResult GetDailyReport() { db = new dbcontext(); List <CNInfo> cnData = db.CNInfoset.ToList(); //var rptData = from c in db.CNInfoset // join p in db.PartyInfoset on c.PartyId equals p.PartyInfoId // select new VMDailyInfo // { // Amount = Convert.ToDecimal(c.TotalAmount), // PartyName = p.Name // }; //for rdlc Warning[] warnings; string mimeType; string[] streamids; string encoding; string filenameExtension; var viewer = new ReportViewer(); viewer.LocalReport.ReportPath = Server.MapPath("~/RDLC/rptDailySales.rdlc"); viewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", cnData)); viewer.LocalReport.Refresh(); var bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings); return(File(bytes, mimeType)); }
public AdminController(dbcontext context) { uS = new UserService(context); fS = new FacultyService(context); unvS = new UniversityService(context); _context = context; }
public ActionResult Login(StudentDetail model, string returnUrl) { dbcontext db = new dbcontext(); var dataItem = db.StudentDetails.Where(x => x.UserName == model.UserName && x.Password == model.Password).ToList(); if (dataItem != null) { //FormsAuthentication.SetAuthCookie(dataItem.Usename, false); if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) { return(Redirect(returnUrl)); } else { TempData["Success"] = "Login Successfully"; Session["student"] = dataItem.FirstOrDefault().Studentid; return(RedirectToAction("StudentProfile", "Home")); } } else { ModelState.AddModelError("", "Invalid user/pass"); return(View()); } }
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("Index", "Admin/Dashaboard")); } } else { // ModelState.AddModelError("", "Invalid user/pass"); TempData["Success"] = "Invalid user/pass"; return(View()); } }
public async void saveDB(ObservableCollection <bomm> db) { try { using (var ctx = new dbcontext()) { foreach (var item in db) { bomm b = new bomm(); b.bom_level = item.bom_level; b.Parent_Part_Number = item.Parent_Part_Number; b.Part_Number = item.Part_Number; b.Part_Name = item.Part_Name; b.Revision = item.Revision; b.Quantit = item.Quantit; b.Unit_of_measure = item.Unit_of_measure; b.Procurement_Type = item.Procurement_Type; b.Reference_Designatos = item.Reference_Designatos; b.BOM_Notes = item.BOM_Notes; ctx.bomm.Add(b); } ctx.SaveChanges(); } } catch (Exception e) { await MainWindow.Instance.ShowMessageAsync("Error", e.Message); } }
public ActionResult Login(Account model, string returnUrl, string ddltype) { dbcontext db = new dbcontext(); var passw = model.Password; var dataItem = db.Accounts.Where(x => x.Username == model.Username && x.Password == passw && x.Role == ddltype).FirstOrDefault(); if (dataItem != null) { string a = dataItem.id.ToString(); FormsAuthentication.SetAuthCookie(dataItem.Username, false); if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) { return(Redirect(returnUrl)); } else if (ddltype == "Admin") { TempData["Success"] = "Login Successfully"; Session["User"] = dataItem.id.ToString(); return(RedirectToAction("Index", "DashBoard")); } return(RedirectToAction("Index", "DashBoard")); } else { // ModelState.AddModelError("", "Invalid user/pass"); TempData["Success"] = "Invalid user/pass"; return(View()); } }
public JsonResult UpdateContentMailforNhanvien([FromBody] MailCustomViewModel Mailcontext) { var db = new dbcontext(); var exsistMailfornhanvien = db.Mailtonhanviens.Where(x => x.NhanvienId == Mailcontext.idnv).FirstOrDefault(); if (exsistMailfornhanvien == null) { var newmailfornhanvien = new Mailtonhanvien() { NhanvienId = Mailcontext.idnv, Tieude = Mailcontext.tieudemail, Noidung = Mailcontext.noidungmail }; db.Mailtonhanviens.Add(newmailfornhanvien); db.SaveChanges(); return(new JsonResult( new { mes = "thanh cong" } )); } else { exsistMailfornhanvien.Tieude = Mailcontext.tieudemail; exsistMailfornhanvien.Noidung = Mailcontext.noidungmail; db.SaveChanges(); return(new JsonResult( new { mes = "thanh cong" } )); } }
public ActionResult Login(tblreceptionist model, string returnUrl, Helper Help) { dbcontext db = new dbcontext(); var passw = Help.EncryptData(model.password); var dataItem = db.tblreceptionists.Where(x => x.login == model.login && x.password == passw).FirstOrDefault(); if (dataItem != null) { FormsAuthentication.SetAuthCookie(dataItem.login, 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.rid; return(RedirectToAction("Index", "Default")); } } else { ModelState.AddModelError("", "Invalid user/pass"); return(View()); } }
public ActionResult Login(Account model, string returnUrl) { dbcontext db = new dbcontext(); var dataItem = db.Accounts.Where(x => x.Usename == model.Usename && x.Password == model.Password).First(); if (dataItem != null) { FormsAuthentication.SetAuthCookie(dataItem.Usename, false); if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) { return(Redirect(returnUrl)); } else { TempData["Success"] = "Login Successfully"; return(RedirectToAction("Index", "Default")); } } else { ModelState.AddModelError("", "Invalid user/pass"); return(View()); } }
// GET: Default/Details/5 public ActionResult Details(int id) { dbcontext db = new dbcontext(); Person person = db.Persons.Single(x => x.PersonID == id); return(View(person)); }
public override string[] GetRolesForUser(string username) { dbcontext db = new dbcontext(); string data = db.Registrations.Where(x => x.Email == username).FirstOrDefault().FirstName; string[] result = { data }; return(result); }
public override string[] GetRolesForUser(string username) { dbcontext db = new dbcontext(); string data = db.tblreceptionists.Where(x => x.rid == username).FirstOrDefault().Type; string[] result = { data }; return(result); }
public override string[] GetRolesForUser(string username) { dbcontext db = new dbcontext(); string data = db.Accounts.Where(x => x.login == username).FirstOrDefault().UserType; string[] result = { data }; return(result); }
public HomeController(dbcontext context) { uS = new UserService(context); unvS = new UniversityService(context); fS = new FacultyService(context); sS = new SubjectService(context); qS = new QuestionService(context); }
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()); } }
void AddOrUpdateInstructor(dbcontext context, string courseTitle, string instructorName) { var crs = context.Courses.SingleOrDefault(c => c.Title == courseTitle); var inst = crs.Instructors.SingleOrDefault(i => i.LastName == instructorName); if (inst == null) { crs.Instructors.Add(context.Instructors.Single(i => i.LastName == instructorName)); } }
public JsonResult SearchCountry(string prefix) { dbcontext entities = new dbcontext(); var customers = (from country in entities.Countries select new { label = country.CountryName, val = country.Cid }).ToList(); return(Json(customers)); }
public JsonResult SearchCourse(string prefix) { dbcontext entities = new dbcontext(); var customers = (from customer in entities.CollegeCourses where customer.Name.Contains(prefix) && customer.Status == true select new { label = customer.Name, val = customer.Oid }).ToList(); return(Json(customers)); }
public ActionResult Login(Account objUser) { using (dbcontext db = new dbcontext()) { var obj = db.Accounts.Where(a => a.UserName.Equals(objUser.UserName) && a.Password.Equals(objUser.Password)).FirstOrDefault(); if (obj != null) { Session["UserID"] = obj.UserName.ToString(); Session["UserName"] = obj.Password.ToString(); return(RedirectToAction("Index", "Preforms")); } } return(View(objUser)); }
public async Task <ObservableCollection <bomm> > pushofDB() { ObservableCollection <bomm> db = new ObservableCollection <bomm>(); try { using (var ctx = new dbcontext()) { db = new ObservableCollection <bomm>(ctx.Set <bomm>().ToList()); } } catch (Exception e) { await MainWindow.Instance.ShowMessageAsync("Error", e.Message); } return(db); }
public ActionResult Edit(Person p) { if (ModelState.IsValid) { dbcontext db = new dbcontext(); Person pd = db.Persons.Single(x => x.PersonID == p.PersonID); pd.FirstName = p.FirstName; pd.LastName = p.LastName; pd.Address = p.Address; pd.City = p.City; db.Entry(pd).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Details", new { id = p.PersonID })); } return(View(p)); }
public ActionResult Login(User objUser, Helper help, string sessionname, string user, string pass, string returnUrl) { using (dbcontext db = new dbcontext()) { var obj = db.Users.Where(a => a.UserName.Equals(objUser.UserName) && a.Password.Equals(objUser.Password)).FirstOrDefault(); if (obj != null) { Session["session"] = sessionname; Session["UserName"] = user; return(RedirectToAction("Index", "Registrations")); } else { this.SetNotification("Invalid Login", NotificationEnumeration.Error); return(View("Login")); } } }
public ActionResult CNUserEntryReport(DateTime CNDate, string CNDestination) { db = new dbcontext(); //List<CNInfo> cnData = db.CNInfoset.ToList(); if (CNDestination == "undefined") { CNDestination = "0"; } List <SqlParameter> pram = new List <SqlParameter>(); SqlParameter p1 = new SqlParameter("@CNDate", CNDate); SqlParameter p2 = new SqlParameter("@DestinationId", CNDestination); pram.Add(p1); pram.Add(p2); DataTable dt = SqlHelper.ExecuteDataset(connection, CommandType.StoredProcedure, "UserCNEntryCount", pram.ToArray()).Tables[0]; var viewer = new ReportViewer(); List <ReportParameter> param = new List <ReportParameter>(); viewer.LocalReport.ReportPath = Server.MapPath("~/RDLC/rptUserEntry.rdlc"); viewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt)); param.Add(new ReportParameter("CNDate", CNDate.ToShortDateString())); if (CNDestination == "0") { param.Add(new ReportParameter("Dest", "All")); } else { param.Add(new ReportParameter("Dest", dt.Rows[0][4].ToString())); } viewer.LocalReport.SetParameters(param); viewer.LocalReport.Refresh(); Warning[] warnings; string mimeType; string[] streamids; string encoding; string filenameExtension; var bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings); return(File(bytes, mimeType)); }
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 Search(string CustomerId, int?CountryId) { if (CustomerId != null && CountryId != null) { dbcontext entities = new dbcontext(); IEnumerable <CollegeCourse> ccourse = entities.CollegeCourses.Where(x => x.Name.Contains(CustomerId) && x.Cid == CountryId).ToList(); return(View(ccourse)); } else if (CountryId != null) { dbcontext entities = new dbcontext(); IEnumerable <CollegeCourse> ccourse = entities.CollegeCourses.Where(x => x.Cid == CountryId).ToList(); return(View(ccourse)); } else { dbcontext entities = new dbcontext(); IEnumerable <CollegeCourse> ccourse = entities.CollegeCourses.Where(x => x.Name.Contains(CustomerId)).ToList(); return(View(ccourse)); } }
public ActionResult PartyUpdateReport(DateTime PartyDate, int PartyId, string UpdateStatus) { db = new dbcontext(); List <CNInfo> cnData = db.CNInfoset.ToList(); Warning[] warnings; string mimeType; string[] streamids; string encoding; string filenameExtension; var viewer = new ReportViewer(); viewer.LocalReport.ReportPath = Server.MapPath("~/RDLC/rptDailySales.rdlc"); viewer.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", cnData)); viewer.LocalReport.Refresh(); var bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings); return(File(bytes, mimeType)); }