Example #1
0
 public ActionResult getAllProfiles()
 {
     string strGender = "admin"; // Mugurtham admin, Sangam admin, public user
     Mugurtham.Core.Login.LoggedInUser objLoggedIn = (Mugurtham.Core.Login.LoggedInUser)Session["LoggedInUser"];
     if (objLoggedIn.roleID == "F62DDFBE55448E3A3") // 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,
             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");
     return this.Json(objProfileBasicViewEntity, JsonRequestBehavior.AllowGet);
 }
        public int GetInterestedProfiles(string strConnectionString, string strGender,
            string strInterestedProfileID, string strSangamID,
           ref ProfileBasicViewEntity objProfileBasicViewEntity,
           ref Mugurtham.Core.Login.LoggedInUser objLoggedIn)
        {
            List<PhotoCoreEntity> objPhotoCoreEntityList = new List<PhotoCoreEntity>();
            List<ProfileBasicInfoViewCoreEntity> objProfileBasicInfoViewCoreEntityList = new List<ProfileBasicInfoViewCoreEntity>();
            try
            {
                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("uspGetInterestedProfiles", 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;
        }
Example #3
0
 public ActionResult getViewedProfiles()
 {
     string strGender = "admin"; // Mugurtham admin, Sangam admin, public user
     Mugurtham.Core.Login.LoggedInUser objLoggedIn = (Mugurtham.Core.Login.LoggedInUser)Session["LoggedInUser"];
     if (objLoggedIn.roleID == "F62DDFBE55448E3A3") // User Profiles
     {
         if (!string.IsNullOrWhiteSpace(objLoggedIn.BasicInfoCoreEntity.Gender))
         {
             if (objLoggedIn.BasicInfoCoreEntity.Gender.ToLower().Trim() == "male".ToLower().Trim())
                 strGender = "female";
             else
                 strGender = "male";
         }
     }
     ProfileCore objProfileCore = new ProfileCore();
     ProfileBasicViewEntity objProfileBasicViewEntity = new ProfileBasicViewEntity();
     using (objProfileCore as IDisposable)
     {
         objProfileCore.GetViewedProfiles(Utility.connectionString(), strGender,
             objLoggedIn.LoginID, objLoggedIn.sangamID,
             ref objProfileBasicViewEntity,
             ref objLoggedIn
             );
     }
     objProfileCore = null;
     return this.Json(objProfileBasicViewEntity, JsonRequestBehavior.AllowGet);
 }
Example #4
0
        public int GetAllProfiles(string strConnectionString, string strGender, bool lazyLoad,
                                  ref ProfileBasicViewEntity objProfileBasicViewEntity,
                                  ref Mugurtham.Core.Login.LoggedInUser objLoggedIn)
        {
            try
            {
                List <PhotoCoreEntity> objPhotoCoreEntityList = new List <PhotoCoreEntity>();
                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("uspGetProfileBasicInfoViewLazyLoad", 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("@SangamID", objLoggedIn.sangamID));
                    objSqlCommand.Parameters.Add(new SqlParameter("@lazyLoad", lazyLoad));

                    //using (SqlDataAdapter objSqlDataAdapter = new SqlDataAdapter(objSqlCommand))
                    //{
                    //    // Fill the DataSet using default values for DataTable names, etc
                    //    DataSet objDataSet = new DataSet();
                    //    objSqlDataAdapter.Fill(objDataSet);
                    //}

                    // 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);
        }