public ActionResult Index() { this.LoadIsAdmin(); //ViewBag.SMSAPI= ConfigurationManager.ConnectionStrings["MSG91"] != null ? ConfigurationManager.ConnectionStrings["MSG91"].ConnectionString : ""; var countries = objUser.Select_STP_GetUserDetails().Where(p => p.ismarried == 1 && p.UserType.ToUpper() == "USER"); int pageindex = 0; var filter = countries.OrderBy(p => p.UserId).Skip(pageindex * PageSize).Take(PageSize); Session["users"] = countries; Session["pageindex"] = 0; return(View("Index", filter)); }
public ActionResult SendRequest(int RequestUserId) { if (SessionManager.GetInstance.ActiveUser != null) { ResponseModel model = new ResponseModel() { ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.InvalidUserNamePassword : "******", Status = false, }; bool Success = false; var requestedUser = objUser.Select_STP_GetUserDetails().Where(p => p.UserId == RequestUserId).FirstOrDefault(); if (requestedUser.Gender.ToUpper() == SessionManager.GetInstance.ActiveUser.Gender.ToUpper()) { Success = false; model.ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.RequestSentFailed : "Not able to send request."; } else { Success = objUser.SendRequest(RequestUserId, SessionManager.GetInstance.ActiveUser.UserId); if (Success == false) { model.ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.RequestAlreadySent : "Request already sent for approval."; } } model.Status = Success; return(Json(model, JsonRequestBehavior.AllowGet)); } else { return(Json(new ResponseModel() { Status = false, ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.RequestLogin : "******" })); } }
public ActionResult AddAgent(RegisterViewModel model) { var countries = objUser.Select_STP_GetUserDetails(); UserDetails obj = new UserDetails(); obj.Status = true; try { var checkexist = countries.Where(p => p.MobileNo.ToUpper() == model.MobileNo.ToUpper()); obj.ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.AlreadyExist : "माहिती सेव केली आहे."; if (checkexist.Count() == 0) { model.IsActive = true; model.UserType = "Agent"; obj.ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.InformationSave : "माहिती सेव केली आहे."; objUser.SaveAgent(model); } else { obj.Status = false; obj.ErrorMessage = "Another user registerd with same mobile number."; } int pageindex = 0; var filter = objUser.GetAgentDetails().OrderBy(p => p.UserId).Skip(pageindex * PageSize).Take(PageSize); Session["users"] = countries; Session["pageindex"] = 0; obj.UserList = filter; } catch (Exception) { obj.Status = false; obj.ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.FailedToSave : "माहिती सेव करू शकत नाही"; } return(Json(obj, JsonRequestBehavior.AllowGet)); }
public ActionResult Index(int?UserId) { this.LoadIsAdmin(); string gender = SessionManager.GetInstance.ActiveUser.Gender == "M" ? "F" : "M"; List <SelectListItem> lst = new List <SelectListItem>(); lst = (from tbl in objUser.Select_STP_GetUserDetails() where tbl.UserId != SessionManager.GetInstance.ActiveUser.UserId && tbl.Gender == gender && tbl.UserType.ToUpper() != "ADMIN" select new SelectListItem { Text = tbl.FirstName + " " + tbl.LName, Value = tbl.UserId.Value.ToString(), }).ToList(); lst.Insert(0, new SelectListItem() { Value = "0", Text = "----Select User----" }); ViewBag.UserId = lst; ViewBag.SelectedUserId = UserId == null?0:UserId; ViewBag.ActiveUserId = SessionManager.GetInstance.ActiveUser.UserId; return(View("Index")); }
public static void LoadIsAdmin(this ControllerBase target) { try { target.ViewBag.IsAdmin = false; var user = new UserContextModel(); var users = user.Select_STP_GetUserDetails(); target.ViewBag.Gender = "M"; target.ViewBag.TotalUsers = users.Where(p => p.UserType.ToUpper() == "USER").Count(); var dt = DateTime.Now.Date.AddDays(-15); target.ViewBag.MarriedBrideCount = users.Where(p => p.Gender.ToUpper() == "F" && p.UserType.ToUpper() == "USER" && p.ismarried == 1).Count(); target.ViewBag.MarriedGroomCount = users.Where(p => p.Gender.ToUpper() == "M" && p.UserType.ToUpper() == "USER" && p.ismarried == 1).Count(); target.ViewBag.BridesCount = users.Where(p => p.Gender.ToUpper() == "F" && p.UserType.ToUpper() == "USER").Count(); target.ViewBag.BridesCount = target.ViewBag.BridesCount - target.ViewBag.MarriedBrideCount; target.ViewBag.GroomCount = users.Where(p => p.Gender.ToUpper() == "F" && p.UserType.ToUpper() == "USER").Count(); target.ViewBag.GroomCount = target.ViewBag.GroomCount - target.ViewBag.MarriedGroomCount; //target.ViewBag.NewRegisterd = users.Where(p => dt <= p.DateofReg.Value.Date).Count(); target.ViewBag.UserId = SessionManager.GetInstance.ActiveUser.UserId; target.ViewBag.UserName = ""; if (SessionManager.GetInstance.ActiveUser != null) { bool IsAdmin = SessionManager.GetInstance.ActiveUser.UserType.Equals("User") == true ? false : true; target.ViewBag.IsAdmin = IsAdmin; target.ViewBag.UserName = SessionManager.GetInstance.ActiveUser.FirstName + " " + SessionManager.GetInstance.ActiveUser.LName; if (IsAdmin == false) { target.ViewBag.Gender = SessionManager.GetInstance.ActiveUser.Gender; } target.ViewBag.VisitorCount = user.GetVisitors().Count(); } target.ViewBag.Title = SettingsManager.Instance.Branding; } catch (Exception) { } }
public ActionResult Login(LoginViewModel model) { STP_GetUserDetail user = null; if (SettingsManager.Instance.Branding != "SINDHI") { user = objUser.Select_STP_GetUserDetails().Where(p => p.UserName.ToUpper() == model.UserName.ToUpper() && p.Password.ToUpper() == model.Password.ToUpper() && p.ismarried == 0).FirstOrDefault(); } else { user = objUser.Select_STP_GetUserDetails().Where(p => p.MobileNo.ToUpper() == model.MobileNo.ToUpper() && p.Password.ToUpper() == model.Password.ToUpper() && p.ismarried == 0).FirstOrDefault(); } if (user != null) { string IP = Request.ServerVariables["REMOTE_ADDR"]; var objLoginDetails = new LoginDetails() { Location = "", LoginDate = DateTime.Now, LoginIP = IP, UserId = user.UserId, }; objUser.SaveLoginDetails(objLoginDetails); if (Convert.ToBoolean(user.IsActive) && user.UserType.ToUpper() != "AGENT") { SessionManager.GetInstance.ActiveUser = user; var lst = new List <RegisterViewModel>(); lst.Add(new RegisterViewModel() { UserId = user.UserId, FirstName = user.FirstName, Gender = user.Gender, UserType = user.UserType }); return(Json(new ResponseModel() { Status = true, ErrorMessage = "", DataResponse = lst.AsQueryable() }, JsonRequestBehavior.AllowGet)); } else if (!Convert.ToBoolean(user.IsActive) && user.UserType.ToUpper() == "USER" && user.DateOfBirth == null) { SessionManager.GetInstance.ActiveUser = user; var lst = new List <RegisterViewModel>(); lst.Add(new RegisterViewModel() { UserId = user.UserId, FirstName = user.FirstName, Gender = user.Gender, UserType = "USER" }); return(Json(new ResponseModel() { Status = true, ErrorMessage = "", DataResponse = lst.AsQueryable() }, JsonRequestBehavior.AllowGet)); } else { if (user.UserType.ToUpper() == "ADMIN") { SessionManager.GetInstance.ActiveUser = user; var lst = new List <RegisterViewModel>(); lst.Add(new RegisterViewModel() { UserId = user.UserId, FirstName = user.FirstName, Gender = user.Gender, UserType = "ADMIN" }); return(Json(new ResponseModel() { Status = true, ErrorMessage = "", DataResponse = lst.AsQueryable() }, JsonRequestBehavior.AllowGet)); } else { if (user.UserType.ToUpper() == "AGENT") { if (SettingsManager.Instance.Branding == "SINDHI") { SessionManager.GetInstance.ActiveUser = user; var lst = new List <RegisterViewModel>(); lst.Add(new RegisterViewModel() { UserId = user.UserId, FirstName = user.FirstName, Gender = user.Gender, UserType = "AGENT" }); return(Json(new ResponseModel() { Status = true, ErrorMessage = "", DataResponse = lst.AsQueryable() }, JsonRequestBehavior.AllowGet)); } else { return(Json(new ResponseModel() { Status = false, ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.AgentLogin : "******" }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new ResponseModel() { Status = false, ErrorMessage = SettingsManager.Instance.Branding == "SINDHI" ? Resources.SPMOResources.AccountActivate : "आपले खाते 48 तासांच्या आत सक्रिय होईल ." }, JsonRequestBehavior.AllowGet)); } } } } else { return(Json(new ResponseModel() { Status = false, ErrorMessage = SettingsManager.Instance.Branding == "SINDHI"? Resources.SPMOResources.InvalidUserNamePassword :"******" }, JsonRequestBehavior.AllowGet)); } }