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_Score bll = new BLL.CCOM.View_AEE_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("AEEScoreList.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); }
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"); } }
protected void btnCalAEEScore_Click(object sender, EventArgs e) { getSubjectWeights(); string order = ""; string strWhere = " Major_Agency_id=" + major_id + " AND Period_id=" + period_id + " AND Subject_level=2"; subList = new BLL.CCOM.Subject().GetModelList(strWhere + order); count = subList.Count; order = " order by UP_CCOM_number asc"; strWhere = CombSqlTxt(""); BLL.CCOM.View_AEE_Score bll = new BLL.CCOM.View_AEE_Score(); BLL.CCOM.Examination_AEE_score bll1 = new BLL.CCOM.Examination_AEE_score(); var userList = bll.GetModelList(strWhere + order); try { foreach (var model in userList) { decimal _score = 0; decimal _sequence = 0; foreach (var model1 in subList) { decimal weight = ((decimal)Weights[model1.Subject_id] / (decimal)Weights[0]) * ((decimal)model1.Subject_weight / (decimal)Weights[model1.Fs_id]); _score += Convert.ToDecimal(getSubjectAverageScore(model.User_id.ToString(), model1.Subject_id.ToString())) * weight; if (getSubjectAverageXu(model.User_id.ToString(), model1.Subject_id.ToString()) != "") { _sequence += Convert.ToDecimal(getSubjectAverageXu(model.User_id.ToString(), model1.Subject_id.ToString())) * weight; } } var _model = bll1.GetModel(" User_id=" + model.User_id + " AND Period_id=" + period_id); var __model = new Model.CCOM.Examination_AEE_score(); __model.AEE_score = _score; __model.AEE_sequence = _sequence; __model.Period_id = period_id; __model.User_id = model.User_id; if (_model != null) { __model.AEE_id = _model.AEE_id; bll1.Update(__model); } else { bll1.Add(__model); } } var userList1 = bll.GetModelList(strWhere + " order by AEE_score DESC, AEE_sequence DESC, UP_CCOM_number asc"); int rank = 1; foreach (var model in userList1) { var _model = bll1.GetModel(" User_id=" + model.User_id + " AND Period_id=" + period_id); _model.AEE_ranking = rank++; bll1.Update(_model); } JscriptMsg("计算成绩成功", "AEEScoreList.aspx?fun_id=" + DESEncrypt.Encrypt(this.fun_id) + "&keywords=" + this.txtKeywords.Text + "&major_id=" + DESEncrypt.Encrypt(this.major_id), "Success"); } catch { JscriptMsg("计算成绩出错", "", "Error"); } }
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"); } }