コード例 #1
0
        /// <summary>
        /// Myxls导出Excel,保存在客户端
        /// </summary>
        private void DataTableExportToExcel(long applyId, string xlsName, string sheetName)
        {
            //表头
            //决定Datatable显示哪些内容
            DataSet    ds = new DataSet();
            DataTable  dt = ds.Tables.Add("Sheet1");
            DataRow    dr;
            DataColumn column;

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

            //2---准考证号
            column            = new DataColumn();
            column.DataType   = System.Type.GetType("System.String");
            column.ColumnName = "准考证号";
            ds.Tables["Sheet1"].Columns.Add(column);
            //3---姓名
            column            = new DataColumn();
            column.DataType   = System.Type.GetType("System.String");
            column.ColumnName = "姓名";
            ds.Tables["Sheet1"].Columns.Add(column);
            //4---专业
            column            = new DataColumn();
            column.DataType   = System.Type.GetType("System.String");
            column.ColumnName = "专业";
            ds.Tables["Sheet1"].Columns.Add(column);

            var ml = new BLL.CCOM.Examination_arrangement_detail().GetModelList(" Ea_id='" + applyId + "' order by newid()");

            for (int row = 0; row < ml.Count; row++)
            {
                var m = ml[row];

                //申请人基本信息
                //学生用户
                try
                {
                    Model.CCOM.View_UserAgency model = new BLL.CCOM.View_UserAgency().GetModel(" User_id='" + m.User_id + "'");
                    dr    = ds.Tables["Sheet1"].NewRow();
                    dr[0] = row + 1;
                    dr[1] = model.UP_CCOM_number;
                    dr[2] = model.User_realname;
                    dr[3] = model.Agency_name;

                    ds.Tables["Sheet1"].Rows.Add(dr);
                }
                catch
                {
                    continue;
                }
            }

            //导出EXCEL,速度有点慢
            DataToExcel.ExportToExcel(ds, Server.MapPath("/upload/excel/"), xlsName + ".xlsx", this.Page);
        }
コード例 #2
0
        /// <summary>
        /// 导出数据
        /// </summary>
        protected override void DoExport(object sender)
        {
            DataTable dt = new DataTable();

            int[] rows = _SummaryView.GetSelectedRows();
            if (rows.Length < 1)
            {
                Msg.Warning("请选择至少1条数据!");
                return;
            }
            else
            {
                WaiteServer.ShowWaite(this);

                int sucess = 0;

                Dictionary <string, object> dic = new Dictionary <string, object>();

                if (!String.IsNullOrEmpty(txts_RETURN_STATUS.Text))
                {
                    dic.Add("RETURN_STATUS", txts_RETURN_STATUS.EditValue);
                }
                if (!String.IsNullOrEmpty(txts_STAR_TIME.Text))
                {
                    dic.Add("STAR_TIME", txts_STAR_TIME.EditValue);
                }
                if (!String.IsNullOrEmpty(txts_END_TIME.Text))
                {
                    dic.Add("END_TIME", txts_END_TIME.EditValue);
                }

                foreach (int k in rows)
                {
                    string Key = ConvertEx.ToString(_SummaryView.GetDataRow(k)[_bll.SummaryModel.PrimaryKey]);

                    if (!String.IsNullOrEmpty(Key))
                    {
                        dic.Add("G_NAME" + sucess.ToString(), ",'" + Key + "'");
                    }

                    sucess++;
                }

                dt = bll.GetListData(dic);//获得需要绑定的数据
            }

            if (DataToExcel.ExportToExcel(dt, "商品汇总", Lists))
            {
                WaiteServer.CloseWaite();
                Msg.ShowInformation("导出成功!");
            }

            WaiteServer.CloseWaite();
        }
コード例 #3
0
        protected void exportexcel_ServerClick(object sender, EventArgs e)
        {
            string order    = "AEE_score DESC, AEE_sequence DESC ,UP_CCOM_number asc";
            string strWhere = CombSqlTxt(this.keywords);

            try
            {
                string order1    = "";
                string strWhere1 = " Major_Agency_id=" + major_id + " AND Period_id=" + period_id + " AND Subject_level=2";

                subList = new BLL.CCOM.Subject().GetModelList(strWhere1 + order1);
                count   = subList.Count;

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

                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);

                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;

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

                    dr["总成绩"]  = ((decimal)(modelList[i].AEE_score)).ToString("F2");
                    dr["总平均序"] = ((decimal)modelList[i].AEE_sequence).ToString("F2");
                    dr["专业排名"] = modelList[i].AEE_ranking;

                    _ds.Tables["Sheet1"].Rows.Add(dr);
                }
                DataToExcel.ExportToExcel(_ds, Server.MapPath("/upload/excel/"), "艺考科目成绩_" + DateTime.Now.ToFileTime().ToString() + ".xlsx", this.Page);
            }
            catch
            {
                JscriptMsg("获取艺考科目成绩出错", "", "Error");
            }
        }
