public ActionResult RequestedList() { DataTable dt = WebAppDAL.GetRequestedUserList(ProjectSession.clientID); List <RequestedListModel> model = new List <RequestedListModel>(); if (dt != null && dt.Rows.Count > 0) { for (var i = 0; i < dt.Rows.Count; i++) { RequestedListModel registrationPageModel = new RequestedListModel(); registrationPageModel.UserID = Convert.ToInt32(dt.Rows[i]["UserID"]); registrationPageModel.EmailAddress = dt.Rows[i]["EmailAddress"].ToString(); registrationPageModel.Type = dt.Rows[i]["Usertype"].ToString(); registrationPageModel.UserName = dt.Rows[i]["Username"].ToString(); if (ProjectSession.clientID != registrationPageModel.UserID) { if (!string.IsNullOrEmpty(Convert.ToString(dt.Rows[i]["Status"]))) { if (Convert.ToInt32(dt.Rows[i]["Status"]) == 0) { model.Add(registrationPageModel); } } } } } return(View("Contact", model)); }
public ActionResult Index(LoginModel model) { DataTable dtlogin = WebAppDAL.UserLogin(model); LoginModel login = new LoginModel(); if (dtlogin.Rows.Count > 0 && dtlogin != null) { login.UserID = Convert.ToInt32(dtlogin.Rows[0]["UserID"]); login.UserName = Convert.ToString(dtlogin.Rows[0]["Username"]); ProjectSession.clientID = login.UserID; ProjectSession.EmailAddress = model.EmailAddress; ProjectSession.UserName = login.UserName; return(RedirectToAction("GetUserPost", "NewsFeed")); } else { RegistrationPageModel modal = new RegistrationPageModel(); List <Types> types = new List <Types>(); types.Add(new Types { UserID = 1, UserType = "Select Type" }); types.Add(new Types { UserID = 2, UserType = "Admin" }); types.Add(new Types { UserID = 3, UserType = "User" }); modal.Types = types; ModelState.AddModelError("EmailAddress", "Please Enter Valid Username Or Password"); return(View("Login", modal)); } }
public ActionResult GetUplodedImage() { string FolderPath; string ServerPath; string result; FolderPath = Constant_UploadImagePath.UserUploadImage; ServerPath = string.Format("{0}://{1}:{2}{3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, (Request.ApplicationPath == "/" ? "" : Request.ApplicationPath)); var tempFolderPath = FolderPath.Replace("~/", ServerPath + "/"); if (Directory.Exists(Server.MapPath(FolderPath))) { ; } { var ImageInfos = new DirectoryInfo(Server.MapPath(FolderPath)).GetFiles().ToList(); } DataTable dtGetUserPost = WebAppDAL.GetUserPostData(ProjectSession.clientID); NewsFeed newsFeed = new NewsFeed(); if (dtGetUserPost != null && dtGetUserPost.Rows.Count > 0) { for (var i = 0; i < 1; i++) { if (!string.IsNullOrEmpty(Convert.ToString(dtGetUserPost.Rows[0]["Imagename"]))) { newsFeed.Data.Add(new UserData { UserPostData = Convert.ToString(dtGetUserPost.Rows[0]["NewsFeed"]), UserName = Convert.ToString(dtGetUserPost.Rows[0]["Username"]), DateTime = Convert.ToDateTime(dtGetUserPost.Rows[i]["CreatedDateTime"]), ImagePath = tempFolderPath + Convert.ToInt32(dtGetUserPost.Rows[0]["UserID"]) + "/" + Convert.ToString(dtGetUserPost.Rows[0]["Imagename"]), }); } else { newsFeed.Data.Add(new UserData { UserPostData = Convert.ToString(dtGetUserPost.Rows[0]["NewsFeed"]), UserName = Convert.ToString(dtGetUserPost.Rows[0]["Username"]), UserID = Convert.ToInt32(dtGetUserPost.Rows[0]["UserID"]), DateTime = Convert.ToDateTime(dtGetUserPost.Rows[0]["CreatedDateTime"]), }); } } } string jsonResult = JsonConvert.SerializeObject(newsFeed); return(new ContentResult { Content = jsonResult, ContentType = "application/json" }); }
public ActionResult Index() { DataTable dt = WebAppDAL.GetUserDetails(ProjectSession.clientID); //List<RegistrationPageModel> model = new List<RegistrationPageModel>(); RegistrationPageModel model = new RegistrationPageModel(); if (dt != null && dt.Rows.Count > 0) { for (var i = 0; i < dt.Rows.Count; i++) { model.FindFriendList.Add(new FindFriendList { UserID = Convert.ToInt32(dt.Rows[i]["UserID"]), UserName = dt.Rows[i]["Username"].ToString(), EmailAddress = dt.Rows[i]["EmailAddress"].ToString(), Type = dt.Rows[i]["Usertype"].ToString() }); } } DataTable dtGetFriendRequestList = WebAppDAL.GetFriendRequestList(ProjectSession.clientID); if (dtGetFriendRequestList != null && dtGetFriendRequestList.Rows.Count > 0) { for (var i = 0; i < dtGetFriendRequestList.Rows.Count; i++) { model.RequestedList.Add(new RequestedListModel { UserID = Convert.ToInt32(dtGetFriendRequestList.Rows[i]["UserID"]), EmailAddress = dtGetFriendRequestList.Rows[i]["EmailAddress"].ToString(), UserName = dtGetFriendRequestList.Rows[i]["Username"].ToString(), Type = dtGetFriendRequestList.Rows[i]["Usertype"].ToString() }); } } DataTable dtGetFriendList = WebAppDAL.GetFriendList(ProjectSession.clientID); if (dtGetFriendList != null && dtGetFriendList.Rows.Count > 0) { for (var i = 0; i < dtGetFriendList.Rows.Count; i++) { model.FriendList.Add(new FriendList { UserID = Convert.ToInt32(dtGetFriendList.Rows[i]["UserID"]), EmailAddress = dtGetFriendList.Rows[i]["EmailAddress"].ToString(), UserName = dtGetFriendList.Rows[i]["Username"].ToString(), Type = dtGetFriendList.Rows[i]["Usertype"].ToString() }); } } return(View(model)); }
public ActionResult RegistrationPage(RegistrationPageModel model) { DataSet dtRegistration = WebAppDAL.UserRegistration(model); if (dtRegistration.Tables.Count > 0) { ModelState.AddModelError("EmailAddress", "This Email Address is already registered"); return(RedirectToAction("Index")); } else { return(RedirectToAction("Index")); } }
public ActionResult OpenUploadFileDialog() { DataTable dtGetLoginUserDetail = WebAppDAL.GetLoginUserDetail(ProjectSession.clientID); NewsFeed newsFeed = new NewsFeed(); if (dtGetLoginUserDetail != null && dtGetLoginUserDetail.Rows.Count > 0) { for (var i = 0; i < dtGetLoginUserDetail.Rows.Count; i++) { newsFeed.Data.Add(new UserData() { UserID = Convert.ToInt32(dtGetLoginUserDetail.Rows[i]["UserID"]), UserName = Convert.ToString(dtGetLoginUserDetail.Rows[i]["Username"]), Email = Convert.ToString(dtGetLoginUserDetail.Rows[i]["EmailAddress"]), FirstName = Convert.ToString(dtGetLoginUserDetail.Rows[i]["Firstname"]), LastName = Convert.ToString(dtGetLoginUserDetail.Rows[i]["Lastname"]) }); } } return(View()); }
public ActionResult GetMutualFriendList(int id) { DataTable dtGetMutualFriend = WebAppDAL.GetMutualFriendList(id, ProjectSession.clientID); ProjectSession.IsMutualFriendTab = true; List <RegistrationPageModel> model = new List <RegistrationPageModel>(); if (dtGetMutualFriend != null && dtGetMutualFriend.Rows.Count > 0) { for (var i = 0; i < dtGetMutualFriend.Rows.Count; i++) { RegistrationPageModel registration = new RegistrationPageModel(); registration.UserID = Convert.ToInt32(dtGetMutualFriend.Rows[i]["UserID"]); registration.EmailAddress = dtGetMutualFriend.Rows[i]["EmailAddress"].ToString(); registration.Type = dtGetMutualFriend.Rows[i]["Usertype"].ToString(); registration.UserName = dtGetMutualFriend.Rows[i]["Username"].ToString(); model.Add(registration); } } return(PartialView("_MutualFriendList", model)); }
public ActionResult UploadImage() { try { var result = new object(); //check if path exist or not checkifPathExistForCurrentUser(); var pathofUploadImage = ""; pathofUploadImage = Server.MapPath(Constant_UploadImagePath.UserUploadImage + ProjectSession.clientID.ToString()); foreach (string filname in Request.Files) { HttpPostedFileBase file = Request.Files[filname]; var filename1 = Path.GetFileName(file.FileName); filename1 = filename1.Replace(' ', '_'); file.SaveAs(Path.Combine(pathofUploadImage, filename1)); pathofUploadImage = Path.Combine(pathofUploadImage, filename1); var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filename1); WebAppDAL.AddUploadedUserImage(ProjectSession.clientID, pathofUploadImage, filename1, fileNameWithoutExtension); } result = new { Message = "Successfully Uploaded Images", IsSuccess = true }; string JsonResult = JsonConvert.SerializeObject(result); return(new ContentResult { Content = JsonResult, ContentType = "application/json" }); } catch (Exception ex) { var result = new { Message = "Uploading fail.", IsSuccess = false }; string JsonResult = Newtonsoft.Json.JsonConvert.SerializeObject(result); return(new ContentResult { Content = JsonResult, ContentType = "application/json" }); } }
public ActionResult GetUserPost() { string FolderPath; string ServerPath; //if (string.IsNullOrEmpty(FolderPath)) //{ FolderPath = Constant_UploadImagePath.UserUploadImage; //} //if(string.IsNullOrEmpty(ServerPath)) //{ ServerPath = string.Format("{0}://{1}:{2}{3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, (Request.ApplicationPath == "/" ? "" : Request.ApplicationPath)); //} var tempFolderPath = FolderPath.Replace("~/", ServerPath + "/"); if (Directory.Exists(Server.MapPath(FolderPath))) { ; } { var ImageInfos = new DirectoryInfo(Server.MapPath(FolderPath)).GetFiles().ToList(); } DataTable dtGetUserPost = WebAppDAL.GetUserPostData(ProjectSession.clientID); NewsFeed newsFeed = new NewsFeed(); if (dtGetUserPost != null && dtGetUserPost.Rows.Count > 0) { for (var i = 0; i < dtGetUserPost.Rows.Count; i++) { //NewsFeed data = new NewsFeed(); //data.UserPostData = Convert.ToString(dtGetUserPost.Rows[i]["NewsFeed"]); if (!string.IsNullOrEmpty(Convert.ToString(dtGetUserPost.Rows[i]["Imagename"]))) { newsFeed.Data.Add(new UserData { UserPostData = Convert.ToString(dtGetUserPost.Rows[i]["NewsFeed"]), UserName = Convert.ToString(dtGetUserPost.Rows[i]["Username"]), UserID = Convert.ToInt32(dtGetUserPost.Rows[i]["UserID"]), DateTime = Convert.ToDateTime(dtGetUserPost.Rows[i]["CreatedDateTime"]), ImagePath = tempFolderPath + Convert.ToInt32(dtGetUserPost.Rows[i]["UserID"]) + "/" + Convert.ToString(dtGetUserPost.Rows[0]["Imagename"]), }); } else { newsFeed.Data.Add(new UserData { UserPostData = Convert.ToString(dtGetUserPost.Rows[i]["NewsFeed"]), UserName = Convert.ToString(dtGetUserPost.Rows[i]["Username"]), UserID = Convert.ToInt32(dtGetUserPost.Rows[i]["UserID"]), DateTime = Convert.ToDateTime(dtGetUserPost.Rows[i]["CreatedDateTime"]), //ImagePath = tempFolderPath + "/" + Convert.ToString(dtGetUserPost.Rows[i]["Imagename"]), }); } //model.Add(new SelectListItem { // Value = Convert.ToString(dtGetUserPost.Rows[i]["NewsFeed"]), // Text = Convert.ToString(dtGetUserPost.Rows[i]["NewsFeed"]), //}); } } //dynamic mymodel = new ExpandoObject(); //mymodel.UserData = model; //ViewBag.NewsFeed = model; return(View("Index", newsFeed)); }
public ActionResult PostNews(NewsFeed newsFeed) { WebAppDAL.InsertNewsFeedData(ProjectSession.clientID, newsFeed.NewsFeeds); return(RedirectToAction("GetUserPost")); }
public ActionResult SendRequest(int id) { int bl = WebAppDAL.SendRequestStatus(id, ProjectSession.clientID); return(RedirectToAction("Index")); }
public ActionResult UnFriend(int id) { WebAppDAL.UnFriend(id, ProjectSession.clientID); return(RedirectToAction("Index")); }
public ActionResult RejectFriendRequest(int ID) { WebAppDAL.RejectRequest(ID, ProjectSession.clientID); return(RedirectToAction("Index")); }
public ActionResult AcceptFriendRequest(int id) { WebAppDAL.AcceptRequest(id, ProjectSession.clientID); return(RedirectToAction("Index")); }
public ActionResult CancelSentRequest(int id) { WebAppDAL.CancelRequestStatus(id); return(RedirectToAction("Index")); }