public static void Run() { var SList = Get.MSubmitList(); foreach (var S in SList) { Thread.Sleep(512); try { var m = new Member(); var r = new Report(); m.IDCard = S.IDCard; m.IDSN = S.IDSN; m.Year = S.Year; m.RegDate = S.RegDate; m.MID = S.MID; r.MID = S.MID; r.Compulsory = S.Compulsory; r.Elective = S.Elective; r.Status = S.Status; r.Score = S.Score; r.Minutes = S.Minutes; CommitReport(m, r); } catch (Exception ex) { log.Fatal("{0},{1}", ex.Message, ex.StackTrace); } } }
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.Minutes >= 1080) { para.isPass = "******"; } } else { if (re.Minutes >= 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; }
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(SqlHelper.Local, 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; }