示例#1
0
        /// <summary>
        /// 获得评议辅导员的评议内容打分
        /// </summary>
        /// <returns></returns>
        private string GetCounScore()
        {
            if (string.IsNullOrEmpty(Get("seq_no")))
            {
                return("{}");
            }

            Dictionary <string, string> param = new Dictionary <string, string>();

            param.Add("SEQ_NO", Get("seq_no"));
            List <Peer_coun_list> list = PeerCounHandleClass.getInstance().GetPeerCounContentList(param);

            if (list == null)
            {
                return("{}");
            }

            StringBuilder json = new StringBuilder();//用来存放Json的

            json.Append("{");
            foreach (Peer_coun_list counList in list)
            {
                json.Append(Json.StringToJson(counList.CONTENT_SCORE.ToString(), counList.CONTENT_ID));
                json.Append(",");
            }
            if (json[json.Length - 1].Equals(','))
            {                                    //必须有数据才去掉最后一个逗号‘,’
                json.Remove(json.Length - 1, 1); //去掉最后一个逗号
            }
            json.Append("}");
            return(json.ToString());
        }
示例#2
0
        /// <summary>
        /// 保存表体数据
        /// </summary>
        /// <returns></returns>
        private void SaveDataList(string SeqNo, string PeerSeqNo)
        {
            //先删除
            ds.ExecuteTxtNonQuery(string.Format("DELETE FROM PEER_COUN_LIST WHERE SEQ_NO = '{0}' ", SeqNo));
            //再保存
            Dictionary <string, string> param = new Dictionary <string, string>();

            param.Add("SEQ_NO", PeerSeqNo);
            List <Peer_project_list> list = PeerInfoHandleClass.getInstance().GetPeerContentList(param);
            var     inserttrcn            = ImplementFactory.GetInsertTransaction <Peer_coun_list>("Peer_coun_listInsertTransaction");
            decimal decTotalScore         = 0;

            foreach (Peer_project_list temp in list)
            {
                if (temp == null)
                {
                    continue;
                }

                Peer_coun_list notboth = new Peer_coun_list();
                notboth.OID = Guid.NewGuid().ToString();
                ds.RetrieveObject(notboth);
                notboth.SEQ_NO        = SeqNo;
                notboth.CONTENT_ID    = temp.OID;
                notboth.CONTENT_SCORE = Math.Round(cod.ChangeDecimal(Post(temp.OID)), 1);
                decTotalScore        += notboth.CONTENT_SCORE;
                inserttrcn.EntityList.Add(notboth);
            }
            bool res = inserttrcn.Commit();

            if (res)
            {
                decimal decPerScore = decTotalScore / list.Count;
                string  strResult   = PeerCounHandleClass.getInstance().GetPeerResult(decPerScore);
                //更新表头字段
                ds.ExecuteTxtNonQuery(string.Format("UPDATE PEER_COUN_HEAD SET PEER_SCORE = '{0}' ,PEER_RESULT= '{1}' WHERE SEQ_NO = '{2}' ", decPerScore, strResult, SeqNo));
            }
        }