public static ImportExcelModel FromInfo(ImportExcelInfo info) { ImportExcelModel retVal = new ImportExcelModel(); retVal.Filename = Path.GetFileName(info.FilePath); retVal.IsCorrectFormat = retVal.Filename.ToLower().EndsWith(".xls") || retVal.Filename.ToLower().EndsWith(".xlsx"); retVal.RowIndex = info.RowIndex; retVal.TotalRow = info.TotalRow; retVal.ErrorCount = info.ErrorCount; retVal.CheckCount = info.CheckCount; retVal.DuplicateCount = info.DuplicateCount + info.InternalDuplicateCount; retVal.NoDuplicateCount = retVal.TotalRow - retVal.ErrorCount - retVal.DuplicateCount; retVal.ImportedDate = info.ImportedDate; retVal.Status = info.Status; retVal.ImportStatus = info.ImportStatus; var sourceType = SourceTypeRepository.GetInfo(info.TypeId); if (sourceType != null) { retVal.SourceTypeName = sourceType.Name; } var channel = ChannelRepository.GetInfo(info.ChannelId); if (channel != null) { retVal.ChannelName = channel.Name; } var branch = BranchRepository.GetInfo(info.BranchId); if (branch != null) { retVal.BranchName = branch.Name; } var collector = CollectorRepository.GetInfo(info.CollectorId); if (collector != null) { retVal.CollectorName = collector.Name; } return(retVal); }
public static ImportExcelModel FromInfo(ImportExcelInfo info) { ImportExcelModel retVal = new ImportExcelModel(); retVal.Filename = Path.GetFileName(info.FilePath); retVal.IsCorrectFormat = retVal.Filename.ToLower().EndsWith(".xls") || retVal.Filename.ToLower().EndsWith(".xlsx"); retVal.RowIndex = info.RowIndex; retVal.TotalRow = info.TotalRow; retVal.ErrorCount = info.ErrorCount; retVal.CheckCount = info.CheckCount; retVal.DuplicateCount = info.DuplicateCount + info.InternalDuplicateCount; retVal.NoDuplicateCount = retVal.TotalRow - retVal.ErrorCount - retVal.DuplicateCount; retVal.ImportedDate = info.ImportedDate; retVal.Status = info.Status; retVal.ImportStatus = info.ImportStatus; var sourceType = SourceTypeRepository.GetInfo(info.TypeId); if (sourceType != null) retVal.SourceTypeName = sourceType.Name; var channel = ChannelRepository.GetInfo(info.ChannelId); if (channel != null) retVal.ChannelName = channel.Name; var branch = BranchRepository.GetInfo(info.BranchId); if (branch != null) retVal.BranchName = branch.Name; var collector = CollectorRepository.GetInfo(info.CollectorId); if (collector != null) retVal.CollectorName = collector.Name; return retVal; }