protected void ddlMajor_SelectedIndexChanged(object sender, EventArgs e) { string str1 = " Agency_id=" + major_id + " AND Period_id=" + period_id + " AND UP_calculation_status > 2"; var model1 = new BLL.CCOM.User_property().GetModelList(str1); if (model1.Count > 0) { hasRetrial = false; } this.btnCalculation.Enabled = hasRetrial; string order = ""; string strWhere = " Major_id=" + major_id + " AND Period_id=" + period_id; BLL.CCOM.Exam_preliminary_subject bll = new BLL.CCOM.Exam_preliminary_subject(); var epsmodel = bll.GetModel(strWhere); if (epsmodel != null) { int Esn_id = epsmodel.Esn_id; subList = new BLL.CCOM.Subject().GetModelList(" Fs_id=" + Esn_id); count = subList.Count; } order = "Epss_score DESC, Epss_sequence DESC ,UP_CCOM_number asc"; strWhere = CombSqlTxt(this.keywords); try { RptBind(strWhere, order); } catch { JscriptMsg("获取考生成绩出错", "", "Error"); } }
public bool addPreliminary(string major, string subject_id) { try { string strWhere = " Major_id=" + major + " AND Period_id=" + this.period_id; BLL.CCOM.Exam_preliminary_subject bll = new BLL.CCOM.Exam_preliminary_subject(); var model = bll.GetModel(strWhere); var _model = new Model.CCOM.Exam_preliminary_subject(); if (model == null) { _model.Esn_id = Convert.ToInt32(subject_id); _model.Major_id = Convert.ToInt32(major); _model.Period_id = this.period_id; bll.Add(_model); } else { model.Esn_id = Convert.ToInt32(subject_id); bll.Update(model); } return(true); } catch { JscriptMsg("数据出错", "", "Error"); return(false); } }
private void RalBind() { try { string order = ""; string strWhere = " Major_id=" + major_id + " AND Period_id=" + period_id; BLL.CCOM.Exam_preliminary_subject bll = new BLL.CCOM.Exam_preliminary_subject(); var epsmodel = bll.GetModel(strWhere); if (epsmodel != null) { int Esn_id = epsmodel.Esn_id; subList = new BLL.CCOM.Subject().GetModelList(" Fs_id=" + Esn_id); count = subList.Count; } order = "Epss_score DESC, Epss_sequence DESC ,UP_CCOM_number asc"; strWhere = CombSqlTxt(this.keywords); try { RptBind(strWhere, order); } catch { JscriptMsg("获取考生成绩出错", "", "Error"); } } catch { JscriptMsg("数据出错", "", "Error"); } }
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"); } }