Beispiel #1
0
        public static int GetExamFullMarks(SchContext _context, string gClss, string gSubName, string tExamName, string dSess, int mdBId)
        {
            string MySql = "";
            object tmpObj;

            MySql = " SELECT FullMarks ";
            MySql = MySql + " From ExamSub WITH (NOLOCK)  ";
            MySql = MySql + " WHERE SubName ='" + repSplChr(gSubName) + "'";
            MySql = MySql + " AND ExamName ='" + repSplChr(tExamName) + "'";
            MySql = MySql + " AND Clss = '" + repSplChr(gClss) + "'";
            MySql = MySql + " AND SSession ='" + repSplChr(dSess) + "'";
            MySql = MySql + " AND Dormant = 0";
            MySql = MySql + " AND DBID =  " + mdBId;
            var conn = _context.Database.GetDbConnection();

            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            using (var command = conn.CreateCommand())
            {
                command.CommandText = MySql;
                command.CommandType = CommandType.Text;
                tmpObj = command.ExecuteScalar();
                if (!((Object)tmpObj == null))
                {
                    if (GloFunc.IsNumeric(tmpObj.ToString()))
                    {
                        return(int.Parse(tmpObj.ToString()));
                    }
                    else
                    {
                        return(-1);
                    }
                }
                else
                {
                    return(-1);
                }
            }
        }
Beispiel #2
0
        public static int GetSubName(SchContext _context, string tSubID, string tClass, string dSess, int mdBId)
        {
            string MySql2 = "";
            object tmpObj;
            var    conn = _context.Database.GetDbConnection();

            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            using (var command = conn.CreateCommand())
            {
                MySql2 = " SELECT SubName FROM Subjects WITH (NOLOCK)";
                MySql2 = MySql2 + " WHERE SubID = " + tSubID;
                MySql2 = MySql2 + " AND Clss = '" + repSplChr(tClass) + "'";
                MySql2 = MySql2 + " AND AcaSession = '" + dSess + "'";
                MySql2 = MySql2 + " AND Dormant = 0";
                MySql2 = MySql2 + " AND dBID = " + mdBId;

                command.CommandText = MySql2;
                command.CommandType = CommandType.Text;
                tmpObj = command.ExecuteScalar();
                if (!((Object)tmpObj == null))
                {
                    if (GloFunc.IsNumeric(tmpObj.ToString()))
                    {
                        return(int.Parse(tmpObj.ToString()));
                    }
                    else
                    {
                        return(-1);
                    }
                }
                else
                {
                    return(-1);
                }
                //conn.Close();
            }
        }