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

            BLL.CCOM.View_Preliminary_Score bll = new BLL.CCOM.View_Preliminary_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("SelectToRetrial.aspx", "fun_id={0}&page={1}&keywords={2}&major_id={3}", DESEncrypt.Encrypt(this.fun_id), "__id__",
                                              this.txtKeywords.Text, DESEncrypt.Encrypt(this.major_id));

            this.PageContent.InnerHtml = Utils.OutPageList(pageSize, page, totalCount, pageUrl, 8, true);
        }
Exemple #2
0
        protected void exportexcel_ServerClick(object sender, EventArgs e)
        {
            string order    = "Epss_score DESC, Epss_sequence DESC ,UP_CCOM_number asc";
            string strWhere = CombSqlTxt(this.keywords);

            try
            {
                string strWhere1 = " Major_id=" + major_id + " AND Period_id=" + period_id;

                BLL.CCOM.Exam_preliminary_subject bll1 = new BLL.CCOM.Exam_preliminary_subject();
                var epsmodel = bll1.GetModel(strWhere1);

                if (epsmodel != null)
                {
                    int Esn_id = epsmodel.Esn_id;
                    subList = new BLL.CCOM.Subject().GetModelList(" Fs_id=" + Esn_id);
                    count   = subList.Count;
                }

                BLL.CCOM.View_Preliminary_Score          bll       = new BLL.CCOM.View_Preliminary_Score();
                List <Model.CCOM.View_Preliminary_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);

                if (count > 0)
                {
                    foreach (var model in subList)
                    {
                        column            = new DataColumn();
                        column.DataType   = System.Type.GetType("System.String");
                        column.ColumnName = model.Subject_title;
                        _ds.Tables["Sheet1"].Columns.Add(column);

                        column            = new DataColumn();
                        column.DataType   = System.Type.GetType("System.String");
                        column.ColumnName = model.Subject_title + "序";
                        _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["状态"]  = getIntoRetrail(modelList[i].UP_calculation_status.ToString());
                    dr["姓名"]  = modelList[i].User_realname;
                    dr["考生号"] = modelList[i].UP_CCOM_number;

                    int t = 0;;
                    if (count > 0)
                    {
                        foreach (var model in subList)
                        {
                            dr[4 + t]     = getSubjectAverageScore(modelList[i].User_id.ToString(), model.Subject_id.ToString());
                            dr[4 + t + 1] = getSubjectAverageXu(modelList[i].User_id.ToString(), model.Subject_id.ToString());
                            t            += 2;
                        }
                    }

                    dr["总成绩"]  = ((decimal)(modelList[i].Epss_score)).ToString("F2");
                    dr["总平均序"] = ((decimal)modelList[i].Epss_sequence).ToString("F2");

                    _ds.Tables["Sheet1"].Rows.Add(dr);
                }
                DataToExcel.ExportToExcel(_ds, Server.MapPath("/upload/excel/"), "初试进入复试情况_" + DateTime.Now.ToFileTime().ToString() + ".xlsx", this.Page);
            }
            catch
            {
                JscriptMsg("获取初试进入复试情况出错", "", "Error");
            }
        }