public JsonResult GetAudiences(string startDate, string endDate)
        {
            var startDateTime = Convert.ToDateTime(startDate);
            var endDateTime = Convert.ToDateTime(endDate);
            var officeManager = new DataAccess.OfficeMananer();
            var offices = officeManager.GetOfficeIDs(IsAdmin ? 0 : UserDetail.UserId);
            var audienceManager = new DataAccess.AudienceManager();
            var audiences = audienceManager.GetAudiences(offices.ToList(), startDateTime, endDateTime);
            if (audiences == null) { return Json(new { data = new { } }); }
            var users = audiences.Select(model => new
            {
                ID = model.AudienceID,
                Name = model.Name,
                Contact = model.Contact,
                EmailAddress = model.EmailAddress,
                VisitDate = model.VisitDate.ToString("MMM dd,yyyy"),
                OfficeName = model.Office.Name,
                VisitType = model.VisitType.VisitTypeName,
                EventName = (model.Event == null ? "-" : model.Event.Name),
                ConventionName = (model.Convention == null ? "-" : model.Convention.Name),
                ServiceName = (model.Service == null ? "-" : model.Service.ServiceName),
                Status = (model.VisitType.VisitTypeId == 1) ? "-" : (model.BookingStatus == 1 ? "In Progress" : (model.BookingStatus == 2 ? "Booked" : "Reach")),
                FSMName = model.FSMDetail == null ? " - " : model.FSMDetail.Name,
                Attended = model.IsAttended,
                GSBAmount = model.GSBAmount,
                DonationAmount = model.Amount
            }).ToList();

            return Json(new
            {
                data = users
            });
        }
 public object GetGSBAountTarget(int id)
 {
     var audienceManager = new DataAccess.AudienceManager();
     var audiences = audienceManager.GetAudiences(id);
     var totalAchievedTargets = audiences.Where(model => model.BookingStatus == 2 && model.IsDeleted == false).Sum(model => model.GSBAmount);
     return new { Total = 0, ActTotal = totalAchievedTargets };
 }
 public JsonResult GetAudiences(int id)
 {
     var audienceManager = new DataAccess.AudienceManager();
     var audiences = audienceManager.GetAudiences(id).Select(model => new
     {
         ID = model.AudienceID,
         IsAttended = model.IsAttended,
         Name = model.Name,
         Contact = model.Contact,
     }).ToList();
     return Json(new { data = audiences });
 }
 public object GetConventionBookingTarget(int id)
 {
     var audienceManager = new DataAccess.AudienceManager();
     var audiences = audienceManager.GetAudiences(id);
     var totalAchievedTargets = audiences.Where(model => model.BookingStatus == 2 && model.IsDeleted == false).ToList().Count();
     return new { Total = 0, ActTotal = totalAchievedTargets };
 }