Exemplo n.º 1
0
        public bool calculateSubjectXu(string esn_id, string jugde_id)
        {
            var bll = new BLL.CCOM.Examination_subject_score();

            var     modelList  = bll.GetModelList(" Esn_id =" + esn_id + " AND Judge_id=" + jugde_id + "order by Ess_score desc");
            int     totalCount = modelList.Count;
            decimal _score     = 200;
            int     order      = 0;

            if (totalCount > 0)
            {
                int count = 1;
                foreach (var model in modelList)
                {
                    if (model.Ess_score < _score)
                    {
                        model.Ess_sequence = count;
                        bll.Update(model);
                        _score = model.Ess_score;
                        order  = count;
                    }
                    else
                    {
                        model.Ess_sequence = order;
                        bll.Update(model);
                    }
                    count++;
                }
            }
            return(true);
        }
Exemplo n.º 2
0
 protected bool DoUpdate(Model.CCOM.Examination_subject_score Fl)
 {
     try
     {
         BLL.CCOM.Examination_subject_score Bss = new BLL.CCOM.Examination_subject_score();
         Bss.Update(Fl);
     }
     catch (Exception ex)
     {
         return(false);
     }
     return(true);
 }
        protected string getSubjectXu(string _user_id, string _esn_id, string _judge_id)
        {
            string strWhere = " User_id=" + _user_id + " AND Esn_id=" + _esn_id + " AND Judge_id=" + _judge_id;

            Model.CCOM.Examination_subject_score subScore = new BLL.CCOM.Examination_subject_score().GetModel(strWhere);
            string Xu = "";

            if (subScore != null)
            {
                Xu = subScore.Ess_sequence.ToString();
            }

            return(Xu);
        }
        protected bool getSubjectXuStatus(string _user_id, string _esn_id, string _judge_id)
        {
            string strWhere = " User_id=" + _user_id + " AND Esn_id=" + _esn_id + " AND Judge_id=" + _judge_id;

            Model.CCOM.Examination_subject_score sub = new BLL.CCOM.Examination_subject_score().GetModel(strWhere);
            bool Xu = true;

            if (sub != null)
            {
                Xu = (bool)(sub.Ess_order_status);
            }

            return(Xu);
        }
        protected bool getSubjectScoreStatus(string _user_id, string _esn_id, string _judge_id)
        {
            string strWhere = " User_id=" + _user_id + " AND Esn_id=" + _esn_id + " AND Judge_id=" + _judge_id;

            Model.CCOM.Examination_subject_score subScore = new BLL.CCOM.Examination_subject_score().GetModel(strWhere);
            bool score = true;

            if (subScore != null)
            {
                score = (bool)(subScore.Ess_score_status);
            }

            return(score);
        }
        public void ProcessRequest(HttpContext context)
        {
            long    Id;
            int     Id1, Id2;
            string  result = "";
            decimal Score  = 0;

            try
            {
                Id    = Convert.ToInt64(DESEncrypt.Decrypt(context.Request.Params["id"].ToString()));
                Id1   = Convert.ToInt32(DESEncrypt.Decrypt(context.Request.Params["id1"].ToString()));
                Id2   = Convert.ToInt32(DESEncrypt.Decrypt(context.Request.Params["id2"].ToString()));
                Score = Convert.ToDecimal(context.Request.Params["txtScore"].ToString());

                var model  = new Model.CCOM.Examination_subject_score();
                var _model = new Model.CCOM.Examination_subject_score();
                BLL.CCOM.Examination_subject_score Bess = new BLL.CCOM.Examination_subject_score();

                model                   = new BLL.CCOM.Examination_subject_score().GetModel(" Esn_id = " + Id1 + " AND User_id=" + Id + " AND Judge_id=" + Id2);
                _model.Esn_id           = Id1;
                _model.Ess_score        = Score;
                _model.Judge_id         = Id2;
                _model.User_id          = Id;
                _model.Ess_score_status = true;
                _model.Ess_order_status = true;
                if (model != null)
                {
                    _model.Ess_id = model.Ess_id;
                    Bess.Update(_model);
                }
                else
                {
                    Bess.Add(_model);
                }
                new Calculation().calculateSubjectXu(Id1.ToString(), Id2.ToString());
                result += "添加成功";
            }
            catch (Exception ex)
            {
                ILog LOGGER = LogManager.GetLogger("quanquan");
                LOGGER.Debug(ex.Message, ex);
                result += "添加失败,请重新尝试";
            }
            context.Response.ContentType = "text/plain";
            context.Response.Write(result);
        }
