Exemplo n.º 1
0
        public bool calculateSubjectXu(string esn_id, string jugde_id)
        {
            var bll = new BLL.CCOM.Examination_subject_score();

            var     modelList  = bll.GetModelList(" Esn_id =" + esn_id + " AND Judge_id=" + jugde_id + "order by Ess_score desc");
            int     totalCount = modelList.Count;
            decimal _score     = 200;
            int     order      = 0;

            if (totalCount > 0)
            {
                int count = 1;
                foreach (var model in modelList)
                {
                    if (model.Ess_score < _score)
                    {
                        model.Ess_sequence = count;
                        bll.Update(model);
                        _score = model.Ess_score;
                        order  = count;
                    }
                    else
                    {
                        model.Ess_sequence = order;
                        bll.Update(model);
                    }
                    count++;
                }
            }
            return(true);
        }
Exemplo n.º 2
0
 protected bool DoUpdate(Model.CCOM.Examination_subject_score Fl)
 {
     try
     {
         BLL.CCOM.Examination_subject_score Bss = new BLL.CCOM.Examination_subject_score();
         Bss.Update(Fl);
     }
     catch (Exception ex)
     {
         return(false);
     }
     return(true);
 }
        public void ProcessRequest(HttpContext context)
        {
            long    Id;
            int     Id1, Id2;
            string  result = "";
            decimal Score  = 0;

            try
            {
                Id    = Convert.ToInt64(DESEncrypt.Decrypt(context.Request.Params["id"].ToString()));
                Id1   = Convert.ToInt32(DESEncrypt.Decrypt(context.Request.Params["id1"].ToString()));
                Id2   = Convert.ToInt32(DESEncrypt.Decrypt(context.Request.Params["id2"].ToString()));
                Score = Convert.ToDecimal(context.Request.Params["txtScore"].ToString());

                var model  = new Model.CCOM.Examination_subject_score();
                var _model = new Model.CCOM.Examination_subject_score();
                BLL.CCOM.Examination_subject_score Bess = new BLL.CCOM.Examination_subject_score();

                model                   = new BLL.CCOM.Examination_subject_score().GetModel(" Esn_id = " + Id1 + " AND User_id=" + Id + " AND Judge_id=" + Id2);
                _model.Esn_id           = Id1;
                _model.Ess_score        = Score;
                _model.Judge_id         = Id2;
                _model.User_id          = Id;
                _model.Ess_score_status = true;
                _model.Ess_order_status = true;
                if (model != null)
                {
                    _model.Ess_id = model.Ess_id;
                    Bess.Update(_model);
                }
                else
                {
                    Bess.Add(_model);
                }
                new Calculation().calculateSubjectXu(Id1.ToString(), Id2.ToString());
                result += "添加成功";
            }
            catch (Exception ex)
            {
                ILog LOGGER = LogManager.GetLogger("quanquan");
                LOGGER.Debug(ex.Message, ex);
                result += "添加失败,请重新尝试";
            }
            context.Response.ContentType = "text/plain";
            context.Response.Write(result);
        }
        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");
        }