Пример #1
0
        protected string GetEventCommentList(string pRequest)
        {
            EventCommentListRD rd = new EventCommentListRD();

            try
            {
                var rp = pRequest.DeserializeJSONTo <APIRequest <EventCommentListRP> >();

                var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID);
                QuestionnaireBLL bll   = new QuestionnaireBLL(loggingSessionInfo);
                var ds = bll.GetCommentList(rp.Parameters.QuestionnaireID, rp.UserID);
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    string VIPName        = ds.Tables[0].Rows[0]["VipName"].ToString();
                    var    list1          = ds.Tables[0].AsEnumerable().Where(t => t["QuestionType"].ToString() == "3"); //查内容
                    var    list2          = ds.Tables[0].AsEnumerable().Where(t => t["QuestionType"].ToString() == "6"); //查询评分
                    var    Grade          = list2.Aggregate(0, (a, b) => a + Convert.ToInt32(b["OptionsText"])) / list2.Count();
                    var    Commentcontent = list1.Aggregate("", (a, b) => a + b["Content"].ToString() + "\r\n ");
                    rd.VipName        = VIPName;
                    rd.Grade          = Grade;
                    rd.Commentcontent = Commentcontent;
                }
                var rsp = new SuccessResponse <IAPIResponseData>(rd);
                return(rsp.ToJSON());
            }
            catch (Exception ex)
            {
                throw new APIException(ex.Message);
            }
        }