Exemplo n.º 7
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;

                    var model  = new Model.CCOM.Examination_subject_score();
                    var _model = new Model.CCOM.Examination_subject_score();
                    model = new BLL.CCOM.Examination_subject_score().GetModel(" Esn_id = " + id1 + " AND User_id=" + user_id + " AND Judge_id=" + id2);

                    _model.Esn_id           = Convert.ToInt32(id1);
                    _model.Judge_id         = Convert.ToInt32(id2);
                    _model.User_id          = user_id;
                    _model.Ess_score        = (ds.Tables[0].Rows[i]["科目成绩"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(ds.Tables[0].Rows[i]["科目成绩"].ToString().Trim()));
                    _model.Ess_score_status = true;
                    _model.Ess_order_status = true;
                    bool isOK = false;
                    if (model != null)
                    {
                        _model.Ess_id = model.Ess_id;
                        isOK          = DoUpdate(_model);
                    }
                    else
                    {
                        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 = "导入分数线异常,请联系客服";
            }

            try
            {
                new Calculation().calculateSubjectXu(id1.ToString(), id2.ToString());
            }
            catch
            {
            }
            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);
        }
        public void ScoreManege()
        {
            string str = CombSqlTxt("");

            BLL.CCOM.View_AEE_Subject_Score bll1 = new BLL.CCOM.View_AEE_Subject_Score();
            var userModelList = bll1.GetModelList(str);

            foreach (var user_model in userModelList)
            {
                string sqlStr    = "SELECT DISTINCT Judge_id FROM Examination_subject_score WHERE Esn_id=" + esn_id + " AND User_id =" + user_model.User_id;
                var    judgeList = DBSQL.Query(sqlStr);

                int _count = judgeList.Tables[0].Rows.Count;

                string strWhere    = " Esn_id= " + esn_id + " AND User_id=" + user_model.User_id + " order by Ess_score DESC";
                var    scoreList   = new BLL.CCOM.Examination_subject_score().GetModelList(strWhere);
                int    score_count = scoreList.Count;

                BLL.CCOM.Examination_subject_score         blls = new BLL.CCOM.Examination_subject_score();
                BLL.CCOM.Examination_subject_average_score bll  = new BLL.CCOM.Examination_subject_average_score();
                int     now      = 0;
                int     num      = DelScore(_count);
                int     chushu   = 0;
                decimal avgScore = 0;
                int?    avgXu    = 0;

                foreach (var score_model in scoreList)
                {
                    if (now > num - 1 && now < _count - num)
                    {
                        avgScore += score_model.Ess_score;
                        avgXu    += score_model.Ess_sequence;
                        chushu++;
                        score_model.Ess_score_status = true;
                        score_model.Ess_order_status = true;
                    }
                    else
                    {
                        score_model.Ess_score_status = false;
                        score_model.Ess_order_status = false;
                    }
                    blls.Update(score_model);
                    if (now == _count - 1)
                    {
                        Model.CCOM.Examination_subject_average_score _model = new Model.CCOM.Examination_subject_average_score();
                        _model.Esas_score    = avgScore / chushu;
                        _model.Esas_sequence = (decimal)(avgXu / (1.0 * chushu));
                        _model.User_id       = score_model.User_id;
                        _model.Esn_id        = score_model.Esn_id;

                        DoAvgScore(_model);
                        avgScore = 0;
                        avgXu    = 0;
                        now      = chushu = 0;
                        continue;
                    }
                    now++;
                }
            }
            JscriptMsg("计算科目成绩成功", "SubjectScoreList.aspx?fun_id=" + DESEncrypt.Encrypt(this.fun_id) + "&keywords=" + this.txtKeywords.Text + "&esn_id=" + DESEncrypt.Encrypt(esn_id) + "&major_id=" + DESEncrypt.Encrypt(major_id), "Success");
        }