Exemplo n.º 1
0
        public CallHistoryListModel FilterHistoryForImporter(int userId, string callDate, string callDateEnd, string startTime, string endTime, int statusMapId, string levels, string educationLevels, string schools, string majors, int page, int rows)
        {
            DateTime?startDate = null, endDate = null;

            if (endTime.IsStringNullOrEmpty())
            {
                endTime = "23:59:59";
            }
            if (startTime.IsStringNullOrEmpty())
            {
                startTime = "00:00:00";
            }
            var dateCall    = callDate.IsStringNullOrEmpty() ? null : callDate.ToDateTime();
            var dateCallEnd = callDateEnd.IsStringNullOrEmpty() ? null : callDateEnd.ToDateTime();

            if (dateCall != null)
            {
                startDate = (dateCall.Value.ToString("dd/MM/yyyy") + " " + startTime).ToDateTime("dd/MM/yyyy HH:mm:ss");
            }
            if (dateCallEnd != null)
            {
                endDate = (dateCallEnd.Value.ToString("dd/MM/yyyy") + " " + endTime).ToDateTime("dd/MM/yyyy HH:mm:ss");
            }

            int       totalRecords;
            const int userLogType = (int)EmployeeType.Collaborator;
            var       model       = new CallHistoryListModel
            {
                Rows     = CallHistoryRepository.FilterHistoryForImporter(userId, startDate, endDate, statusMapId, levels, educationLevels, schools, majors, userLogType, page, rows, out totalRecords),
                Total    = (totalRecords / rows) + 1,
                UserData = new List <string>
                {
                    totalRecords.ToString(),
                },
                Records = rows,
                Page    = page,
            };

            return(model);
        }