Example #1
0
        public string getUserRole(string email)
        {
            String        role        = "";
            StringBuilder queryString = new StringBuilder();

            queryString.AppendFormat("SELECT tipo FROM Usuarios WHERE email='{0}'", email);
            dbManager.Open();
            SqlDataReader r = dbManager.readQuery(queryString.ToString());

            if (r.Read())
            {
                role = r[0].ToString();
            }
            dbManager.Close();
            return(role);
        }
        public float getAvg_OverWork(string subject)
        {
            StringBuilder sb          = new StringBuilder();
            float         avgOverWork = 0;
            float         aux         = -1F;

            sb.AppendFormat("select avg(HReales) from tareasGenericas as tg join estudiantesTareas as et on tg.Codigo=et.CodTarea where tg.CodAsig='{0}'", subject);
            dbManager.Open();
            SqlDataReader dr = dbManager.readQuery(sb.ToString());

            if (dr.Read())
            {
                if (dr[0] != null)
                {
                    if (dr[0] is int || dr[0] is float)
                    {
                        avgOverWork = float.Parse(dr[0].ToString());
                    }
                }
            }
            dbManager.Close();
            return(avgOverWork);
        }