Ejemplo n.º 1
0
 new public static MyCourses Courses(int MID, int CID)
 {
     var m = new MyCourses();
     try
     {
         SqlParameter[] param =
         {
             new SqlParameter("@MID",MID),
             new SqlParameter("@CID",CID)
             
         };
         var dr = SqlHelper.ExecuteReader(C.conn, CommandType.StoredProcedure, "Get_MyCourses", param);
         if (dr.Read())
         {
             m.CID = CID;
             m.MID = MID;
             m.Name = Convert.ToString(dr["Name"]);
             m.Year = Convert.ToInt32(dr["Year"]);
             if (DBNull.Value != dr["Minutes"])
                 m.Minutes = Convert.ToInt32(dr["Minutes"]);
             if (DBNull.Value != dr["Second"])
                 m.Second = Convert.ToDecimal(dr["Second"]);
             m.Validate = Convert.ToInt32(dr["Validate"]);
             m.Length = Convert.ToDecimal(dr["Length"]);
         }
         dr.Close();
     }
     catch (Exception ex)
     {
         log.Fatal("{0},{1}", ex.Message, ex.StackTrace);
     }
     return m;
 }
Ejemplo n.º 2
0
        new public static List<MyCourses> MyCourses(int MID, int Year, int Type)
        {
            var l = new List<MyCourses>();
            try
            {
                SqlParameter[] param =
                {
                    new SqlParameter("@MID",MID),
                    new SqlParameter("@Year",Year),
                    new SqlParameter("@Type",Type)
                    
                };
                var dr = SqlHelper.ExecuteReader(C.conn, CommandType.StoredProcedure, "Get_MyCoursesList", param);
                while (dr.Read())
                {
                    var m = new MyCourses();
                    m.CID = Convert.ToInt32(dr["CID"]);
                    m.Name = Convert.ToString(dr["Name"]);
                    m.Second = Convert.ToInt32(dr["Second"]);
                    m.Minutes = Convert.ToInt32(dr["Minutes"]);
                    m.Status = Convert.ToInt32(dr["Status"]);
                    if (DBNull.Value != dr["Cate"])
                        m.Cate = Convert.ToInt32(dr["Cate"]);
                    if (DBNull.Value != dr["Sort"])
                        m.Sort = Convert.ToInt32(dr["Sort"]);
                    if (DBNull.Value != dr["Teacher"])
                        m.Teacher = Convert.ToString(dr["Teacher"]);
                    if (DBNull.Value != dr["Length"])
                        m.Length = Convert.ToDecimal(dr["Length"]);
                    if (DBNull.Value != dr["Memo"])
                        m.Memo = Convert.ToString(dr["Memo"]);
                    if (DBNull.Value != dr["Tag"])
                        m.Tag = Convert.ToString(dr["Tag"]);
                    l.Add(m);
                }
                dr.Close();
            }
            catch (Exception ex)
            {

                log.Fatal(ex.Message);
                log.FatalException(ex.Message, ex);
            }
            return l;
        }
Ejemplo n.º 3
0
        public ActionResult Certificatev2(int id)
        {
            decimal Total_length = 0;
            var report = DAL.Get.Report(Client.MID, id);
            var cert = DAL.Get.Certificate(Client.MID);
            var CLData = DAL.Get.MyCourses(Client.MID, id, Client.Type);
            var certConfig = DAL.Get.CertConfig(id);
            if (cert.ID == 0)
            {
                DAL.Update.Certificate(Client.MID);
                cert = DAL.Get.Certificate(Client.MID);
            }
            if (report.Status != 1)
            {
                GoMessage("您尚未获得合格证书,请继续学习。");
            }
            //已学
            var MyCourses_1 = CLData.FindAll(n => n.Status == 1);

            var ShowList = new List<MyCourses>();
            for (int i = 0; i < MyCourses_1.Count; i++)
            {
                Total_length = Total_length + MyCourses_1[i].Length;
                if (i < 13)
                {
                    ShowList.Add(MyCourses_1[i]);
                }
            }
            if (MyCourses_1.Count > 14)
            {
                var m = new MyCourses();
                m.Name = "……";
                ShowList.Add(m);
            }


            ViewData["MyCourses_1"] = ShowList;
            ViewData["report"] = report;
            ViewData["cert"] = cert;
            ViewData["certConfig"] = certConfig;
            ViewData["PID"] = id;
            ViewData["Total_length"] = Total_length;
            return View();
        }