public ActionResult getInterestedInMeProfiles() { string strGender = "admin"; // Mugurtham admin, Sangam admin, public user Mugurtham.Core.Login.LoggedInUser objLoggedIn = (Mugurtham.Core.Login.LoggedInUser)Session["LoggedInUser"]; if (objLoggedIn.roleID == Mugurtham.Core.Constants.RoleIDForUserProfile) // User Profiles { if (!string.IsNullOrWhiteSpace(objLoggedIn.BasicInfoCoreEntity.Gender)) { if (objLoggedIn.BasicInfoCoreEntity.Gender.ToLower().Trim() == "male".ToLower().Trim()) { strGender = "female"; } else { strGender = "male"; } } } ProfileBasicViewEntity objProfileBasicViewEntity = new ProfileBasicViewEntity(); ProfileInterestedCore objProfileInterestedCore = new ProfileInterestedCore(ref objLoggedIn); using (objProfileInterestedCore as IDisposable) { objProfileInterestedCore.GetInterestedInMeProfiles(Utility.connectionString(), strGender, objLoggedIn.LoginID, objLoggedIn.sangamID, ref objProfileBasicViewEntity, ref objLoggedIn ); } objProfileInterestedCore = null; return(this.Json(objProfileBasicViewEntity, JsonRequestBehavior.AllowGet)); }
public ActionResult getAllProfiles(bool lazyLoad = false) { string strGender = "admin"; // Mugurtham admin, Sangam admin, public user Mugurtham.Core.Login.LoggedInUser objLoggedIn = (Mugurtham.Core.Login.LoggedInUser)Session["LoggedInUser"]; if (objLoggedIn.roleID == Constants.RoleIDForUserProfile) // User Profiles { if (!string.IsNullOrWhiteSpace(objLoggedIn.BasicInfoCoreEntity.Gender)) { if (objLoggedIn.BasicInfoCoreEntity.Gender.ToLower().Trim() == "male".ToLower().Trim()) { strGender = "female"; } else { strGender = "male"; } } } //string cs = System.Configuration.ConfigurationManager.ConnectionStrings["connectionStringName"].ConnectionString; ProfileBasicViewEntity objProfileBasicViewEntity = new ProfileBasicViewEntity(); PorfileBasicInfoViewCore objPorfileBasicInfoViewCore = new PorfileBasicInfoViewCore(); using (objPorfileBasicInfoViewCore as IDisposable) { objPorfileBasicInfoViewCore.GetAllProfiles(Utility.connectionString(), strGender, lazyLoad, ref objProfileBasicViewEntity, ref objLoggedIn ); } objPorfileBasicInfoViewCore = null; //Uncommented the below code for performance optimization - Apr 11 2016 - Anand J /* * List<ProfileCore> objProfileCoreList = new List<ProfileCore>(); * ProfileCore objProfileCore = new ProfileCore(); * using (objProfileCore as IDisposable) * objProfileCore.GetAll(ref objProfileCoreList, strGender, objLoggedIn.sangamID); * objProfileCore = null;*/ //Response.AddHeader("Content-Encoding", "gzip"); var jsonResult = this.Json(objProfileBasicViewEntity.ProfileBasicInfoViewCoreEntityList, JsonRequestBehavior.AllowGet); jsonResult.MaxJsonLength = int.MaxValue; return(jsonResult); //return this.Json(objProfileBasicViewEntity.ProfileBasicInfoViewCoreEntityList, JsonRequestBehavior.AllowGet); }
public int GetInterestedInMeProfiles(string strConnectionString, string strGender, string strInterestedProfileID, string strSangamID, ref ProfileBasicViewEntity objProfileBasicViewEntity, ref Mugurtham.Core.Login.LoggedInUser objLoggedIn) { List <PhotoCoreEntity> objPhotoCoreEntityList = new List <PhotoCoreEntity>(); try { List <ProfileBasicInfoViewCoreEntity> objProfileBasicInfoViewCoreEntityList = new List <ProfileBasicInfoViewCoreEntity>(); if (objLoggedIn.roleID == Constants.RoleIDForUserProfile) // User Profiles { if (!string.IsNullOrWhiteSpace(objLoggedIn.BasicInfoCoreEntity.Gender)) { if (objLoggedIn.BasicInfoCoreEntity.Gender.ToLower().Trim() == "male".ToLower().Trim()) { strGender = "female"; } else { strGender = "male"; } } } using (SqlConnection objSqlConnection = new SqlConnection(strConnectionString)) { objSqlConnection.Open(); // 1. create a command object identifying the stored procedure SqlCommand objSqlCommand = new SqlCommand("uspGetInterestedInMeProfiles", objSqlConnection); // 2. set the command object so it knows to execute a stored procedure objSqlCommand.CommandType = CommandType.StoredProcedure; // 3. add parameter to command, which will be passed to the stored procedure objSqlCommand.Parameters.Add(new SqlParameter("@GENDER", strGender)); objSqlCommand.Parameters.Add(new SqlParameter("@InterestedID", strInterestedProfileID)); objSqlCommand.Parameters.Add(new SqlParameter("@SangamID", strSangamID)); // execute the command using (SqlDataReader objSqlDataReader = objSqlCommand.ExecuteReader()) { while (objSqlDataReader.Read()) { ProfileBasicInfoViewCoreEntity objProfileBasicInfoViewCoreEntity = new ProfileBasicInfoViewCoreEntity(); objProfileBasicInfoViewCoreEntity.SangamProfileID = objSqlDataReader["SangamProfileID"].ToString(); objProfileBasicInfoViewCoreEntity.MugurthamProfileID = objSqlDataReader["MugurthamProfileID"].ToString(); objProfileBasicInfoViewCoreEntity.Name = objSqlDataReader["Name"].ToString(); objProfileBasicInfoViewCoreEntity.Gender = objSqlDataReader["Gender"].ToString(); objProfileBasicInfoViewCoreEntity.Education = objSqlDataReader["Education"].ToString(); objProfileBasicInfoViewCoreEntity.Location = objSqlDataReader["Location"].ToString(); objProfileBasicInfoViewCoreEntity.Occupation = objSqlDataReader["Occupation"].ToString(); objProfileBasicInfoViewCoreEntity.SangamID = objSqlDataReader["SangamID"].ToString(); objProfileBasicInfoViewCoreEntity.SangamName = objSqlDataReader["SangamName"].ToString(); objProfileBasicInfoViewCoreEntity.SubCaste = objSqlDataReader["Subcaste"].ToString(); objProfileBasicInfoViewCoreEntity.Star = objSqlDataReader["Star"].ToString(); objProfileBasicInfoViewCoreEntity.AboutMe = objSqlDataReader["AboutMe"].ToString(); if (!string.IsNullOrEmpty(objSqlDataReader["Age"].ToString())) { objProfileBasicInfoViewCoreEntity.Age = Convert.ToInt32(objSqlDataReader["Age"].ToString()); } objProfileBasicInfoViewCoreEntityList.Add(objProfileBasicInfoViewCoreEntity); } if (objSqlDataReader.NextResult()) { while (objSqlDataReader.Read()) { PhotoCoreEntity objPhotoCoreEntity = new PhotoCoreEntity(); using (objPhotoCoreEntity as IDisposable) { objPhotoCoreEntity.ID = objSqlDataReader["ID"].ToString(); objPhotoCoreEntity.ProfileID = objSqlDataReader["ProfileID"].ToString(); objPhotoCoreEntity.PhotoPath = objSqlDataReader["PhotoPath"].ToString(); objPhotoCoreEntity.IsProfilePic = Convert.ToDecimal(objSqlDataReader["IsProfilePic"].ToString()); objPhotoCoreEntityList.Add(objPhotoCoreEntity); } objPhotoCoreEntity = null; } } objProfileBasicViewEntity.ProfileBasicInfoViewCoreEntityList = objProfileBasicInfoViewCoreEntityList; objProfileBasicViewEntity.PhotoCoreEntityList = objPhotoCoreEntityList; objSqlDataReader.Close(); } objSqlCommand.Cancel(); objSqlCommand.Dispose(); objSqlConnection.Close(); objSqlConnection.Dispose(); } } catch (Exception objEx) { Helpers.LogExceptionInFlatFile(objEx); } return(0); }