public ActionResult BaseCheckClient() { BaseCheckClientModel model = new BaseCheckClientModel(); List <CheckClient> listCheckClient = checkBusinessLogic.Check_Client(model.SearchCheckClient.GetCheckClientSearchCriteria()); listCheckClient = listCheckClient.FindAll(a => !BaseCheckClientModel.ListHideClientId.Contains(a.Id)); model.ListCheckClientModel = listCheckClient.GetRange(0, listCheckClient.Count < 100 ? listCheckClient.Count : 100).Select(item => new CheckClientModel(item)).ToList(); model.CountDublicate = BaseCheckClientModel.SumDublicate(listCheckClient, model.SearchCheckClient); model.CountRow = listCheckClient.Count; model.SetHide(); return(View(model)); }
public ActionResult CheckClient(BaseCheckClientModel model, long?CountDublicate) { List <CheckClient> listCheckClient = checkBusinessLogic.Check_Client(model.SearchCheckClient.GetCheckClientSearchCriteria()); if (model.IsHideClientId) { listCheckClient = listCheckClient.FindAll(a => !BaseCheckClientModel.ListHideClientId.Contains(a.Id)); } CheckClientReport printedForm = new CheckClientReport(listCheckClient, CountDublicate, model.SearchCheckClient.GetCheckClientSearchCriteria(), model.ViewColumn.GetViewColumn()); return(File(printedForm.GetExcel(), System.Net.Mime.MediaTypeNames.Application.Octet, string.Format("Отчет по дубликатам клиентов.xlsx"))); }
public ActionResult MassMergeClients(BaseCheckClientModel m) { BaseCheckClientModel model = new BaseCheckClientModel(); model.SearchCheckClient = m.SearchCheckClient; List <CheckClient> listCheckClient = checkBusinessLogic.Check_Client(model.SearchCheckClient.GetCheckClientSearchCriteria()); if (m.IsHideClientId) { listCheckClient = listCheckClient.FindAll(a => !BaseCheckClientModel.ListHideClientId.Contains(a.Id)); } Dictionary <long, List <long> > dic = model.FindDuplicate(listCheckClient, m.SearchCheckClient, m.CountMerge); List <long> afterMergingListClient = new List <long>(); foreach (var item in dic) { if (item.Value.Count() > 1) { long resultClient = clientBusinessLogic.Clients_Merge(item.Key, item.Value.FirstOrDefault(), CurrentUser); for (int i = 1; i < item.Value.Count(); i++) { resultClient = clientBusinessLogic.Clients_Merge(resultClient, item.Value[i], CurrentUser); } afterMergingListClient.Add(resultClient); } else if (item.Value.Count() == 1) { long resultClient = clientBusinessLogic.Clients_Merge(item.Key, item.Value.FirstOrDefault(), CurrentUser); afterMergingListClient.Add(resultClient); } else { //Count=0 //nothing } } model.ListCheckClientModel = listCheckClient.Where(a => afterMergingListClient.Contains(a.Id)).ToList() .GetRange(0, afterMergingListClient.Count < 100 ? afterMergingListClient.Count : 100) .Select(item => new CheckClientModel(item)) .ToList(); model.CountMerge = m.CountMerge; model.SearchCheckClient = m.SearchCheckClient; model.CountRow = listCheckClient.Count; return(View(model)); }
public ActionResult BaseCheckClient(BaseCheckClientModel m) { BaseCheckClientModel model = new BaseCheckClientModel(); List <CheckClient> listCheckClient = checkBusinessLogic.Check_Client(m.SearchCheckClient.GetCheckClientSearchCriteria()); if (m.IsHideClientId) { listCheckClient = listCheckClient.FindAll(a => !BaseCheckClientModel.ListHideClientId.Contains(a.Id)); } model.SearchCheckClient = m.SearchCheckClient; model.ListCheckClientModel = listCheckClient.Select(item => new CheckClientModel(item)).ToList(); if (model.ListCheckClientModel.Count >= (int)m.PageSize) { model.ListCheckClientModel = model.ListCheckClientModel.GetRange(0, (int)m.PageSize); } model.CountDublicate = BaseCheckClientModel.SumDublicate(listCheckClient, model.SearchCheckClient); model.CountRow = listCheckClient.Count; model.ViewColumn = m.ViewColumn; model.PageSize = m.PageSize; model.SetHide(); return(View(model)); }