private void RptBind(string _strWhere, string _order)
        {
            int pageSize    = GetPageSize(30); //每页数量
            int page        = MyRequest.GetQueryInt("page", 1);
            int start_index = pageSize * (page - 1) + 1;
            int end_index   = pageSize * page;

            BLL.CCOM.View_AEE_Subject_Score bll = new BLL.CCOM.View_AEE_Subject_Score();

            //计算数量
            int totalCount = bll.GetRecordCount(_strWhere);

            //   txtSearchResult.Text = "本次命中" + totalCount.ToString() + "条";

            //绑定当页
            this.rptList.DataSource = bll.GetListByPage(_strWhere, _order, start_index, end_index);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("JudgeSubjectScoreList.aspx", "fun_id={0}&page={1}&keywords={2}&ea_id={3}&esn_id={4}&judge_id={5}", DESEncrypt.Encrypt(this.fun_id), "__id__",
                                              this.txtKeywords.Text, DESEncrypt.Encrypt(ea_id), DESEncrypt.Encrypt(esn_id), DESEncrypt.Encrypt(this.ddlJudge.SelectedValue));

            this.PageContent.InnerHtml = Utils.OutPageList(pageSize, page, totalCount, pageUrl, 8, true);
        }
예제 #2
0
        protected string getSubjectScore()
        {
            string txt       = "";
            string strWhere  = " Agency_id=" + model.Agency_id + " AND Period_id=" + period_id + " AND User_id=" + user_id;
            var    scoreList = new BLL.CCOM.View_AEE_Subject_Score().GetModelList(strWhere);

            if (scoreList.Count > 0)
            {
                txt += "<br/><br/><table width='100%' border='0' cellspacing='0' cellpadding='0' class='table table-striped table-bordered table-hover'><tbody>";

                string th = "<tr><th>考试科目名称</th><th>考试科目成绩</th><th>考试科目序</th></tr>";
                string td = "";
                foreach (var subScore in scoreList)
                {
                    td += "<tr>";
                    td += "<td>" + getSubjectName(subScore.Subject_id.ToString()) + "</td>";
                    td += "<td>" + getSubjectAverageScore(user_id.ToString(), subScore.Subject_id.ToString()) + "</td>";
                    td += "<td>" + getSubjectAverageXu(user_id.ToString(), subScore.Subject_id.ToString()) + "</td>";
                    td += "</tr>";
                }
                txt += th + td;
                txt += "</tbody></table>";
            }
            else
            {
                txt = "暂无记录";
            }
            return(txt);
        }
        protected void exportexcel_ServerClick(object sender, EventArgs e)
        {
            string order    = "UP_CCOM_number asc";
            string strWhere = CombSqlTxt(this.keywords);

            try
            {
                BLL.CCOM.View_AEE_Subject_Score bll = new BLL.CCOM.View_AEE_Subject_Score();

                List <Model.CCOM.View_AEE_Subject_Score> modelList = bll.GetModelList(strWhere + " order by " + order);

                DataSet ds = new DataSet();
                ds.Tables.Clear();

                DataTable  dt = ds.Tables.Add("Sheet1");
                DataRow    dr;
                DataColumn column;

                column            = new DataColumn();
                column.DataType   = System.Type.GetType("System.String");
                column.ColumnName = "序号";
                ds.Tables["Sheet1"].Columns.Add(column);

                column            = new DataColumn();
                column.DataType   = System.Type.GetType("System.String");
                column.ColumnName = "考生号";
                ds.Tables["Sheet1"].Columns.Add(column);

                column            = new DataColumn();
                column.DataType   = System.Type.GetType("System.String");
                column.ColumnName = "姓名";
                ds.Tables["Sheet1"].Columns.Add(column);

                column            = new DataColumn();
                column.DataType   = System.Type.GetType("System.String");
                column.ColumnName = "科目名称";
                ds.Tables["Sheet1"].Columns.Add(column);

                column            = new DataColumn();
                column.DataType   = System.Type.GetType("System.String");
                column.ColumnName = "科目成绩";
                ds.Tables["Sheet1"].Columns.Add(column);

                int count = modelList.Count;
                for (int i = 0, num = 1; i < count; i++, num++)
                {
                    dr         = ds.Tables["Sheet1"].NewRow();
                    dr["序号"]   = num.ToString();
                    dr["姓名"]   = modelList[i].User_realname;
                    dr["考生号"]  = modelList[i].UP_CCOM_number;
                    dr["科目名称"] = getSubjectName(modelList[i].Subject_id.ToString());


                    string score = getSubjectScore(modelList[i].User_id.ToString(), modelList[i].Subject_id.ToString(), this.judge_id.ToString());
                    if (score != null && score != "")
                    {
                        dr["科目成绩"] = score;
                    }
                    ds.Tables["Sheet1"].Rows.Add(dr);
                }

                DataToExcel.ExportToExcel(ds, Server.MapPath("/upload/excel/"), "考生科目成绩_" + DateTime.Now.ToFileTime().ToString() + ".xlsx", this.Page);
            }
            catch
            {
                JscriptMsg("获取考生科目成绩出错", "", "Error");
            }
        }
        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");
        }