Example #1
0
        new public static Certificate Certificate(int MID)
        {
            var m = new Certificate();
            try
            {
                SqlParameter[] param =
                {
                    new SqlParameter("@MID",MID)
                    
                };
                var dr = SqlHelper.ExecuteReader(C.conn, CommandType.StoredProcedure, "Get_Certificate", param);
                if (dr.Read())
                {
                    m.ID = Convert.ToInt32(dr["ID"]);
                    m.MID = Convert.ToInt32(dr["MID"]);

                    if (DBNull.Value != dr["CreateDate"])
                        m.CreateDate = Convert.ToDateTime(dr["CreateDate"]);
                    if (DBNull.Value != dr["BeginDate"])
                        m.BeginDate = Convert.ToDateTime(dr["BeginDate"]);
                    if (DBNull.Value != dr["EndDate"])
                        m.EndDate = Convert.ToDateTime(dr["EndDate"]);
                    if (DBNull.Value != dr["CertID"])
                        m.CertID = Convert.ToString(dr["CertID"]);
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                log.Fatal(ex.Message);
                log.Fatal(ex.StackTrace);
            }
            return m;
        }
Example #2
0
        public ActionResult Certificate()
        {
            var report = DAL.Get.MyReport(Client.MID);
            var reportFinish = report.FindAll(N => N.Score >= 60 && N.Minutes >= 1080);
            var cert = new Certificate();
            if (reportFinish.Count > 0)
            {
                DAL.Update.Certificate(Client.MID);
                cert = DAL.Get.Certificate(Client.MID);
            }
            if (reportFinish.Count == 0)
            {
                GoMessage("您尚未获得合格证书,请继续学习。");
            }
            ViewData["report"] = reportFinish;
            ViewData["cert"] = cert;

            return View();
        }
Example #3
0
        public ActionResult Certificate()
        {
            var member = DAL.Get.Member(Client.MID);
            if (member.Level == -1)
            {
                string Url = "/Account/ProfilesEdit";
                //Response.Redirect(Url);
                GoMessage("您需要完善个人信息后,才可以打印证书。", Url);
            }
            var report = DAL.Get.MyReport(Client.MID);
            var reportFinish = report.FindAll(N => N.Score >= 60 && N.Minutes >= 1080);
            var cert = new Certificate();
            if (reportFinish.Count > 0)
            {
                DAL.Update.Certificate(Client.MID);
                cert = DAL.Get.Certificate(Client.MID);
            }
            if (reportFinish.Count == 0)
            {
                GoMessage("您尚未获得合格证书,请继续学习。");
            }
            ViewData["member"] = member;
            ViewData["report"] = reportFinish;
            ViewData["cert"] = cert;

            return View();
        }