コード例 #1
0
        protected string getSubjectScore()
        {
            string txt      = "";//
            string strWhere = " Period_id=" + period_id + " AND User_id=" + user_id;
            var    score    = new BLL.CCOM.Examination_CEE_score().GetModel(strWhere);

            if (score != null)
            {
                txt += "你的考生类型: " + (score.CEE_type == 1 ? "文科" : "理科") + "考生";
                txt += ", 你的高考各科考试成绩如下:<br/><br/>";
                txt += "<table width='100%' border='0' cellspacing='0' cellpadding='0' class='table table-striped table-bordered table-hover'><tbody>";

                string th = "<tr><th>考试科目名称</th><th>考试科目成绩</th></tr>";
                string td = "";
                td  += "<tr><td>语文</td><td>" + ((decimal)score.CEE_Chinese_score).ToString("F2") + "</td></tr>";
                td  += "<tr><td>数学</td><td>" + ((decimal)score.CEE_Math_score).ToString("F2") + "</td></tr>";
                td  += "<tr><td>外语</td><td>" + ((decimal)score.CEE_English_score).ToString("F2") + "</td></tr>";
                td  += "<tr><td>综合</td><td>" + ((decimal)score.CEE_comprehensive_score).ToString("F2") + "</td></tr>";
                td  += "<tr><td>附加分</td><td>" + ((decimal)score.CEE_extra_score).ToString("F2") + "</td></tr>";
                td  += "<tr><td>总分</td><td>" + ((decimal)score.CEE_score).ToString("F2") + "</td></tr>";
                txt += th + td;
                txt += "</tbody></table>";
            }
            else
            {
                txt = "你的高考各科目成绩是: 暂无记录";
            }
            return(txt);
        }
コード例 #2
0
 protected bool DoUpdate(Model.CCOM.Examination_CEE_score Fl)
 {
     try
     {
         BLL.CCOM.Examination_CEE_score Bfl = new BLL.CCOM.Examination_CEE_score();
         Bfl.Update(Fl);
     }
     catch (Exception ex)
     {
         return(false);
     }
     return(true);
 }
コード例 #3
0
        public void ProcessRequest(HttpContext context)
        {
            long    Id = 0;
            int     type = 0;
            string  result = "";
            decimal YuWen, ShuXue, YingYu, ZongHe, ErWai, ZongFen;

            YuWen = ShuXue = YingYu = ZongHe = ErWai = ZongFen = 0;

            var period = new BLL.CCOM.Period().GetModel("Period_state = " + DataDic.Period_state_On);

            if (period != null)
            {
                period_id = period.Period_id;
            }

            try
            {
                Id      = Convert.ToInt64(DESEncrypt.Decrypt(context.Request.Params["id"].ToString()));
                type    = Convert.ToInt16(context.Request.Params["type"].ToString());
                YuWen   = Convert.ToDecimal(context.Request.Params["YuWen"].ToString());
                ShuXue  = Convert.ToDecimal(context.Request.Params["ShuXue"].ToString());
                YingYu  = Convert.ToDecimal(context.Request.Params["YingYu"].ToString());
                ZongHe  = Convert.ToDecimal(context.Request.Params["ZongHe"].ToString());
                ErWai   = Convert.ToDecimal(context.Request.Params["ErWai"].ToString());
                ZongFen = Convert.ToDecimal(context.Request.Params["ZongFen"].ToString());

                var model  = new Model.CCOM.Examination_CEE_score();
                var _model = new Model.CCOM.Examination_CEE_score();
                BLL.CCOM.Examination_CEE_score Becs = new BLL.CCOM.Examination_CEE_score();

                model                          = new BLL.CCOM.Examination_CEE_score().GetModel(" Period_id = " + period_id + " and User_id=" + Id);
                _model.CEE_type                = type;
                _model.CEE_Chinese_score       = YuWen;
                _model.CEE_Math_score          = ShuXue;
                _model.CEE_English_score       = YingYu;
                _model.CEE_comprehensive_score = ZongHe;
                _model.CEE_extra_score         = ErWai;
                _model.CEE_score               = ZongFen;
                _model.Period_id               = period_id;
                _model.User_id                 = Id;
                _model.CEE_status              = false;
                if (model != null)
                {
                    _model.CEE_id = model.CEE_id;
                    Becs.Update(_model);
                }
                else
                {
                    Becs.Add(_model);
                }

                result += "添加成功";
            }
            catch (Exception ex)
            {
                ILog LOGGER = LogManager.GetLogger("quanquan");
                LOGGER.Debug(ex.Message, ex);
                result += "添加失败,请重新尝试";
            }

            context.Response.ContentType = "text/plain";
            context.Response.Write(result);
        }
コード例 #4
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);
        }
コード例 #5
0
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            string result = "";

            if (this.txtFraUpload.PostedFile.FileName == "")
            {
                JscriptMsg("请选择上传文件", "", "Error");
                return;
            }
            DataSet ds   = new DataSet();
            string  path = "/upload/excel/";

            #region 解决360获取绝对路径导致出错的问题
            string   AbsolutePath = this.txtFraUpload.PostedFile.FileName;
            string[] pathList     = new string[] { };

            pathList     = AbsolutePath.Split('\\');
            AbsolutePath = pathList[pathList.Length - 1];
            #endregion

            string fileName = DateTime.Now.ToFileTime() + "_" + AbsolutePath;
            string FexName  = fileName.Substring(fileName.LastIndexOf(".") + 1);
            if (FexName != "xls" && FexName != "xlsx")
            {
                JscriptMsg("请上传Excel文件", "", "Error");
                return;
            }

            string filePath = Server.MapPath(path + fileName);

            this.txtFraUpload.SaveAs(filePath);
            int success = 0, error = 0;
            try
            {
                var excel = new Common.ExcelToData();
                ds = excel.GetExcelData(filePath);

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    if (ds.Tables[0].Rows[i]["考生号"].ToString().Trim() == "")
                    {
                        result += "×第" + (i + 1).ToString() + "行添加失败,考生号不能为空;<br/>";
                        error++;
                        continue;
                    }

                    var __model = new BLL.CCOM.User_property().GetModel(" UP_CCOM_number='" + ds.Tables[0].Rows[i]["考生号"].ToString().Trim() + "'");
                    if (__model == null)
                    {
                        result += "×第" + (i + 1).ToString() + "行添加失败,考生号错误;<br/>";
                        error++;
                        continue;
                    }
                    long user_id = __model.User_id;

                    string WenOrLi = ds.Tables[0].Rows[i]["文理"].ToString().Trim();
                    if (WenOrLi == "" || (WenOrLi != "1" && WenOrLi != "2" && WenOrLi != "3"))
                    {
                        result += "×第" + (i + 1).ToString() + "行添加失败,文理格式错误或为空;<br/>";
                        error++;
                        continue;
                    }

                    var model  = new Model.CCOM.Examination_CEE_score();
                    var _model = new Model.CCOM.Examination_CEE_score();
                    model = new BLL.CCOM.Examination_CEE_score().GetModel(" Period_id = " + period_id + " and User_id=" + user_id);

                    _model.CEE_type                = Convert.ToInt16(ds.Tables[0].Rows[i]["文理"].ToString().Trim());
                    _model.CEE_Chinese_score       = (ds.Tables[0].Rows[i]["语文"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(ds.Tables[0].Rows[i]["语文"].ToString().Trim()));
                    _model.CEE_Math_score          = (ds.Tables[0].Rows[i]["数学"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(ds.Tables[0].Rows[i]["数学"].ToString().Trim()));
                    _model.CEE_English_score       = (ds.Tables[0].Rows[i]["外语"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(ds.Tables[0].Rows[i]["外语"].ToString().Trim()));
                    _model.CEE_comprehensive_score = (ds.Tables[0].Rows[i]["综合"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(ds.Tables[0].Rows[i]["综合"].ToString().Trim()));
                    _model.CEE_extra_score         = (ds.Tables[0].Rows[i]["附加分"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(ds.Tables[0].Rows[i]["附加分"].ToString().Trim()));
                    _model.CEE_score               = _model.CEE_Chinese_score + _model.CEE_Math_score + _model.CEE_English_score + _model.CEE_comprehensive_score + _model.CEE_extra_score;

                    bool isOK = false;
                    if (model != null)
                    {
                        _model.Period_id  = model.Period_id;
                        _model.CEE_id     = model.CEE_id;
                        _model.CEE_status = model.CEE_status;
                        _model.User_id    = model.User_id;
                        isOK = DoUpdate(_model);
                    }
                    else
                    {
                        _model.Period_id  = period_id;
                        _model.User_id    = user_id;
                        _model.CEE_status = false;
                        isOK = DoAdd(_model);
                    }

                    if (isOK)
                    {
                        success++;
                    }
                    else
                    {
                        result += "×第" + (i + 1).ToString() + "行‘" + ds.Tables[0].Rows[i]["考生号"].ToString().Trim() + "’信息异常,导入失败。<br/>";
                        error++;
                    }
                }
            }
            catch (Exception ex)
            {
                ILog LOGGER = LogManager.GetLogger("quanquan");
                LOGGER.Debug("导入分数线异常" + ex.Message, ex);
                result = "导入分数线异常,请联系客服";
            }

            string divinfo = "<div class=\"alert alert-block alert-info fade in\">";
            divinfo += "<button data-dismiss=\"alert\" class=\"close\" type=\"button\">×</button>";
            divinfo += "<h4 class=\"alert-heading\">导入结果</h4>";
            divinfo += "<p>";
            if (success != ds.Tables[0].DefaultView.Count)
            {
                divinfo += "部分导入成功,您可以按照提示修改Excel并重新提交<br>";
            }
            else
            {
                divinfo += "全部导入成功,请您进入下一步确认导入信息<br>";
            }
            divinfo += "*共有" + ds.Tables[0].DefaultView.Count + "条数据,成功" + success + "条,失败" + error + "条;<br/>";
            if (result != "")
            {
                divinfo += "详细信息如下:<br><font color='red'>" + result;
            }
            divinfo           += "</font></p>";
            divinfo           += "</div>";
            this.lblError.Text = divinfo;

            //显示下一步
            if (success > 0)
            {
                this.btnSubmit.Visible = true;
            }
            //删除上传的文件
            File.Delete(filePath);
        }