Пример #1
0
        public static SqlDataReader GetGMapList(string listid, string which, string sessionid)
        {
            SqlDataReader dbreader = null;

            try
            {
                Framework.Utilities.DataIO dataio = new Framework.Utilities.DataIO();
                string        connstr             = dataio.GetConnectionString();
                SqlConnection dbconnection        = new SqlConnection(connstr);

                dbconnection.Open();

                SqlCommand dbcommand = new SqlCommand();
                dbcommand.CommandType    = CommandType.Text;
                dbcommand.CommandText    = string.Format("exec [Profile.Module].[NetworkMap.GetList] @UserID = {0}, @which ={1},@sessionid = '{2}'", listid, which, sessionid);
                dbcommand.CommandTimeout = dataio.GetCommandTimeout();
                dbcommand.Connection     = dbconnection;
                dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }

            return(dbreader);
        }
Пример #2
0
        public static void DeleteSelected(string ListID, string personids, bool remove = true)
        {
            if (personids.Trim() != "")
            {
                Profiles.Framework.Utilities.DataIO dataio = new Framework.Utilities.DataIO();
                SessionManagement sm = new SessionManagement();
                using (SqlConnection sqlconnection = new SqlConnection(dataio.GetConnectionString()))
                {
                    SqlCommand cmd = new SqlCommand("[Profile.Data].[List.AddRemove.SelectedPeople]", sqlconnection);
                    cmd.CommandTimeout = dataio.GetCommandTimeout();
                    cmd.CommandType    = CommandType.StoredProcedure;
                    SqlParameter parm = new SqlParameter("@UserID", SqlDbType.Int);
                    parm.Direction = ParameterDirection.Input;
                    parm.Value     = ListID;
                    cmd.Parameters.Add(parm);
                    parm           = new SqlParameter("@SelectedPeople", SqlDbType.NVarChar);
                    parm.Direction = ParameterDirection.Input;
                    parm.Value     = personids;
                    cmd.Parameters.Add(parm);
                    parm           = new SqlParameter("@Remove", SqlDbType.Bit);
                    parm.Direction = ParameterDirection.Input;
                    parm.Value     = remove;
                    cmd.Parameters.Add(parm);
                    parm           = new SqlParameter("@Size", SqlDbType.Int);
                    parm.Direction = ParameterDirection.Output;
                    cmd.Parameters.Add(parm);

                    sqlconnection.Open();
                    cmd.ExecuteNonQuery();
                    sqlconnection.Close();

                    sm.Session().ListSize = cmd.Parameters["@Size"].Value.ToString();
                }
            }
        }
