Esempio n. 1
0
        public static R CommitReport(Member m, Report re)
        {
            var r = new R();
            try
            {
                if (re.Status == 0)
                {
                    var para = new AnnalParams();
                    para.certId = m.IDCard;
                    para.orderId = m.IDSN;
                    para.credits = "";
                    para.classHour = "24";
                    para.startTeachDate = m.RegDate.ToString("yyyy-MM-dd");
                    para.endTeachDate = DateTime.Now.ToString("yyyy-MM-dd");
                    para.isPass = "******";

                    if (m.Year >= 2012)
                    {
                        if (re.Score >= 60 && (re.Elective + re.Compulsory) * 45 >= 1080)
                        {
                            para.isPass = "******";
                        }
                    }
                    else
                    {
                        if ((re.Elective + re.Compulsory) * 45 >= 1080)
                        {
                            para.isPass = "******";
                        }
                    }

                    //已完成学习
                    if (para.isPass == "Pass")
                    {
                        var ps = Teach.TeachAnnalAction(para);
                        if (ps.annalValue == "annal000" || ps.annalValue == "annal003")
                        {
                            re.Status = 1;
                            DAL.Update.Report(re);
                            r.Value = 1;
                            r.Message = "success";
                            r.Code = 0;
                        }
                        else
                        {
                            log.Warn("{0},{1},{2}", ps.annalValue, ps.personName, ps.yearValue);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                log.Fatal("{0},{1}", ex.Message, ex.StackTrace);
            }
            return r;
        }
Esempio n. 2
0
 new public static Report Report(int MID, int Year)
 {
     var m = new Report();
     try
     {
         SqlParameter[] param =
         {
             new SqlParameter("@MID",MID),
             new SqlParameter("@Year",Year)
             
         };
         string SQL = "SELECT * FROM dbo.Report WHERE MID=@MID AND [Year]=@Year";
         var dr = SqlHelper.ExecuteReader(SqlHelper.Local, CommandType.Text, SQL, param);
         if (dr.Read())
         {
             m.ID = Convert.ToInt32(dr["ID"]);
             m.MID = Convert.ToInt32(dr["MID"]);
             m.Year = Convert.ToInt32(dr["Year"]);
             if (DBNull.Value != dr["Minutes"])
                 m.Minutes = Convert.ToDecimal(dr["Minutes"]);
             if (DBNull.Value != dr["Score"])
                 m.Score = Convert.ToInt32(dr["Score"]);
             if (DBNull.Value != dr["Compulsory"])
                 m.Compulsory = Convert.ToDecimal(dr["Compulsory"]);
             if (DBNull.Value != dr["Elective"])
                 m.Elective = Convert.ToDecimal(dr["Elective"]);
             if (DBNull.Value != dr["Status"])
                 m.Status = Convert.ToInt32(dr["Status"]);
             if (DBNull.Value != dr["Memo"])
                 m.Memo = Convert.ToString(dr["Memo"]);
             if (DBNull.Value != dr["CreateDate"])
                 m.CreateDate = Convert.ToDateTime(dr["CreateDate"]);
             if (DBNull.Value != dr["UpdateDate"])
                 m.UpdateDate = Convert.ToDateTime(dr["UpdateDate"]);
             if (DBNull.Value != dr["CommitDate"])
                 m.CommitDate = Convert.ToDateTime(dr["CommitDate"]);
             if (DBNull.Value != dr["Flag"])
                 m.Flag = Convert.ToInt32(dr["Flag"]);
         }
         dr.Close();
     }
     catch (Exception ex)
     {
         log.Fatal(ex.Message);
         log.Fatal(ex.StackTrace);
     }
     return m;
 }
Esempio n. 3
0
 public ActionResult CreditScore(int MID, int Year, int Score)
 {
     string referrer = Request.UrlReferrer.ToString();
     Score = Score > 0 ? Score : 0;
     Report re = new Report();
     re.Score = Score;
     re.MID = MID;
     re.Year = Year;
     if (Score >= 60)
     {
         re.Status = 1;
     }
     var r = DAL.Update.Report(re);
     Response.Redirect(referrer);
     return Content(r.Message);
 }
Esempio n. 4
0
 public static Report Report(int MID,int Year)
 {
     var m = new Report();
     try
     {
         SqlParameter[] param =
         {
             new SqlParameter("@MID",MID),
             new SqlParameter("@Year",Year)
             
         };
         var dr = SqlHelper.ExecuteReader(C.conn, CommandType.StoredProcedure, "Get_Report", param);
         if (dr.Read())
         {
             m.ID = Convert.ToInt32(dr["ID"]);
             m.MID = Convert.ToInt32(dr["MID"]);
             m.Year = Convert.ToInt32(dr["Year"]);
             if (DBNull.Value != dr["Minutes"])
                 m.Minutes = Convert.ToDecimal(dr["Minutes"]);
             if (DBNull.Value != dr["Score"])
                 m.Score = Convert.ToInt32(dr["Score"]);
             m.Compulsory = Convert.ToDecimal(dr["Compulsory"]);
             m.Elective = Convert.ToDecimal(dr["Elective"]);
             m.Status = Convert.ToInt32(dr["Status"]);
             m.Memo = Convert.ToString(dr["Memo"]);
             if (DBNull.Value != dr["CreateDate"])
                 m.CreateDate = Convert.ToDateTime(dr["CreateDate"]);
             if (DBNull.Value != dr["UpdateDate"])
                 m.UpdateDate = Convert.ToDateTime(dr["UpdateDate"]);
             if (DBNull.Value != dr["CommitDate"])
                 m.CommitDate = Convert.ToDateTime(dr["CommitDate"]);
         }
         dr.Close();
     }
     catch (Exception ex)
     {
         log.Fatal(ex.Message);
         log.Fatal(ex.StackTrace);
     }
     return m;
 }
Esempio n. 5
0
 public static R Report(Report re)
 {
     var m = new R();
     try
     {
         SqlParameter[] param =
         {
             new SqlParameter("@MID",re.MID),
             new SqlParameter("@Score",re.Score),
             new SqlParameter("@Compulsory",re.Compulsory),
             new SqlParameter("@Elective",re.Elective),
             new SqlParameter("@Status",re.Status),
             new SqlParameter("@Memo",re.Memo)
         };
         
         var r = SqlHelper.ExecuteNonQuery(C.conn, CommandType.StoredProcedure, "Update_Report", param);
         m.Code = 0;
         m.Message = "sucess";
         log.Info("MID:{0},code:{1}", re.MID, m.Code);
     }
     catch (Exception ex)
     {
         m.Code = 300;
         m.Message = ex.Message;
         log.Fatal(ex.Message);
         log.FatalException(ex.Message, ex);
     }
     return m;
 }