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");
            }
        }
예제 #2
0
        /// <summary>
        /// 计算成绩,计算这个App_CCOM_TestScores表中 ShiJian是当前年份的记录
        /// 要求该表中以下字段不为空:UserID、SchoolUserID、WenLi、ZongFen、ZhuanYeMingCheng、ZhuanYeFenShu、ShiJian,SchoolUser_HomeProvince
        /// 最终计算的出WenKaoGuoXian、WenKeFenShu、以及ZuiZhongFenShu
        /// 计算规则:先判断其文考成绩是否过线(根据各省分数线以及不同专业的那个要求);而后将理科考生的成绩按照公式转化为文科成绩,文科考生不做处理;
        /// 紧接着将文科成绩按照公式转化为百分制;最后文科成绩和艺术专业成绩按照各50%计算出最终成绩。
        /// </summary>
        /// <returns></returns>
        public bool Calculate(string major_id)
        {
            //calculateFenShuXian();
            try
            {
                BLL.CCOM.View_TotalScore bll = new BLL.CCOM.View_TotalScore();
                var userList = bll.GetModelList(" Period_id=" + period_id + " AND Agency_id=" + major_id); //本年度的学生
                foreach (var user in userList)
                {
                    var userInfo = new BLL.CCOM.User_property().GetModel(" User_id=" + user.User_id);
                    var userCEE  = new BLL.CCOM.Examination_CEE_score().GetModel(" User_id=" + user.User_id + " AND Period_id=" + period_id);
                    var model    = new BLL.CCOM.Transcript().GetModel(" User_id=" + user.User_id + " AND Period_id=" + period_id);
                    if (userInfo != null)
                    {
                        var fenshuxian = new BLL.CCOM.Fractional_line().GetModelList("Fl_Province = " + userInfo.UP_province + " and Period_id = " + period_id);
                        if (fenshuxian == null || fenshuxian.Count == 0)
                        {
                            continue;
                        }

                        int WenLi = (int)(userCEE.CEE_type);
                        ///判断是否过线
                        string zhuanye    = new BLL.CCOM.Agency().GetModel("Agency_id=" + major_id).Agency_name;
                        var    guoxianfen = guoxianFen(zhuanye, WenLi, fenshuxian[0]);
                        if (guoxianfen == 0)
                        {
                            continue;
                        }

                        bool passline = false;
                        if (guoxianfen <= Convert.ToDecimal(userCEE.CEE_score))
                        {
                            passline = true;
                        }
                        else
                        {
                            passline = false;
                        }

                        decimal wenkaofenshu = (decimal)userCEE.CEE_score;
                        if (WenLi == 2)  //理科
                        {
                            wenkaofenshu = wenkaofenshu / (decimal)fenshuxian[0].LiKeSanBen * (decimal)fenshuxian[0].WenKeSanBen;
                        }
                        wenkaofenshu = wenkaofenshu / (decimal)fenshuxian[0].WenKeZongFen * 100;  //转换为百分制
                        user.Transcript_CEE_convert_score = wenkaofenshu;
                        user.Transcript_CEE_score         = userCEE.CEE_score;

                        decimal score = 0;
                        if (zhuanye == "音乐学" || zhuanye == "音乐艺术管理" || zhuanye == "音乐治疗" || zhuanye == "音乐教育" || zhuanye == "音乐教育(协作计划)")
                        {
                            score = wenkaofenshu * (decimal)0.5 + (decimal)user.Transcript_AEE_score * (decimal)0.5;
                        }
                        else
                        {
                            score = (decimal)user.Transcript_AEE_score;
                        }

                        model.Transcript_CEE_score         = userCEE.CEE_score;
                        model.Transcript_CEE_convert_score = wenkaofenshu;
                        model.Transcript_passline          = passline;
                        model.Transcript_score             = score;
                    }
                    new BLL.CCOM.Transcript().Update(model);
                }
            }
            catch
            {
            }
            return(true);
        }