public bool DoAvgScore(Model.CCOM.Examination_subject_average_score _model) { try { BLL.CCOM.Examination_subject_average_score bll = new BLL.CCOM.Examination_subject_average_score(); var model = bll.GetModel(" Esn_id= " + _model.Esn_id + " AND User_id=" + _model.User_id); if (model != null) { _model.Esas_id = model.Esas_id; bll.Update(_model); } else { bll.Add(_model); } return(true); } catch { JscriptMsg("计算考生平均成绩出错", "", "Error"); return(false); } }
public void ScoreManege() { string str = CombSqlTxt(""); BLL.CCOM.View_AEE_Subject_Score bll1 = new BLL.CCOM.View_AEE_Subject_Score(); var userModelList = bll1.GetModelList(str); foreach (var user_model in userModelList) { string sqlStr = "SELECT DISTINCT Judge_id FROM Examination_subject_score WHERE Esn_id=" + esn_id + " AND User_id =" + user_model.User_id; var judgeList = DBSQL.Query(sqlStr); int _count = judgeList.Tables[0].Rows.Count; string strWhere = " Esn_id= " + esn_id + " AND User_id=" + user_model.User_id + " order by Ess_score DESC"; var scoreList = new BLL.CCOM.Examination_subject_score().GetModelList(strWhere); int score_count = scoreList.Count; BLL.CCOM.Examination_subject_score blls = new BLL.CCOM.Examination_subject_score(); BLL.CCOM.Examination_subject_average_score bll = new BLL.CCOM.Examination_subject_average_score(); int now = 0; int num = DelScore(_count); int chushu = 0; decimal avgScore = 0; int? avgXu = 0; foreach (var score_model in scoreList) { if (now > num - 1 && now < _count - num) { avgScore += score_model.Ess_score; avgXu += score_model.Ess_sequence; chushu++; score_model.Ess_score_status = true; score_model.Ess_order_status = true; } else { score_model.Ess_score_status = false; score_model.Ess_order_status = false; } blls.Update(score_model); if (now == _count - 1) { Model.CCOM.Examination_subject_average_score _model = new Model.CCOM.Examination_subject_average_score(); _model.Esas_score = avgScore / chushu; _model.Esas_sequence = (decimal)(avgXu / (1.0 * chushu)); _model.User_id = score_model.User_id; _model.Esn_id = score_model.Esn_id; DoAvgScore(_model); avgScore = 0; avgXu = 0; now = chushu = 0; continue; } now++; } } JscriptMsg("计算科目成绩成功", "SubjectScoreList.aspx?fun_id=" + DESEncrypt.Encrypt(this.fun_id) + "&keywords=" + this.txtKeywords.Text + "&esn_id=" + DESEncrypt.Encrypt(esn_id) + "&major_id=" + DESEncrypt.Encrypt(major_id), "Success"); }