public ActionResult getSangamDashboardData()
 {
     Mugurtham.Core.Login.LoggedInUser objLoggedIn = (Mugurtham.Core.Login.LoggedInUser)Session["LoggedInUser"];
     Core.Sangam.SangamDashboardEntity objSangamDashboardEntity = new Core.Sangam.SangamDashboardEntity();
     SangamDashboardCore objSangamDashboardCore = new SangamDashboardCore();
     using (objSangamDashboardCore as IDisposable)
     {
         objSangamDashboardCore.GetSangamDashboardData(Helpers.ConnectionString, objLoggedIn.sangamID, ref objSangamDashboardEntity);
     }
     objSangamDashboardCore = null;
     return this.Json(objSangamDashboardEntity, JsonRequestBehavior.AllowGet);
 }
示例#2
0
        public int GetSangamDashboardData(string strConnectionString, string strSangamID,
                                          ref Core.Sangam.SangamDashboardEntity objSangamDashboardEntity)
        {
            try
            {
                using (SqlConnection objSqlConnection = new SqlConnection(strConnectionString))
                {
                    objSqlConnection.Open();
                    // 1.  create a command object identifying the stored procedure
                    SqlCommand objSqlCommand = new SqlCommand("UspGetSangamProfilesInfo", 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("@SangamID", strSangamID));
                    // execute the command
                    using (SqlDataReader objSqlDataReader = objSqlCommand.ExecuteReader())
                    {
                        while (objSqlDataReader.Read())
                        {
                            if (!string.IsNullOrEmpty(objSqlDataReader["LoggedInCount"].ToString()))
                            {
                                objSangamDashboardEntity.TotalLogin = Convert.ToInt32(objSqlDataReader["LoggedInCount"].ToString());
                            }
                            if (!string.IsNullOrEmpty(objSqlDataReader["ViewedProfile"].ToString()))
                            {
                                objSangamDashboardEntity.ProfilesViewed = Convert.ToInt32(objSqlDataReader["ViewedProfile"].ToString());
                            }
                            if (!string.IsNullOrEmpty(objSqlDataReader["ActiveProfiles"].ToString()))
                            {
                                objSangamDashboardEntity.ActiveProfiles = Convert.ToInt32(objSqlDataReader["ActiveProfiles"].ToString());
                            }
                            if (!string.IsNullOrEmpty(objSqlDataReader["TotalProfiles"].ToString()))
                            {
                                objSangamDashboardEntity.TotalProfiles = Convert.ToInt32(objSqlDataReader["TotalProfiles"].ToString());
                            }
                        }
                        objSqlDataReader.Close();
                    }
                    objSqlCommand.Cancel();
                    objSqlCommand.Dispose();
                    objSqlConnection.Close();
                    objSqlConnection.Dispose();
                }
            }
            catch (Exception objEx)
            {
                Helpers.LogExceptionInFlatFile(objEx);
            }
            return(0);
        }
 public ActionResult getSangamDashboardData()
 {
     Core.Sangam.SangamDashboardEntity objSangamDashboardEntity = new Core.Sangam.SangamDashboardEntity();
     try
     {
         Mugurtham.Core.Login.LoggedInUser objLoggedIn = (Mugurtham.Core.Login.LoggedInUser)Session["LoggedInUser"];
         SangamDashboardCore objSangamDashboardCore    = new SangamDashboardCore(ref objLoggedIn);
         using (objSangamDashboardCore as IDisposable)
         {
             objSangamDashboardCore.GetSangamDashboardData(objLoggedIn.ConnectionString, objLoggedIn.sangamID, ref objSangamDashboardEntity);
         }
         objSangamDashboardCore = null;
     }
     catch (Exception objEx)
     {
         Helpers.LogExceptionInFlatFile(objEx);
     }
     finally
     {
         // ((IDisposable)objSangamDashboardEntity).Dispose();
     }
     return(this.Json(objSangamDashboardEntity, JsonRequestBehavior.AllowGet));
 }