public ActionResult UserSearch(string query, sbAdministrator admin, int?page) { try { int pageSize = 6; int pageIndex = 1; pageIndex = page.HasValue ? Convert.ToInt32(page) : 1; IPagedList <sbAdministrator> pdetails = null; sbAdministrator sb = new sbAdministrator(); List <sbAdministrator> objsbAdministrator = new List <sbAdministrator>(); sb.Query = admin.Query; objsbAdministrator = admin.SearchAllUsersBind(); sb.pds = objsbAdministrator; pdetails = objsbAdministrator.ToPagedList(pageIndex, pageSize); if (objsbAdministrator.Count == 0) { ViewBag.Message = "Oops! No User Found"; } return(View(pdetails)); } catch (Exception ee) { ViewBag.Message = "Error Occure"; return(View()); } }
public ActionResult AllUsers(sbAdministrator admin, int?page) { try { if (Session["username"] == null) { return(RedirectToAction("Login", "Administrator")); } else { int pageSize = 6; int pageIndex = 1; pageIndex = page.HasValue ? Convert.ToInt32(page) : 1; IPagedList <sbAdministrator> pdetails = null; sbAdministrator sb = new sbAdministrator(); List <sbAdministrator> objsbAdministrator = new List <sbAdministrator>(); objsbAdministrator = admin.AllUsersBind(); sb.pds = objsbAdministrator; pdetails = objsbAdministrator.ToPagedList(pageIndex, pageSize); if (objsbAdministrator.Count == 0) { ViewBag.Message = "Oops! No Record Found"; } return(View(pdetails)); } } catch (Exception ee) { ViewBag.Message = "Error Occure"; return(View()); } }
public ActionResult Login(sbAdministrator login) { try { SbUserService objUserService = new SbUserService(); if (!string.IsNullOrEmpty(login.EmailId)) { sbAdministrator objAdministrator = new sbAdministrator(); objAdministrator.EmailId = login.EmailId; string password = login.Password; objAdministrator.Password = objUserService.GetEncryptedValue(password); DataSet ds = objAdministrator.Sb_Login(); if (ds.Tables[0].Rows.Count > 0) { Session["username"] = ds.Tables[0].Rows[0]["Name"].ToString(); return(RedirectToAction("../Administrator/Index")); } else { ViewBag.Message = "Wrong Email or Password entered"; } } } catch (Exception ee) { ViewBag.Message = "Error Occurred"; } return(View(login)); }
public ActionResult UserDetails(int id, sbAdministrator admin) { try { DataSet ds = new DataSet(); ds = admin.GetByID_Sb_User(); if (ds.Tables[0].Rows.Count > 0) { admin.FirstName = ds.Tables[0].Rows[0]["FirstName"].ToString(); admin.LastName = ds.Tables[0].Rows[0]["LastName"].ToString(); admin.EmailId = ds.Tables[0].Rows[0]["EmailId"].ToString(); admin.Password = ds.Tables[0].Rows[0]["Password"].ToString(); admin.MobileNumber = ds.Tables[0].Rows[0]["MobileNumber"].ToString(); admin.CompanyURL = ds.Tables[0].Rows[0]["CompanyURL"].ToString(); //admin.IsSeller = Convert.ToBoolean(ds.Tables[0].Rows[0]["IsSeller"].ToString()); admin.Status = Convert.ToBoolean(ds.Tables[0].Rows[0]["Status"].ToString()); if (Convert.ToString(ds.Tables[0].Rows[0]["ModifiedOn"]) == "") { admin.ModifiedOn = ""; } else { admin.ModifiedOn = ds.Tables[0].Rows[0]["ModifiedOn"].ToString(); } } return(View(admin)); } catch (Exception ee) { ViewBag.Message = "Error Occure"; return(View()); } }
// GET: Administrator public ActionResult Index(sbAdministrator admin) { if (Session["username"] == null) { return(RedirectToAction("Login", "Administrator")); } else { ViewBag.TotalUser = admin.countTotalUser(); ViewBag.TotalProjects = admin.countTotalProjects(); return(View(admin)); } }
public ActionResult ChangePassword(sbAdministrator chngPass) { try { SbUserService objUserService = new SbUserService(); if (!string.IsNullOrEmpty(chngPass.EmailId)) { sbAdministrator objsbsbAdministrator = new sbAdministrator(); objsbsbAdministrator.EmailId = chngPass.EmailId; objsbsbAdministrator.Password = objUserService.GetEncryptedValue(chngPass.Password); objsbsbAdministrator.NewPassword = objUserService.GetEncryptedValue(chngPass.NewPassword); //objsbsbAdministrator.Name = Session["username"].ToString(); bool IsUpdated = false; IsUpdated = objsbsbAdministrator.UpdateSb_User(); if (IsUpdated) { ViewBag.Message = "Password changed successfully"; } else { ViewBag.Message = "Wrong password entered "; } ModelState.Clear(); ModelState.Remove("EmailId"); chngPass.EmailId = ""; ModelState.Remove("Password"); chngPass.Password = ""; ModelState.Remove("Password"); chngPass.NewPassword = ""; } return(View(chngPass)); } catch (Exception ee) { ViewBag.Message = "Error Occure"; return(View()); } }
public ActionResult DeleteUser(int id, sbAdministrator admin) { try { if (id != 0) { sbAdministrator objsbAdministrator = new sbAdministrator(); objsbAdministrator.ID = id; bool IsDeleted = false; IsDeleted = objsbAdministrator.DeleteByID_Sb_User(); if (IsDeleted) { ViewBag.Message = "Information has been deleted successfully"; } } return(RedirectToAction("AllUsers")); } catch (Exception ee) { ViewBag.Message = "Error Occurred"; return(View()); } }