public ContactListModel FilterSearchAdvanceManager(int statusMapId, int statusCareId, string levelIds, string handoverFromDate, string handoverToDate, string callFromDate, string callToDate, int qualityId, int productSellId, string userIds, int employeeTypeId, int page, int rows) { var branchId = UserContext.GetDefaultBranch(); var employeeType = (EmployeeType)employeeTypeId; var callTDate = callToDate.ToDateTime("ddMMyyyy"); var callFDate = callFromDate.ToDateTime("ddMMyyyy"); if (!callTDate.HasValue) callTDate = callFDate; if (callTDate.HasValue) callTDate = callTDate.Value.AddDays(1).AddSeconds(-1); var handoverTDate = handoverToDate.ToDateTime("ddMMyyyy"); var handoverFDate = handoverFromDate.ToDateTime("ddMMyyyy"); if (!handoverTDate.HasValue) handoverTDate = handoverFDate; if (handoverTDate.HasValue) handoverTDate = handoverTDate.Value.AddDays(1).AddSeconds(-1); int totalRecords; var list = new ContactListModel { Rows = ContactRepository.FilterSearchAdvance(branchId, userIds, statusMapId, statusCareId, levelIds, handoverFDate, handoverTDate, callFDate, callTDate, qualityId, productSellId, employeeType, page, rows, out totalRecords), Total = (totalRecords / rows) + 1, UserData = totalRecords, Records = rows, Page = page, }; return list; }
public ContactListModel FilterSearchManager(string name, string mobile, string email, int employeeTypeId, int page, int rows) { int totalRecords; //var branchId = UserContext.GetDefaultBranch(); int branchId = 0; //Quan ly TVTS tim kiem tren toan he thong var employeeType = (EmployeeType)employeeTypeId; if (!mobile.IsStringNullOrEmpty()) mobile = Util.CleanAlphabetAndFirstZero(mobile); var items = ContactRepository.FilterSearchManager(branchId, name, mobile, email, employeeType, page, rows, out totalRecords) ?? new List<ContactInfo>(); var listContacts = new List<ContactInfo>(); foreach (var item in items.Where(c => !listContacts.Exists(p => p.Id == c.Id))) listContacts.Add(item); var list = new ContactListModel { Rows = listContacts, Total = (listContacts.Count / rows) + 1, UserData = listContacts.Count, Records = rows, Page = page, }; return list; }
public ContactListModel FilterSearch(string mobile, string email, int branchId, int page, int rows) { if (string.IsNullOrEmpty(email) && string.IsNullOrEmpty(mobile)) return null; if (string.IsNullOrEmpty(email)) email = string.Empty; if (string.IsNullOrEmpty(mobile)) mobile = string.Empty; int totalRecords; var list = new ContactListModel { Rows = ContactRepository.FilterSearch(mobile, email, branchId, page, rows, out totalRecords), Total = (totalRecords / rows) + 1, UserData = totalRecords, Records = rows, Page = page, }; return list; }
public ContactListModel FilterSearchAdvance(int statusMapId, int statusCareId, string levelIds, string handoverFromDate, string handoverToDate, string callFromDate, string callToDate, int qualityId, int productSellId, int employeeTypeId, int page, int rows) { var user = UserContext.GetCurrentUser(); var branchId = UserContext.GetDefaultBranch(); var employeeType = (EmployeeType)employeeTypeId; var callTDate = callToDate.ToDateTime("ddMMyyyy"); var callFDate = callFromDate.ToDateTime("ddMMyyyy"); if (!callTDate.HasValue) callTDate = callFDate; if (callTDate.HasValue) callTDate = callTDate.Value.AddDays(1).AddSeconds(-1); var handoverTDate = handoverToDate.ToDateTime("ddMMyyyy"); var handoverFDate = handoverFromDate.ToDateTime("ddMMyyyy"); if (!handoverTDate.HasValue) handoverTDate = handoverFDate; if (handoverTDate.HasValue) handoverTDate = handoverTDate.Value.AddDays(1).AddSeconds(-1); var userIds = user.UserID.ToString(); //if (user.IsCollaborator) //{ // if (user.GroupCollaboratorType == (int)GroupCollaboratorType.LeaderCollaborator) // userIds = string.Join(",", StoreData.ListUser.Where(c => c.GroupId == user.GroupId).Select(c => c.UserID).Distinct()); // else if (user.GroupCollaboratorType == (int)GroupCollaboratorType.ManagerCollaborator) // userIds = string.Empty; //} //else if (user.IsConsultant) //{ // if (user.GroupConsultantType == (int)GroupConsultantType.LeaderConsultant) // userIds = string.Join(",", StoreData.ListUser.Where(c => c.GroupId == user.GroupId).Select(c => c.UserID).Distinct()); // else if (user.GroupConsultantType == (int)GroupConsultantType.ManagerConsultant) // userIds = string.Empty; //} int totalRecords; var list = new ContactListModel { Rows = ContactRepository.FilterSearchAdvance(branchId, userIds, statusMapId, statusCareId, levelIds, handoverFDate, handoverTDate, callFDate, callTDate, qualityId, productSellId, employeeType, page, rows, out totalRecords), Total = (totalRecords / rows) + 1, UserData = totalRecords, Records = rows, Page = page, }; return list; }
public ContactListModel FilterForCollaboratorL1(int importId, int channelId, int schoolId, string startImportDate, string endImportDate, string startRegisterDate, string endRegisterDate, int connectStatus, int todayType, string statusMapIds, int campainId, int page, int rows) { var branchId = UserContext.GetDefaultBranch(); var endImport = endImportDate.ToDateTime("ddMMyyyy"); var startImport = startImportDate.ToDateTime("ddMMyyyy"); var endRegister = endRegisterDate.ToDateTime("ddMMyyyy"); var startRegister = startRegisterDate.ToDateTime("ddMMyyyy"); if (statusMapIds.IsStringNullOrEmpty()) statusMapIds = string.Empty; statusMapIds = statusMapIds.Trim('|').Replace('|', ','); try { if (startImport.HasValue) { startImport = startImport.Value.Date; if (!endImport.HasValue) endImport = DateTime.Now; } if (endImport.HasValue) endImport = endImport.Value.Date.AddDays(1).AddSeconds(-1); if (startRegister.HasValue) { startRegister = startRegister.Value.Date; if (!endRegister.HasValue) endRegister = DateTime.Now; } if (endRegister.HasValue) endRegister = endRegister.Value.Date.AddDays(1).AddSeconds(-1); int totalRecords; var listContacts = ContactRepository.FilterForCollaboratorL1(branchId, importId, channelId, schoolId, startImport, endImport, startRegister, endRegister, connectStatus, todayType, statusMapIds, campainId, page, rows, out totalRecords); var list = new ContactListModel { Rows = listContacts, Total = (listContacts.Count / rows) + 1, UserData = totalRecords, Records = rows, Page = page, }; return list; } catch { return new ContactListModel(); } }
public ContactListModel FilterHandover(string typeIds, string levelIds, string importIds, string statusIds, string containerIds, string channelIds, string channelAmounts, int employeeTypeId) { var branchId = UserContext.GetDefaultBranch(); var employeeType = (EmployeeType)employeeTypeId; var listContact = ContactRepository.FilterHandover(branchId, typeIds, levelIds, importIds, statusIds, containerIds, channelIds, channelAmounts, employeeType) ?? new List<ContactInfo>(); var list = new ContactListModel { Rows = listContact, }; return list; }
public ContactListModel FilterDuplicateTvts(string statusIds, int branchId, int page, int rows) { var userId = UserContext.GetCurrentUser().UserID; int totalRecords; var list = new ContactListModel { Rows = ContactRepository.FilterDuplicateTvts(userId, statusIds, branchId, page, rows, out totalRecords), Total = (totalRecords / rows) + 1, UserData = totalRecords, Records = rows, Page = page, }; return list; }
public ContactListModel FilterContactForChange(int branchId, int statusMapId, int statusCareId, string userIds, string fromDate, string toDate, int employeeTypeId, int page, int rows) { int totalRecords; var employeeType = (EmployeeType)employeeTypeId; var fDate = fromDate.ToDateTime("ddMMyyyy") ?? DateTime.Now.Date; var tDate = toDate.ToDateTime("ddMMyyyy") ?? DateTime.Now.Date; tDate = tDate.AddDays(1).AddSeconds(-1); var items = ContactRepository.FilterContactForChange(branchId, statusMapId, statusCareId, userIds, fDate, tDate, employeeType, page, rows, out totalRecords) ?? new List<ContactInfo>(); var listContacts = new List<ContactInfo>(); foreach (var item in items.Where(c => !listContacts.Exists(p => p.Id == c.Id))) listContacts.Add(item); var list = new ContactListModel { Rows = listContacts, Total = (totalRecords / rows) + 1, UserData = totalRecords, Records = rows, Page = page, }; return list; }
public ContactListModel FilterTodayOneMonthManager(string userIds, int employeeTypeId, int page, int rows) { var branchId = UserContext.GetDefaultBranch(); var employeeType = (EmployeeType)employeeTypeId; int totalRecords; var result = new ContactListModel { Rows = ContactRepository.FilterTodayAll(userIds, DateTime.Now.AddMonths(-1).AddDays(-1).Date, DateTime.Now.Date.AddSeconds(-1), branchId, employeeType, page, rows, out totalRecords), Total = (totalRecords / rows) + 1, UserData = totalRecords, Records = rows, Page = page, }; if (result.Rows.Any()) { foreach (var item in result.Rows.Where(c => c.AppointmentConsultantDate == DateTime.MinValue)) { item.AppointmentConsultantDate = item.HandoverConsultantDate; } } return result; }
public ContactListModel FilterTodayManager(string from, string to, int type, string levels, string userIds, int employeeTypeId, int page, int rows) { var fromDate = string.IsNullOrEmpty(from) ? DateTime.Now.Date : DateTime.ParseExact(from, "ddMMyyyy", CultureInfo.InvariantCulture); var toDate = string.IsNullOrEmpty(to) ? fromDate.AddDays(1).AddSeconds(-1) : DateTime.ParseExact(to, "ddMMyyyy", CultureInfo.InvariantCulture).AddDays(1).AddSeconds(-1); if (string.IsNullOrEmpty(levels)) levels = string.Empty; var branchId = UserContext.GetDefaultBranch(); var employeeType = (EmployeeType)employeeTypeId; int totalRecords; var result = new ContactListModel(); switch (type) { case (int)TodayType.NewAndAppointment: { result = new ContactListModel { Rows = ContactRepository.FilterTodayNewAndAppointment(userIds, fromDate, toDate, branchId, employeeType, page, rows, out totalRecords), Total = (totalRecords / rows) + 1, UserData = totalRecords, Records = rows, Page = page, }; } break; case (int)TodayType.Appointment: { result = new ContactListModel { Rows = ContactRepository.FilterTodayAppointment(userIds, fromDate, toDate, levels, branchId, employeeType, page, rows, out totalRecords), Total = (totalRecords / rows) + 1, UserData = totalRecords, Records = rows, Page = page, }; } break; case (int)TodayType.New: { result = new ContactListModel { Rows = ContactRepository.FilterTodayNew(userIds, fromDate, toDate, branchId, employeeType, page, rows, out totalRecords), Total = (totalRecords / rows) + 1, UserData = totalRecords, Records = rows, Page = page, }; } break; case (int)TodayType.All: { result = new ContactListModel { Rows = ContactRepository.FilterTodayAll(userIds, fromDate, toDate, branchId, employeeType, page, rows, out totalRecords), Total = (totalRecords / rows) + 1, UserData = totalRecords, Records = rows, Page = page, }; } break; } if (result.Rows.Any()) { foreach (var item in result.Rows.Where(c => c.AppointmentConsultantDate == DateTime.MinValue)) { item.AppointmentConsultantDate = item.HandoverConsultantDate; } } return result; }
public ContactListModel FilterSearchManager_copy(FormDataCollection form) { int totalRecords; var mobile = ConvertHelper.ToString(form.Get("mobile")); var name = ConvertHelper.ToString(form.Get("name")); var email = ConvertHelper.ToString(form.Get("email")); var employeeTypeId = EmployeeType.Consultant; var rows = 30; var page = 1; //var branchId = UserContext.GetDefaultBranch(); int branchId = 0; //Quan ly TVTS tim kiem tren toan he thong //var employeeType = (EmployeeType)employeeTypeId; if (!mobile.IsStringNullOrEmpty()) mobile = Util.CleanAlphabetAndFirstZero(mobile); var items = ContactRepository.FilterSearchManager(branchId, name, mobile, email, employeeTypeId, page, rows, out totalRecords) ?? new List<ContactInfo>(); var listContacts = new List<ContactInfo>(); foreach (var item in items.Where(c => !listContacts.Exists(p => p.Id == c.Id))) listContacts.Add(item); var list = new ContactListModel { Rows = listContacts, Total = (listContacts.Count / rows) + 1, UserData = listContacts.Count, Records = rows, Page = page, }; return list; }