public JsonResultEntity Create([FromBody] UserProfileEntity userprofileEntity) { UserProfileBL userprofileBL = new UserProfileBL(); JsonResultEntity response = new JsonResultEntity(); return(response); try { var result = userprofileBL.Create(userprofileEntity); if (result.HasWarning()) { response.Message = String.Join(",", result.Warning); return(response); } response.Success = true; response.Data = result.Value; } catch (Exception ex) { response.Message = ex.Message; LoggerHelper.Error(ex); } return(response); }
public ActionResult UserProfile(string Id) { if (Id != null) { OrganizationBL organizationBL = new OrganizationBL(); var organization = organizationBL.OrganizationList(); var collection = organization.Select(s => new { Name = s.Name, ID = s.OrganizationID }).ToList(); UserProfileBL userProfile = new UserProfileBL(); var countries = userProfile.GetCountries().Select(s => new { Text = s.CoutnryName, Value = s.CountryID }).ToList(); ViewBag.UserId = Id; ViewBag.Organizations = new SelectList(collection, "ID", "Name"); ViewBag.CountryDropDown = new SelectList(countries, "Value", "Text"); return(View()); } else { return(View("Index")); } }
public UserProfileResponse RetrieveAllUserProfiles(UserProfileRequest obj) { UserProfileResponse result = new UserProfileResponse(); DbConnectionHandler dbConnectionHandler = new DbConnectionHandler(); DbConnection dbConnection = dbConnectionHandler.GetSqlConnection(obj.ConnString); SqlTransaction transaction = null; try { dbConnectionHandler.OpenDbConnection(dbConnection); transaction = (SqlTransaction)dbConnection.BeginTransaction(); UserProfileBL userProfileBL = new UserProfileBL(); result.UserProfileList = userProfileBL.RetrieveAllUserProfiles(obj.UserProfileType, dbConnection, transaction); } catch (Exception ex) { AppLog.GetAppLog().Log("Error: occurred in retrieving from query RetriveAllUserProfiles."); AppLog.GetAppLog().Log(ex.ToString()); AppLog.GetAppLog().HasError = true; throw ex; } finally { dbConnectionHandler.CloseDbConnection(dbConnection); } return(result); }
public ActionResult UserProfile(UserProfileViewModel viewModel) { var userProfileBL = new UserProfileBL(); userProfileBL.UserProfileInsert(viewModel); int?orgID = viewModel.SelectedOrganization; return(RedirectToAction("Profile", new { UserId = viewModel.UserID, orgID })); }
public ActionResult EditUserProfile(EditUserProfileViewModel viewModel) { UserProfileBL profileBL = new UserProfileBL(); profileBL.InsertEditedUserProfile(viewModel); int?orgID = viewModel.OrganizationID; return(RedirectToAction("Profile", new { UserId = viewModel.UserID, orgID })); }
public JsonResult CitesByStateID(int id) { UserProfileBL bl = new UserProfileBL(); List <SelectListItem> list = new List <SelectListItem>(); var cities = bl.GetCitiesByStateId(id).Select(s => new { Text = s.CityName, Id = s.CityID }).ToList(); var city = new SelectList(cities, "Id", "Text"); return(Json(new { city }, JsonRequestBehavior.AllowGet)); }
public JsonResult StatesByCountryID(int id) { UserProfileBL bl = new UserProfileBL(); List <SelectListItem> list = new List <SelectListItem>(); var states = bl.GetStatesByCountryId(id).Select(s => new { Text = s.StateName, Id = s.StateID }).ToList(); var state = new SelectList(states, "Id", "Text"); return(Json(new { state }, JsonRequestBehavior.AllowGet)); }
public ActionResult Profile(string userID, int?orgID) { if (userID != null && orgID != null) { UserProfileBL BL = new UserProfileBL(); var profile = BL.GetProfileByUserIdentity(userID); return(View(profile)); } else { return(View("Index")); } }
public static string GetUserFullName(this IIdentity identity) { if (identity.GetUserId() != "") { var userProfile = new UserProfileBL().GetProfileByUserIdentity(identity.GetUserId()); if (userProfile != null) { return(userProfile.FirstName + " " + userProfile.LastName); } return(""); } return(""); }
public static int GetUserProfileID(this IIdentity identity) { if (identity.GetUserId() != "") { var userProfile = new UserProfileBL().GetProfileByUserIdentity(identity.GetUserId()); if (userProfile != null) { return(userProfile.UserProfileID); } return(0); } return(0); }
public ActionResult Index() { UserProfileBL profileBL = new UserProfileBL(); var userID = User.Identity.GetUserId(); if (userID != null) { var check = profileBL.IsProfilecompleted(userID); if (check == false || check == null) { return(RedirectToAction("UserProfile", "Home", new { id = userID })); } } return(View()); }
public ActionResult Wall() { var userID = User.Identity.GetUserId(); if (Request.QueryString["user"] != null && Request.QueryString["user"] != "") { userID = Request.QueryString["user"].ToString(); } else { userID = new UserProfileBL().GetProfileByUserIdentity(userID).UserProfileID.ToString(); } var postVM = new PostBL().GetPostsWithLikesAndComments(Convert.ToInt32(userID)); return(View(postVM)); }
public ActionResult EditUserProfile(string userID, int?orgID) { if (userID != null && orgID != null) { UserProfileBL profileBL = new UserProfileBL(); var countries = profileBL.GetCountries().Select(s => new { Text = s.CoutnryName, Value = s.CountryID }).ToList(); ViewBag.CountryDropDown = new SelectList(countries, "Value", "Text"); EditUserProfileViewModel viewModel = profileBL.EditUserProfile(userID, orgID); return(View(viewModel)); } else { return(View("Index")); } }
public JsonResultEntity Delete(int id) { var userprofileBL = new UserProfileBL(); JsonResultEntity response = new JsonResultEntity(); try { var result = userprofileBL.DeleteById(id); if (result.HasWarning()) { response.Message = String.Join(",", result.Warning); return(response); } response.Success = true; response.Data = result.Value; } catch (Exception e) { response.Message = e.Message; LoggerHelper.Error(e); } return(response); }
public override JsonResultEntity Get([FromBody] DBParamEntity dbParamEntity) { UserProfileBL userprofileBL = new UserProfileBL(); JsonResultEntity response = new JsonResultEntity(); try { var result = userprofileBL.GetAll(dbParamEntity); if (result.HasWarning()) { response.Message = String.Join(",", result.Warning); return(response); } var dataFound = userprofileBL.GetTotalRows(dbParamEntity); var totalPages = Convert.ToInt32(Math.Ceiling(dataFound.Value / Convert.ToDouble(dbParamEntity.Limit))); response.Success = true; response.Data = result.Value; response.MetaInfo = new MetaInfoEntity { DataFound = dataFound.Value, DataPerPage = dbParamEntity.Limit, Page = dbParamEntity.Page, TotalPages = totalPages == 0 ? 1 : totalPages }; } catch (Exception ex) { response.Message = ex.Message; LoggerHelper.Error(ex); } return(response); }
public BaseController() { var userProfileID = System.Web.HttpContext.Current.User.Identity.GetUserProfileID(); int userProfileIDCopy = userProfileID; if (System.Web.HttpContext.Current.Request.QueryString["user"] != null && System.Web.HttpContext.Current.Request.QueryString["user"] != "") { userProfileID = Convert.ToInt32(System.Web.HttpContext.Current.Request.QueryString["user"]); } if (userProfileID > 0) { var userProfileBL = new UserProfileBL(); var friendRequestBL = new FriendRequestBL(); var notificationBL = new NotificationBL(); var userData = new ProfileViewModel(); //Get user profile userData = userProfileBL.GetProfileByUserProfileID(userProfileID); //Get user notificaitons var notifications = notificationBL.GetNotificationsByUser(userProfileID); userData.Notifications = notifications; //Get user friends var friendRequests = friendRequestBL.GetFriendsByUserProfileID(userProfileIDCopy); //Get other user friends var otherFriendRequests = friendRequestBL.GetFriendsByUserProfileID(userProfileID); //Check if friend request sent if (friendRequests.Where(w => w.FriendID == userProfileID && w.IsFriendRequestPending == true).ToList().Count > 0) { userData.IsFriendRequestSent = true; } //Check if friend if (friendRequests.Where(w => w.FriendID == userProfileID && w.IsFriendRequestPending == false).ToList().Count > 0 || otherFriendRequests.Where(w => w.FriendID == userProfileIDCopy && w.IsFriendRequestPending == false).ToList().Count > 0) { userData.IsFriend = true; } //Check if friend request pending //if (friendRequestBL.GetFriendsByUserProfileID(userProfileIDCopy, true).Count > 0) if (friendRequests.Where(w => w.IsFriendRequestPending == true).ToList().Count > 0) { userData.IsFriendRequestPending = true; } var today = DateTime.Today; // Calculate the age. var age = today.Year - userData.DOB.Value.Year; // Do stuff with it. if (userData.DOB.Value > today.AddYears(-age)) { age--; userData.Age = age.ToString() + " y"; } if (System.Web.HttpContext.Current.Request.QueryString["user"] != null && System.Web.HttpContext.Current.Request.QueryString["user"] != "") { if (userProfileIDCopy == Convert.ToInt32(System.Web.HttpContext.Current.Request.QueryString["user"])) { userData.IsOwnProfile = true; } else { userData.IsOwnProfile = false; } } else { userData.IsOwnProfile = true; } ViewBag.LayoutModel = userData; } }