Exemplo n.º 1
0
        public JsonResult ExpertScore(SR_TOPIC.Entity entity, FormCollection collection)
        {
            int            topicId = entity.ID;
            JsonResultData result  = new JsonResultData();
            int            i       = 0;

            try
            {
                if (entity.ID < 0)
                {
                    result.Message = "课题项不存在,不可编辑";
                    return(Json(result, JsonRequestBehavior.AllowGet));
                }


                //获取选择的课题评分规则
                string selectSubItemJson = collection["ScoreItems"];
                var    subItemList       = DeserializeObject <List <SR_TOPIC_SCORE.Entity> >(selectSubItemJson);
                double actScore          = 0;
                foreach (var item in subItemList)
                {
                    item.ACT_SCORE = item.SCORE * item.WEIGHT / 100;
                    actScore      += item.ACT_SCORE;
                }
                //保存所选评分规则
                int addCountSub    = 0;
                int updateCountSub = 0;
                int deleteCountSub = 0;
                SR_TOPIC_SCORE.Instance.SaveScoreListJoins(topicId, SystemSession.UserID, subItemList, out addCountSub, out updateCountSub, out deleteCountSub);

                var topicExpert = SR_TOPIC_EXPERT.Instance.GetTopicByTopicAndUser(topicId, SystemSession.UserID);
                topicExpert.IS_SCORE  = 1;
                topicExpert.OPER_TIME = DateTime.Now;
                topicExpert.SCORE     = actScore;
                SR_TOPIC_EXPERT.Instance.UpdateByKey(topicExpert, topicExpert.ID);//修改
                result.IsSuccess = true;
                result.Message   = "保存成功";
                WriteOperationLog(BLog.LogLevel.INFO, true, Modular, (entity.ID > 0 ? "修改" : "添加"), "", (entity.ID > 0 ? "修改" : "添加") + "ID为" + entity.ID + "的课题成功!");
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.Message   = ex.Message;

                WriteOperationLog(BLog.LogLevel.ERROR, true, Modular, (entity.ID > 0 ? "修改" : "添加"), "", (entity.ID > 0 ? "修改" : "添加") + "ID为" + entity.ID + "的配置失败:" + ex.Message);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public JsonResult Edit(SR_TOPIC.Entity entity, FormCollection collection)
        {
            int            topicId = entity.ID;
            JsonResultData result  = new JsonResultData();
            int            i       = 0;

            try
            {
                if (entity.ID < 0)
                {
                    result.Message = "课题项不存在,不可编辑";
                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                //获取选择的课题参与人员
                string selectUserJson = collection["SelectUser"];
                var    userList       = DeserializeObject <List <SR_TOPIC_USER.Entity> >(selectUserJson);
                if (entity.ID == 0)
                {
                    topicId               = SR_TOPIC.Instance.GetNextValueFromSeqDef();
                    entity.ID             = topicId;
                    entity.CREATE_USER_ID = SystemSession.UserID;
                    entity.CREATE_TIME    = DateTime.Now;
                    SR_TOPIC.Instance.Add(entity, true);
                }
                else
                {
                    i = SR_TOPIC.Instance.UpdateByKey(entity, entity.ID);//修改
                }
                //保存参与人员信息
                int addCount    = 0;
                int updateCount = 0;
                int deleteCount = 0;
                SR_TOPIC_USER.Instance.SaveUserListJoins(topicId, userList, out addCount, out updateCount, out deleteCount);
                result.IsSuccess = true;
                result.Message   = "保存成功";
                result.Result    = topicId.ToString();
                WriteOperationLog(BLog.LogLevel.INFO, true, Modular, (entity.ID > 0 ? "修改" : "添加"), "", (entity.ID > 0 ? "修改" : "添加") + "ID为" + entity.ID + "的课题成功!");
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.Message   = ex.Message;

                WriteOperationLog(BLog.LogLevel.ERROR, true, Modular, (entity.ID > 0 ? "修改" : "添加"), "", (entity.ID > 0 ? "修改" : "添加") + "ID为" + entity.ID + "的配置失败:" + ex.Message);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public JsonResult Set(SR_TOPIC.Entity entity, FormCollection collection)
        {
            int            topicId = entity.ID;
            JsonResultData result  = new JsonResultData();
            int            i       = 0;

            try
            {
                if (entity.ID < 0)
                {
                    result.Message = "课题项不存在,不可编辑";
                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                //获取选择的课参与评分专家
                string selectUserJson = collection["SelectExpert"];
                var    userList       = DeserializeObject <List <SR_TOPIC_EXPERT.Entity> >(selectUserJson);

                //获取选择的课题评分规则
                string selectSubItemJson = collection["SubItems"];
                var    subItemList       = DeserializeObject <List <SR_TOPIC_SUB_ITEM.Entity> >(selectSubItemJson);

                //保存参与人员信息
                int addCount    = 0;
                int updateCount = 0;
                int deleteCount = 0;
                SR_TOPIC_EXPERT.Instance.SaveExpertListJoins(topicId, userList, out addCount, out updateCount, out deleteCount);
                //保存所选评分规则
                int addCountSub    = 0;
                int updateCountSub = 0;
                int deleteCountSub = 0;
                SR_TOPIC_SUB_ITEM.Instance.SaveSubItemListJoins(topicId, subItemList, out addCountSub, out updateCountSub, out deleteCountSub);

                result.IsSuccess = true;
                result.Message   = "保存成功";
                WriteOperationLog(BLog.LogLevel.INFO, true, Modular, (entity.ID > 0 ? "修改" : "添加"), "", (entity.ID > 0 ? "修改" : "添加") + "ID为" + entity.ID + "的课题成功!");
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.Message   = ex.Message;

                WriteOperationLog(BLog.LogLevel.ERROR, true, Modular, (entity.ID > 0 ? "修改" : "添加"), "", (entity.ID > 0 ? "修改" : "添加") + "ID为" + entity.ID + "的配置失败:" + ex.Message);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public JsonResult TopicScore(SR_TOPIC.Entity entity)
        {
            int            topicId = entity.ID;
            JsonResultData result  = new JsonResultData();
            int            i       = 0;

            try
            {
                if (entity.ID < 0)
                {
                    result.Message = "课题项不存在,不可编辑";
                    return(Json(result, JsonRequestBehavior.AllowGet));
                }

                var topic = SR_TOPIC.Instance.GetEntityByKey <SR_TOPIC.Entity>(entity.ID);
                topic.IS_APPROVAL     = entity.IS_APPROVAL;
                topic.APPROVAL_REMARK = entity.APPROVAL_REMARK;
                topic.TOTAL_SCORE     = entity.TOTAL_SCORE;
                topic.MAX_SCORE       = entity.MAX_SCORE;
                topic.MIN_SCORE       = entity.MIN_SCORE;
                topic.AVG_SCORE       = entity.AVG_SCORE;
                topic.APPROVAL_TIME   = DateTime.Now;
                SR_TOPIC.Instance.UpdateByKey(topic, topic.ID);//修改
                result.IsSuccess = true;
                result.Message   = "保存成功";
                WriteOperationLog(BLog.LogLevel.INFO, true, Modular, (entity.ID > 0 ? "修改" : "添加"), "", (entity.ID > 0 ? "修改" : "添加") + "ID为" + entity.ID + "的课题成功!");
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.Message   = ex.Message;

                WriteOperationLog(BLog.LogLevel.ERROR, true, Modular, (entity.ID > 0 ? "修改" : "添加"), "", (entity.ID > 0 ? "修改" : "添加") + "ID为" + entity.ID + "的配置失败:" + ex.Message);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }