public ActionResult Ad_Seach_Prac() { using (var Context = new ddc_login2Entities()) { Binddropdowndata(); //var data = Context.search_pract(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty).ToList(); return(View()); } }
public ActionResult Ad_Seach_Prac(FormCollection formdata) { using (var Context = new ddc_login2Entities()) { Binddropdowndata(); //var data= Context.search_pract("", "", "", "", "1351").ToList(); var data = Context.search_pract(Convert.ToString(formdata["fname"]), Convert.ToString(formdata["lname"]), Convert.ToString(formdata["RegistrationNumber"]), Convert.ToString(formdata["Residential"]), Convert.ToString(formdata["ProfessionalCity"])).ToList(); return(View(data)); } }
private void Binddropdowndata() { using (var Context = new ddc_login2Entities()) { TempData["ProfessionalCity"] = Context.tbdocs.Where(z => z.docprocty != null).Select(i => new SelectListItem() { Text = i.docprocty, Value = i.docprocty.ToString() }).Distinct().ToList(); TempData["Residential"] = Context.tbdocs.Where(z => z.docrescty != null).Select(i => new SelectListItem() { Text = i.docrescty, Value = i.docrescty.ToString() }).Distinct().ToList(); //ViewBag.ProfessionalCity = TempData["ProfessionalCity"]; //ViewBag.Residential = TempData["Residential"]; //ViewBag.ProfessionalCity = Context.tbdocs.Where(z => z.docrescty != null).Select(i => new SelectListItem() { Text = i.docrescty, Value = i.docrescty.ToString() }).Distinct().ToList(); //ViewBag.Residential = Context.tbdocs.Where(z => z.docprocty != null).Select(i => new SelectListItem() { Text = i.docprocty, Value = i.docprocty.ToString() }).Distinct().ToList(); } }
public ActionResult Login(tbusr model) { if (ModelState.IsValid) { using (var context = new ddc_login2Entities()) { bool IsValidUser = context.tbusrs.Any(user => user.usrnam.ToLower() == model.usrnam.ToLower() && user.usrpwd == model.usrpwd); if (IsValidUser) { FormsAuthentication.SetAuthCookie(model.usrnam, false); return(RedirectToAction("Ad_Seach_Prac", "Main")); } ModelState.AddModelError("", "invalid Username or Password"); return(View()); } } else { return(View(model)); } }
public ActionResult Getexcelreport(FormCollection formdata) { Binddropdowndata(); using (var Context = new ddc_login2Entities()) { //var data= Context.search_pract("", "", "", "", "1351").ToList(); var data = Context.search_pract(Convert.ToString(formdata["fname"]), Convert.ToString(formdata["lname"]), Convert.ToString(formdata["RegistrationNumber"]), Convert.ToString(formdata["Residential"]), Convert.ToString(formdata["ProfessionalCity"])).ToList(); var gv = new GridView(); gv.DataSource = data;//this.GetEmployeeList(); gv.DataBind(); Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment; filename=DemoExcel.xls"); Response.ContentType = "application/ms-excel"; Response.Charset = ""; StringWriter objStringWriter = new StringWriter(); HtmlTextWriter objHtmlTextWriter = new HtmlTextWriter(objStringWriter); gv.RenderControl(objHtmlTextWriter); Response.Output.Write(objStringWriter.ToString()); Response.Flush(); Response.End(); return(View("Ad_Seach_Prac")); } }