Exemplo n.º 1
0
        public JsonResult GetHotListContacts()
        {
            var dropdownValues = cachingService.GetDropdownValues(this.Identity.ToAccountID());

            ReportViewModel viewModel = new ReportViewModel
            {
                CustomStartDate = DateTime.Now.ToUniversalTime().AddDays(-30),
                CustomEndDate   = DateTime.Now.ToUniversalTime(),
                PageNumber      = 1,
                ShowTop         = 10
            };
            var lifecycleStages = dropdownValues.Where(s => s.DropdownID == (byte)DropdownFieldTypes.LifeCycle)
                                  .Select(s => s.DropdownValuesList).ToList().FirstOrDefault().Where(d => d.IsActive == true).Select(d => d.DropdownValueID).ToArray();

            viewModel.LifeStageIds = lifecycleStages;

            ReportDataResponse response = reportService.GetHotListData(new ReportDataRequest
            {
                ReportViewModel = viewModel,
                AccountId       = this.Identity.ToAccountID(),
                UserId          = this.Identity.ToUserID(),
                RoleId          = this.Identity.ToRoleID(),
                IsSTAdmin       = this.Identity.IsSTAdmin(),
                IsDasboardView  = true
            });

            response.ReportId = GetReportId(Reports.HotList);


            response.HotlistGridData.Contacts = response.ContactIds = new List <int>();
            return(Json(new { success = true, response = response }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public HttpResponseMessage GetHotListLeads()
        {
            var dropdownValues = cachingService.GetDropdownValues(this.AccountId);

            ReportViewModel viewModel = new ReportViewModel
            {
                CustomStartDate = DateTime.Now.ToUniversalTime().AddDays(-30),
                CustomEndDate   = DateTime.Now.ToUniversalTime(),
                PageNumber      = 1,
                ShowTop         = 10
            };
            var lifecycleStages = dropdownValues.Where(s => s.DropdownID == (byte)DropdownFieldTypes.LifeCycle)
                                  .Select(s => s.DropdownValuesList).ToList().FirstOrDefault().Where(d => d.IsActive == true).Select(d => d.DropdownValueID).ToArray();

            viewModel.LifeStageIds = lifecycleStages;

            ReportDataResponse response = reportService.GetHotListData(new ReportDataRequest
            {
                ReportViewModel = viewModel,
                AccountId       = this.AccountId,
                UserId          = this.UserId,
                RoleId          = this.RoleId,
                IsSTAdmin       = this.IsSTAdmin,
                IsDasboardView  = true
            });

            response.ReportId = GetReportId(Reports.HotList);
            response.HotlistGridData.Contacts = response.ContactIds = new List <int>();
            return(Request.BuildResponse(response));
        }
Exemplo n.º 3
0
        public HttpResponseMessage RunHotList(ReportViewModel viewmodel)
        {
            if (viewmodel.PeriodId != 7)
            {
                viewmodel.CustomStartDate = ToUserUtcDateTime(viewmodel.CustomStartDate);
                viewmodel.CustomEndDate   = ToUserUtcDateTime(viewmodel.CustomEndDate);
            }
            ReportDataResponse response = reportService.GetHotListData(new ReportDataRequest
            {
                ReportViewModel = viewmodel,
                AccountId       = this.AccountId,
                RoleId          = this.RoleId,
                RequestedBy     = this.UserId,
                UserId          = this.UserId,
                IsDasboardView  = false
            });

            // UpdateLastRunActivity(viewmodel.ReportId, viewmodel.ReportName);
            //Guid guid = Guid.NewGuid();
            //ViewBag.Guid = guid.ToString();
            //if (response.ContactIds != null)
            //{
            //    AddCookie("ContactsGuid", guid.ToString(), 1);
            //    var contactIds = response.ContactIds;
            //    cachingService.StoreSavedSearchContactIds(guid.ToString(), contactIds);
            //}
            return(Request.BuildResponse(response));
        }
Exemplo n.º 4
0
        public HttpResponseMessage GetContacts(ReportViewModel viewmodel)
        {
            viewmodel.CustomStartDate = viewmodel.CustomStartDate != DateTime.MinValue ? ToUserUtcDateTime(viewmodel.CustomStartDate) : DateTime.MinValue;
            viewmodel.CustomEndDate   = ToUserUtcDateTime(viewmodel.CustomEndDate);
            if (viewmodel.ReportType != Reports.FirstLeadSourceReport && viewmodel.ReportType != Reports.AllLeadSourceReport && viewmodel.ReportType != Reports.DatabaseLifeCycleReport)
            {
                viewmodel.CustomStartDatePrev = viewmodel.CustomStartDatePrev != DateTime.MinValue ? ToUserUtcDateTime(viewmodel.CustomStartDatePrev) : DateTime.MinValue;
                viewmodel.CustomEndDatePrev   = viewmodel.CustomEndDatePrev != DateTime.MinValue ? ToUserUtcDateTime(viewmodel.CustomEndDatePrev) : DateTime.MaxValue;
            }
            ReportDataRequest request = new ReportDataRequest()
            {
                ReportViewModel = viewmodel,
                AccountId       = this.AccountId,
                RequestedBy     = this.UserId,
                RoleId          = this.RoleId,
                IsSTAdmin       = this.IsSTAdmin
            };
            ReportDataResponse response = new ReportDataResponse();

            if (viewmodel.Type == 'T')
            {
                response = reportService.GetTrafficByTypeContacts(request);
            }
            else if (viewmodel.Type == 'P')
            {
                response = reportService.GetOpportunityPipelineContacts(request);
            }
            else if (viewmodel.Type == 'S')
            {
                response = reportService.GetTrafficBySourceContacts(request);
            }
            else if (viewmodel.Type == 'L')
            {
                response = reportService.GetTrafficByLifeCycleContacts(request);
            }
            else if (viewmodel.Type == 'C')
            {
                response = reportService.GetTrafficByTypeAndLifeCycleContacts(request);
            }
            else if (viewmodel.Type == 'A' && (viewmodel.ActivityModule == "Contacts" || viewmodel.ActivityModule == "Tours" || viewmodel.ActivityModule == "Notes"))
            {
                request.ModuleId = viewmodel.ActivityModule == "Contacts" ? (byte)AppModules.Contacts : viewmodel.ActivityModule == "Tours" ? (byte)AppModules.ContactTours : (byte)AppModules.ContactNotes;
                response         = reportService.GetActivityReportContacts(request);
            }
            else if (viewmodel.ReportType == Reports.FirstLeadSourceReport)
            {
                response = reportService.FirstLeadSourceReportContacts(request);
            }
            else if (viewmodel.ReportType == Reports.AllLeadSourceReport)
            {
                response = reportService.AllLeadSourceReportContacts(request);
            }
            else if (viewmodel.ReportType == Reports.DatabaseLifeCycleReport)
            {
                response = reportService.AllDatabaseReportContacts(request);
            }

            return(Request.BuildResponse(response));
        }
Exemplo n.º 5
0
        private void BindReport(ReportEntity reportEntity, string filter)
        {
            MemoryStream memStream = new MemoryStream();
            StreamWriter writer    = new StreamWriter(memStream);

            writer.Write(reportEntity.RdlText);
            writer.Flush();
            memStream.Seek(0, SeekOrigin.Begin);

            rvMain.LocalReport.LoadReportDefinition(memStream);

            ReportDataResponse rdr = BusinessManager.Execute <ReportDataRequest, ReportDataResponse>(new ReportDataRequest(reportEntity, filter));

            foreach (DataTable dt in rdr.Data)
            {
                rvMain.LocalReport.DataSources.Add(new ReportDataSource(dt.TableName, dt));
            }
        }
Exemplo n.º 6
0
        public HttpResponseMessage GetReportData(ReportViewModel viewmodel)
        {
            viewmodel.CustomStartDate     = viewmodel.CustomStartDate != DateTime.MinValue ? ToUserUtcDateTime(viewmodel.CustomStartDate) : DateTime.MinValue;
            viewmodel.CustomEndDate       = ToUserUtcDateTime(viewmodel.CustomEndDate);
            viewmodel.CustomStartDatePrev = viewmodel.CustomStartDatePrev != DateTime.MinValue ? ToUserUtcDateTime(viewmodel.CustomStartDatePrev) : DateTime.MinValue;
            viewmodel.CustomEndDatePrev   = viewmodel.CustomEndDatePrev != DateTime.MinValue ? ToUserUtcDateTime(viewmodel.CustomEndDatePrev) : DateTime.MinValue;
            ReportDataRequest request = new ReportDataRequest()
            {
                ReportViewModel = viewmodel,
                AccountId       = this.AccountId,
                RequestedBy     = this.UserId,
                RoleId          = this.RoleId
            };
            ReportDataResponse response = new ReportDataResponse();

            if (viewmodel.Type == 'T')
            {
                response = reportService.GetTrafficByTypeData(request);
            }
            if (viewmodel.Type == 'P')
            {
                response = reportService.GetOpportunityPipeline(request);
            }
            if (viewmodel.Type == 'S')
            {
                response = reportService.GetTrafficBySourceData(request);
            }
            if (viewmodel.Type == 'L')
            {
                response = reportService.GetTrafficByLifeCycleData(request);
            }
            if (viewmodel.Type == 'A')
            {
                response = reportService.GetActivityData(request);
            }
            if (viewmodel.Type == 'C')
            {
                response = reportService.GetTrafficByTypeAndLifeCycleData(request);
            }
            // UpdateLastRunActivity(viewmodel.ReportId, viewmodel.ReportName);
            return(Request.BuildResponse(response));
        }