public CallHistoryListModel GetAllByContactId(int contactId, int employeeTypeId) { var list = CallHistoryRepository.GetAllByContactId(contactId, employeeTypeId) ?? new List <CallHistoryInfo>(); // Repear call var task = new Task(() => RepairCall(list.Where(c => !c.CallId.IsStringNullOrEmpty()) .Where(c => c.Duration.IsStringNullOrEmpty()))); //var task = new Task(() => RepairCall(list)); task.Start(); //list = list.Where(c => c.StatusMapId > 0).ToList(); list = list.ToList(); var model = new CallHistoryListModel { Rows = list, }; var second = model.Rows.ToList().Sum(c => ConvertHelper.ToInt32(c.Duration)); var strTime = second >= 60 ? (second / 60) + " phút, " + (second % 60) + " giây" : second + " giây"; model.UserData = new List <string> { "Tổng số lượng gọi: " + model.Rows.Count(c => !string.IsNullOrEmpty(c.CallId)) + " cuộc", "Tổng thời gian gọi: " + strTime, }; return(model); }
public CallHistoryListModel GetCallError() { var listCallHistories = CallHistoryRepository.GetAllCallError() ?? new List <CallHistoryInfo>(); var model = new CallHistoryListModel { Rows = listCallHistories, }; return(model); }
public CallHistoryListModel FilterHistory(int groupId, int userId, string handoverDate, string callDate, int statusMapId, int statusCareId, string levelIds, string mobilePhone, int employeeTypeId, int page, int rows) { string users; if (userId == 0) { if (groupId == 0) { users = string.Empty; } else { users = StoreData.ListUser .Where(c => c.GroupId == groupId) .Select(c => c.UserID.ToString()) .Distinct().Aggregate((total, curent) => total + "," + curent); } } else { users = userId.ToString(); } var employeeType = (EmployeeType)employeeTypeId; var dateCall = callDate.IsStringNullOrEmpty() ? null : callDate.ToDateTime(); var dateHandover = handoverDate.IsStringNullOrEmpty() ? null : handoverDate.ToDateTime(); int totalRecords; var model = new CallHistoryListModel { Rows = CallHistoryRepository.FilterHistory(users, dateHandover, dateCall, statusMapId, statusCareId, levelIds, mobilePhone, employeeType, page, rows, out totalRecords), Total = (totalRecords / rows) + 1, UserData = new List <string> { totalRecords.ToString(), }, Records = rows, Page = page, }; return(model); }
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); }
public CallHistoryListModel FilterHistory(int groupId, int userId, string handoverDate, string callDate, int statusMapId, int statusCareId, string levelIds, int employeeTypeId, int page, int rows) { string users; if (userId == 0) { if (groupId == 0) users = string.Empty; else users = StoreData.ListUser .Where(c => c.GroupId == groupId) .Select(c => c.UserID.ToString()) .Distinct().Aggregate((total, curent) => total + "," + curent); } else users = userId.ToString(); var employeeType = (EmployeeType)employeeTypeId; var dateCall = callDate.IsStringNullOrEmpty() ? null : callDate.ToDateTime(); var dateHandover = handoverDate.IsStringNullOrEmpty() ? null : handoverDate.ToDateTime(); int totalRecords; var model = new CallHistoryListModel { Rows = CallHistoryRepository.FilterHistory(users, dateHandover, dateCall, statusMapId, statusCareId, levelIds, employeeType, page, rows, out totalRecords), Total = (totalRecords / rows) + 1, UserData = new List<string> { totalRecords.ToString(), }, Records = rows, Page = page, }; return model; }
public CallHistoryListModel GetCallError() { var listCallHistories = CallHistoryRepository.GetAllCallError() ?? new List<CallHistoryInfo>(); var model = new CallHistoryListModel { Rows = listCallHistories, }; return model; }
public CallHistoryListModel GetByContactId(int contactId, int userLogType) { var list = CallHistoryRepository.GetAllByContactId(contactId) ?? new List<CallHistoryInfo>(); // Repear call var task = new Task(() => RepairCall(list.Where(c => !c.CallId.IsStringNullOrEmpty()) .Where(c => c.Duration.IsStringNullOrEmpty()))); task.Start(); list = list.Where(c => c.StatusMapId > 0).ToList(); list = userLogType == (int)EmployeeType.Consultant ? list.Where(c => c.UserLogType.IsIntegerNull() || c.UserLogType == userLogType).ToList() : list.Where(c => c.UserLogType == userLogType).ToList(); var model = new CallHistoryListModel { Rows = list, }; var second = model.Rows.ToList().Sum(c => ConvertHelper.ToInt32(c.Duration)); var strTime = second >= 60 ? (second / 60) + " phút, " + (second % 60) + " giây" : second + " giây"; model.UserData = new List<string> { "Tổng số lượng gọi: " + model.Rows.Count(c => !string.IsNullOrEmpty(c.CallId)) + " cuộc", "Tổng thời gian gọi: " + strTime, }; return model; }
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; }