Пример #3
0
        public static string GetSummary(string listid, string type)
        {
            SummaryChart sc = new SummaryChart();

            List <SummaryItem> rawitems = new List <SummaryItem>();
            List <SummaryItem> rtnitems = new List <SummaryItem>();

            Framework.Utilities.DataIO dataio = new Framework.Utilities.DataIO();
            try
            {
                string        connstr      = dataio.GetConnectionString();
                SqlConnection dbconnection = new SqlConnection(connstr);

                dbconnection.Open();

                SqlCommand dbcommand = new SqlCommand();
                dbcommand.CommandType    = CommandType.Text;
                dbcommand.CommandText    = string.Format("exec [Profile.Data].[List.GetSummary]  @UserID = {0}", listid);
                dbcommand.CommandTimeout = dataio.GetCommandTimeout();

                dbcommand.Connection = dbconnection;
                using (SqlDataReader dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    while (dbreader.Read())
                    {
                        rawitems.Add(new SummaryItem {
                            Variable = dbreader["Variable"].ToString(), Value = dbreader["Value"].ToString().Replace("'", "\\'"), n = Convert.ToInt32(dbreader["n"]), color = ""
                        });
                    }

                    if (!dbreader.IsClosed)
                    {
                        dbreader.Close();
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }

            rtnitems = rawitems.FindAll(o => o.Variable.ToLower() == type.ToLower()).ToList();

            sc.cols = "{\"cols\": [{\"id\":\"\",\"label\": \"" + type + "\",\"pattern\":\"\",\"type\":\"string\"},{\"id\":\"\",\"label\":\"Count\",\"pattern\":\"\",\"type\":\"number\"}],";
            sc.rows = "\"rows\":[";
            foreach (SummaryItem si in rtnitems)
            {
                sc.rows += "{ \"c\":[{\"v\":\"" + si.Value + "\"},{\"v\":" + si.n.ToString() + "}]},";
            }
            sc.rows   = sc.rows.Substring(0, sc.rows.Length - 1);
            sc.colors = "],\"colors\":\"[#4E79A7,#F28E2B,#E15759,#76B7B2,#59A14F,#EDC948,#B07AA1,#FF9DA7,#9C755F,#BAB0AC]\"}";

            return(sc.cols + sc.rows + sc.colors);
        }
Пример #4
0
        public static string GetNetworkRadialCoAuthors(string listid)
        {
            string str = string.Empty;


            if (Framework.Utilities.Cache.FetchObject(listid + "LISTGetNetworkRadialCoAuthors") == null)
            {
                Framework.Utilities.DataIO dataio = new Framework.Utilities.DataIO();
                try
                {
                    string        connstr      = dataio.GetConnectionString();
                    SqlConnection dbconnection = new SqlConnection(connstr);
                    SqlCommand    dbcommand    = new SqlCommand("[Profile.Module].[NetworkRadial.List.GetCoAuthors]");

                    SqlDataReader dbreader;
                    dbconnection.Open();
                    dbcommand.CommandType    = CommandType.StoredProcedure;
                    dbcommand.CommandTimeout = dataio.GetCommandTimeout();
                    dbcommand.Parameters.Add(new SqlParameter("@OutputFormat", "JSON"));
                    dbcommand.Parameters.Add(new SqlParameter("@UserID", listid));

                    dbcommand.Connection = dbconnection;
                    dbreader             = dbcommand.ExecuteReader(CommandBehavior.CloseConnection);

                    while (dbreader.Read())
                    {
                        str += dbreader[0].ToString();
                    }

                    Framework.Utilities.DebugLogging.Log(str);

                    if (!dbreader.IsClosed)
                    {
                        dbreader.Close();
                    }

                    Framework.Utilities.Cache.Set(listid + "LISTGetNetworkRadialCoAuthors", str);
                }
                catch (Exception ex)
                {
                    Framework.Utilities.DebugLogging.Log(ex.Message + " ++ " + ex.StackTrace);
                }
            }
            else
            {
                str = (string)Framework.Utilities.Cache.FetchObject(listid + "LISTGetNetworkRadialCoAuthors");
            }

            return(str);
        }
Пример #5
0
        public static List <SummaryItem> GetSummaryRaw(string listid, string type)
        {
            SummaryChart sc = new SummaryChart();

            List <SummaryItem> rawitems = new List <SummaryItem>();
            List <SummaryItem> rtnitems = new List <SummaryItem>();

            Framework.Utilities.DataIO dataio = new Framework.Utilities.DataIO();
            try
            {
                string        connstr      = dataio.GetConnectionString();
                SqlConnection dbconnection = new SqlConnection(connstr);

                dbconnection.Open();

                SqlCommand dbcommand = new SqlCommand();
                dbcommand.CommandType    = CommandType.Text;
                dbcommand.CommandText    = string.Format("exec [Profile.Data].[List.GetSummary]  @UserID = {0}", listid);
                dbcommand.CommandTimeout = dataio.GetCommandTimeout();

                dbcommand.Connection = dbconnection;
                using (SqlDataReader dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    while (dbreader.Read())
                    {
                        rawitems.Add(new SummaryItem {
                            Variable = dbreader["Variable"].ToString(), Value = dbreader["Value"].ToString().Replace("'", "\\'"), n = Convert.ToInt32(dbreader["n"]), color = ""
                        });
                    }

                    if (!dbreader.IsClosed)
                    {
                        dbreader.Close();
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }

            rtnitems = rawitems.FindAll(o => o.Variable.ToLower() == type.ToLower()).ToList();



            return(rtnitems);
        }
Пример #6
0
        public static string PersonExists(string listid, string personid)
        {
            string data = string.Empty;

            Framework.Utilities.DataIO dataio = new Framework.Utilities.DataIO();
            try
            {
                string        connstr      = dataio.GetConnectionString();
                SqlConnection dbconnection = new SqlConnection(connstr);

                dbconnection.Open();
                SqlCommand dbcommand = new SqlCommand();
                dbcommand.CommandType    = CommandType.Text;
                dbcommand.CommandText    = string.Format("select count(*) as count from [Profile.Data].[List.Member]  where UserID = {0} and personid = {1}", listid, personid);
                dbcommand.CommandTimeout = dataio.GetCommandTimeout();

                dbcommand.Connection = dbconnection;
                using (SqlDataReader dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    while (dbreader.Read())
                    {
                        data = dbreader[0].ToString();
                    }

                    if (!dbreader.IsClosed)
                    {
                        dbreader.Close();
                    }
                }


                if (dbcommand.Connection.State != ConnectionState.Closed)
                {
                    dbcommand.Connection.Close();
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            return(data);
        }
Пример #7
0
        public static void GetCoauthorConnections(string listid)
        {
            StringBuilder data = new StringBuilder();

            Framework.Utilities.DataIO dataio = new Framework.Utilities.DataIO();
            try
            {
                string        connstr      = dataio.GetConnectionString();
                SqlConnection dbconnection = new SqlConnection(connstr);

                dbconnection.Open();


                SqlCommand dbcommand = new SqlCommand();
                dbcommand.CommandType    = CommandType.Text;
                dbcommand.CommandText    = string.Format("exec [Profile.Data].[List.ExportCoAuthorConnections] @UserID={0}", listid);
                dbcommand.CommandTimeout = dataio.GetCommandTimeout();

                dbcommand.Connection = dbconnection;
                using (SqlDataReader dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    while (dbreader.Read())
                    {
                        data.AppendLine(dbreader[0].ToString());
                    }

                    if (!dbreader.IsClosed)
                    {
                        dbreader.Close();
                    }


                    GetCSV(data.ToString(), "Connections");
                }
            }
            catch (Exception e)
            {
                //donothingbecause of the end();;;; calllllllll
            }
        }
Пример #8
0
        public static string GetNetworkRadialCoAuthors(string listid)
        {
            StringBuilder data = new StringBuilder();

            Framework.Utilities.DataIO dataio = new Framework.Utilities.DataIO();
            try
            {
                string        connstr      = dataio.GetConnectionString();
                SqlConnection dbconnection = new SqlConnection(connstr);

                dbconnection.Open();


                SqlCommand dbcommand = new SqlCommand();
                dbcommand.CommandType    = CommandType.Text;
                dbcommand.CommandText    = string.Format("exec [Profile.Module].[NetworkRadial.List.GetCoAuthors] @OutputFormat='JSON', @UserID={0}", listid);
                dbcommand.CommandTimeout = dataio.GetCommandTimeout();

                dbcommand.Connection = dbconnection;
                using (SqlDataReader dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    while (dbreader.Read())
                    {
                        data.AppendLine(dbreader[0].ToString());
                    }

                    if (!dbreader.IsClosed)
                    {
                        dbreader.Close();
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }


            return(data.ToString());
        }
Пример #9
0
        public static void DeleteFildered(string listid, string institution, string facultyrank)
        {
            Profiles.Framework.Utilities.DataIO dataio = new Framework.Utilities.DataIO();
            SessionManagement sm = new SessionManagement();

            using (SqlConnection sqlconnection = new SqlConnection(dataio.GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("[Profile.Data].[List.AddRemove.Filter]", sqlconnection);
                cmd.CommandTimeout = dataio.GetCommandTimeout();
                cmd.CommandType    = CommandType.StoredProcedure;
                SqlParameter parm = new SqlParameter("@UserID", SqlDbType.Int);
                parm.Direction = ParameterDirection.Input;
                parm.Value     = listid;
                cmd.Parameters.Add(parm);
                parm           = new SqlParameter("@Institution", SqlDbType.NVarChar);
                parm.Direction = ParameterDirection.Input;
                parm.Value     = institution;
                cmd.Parameters.Add(parm);
                parm           = new SqlParameter("@FacultyRank", SqlDbType.NVarChar);
                parm.Direction = ParameterDirection.Input;

                parm.Value = facultyrank;
                cmd.Parameters.Add(parm);
                parm           = new SqlParameter("@Remove", SqlDbType.Bit);
                parm.Direction = ParameterDirection.Input;
                parm.Value     = true;
                cmd.Parameters.Add(parm);
                parm           = new SqlParameter("@Size", SqlDbType.Int);
                parm.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(parm);

                sqlconnection.Open();
                cmd.ExecuteNonQuery();
                sqlconnection.Close();

                sm.Session().ListSize = cmd.Parameters["@Size"].Value.ToString();
            }
        }
Пример #10
0
        public static string CreateList(string listownerid, string ListName)
        {
            string data = string.Empty;

            Framework.Utilities.DataIO dataio = new Framework.Utilities.DataIO();
            try
            {
                string        connstr      = dataio.GetConnectionString();
                SqlConnection dbconnection = new SqlConnection(connstr);

                dbconnection.Open();


                SqlCommand dbcommand = new SqlCommand();
                dbcommand.CommandType    = CommandType.Text;
                dbcommand.CommandText    = string.Format("exec [Profile.Data].[List.CreateList]  @OwnerNodeID = {0}, @ListName = '{1}'", listownerid, ListName);
                dbcommand.CommandTimeout = dataio.GetCommandTimeout();

                dbcommand.Connection = dbconnection;
                using (SqlDataReader dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    while (dbreader.Read())
                    {
                        data = dbreader[0].ToString();
                    }

                    if (!dbreader.IsClosed)
                    {
                        dbreader.Close();
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            return(data.Trim());
        }
Пример #11
0
        public static string GetSocialMediaPlugInData(Int64 subject, string name)
        {
            string data = string.Empty;

            Framework.Utilities.DataIO dataio = new Framework.Utilities.DataIO();
            try
            {
                string        connstr      = dataio.GetConnectionString();
                SqlConnection dbconnection = new SqlConnection(connstr);

                dbconnection.Open();


                SqlCommand dbcommand = new SqlCommand();
                dbcommand.CommandType    = CommandType.Text;
                dbcommand.CommandText    = "exec [Profile.Module].[GenericRDF.GetPluginData]  @Name = '" + name + "', @NodeID = " + subject.ToString();
                dbcommand.CommandTimeout = dataio.GetCommandTimeout();

                dbcommand.Connection = dbconnection;
                using (SqlDataReader dbreader = dbcommand.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    while (dbreader.Read())
                    {
                        data = dbreader["Data"].ToString();
                    }

                    if (!dbreader.IsClosed)
                    {
                        dbreader.Close();
                    }
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            return(data.Trim());
        }
Пример #12
0
        public static void AddEditPluginData(string name, Int64 subject, string data, string searchableitem)
        {
            Framework.Utilities.DataIO dataio = new Framework.Utilities.DataIO();
            try
            {
                string        connstr      = dataio.GetConnectionString();
                SqlConnection dbconnection = new SqlConnection(connstr);

                dbconnection.Open();

                SqlCommand dbcommand = new SqlCommand();
                dbcommand.CommandType    = CommandType.Text;
                dbcommand.CommandText    = "exec [Profile.Module].[GenericRDF.AddEditPluginData] @Name = '" + name + "', @NodeID = " + subject.ToString() + ", @data='" + data + "', @searchabledata ='" + searchableitem + "'";
                dbcommand.CommandTimeout = dataio.GetCommandTimeout();
                Framework.Utilities.Cache.AlterDependency(subject.ToString());
                dbcommand.Connection = dbconnection;
                dbcommand.ExecuteNonQuery();
                dbcommand.Connection.Close();
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }