Ejemplo n.º 1
0
        public FeedbackReportModel GetFeedbackStats(ReportRequestModel feedbackRequestModel, string officerCode)
        {
            FeedbackReportModel response = new FeedbackReportModel();

            using (var imisContext = new ImisDB())
            {
                var feedbackSent = (from FP in imisContext.TblFromPhone
                                    where FP.DocType == "F" &&
                                    FP.LandedDate >= feedbackRequestModel.FromDate &&
                                    FP.LandedDate <= feedbackRequestModel.ToDate &&
                                    FP.OfficerCode == officerCode
                                    select FP)
                                   .ToList();

                var feedbackAccepted = feedbackSent
                                       .Where(f => f.DocStatus == "A")
                                       .Count();

                response = new FeedbackReportModel()
                {
                    FeedbackSent     = feedbackSent.Count(),
                    FeedbackAccepted = feedbackAccepted
                };
            }

            return(response);
        }
Ejemplo n.º 2
0
        public FeedbackReportModel FeedbackReport()
        {
            FeedbackReportModel feedbackReport = new FeedbackReportModel();

            try
            {
                using (var mdb = new OggleBoobleMySqContext())
                {
                    feedbackReport.FeedbackRows =
                        (from f in mdb.FeedBacks
                         join v in mdb.Visitors on f.VisitorId equals v.VisitorId
                         join c in mdb.CategoryFolders on f.PageId equals c.Id
                         join p in mdb.CategoryFolders on c.Parent equals p.Id
                         join r in mdb.RegisteredUsers on f.VisitorId equals r.VisitorId into sr
                         from u in sr.DefaultIfEmpty()
                         where (v.IpAddress != "68.203.90.183")
                         select new FeedbackModel()
                    {
                        IpAddress = v.IpAddress,
                        Parent = p.FolderName,
                        Folder = c.FolderName,
                        FeedBackType = f.FeedBackType,
                        Occured = f.Occured,
                        FeedBackComment = f.FeedBackComment,
                        UserName = u.UserName == null ? "unregistered" : u.UserName,
                        Email = u.Email == null ? "" : u.Email
                    }).OrderByDescending(f => f.Occured).ToList();
                    feedbackReport.Success = "ok";
                }
            }
            catch (Exception ex)
            {
                feedbackReport.Success = Helpers.ErrorDetails(ex);
            }
            return(feedbackReport);
        }