Ejemplo n.º 1
0
        public double normalMarkC(string markCC, string markTX, string markThi)
        {
            Comm.CommonLib com = new Comm.CommonLib();
            double         mThi, mTX, mCC;

            mThi = com.convert2Double(markThi, 0);
            mTX  = com.convert2Double(markTX, 0);
            mCC  = com.convert2Double(markCC, 0);
            string u = markThi.ToUpper();

            if (com.checkDecimal(u) != 0)
            {
                return(0);
            }
            if (markCC == "" && markTX == "")
            {
                return(mThi);
            }
            double t = 0;

            if (mThi < 4)
            {
                return(mThi);
            }
            else
            {
                return(Math.Truncate((mCC + 2 * mTX + 7 * mThi) + 0.5) / 10);
            }
        }
Ejemplo n.º 2
0
        public int checkRecode(string coursecode)
        {
            int              ret = 0;
            DataSet          ds  = new DataSet();
            string           sql = @"SELECT COUNT(B.code) countstudent, 
SUM(
CASE
     WHEN ISNULL(B.name,'')='' THEN 0 
     ELSE 1 
END
) countrecode
  FROM  mark B 
  WHERE coursecode=@coursecode
GROUP BY B.coursecode
";
            List <fieldpara> li  = new List <fieldpara>();

            li.Add(new fieldpara("coursecode", coursecode, SqlDbType.VarChar, 0));
            ret = getByQuery(ref ds, "check", sql, li);
            if (ret < 0)
            {
                return(ret);
            }
            if (ds.Tables["check"].Rows.Count != 1)
            {
                return(-5);
            }
            Comm.CommonLib com = new Comm.CommonLib();
            int            c1, c2;

            c1 = com.int4Row(ds.Tables["check"].Rows[0], "countstudent", 0);
            c2 = com.int4Row(ds.Tables["check"].Rows[0], "countrecode", -1);
            return(c2 - c1);
        }
Ejemplo n.º 3
0
        public string normalMark(string markCC, string markTX, string markThi)
        {
            Comm.CommonLib com = new Comm.CommonLib();
            string         u   = markThi.ToUpper();

            if (com.checkDecimal(u) != 0)
            {
                return("");
            }
            if (markCC == "" && markTX == "")
            {
                return(markThi);
            }
            double mThi, mTX, mCC;

            mThi = com.convert2Double(markThi, 0);
            mTX  = com.convert2Double(markTX, 0);
            mCC  = com.convert2Double(markCC, 0);
            double t = 0;

            if (mThi < 4)
            {
                return(markThi);
            }
            else
            {
                t = Math.Truncate(mCC + 2 * mTX + 7 * mThi + 0.5) / 10;
            }
            string kq = t.ToString("#0.0");

            //if (kq[0] == '0')
            //{
            //    kq = kq.Remove(0, 1);
            //}
            return(kq);
        }