コード例 #4
0
        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");
            }
        }
コード例 #5
0
        protected void exportexcel_ServerClick(object sender, EventArgs e)
        {
            string str1   = " Agency_id=" + major_id + " AND Period_id=" + period_id + " AND UP_calculation_status > 3";
            var    model1 = new BLL.CCOM.User_property().GetModelList(str1);

            if (model1.Count > 0)
            {
                hasCEE = false;
            }
            this.btnCalculation.Enabled = hasCEE;

            string order    = "AEE_score DESC, AEE_sequence DESC ,UP_CCOM_number asc";
            string strWhere = CombSqlTxt(this.keywords);

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

                List <Model.CCOM.View_AEE_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);

                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["状态"]     = getIntoCEE(modelList[i].UP_calculation_status.ToString(), modelList[i].User_id.ToString());
                    dr["姓名"]     = modelList[i].User_realname;
                    dr["考生号"]    = modelList[i].UP_CCOM_number;
                    dr["专业总分"]   = ((decimal)(modelList[i].AEE_score)).ToString("F2");
                    dr["专业总平均序"] = ((decimal)modelList[i].AEE_sequence).ToString("F2");
                    dr["专业排名"]   = modelList[i].AEE_ranking;

                    ds.Tables["Sheet1"].Rows.Add(dr);
                }

                DataToExcel.ExportToExcel(ds, Server.MapPath("/upload/excel/"), this.ddlMajor.SelectedItem.Text + "_进入文考情况_" + DateTime.Now.ToFileTime().ToString() + ".xlsx", this.Page);
            }
            catch
            {
                JscriptMsg("获取进入文考情况出错", "", "Error");
            }
        }
コード例 #6
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");
            }
        }
コード例 #7
0
        protected void exportexcel_ServerClick(object sender, EventArgs e)
        {
            string order    = "UP_CCOM_number asc";
            string strWhere = CombSqlTxt(this.keywords);

            try
            {
                var bll = new BLL.CCOM.View_User_CEE();
                List <Model.CCOM.View_User_CEE> 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);

                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);

                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);

                /*
                 * //增加只导出选择部分学生的功能
                 * bool exprotAll = true;
                 * for (int i = 0; i < rptList.Items.Count; i++)
                 * {
                 *  CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                 *  if (cb.Checked == true)
                 *  {
                 *      exprotAll = false;
                 *      break;
                 *  }
                 * }
                 */

                //int count = exprotAll == true ? modelList.Count : rptList.Items.Count;
                int count = modelList.Count;
                for (int i = 0, num = 1; i < count; i++, num++)
                {
                    /*
                     * //如果只导出部分学生且未选中,则跳过
                     * if (exprotAll == false)
                     * {
                     *  CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                     *  if (cb.Checked == false)
                     *  {
                     *      //增加序号
                     *      num--;
                     *      continue;
                     *  }
                     * }
                     */

                    dr             = ds.Tables["Sheet1"].NewRow();
                    dr["序号"]       = num.ToString();
                    dr["考生号"]      = modelList[i].UP_CCOM_number;
                    dr["姓名"]       = modelList[i].User_realname;
                    dr["高考报名号"]    = modelList[i].UP_CEE_number;
                    dr["专业方向"]     = GetAgencyName(modelList[i].Agency_id.ToString());
                    dr["考生类型:文/理"] = GetWenOrLi(modelList[i].CEE_type.ToString());

                    if (modelList[i].CEE_Chinese_score.ToString() != "" && modelList[i].CEE_Chinese_score.ToString() != null)
                    {
                        dr["语文"] = ((decimal)modelList[i].CEE_Chinese_score).ToString("#.##");
                    }
                    if (modelList[i].CEE_Math_score.ToString() != "" && modelList[i].CEE_Math_score.ToString() != null)
                    {
                        dr["数学"] = ((decimal)modelList[i].CEE_Math_score).ToString("#.##");
                    }
                    if (modelList[i].CEE_English_score.ToString() != "" && modelList[i].CEE_English_score.ToString() != null)
                    {
                        dr["外语"] = ((decimal)modelList[i].CEE_English_score).ToString("#.##");
                    }
                    if (modelList[i].CEE_comprehensive_score.ToString() != "" && modelList[i].CEE_comprehensive_score.ToString() != null)
                    {
                        dr["综合"] = ((decimal)modelList[i].CEE_comprehensive_score).ToString("#.##");
                    }
                    if (modelList[i].CEE_extra_score.ToString() != "" && modelList[i].CEE_extra_score.ToString() != null)
                    {
                        dr["附加分"] = ((decimal)modelList[i].CEE_extra_score).ToString("#.##");
                    }
                    if (modelList[i].CEE_score.ToString() != "" && modelList[i].CEE_score.ToString() != null)
                    {
                        dr["总分"] = ((decimal)modelList[i].CEE_score).ToString("#.##");
                    }

                    ds.Tables["Sheet1"].Rows.Add(dr);
                }

                DataToExcel.ExportToExcel(ds, Server.MapPath("/upload/excel/"), this.ddlProvince.SelectedItem.Text + "_高考分数_" + DateTime.Now.ToFileTime().ToString() + ".xlsx", this.Page);
            }
            catch
            {
                JscriptMsg("导出高考分数出错", "", "Error");
            }
        }
コード例 #8
0
        /// <summary>
        /// Myxls导出Excel,保存在客户端
        /// </summary>
        private void DataTableExportToExcel(string xlsName, string sheetName)
        {
            //表头
            //决定Datatable显示哪些内容
            DataSet    ds = new DataSet();
            DataTable  dt = ds.Tables.Add("Sheet1");
            DataRow    dr;
            DataColumn column;

            //1---序号
            column            = new DataColumn();
            column.DataType   = System.Type.GetType("System.String");
            column.ColumnName = "序号";
            ds.Tables["Sheet1"].Columns.Add(column);
            //2---姓名
            column            = new DataColumn();
            column.DataType   = System.Type.GetType("System.String");
            column.ColumnName = "姓名";
            ds.Tables["Sheet1"].Columns.Add(column);
            //3---学号/工号
            column            = new DataColumn();
            column.DataType   = System.Type.GetType("System.String");
            column.ColumnName = "联系电话";
            ds.Tables["Sheet1"].Columns.Add(column);
            //4---性别
            column            = new DataColumn();
            column.DataType   = System.Type.GetType("System.String");
            column.ColumnName = "性别";
            ds.Tables["Sheet1"].Columns.Add(column);
            ////5---省份
            //column = new DataColumn();
            //column.DataType = System.Type.GetType("System.String");
            //column.ColumnName = "省份";
            //ds.Tables["Sheet1"].Columns.Add(column);

            //6---政治面貌
            column            = new DataColumn();
            column.DataType   = System.Type.GetType("System.String");
            column.ColumnName = "政治面貌";
            ds.Tables["Sheet1"].Columns.Add(column);
            //7---机构
            column            = new DataColumn();
            column.DataType   = System.Type.GetType("System.String");
            column.ColumnName = "报考方向";
            ds.Tables["Sheet1"].Columns.Add(column);



            var ml = new BLL.CCOM.View_UserAgency().GetModelList(" User_type !=6 " + CombSqlTxt(this.uo_id, this.provence, this.keywords));

            for (int row = 0; row < ml.Count; row++)
            {
                var m = ml[row];

                dr    = ds.Tables["Sheet1"].NewRow();
                dr[0] = row + 1;
                dr[1] = m.User_realname;
                dr[2] = ((Boolean)m.User_gender) == false ? "男" : "女";
                dr[3] = GetProvince(Utils.ObjectToStr(m.User_id));
                dr[4] = m.User_number;
                dr[5] = GetNationality(Utils.ObjectToStr(m.User_id));
                dr[6] = m.Agency_name;

                ds.Tables["Sheet1"].Rows.Add(dr);
            }

            //导出EXCEL,速度有点慢
            DataToExcel.ExportToExcel(ds, Server.MapPath("/upload/excel/"), xlsName + ".xlsx", this.Page);
        }
コード例 #9
0
        protected void exportexcel_ServerClick(object sender, EventArgs e)
        {
            string str1   = " Agency_id=" + major_id + " AND Period_id=" + period_id + " AND UP_calculation_status > 4";
            var    model1 = new BLL.CCOM.User_property().GetModelList(str1);

            if (model1.Count > 0)
            {
                hasAdmission = false;
            }
            this.btnSubmit.Enabled = hasAdmission;

            string order    = "";
            string strWhere = "";

            order    = "Transcript_score DESC, Transcript_AEE_ranking asc ,UP_CCOM_number asc";
            strWhere = CombSqlTxt(this.keywords);
            try
            {
                var bll = new BLL.CCOM.View_TotalScore();
                List <Model.CCOM.View_TotalScore> 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);

                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);

                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);

                /*
                 * //增加只导出选择部分学生的功能
                 * bool exprotAll = true;
                 * for (int i = 0; i < rptList.Items.Count; i++)
                 * {
                 *  CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                 *  if (cb.Checked == true)
                 *  {
                 *      exprotAll = false;
                 *      break;
                 *  }
                 * }
                 */

                //int count = exprotAll == true ? modelList.Count : rptList.Items.Count;
                int count = modelList.Count;
                for (int i = 0, num = 1; i < count; i++, num++)
                {
                    /*
                     * //如果只导出部分学生且未选中,则跳过
                     * if (exprotAll == false)
                     * {
                     *  CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                     *  if (cb.Checked == false)
                     *  {
                     *      //增加序号
                     *      num--;
                     *      continue;
                     *  }
                     * }
                     */

                    dr          = ds.Tables["Sheet1"].NewRow();
                    dr["序号"]    = num.ToString();
                    dr["状态"]    = getAdmission(modelList[i].UP_calculation_status.ToString());
                    dr["考生号"]   = modelList[i].UP_CCOM_number;
                    dr["姓名"]    = modelList[i].User_realname;
                    dr["专业成绩"]  = ((decimal)modelList[i].Transcript_AEE_score).ToString("F2");
                    dr["专业平均序"] = ((decimal)modelList[i].Transcript_AEE_sequence).ToString("F2");
                    dr["专业排名"]  = modelList[i].Transcript_AEE_ranking;

                    if (modelList[i].Transcript_type.ToString() != "" && modelList[i].Transcript_type.ToString() != null)
                    {
                        dr["文考结果"] = modelList[i].Transcript_type == 1 ? "备取" : (modelList[i].Transcript_type == 2 ? "合格" : "正取");
                    }
                    if (modelList[i].Transcript_CEE_score.ToString() != "" && modelList[i].Transcript_CEE_score.ToString() != null)
                    {
                        dr["高考总分"] = ((decimal)modelList[i].Transcript_CEE_score).ToString("#.##");
                    }
                    if (modelList[i].Transcript_passline.ToString() != "" && modelList[i].Transcript_passline.ToString() != null)
                    {
                        dr["高考过线"] = modelList[i].Transcript_passline == false ? "否" : "是";
                    }
                    if (modelList[i].Transcript_CEE_convert_score.ToString() != "" && modelList[i].Transcript_CEE_convert_score.ToString() != null)
                    {
                        dr["高考折合分"] = ((decimal)modelList[i].Transcript_CEE_convert_score).ToString("#.##");
                    }
                    if (modelList[i].Transcript_score.ToString() != "" && modelList[i].Transcript_score.ToString() != null)
                    {
                        dr["最终成绩"] = ((decimal)modelList[i].Transcript_score).ToString("#.##");
                    }

                    ds.Tables["Sheet1"].Rows.Add(dr);
                }

                DataToExcel.ExportToExcel(ds, Server.MapPath("/upload/excel/"), this.ddlMajor.SelectedItem.Text + "_考生最终录取名单情况_" + DateTime.Now.ToFileTime().ToString() + ".xlsx", this.Page);
            }
            catch
            {
                JscriptMsg("导出考生最终录取名单情况出错", "", "Error");
            }
        }
コード例 #10
0
        /*
         * protected void btnCalculation_Click(object sender, EventArgs e)
         * {
         *  try
         *  {
         *      new Calculation().calculateFenShuXian();
         *      JscriptMsg("计算分数线成功", "FractionallineList.aspx?fun_id=" + MyRequest.GetString("fun_id"), "Success");
         *  }
         *  catch
         *  {
         *      JscriptMsg("计算分数线失败,请重新尝试", "FractionallineList.aspx?fun_id=" + MyRequest.GetString("fun_id"), "Error");
         *  }
         * }
         * */
        protected void exportexcel_ServerClick(object sender, EventArgs e)
        {
            String _strWhere = " Period_id=" + period_id;
            String _order    = " order by Fl_Province asc";

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

                List <Model.CCOM.Fractional_line> modelList = bll.GetModelList(_strWhere + _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);

                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);

                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["省份"]           = GetProvinceName(modelList[i].Fl_Province);
                    dr["文科一本线"]        = ((decimal)modelList[i].WenKeYiBen).ToString("F2");
                    dr["理科一本线"]        = ((decimal)modelList[i].LiKeYiBen).ToString("F2");
                    dr["文科二本线"]        = ((decimal)modelList[i].WenKeErBen).ToString("F2");
                    dr["理科二本线"]        = ((decimal)modelList[i].LiKeErBen).ToString("F2");
                    dr["文科三本线"]        = ((decimal)modelList[i].WenKeSanBen).ToString("F2");
                    dr["理科三本线"]        = ((decimal)modelList[i].LiKeSanBen).ToString("F2");
                    dr["艺术类最低控制线(文科)"] = ((decimal)modelList[i].WenKeYiShuXian).ToString("F2");
                    dr["艺术类最低控制线(理科)"] = ((decimal)modelList[i].LiKeYiShuXian).ToString("F2");
                    dr["文科满分"]         = ((decimal)modelList[i].WenKeZongFen).ToString("F2");
                    dr["理科满分"]         = ((decimal)modelList[i].LiKeZongFen).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");
            }
        }