public LogisticMap(double mu, double r0, double rmax, double dr) { mapData.ChartType = SeriesChartType.Point ; mapData.MarkerSize = 1; mapData.MarkerColor = Color.Black; int numberOfThreadsInMap =1 ; List<double> activeThreadValues; double eps = .005; for(double r = r0; r < rmax; r+= dr ){ activeThreadValues = new List<double>(); Func<double, double> log = i => r * i * (1 - Math.Pow(i, mu)); for (int i = 150; i < 260; i++) { var A = new Sequence(log, .2).GetElementAt(i); if (A > double.MaxValue || A < double.MinValue) { break; } if (activeThreadValues.Where(j => j < A + eps && j > A - eps).Count() == 0) activeThreadValues.Add(A); mapData.Points.AddXY(r, A); } if (activeThreadValues.Count > numberOfThreadsInMap) { Console.WriteLine("Bifurcation point: " + r.ToString() + " " + activeThreadValues.Count.ToString() + " threads."); numberOfThreadsInMap = activeThreadValues.Count(); eps /= numberOfThreadsInMap; } } }
public void WriteFileToGK(XDevice gkDevice) { var bytesList = new List<byte>(); var gkFileInfo = new GKFileInfo(); gkFileInfo.Initialize(XManager.DeviceConfiguration, gkDevice); bytesList.AddRange(gkFileInfo.InfoBlock); var sendResult = SendManager.Send(gkDevice, 0, 21, 0); if (sendResult.HasError) { Error = "Невозможно начать процедуру записи "; return; } bytesList.AddRange(gkFileInfo.FileBytes); var progressCallback = GKProcessorManager.StartProgress("Запись файла в " + gkDevice.PresentationName, null, bytesList.Count / 256, true, GKProgressClientType.Administrator); for (var i = 0; i < bytesList.Count; i += 256) { if (progressCallback.IsCanceled) { Error = "Операция отменена"; return; } GKProcessorManager.DoProgress("Запись блока данных " + i + 1, progressCallback); var bytesBlock = BitConverter.GetBytes((uint)(i / 256 + 1)).ToList(); bytesBlock.AddRange(bytesList.GetRange(i, Math.Min(256, bytesList.Count - i))); sendResult = SendManager.Send(gkDevice, (ushort)bytesBlock.Count(), 22, 0, bytesBlock); if (sendResult.HasError) { Error = "Невозможно записать блок данных " + i; break; } } var endBlock = BitConverter.GetBytes((uint) (bytesList.Count()/256 + 1)).ToList(); sendResult = SendManager.Send(gkDevice, 0, 22, 0, endBlock); if (sendResult.HasError) { Error = "Невозможно завершить запись файла "; } }
/// <summary> /// 获取OrgList /// </summary> /// <param name="orgidList"></param> /// <returns></returns> public List<Org> GetOrgList(List<Guid> orgidList) { List<Org> orgList = new List<Org>(orgidList.Count()); foreach (Guid item in orgidList) { orgList.Add(orgHandler.GetOrgByID(item)); } return orgList; }
public override void ExecuteCommand() { string searchId = base.Arguments[0]; PrepareSources(); PrepareDestinations(); Console.WriteLine("Copying all packages with '{0}' from {1} to {2}.", searchId, Source.Count == 0 ? "any source" : string.Join(";", Source), string.Join(";", Destination)); IEnumerable<IPackage> packages = new List<IPackage>(); try { packages = GetPackages(searchId); Console.WriteLine("Retrieved {0} packages, not counting dependencies for copying from one or more sources to one or more destinations.", packages.Count()); } catch (Exception) { Console.WriteError("Oopsy!"); throw; } Copy copy = new Copy(_repositoryFactory, _sourceProvider); copy.Console = this.Console; copy.ApiKey = ApiKey; foreach (string src in Source) { copy.Sources.Add(src); } foreach (string dest in Destination) { copy.Destinations.Add(dest); } IList<string> report = new List<string>(); foreach (IPackage package in packages) { copy.Arguments.Clear(); copy.Arguments.Add(package.Id); copy.Version = package.Version.ToString(); try { copy.Execute(); } catch (Exception ex) { string message = string.Format("Had an error getting package '{0} - {1}': {2}", package.Id, package.Version.ToString(), ex.Message); Console.WriteError(message); report.Add(message); } } PrintReport(searchId, report); }
public static Token TestForTokenInference(List<Token> tokens, Token tokenToAdd) { if (tokens.Count() > 0) { //When a minus or plus sign is read as a negative number, add a plus sign before the number //IE: 4 -5 becomes 4 + -5 TokenizerRules.CharInfo lastTknInfo = TokenizerRules.CharacterInfo.GetCharInfo(tokens.Last().TokenString); TokenizerRules.CharInfo currentTknInfo = TokenizerRules.CharacterInfo.GetCharInfo(tokenToAdd.TokenString); TokenizerRules.CharInfo lastCharInfo = TokenizerRules.CharacterInfo.GetCharInfo(tokenToAdd.TokenString[0].ToString()); if ((tokenToAdd.TokenType == TokenType.numberLiteral) && (tokens.Last().TokenType == TokenType.numberLiteral || (lastTknInfo != null && lastTknInfo.Type == TokenizerRules.CharType.closedBrace)) || ((Keywords.KeywordLookup.ContainsKey(tokens.Last().TokenString.ToLower()) && Keywords.KeywordLookup[tokens.Last().TokenString.ToLower()].TokenType == TokenType.numberLiteral) && (lastCharInfo != null && lastCharInfo.Type == TokenizerRules.CharType.plusMinus))) { return new Token("+", TokenType.operatorOrPunctuation); } //Infer a multiplication sign between two sets of parenthesis //IE: (3)(5) becomes (3)*(5) if ((TokenizerRules.CharacterInfo.ContainsKey(tokenToAdd.TokenString) && TokenizerRules.CharacterInfo.ContainsKey(tokens.Last().TokenString)) && TokenizerRules.CharacterInfo[tokenToAdd.TokenString].Type == TokenizerRules.CharType.openBrace && TokenizerRules.CharacterInfo[tokens.Last().TokenString].Type == TokenizerRules.CharType.closedBrace) { return new Token("*", TokenType.operatorOrPunctuation); } //Infer a multiplication sign between parenthesis and a number (that doesn't start with a minus sign) //IE: 3(4) becomes 3*(4) if (TokenizerRules.CharacterInfo.ContainsKey(tokenToAdd.TokenString) && TokenizerRules.CharacterInfo[tokenToAdd.TokenString].Type == TokenizerRules.CharType.openBrace && tokens.Last().TokenType == TokenType.numberLiteral) { return new Token("*", TokenType.operatorOrPunctuation); } //IE: (4)3 becomes (4)*3 if (TokenizerRules.CharacterInfo.ContainsKey(tokens.Last().TokenString) && tokenToAdd.TokenType == TokenType.numberLiteral && TokenizerRules.CharacterInfo[tokens.Last().TokenString].Type == TokenizerRules.CharType.closedBrace && tokenToAdd.TokenString[0] != '-') { return new Token("*", TokenType.operatorOrPunctuation); } } return null; }
public void GetBlobContentFromSnapshot() { SetupTestContainerAndBlob(); try { List<ICloudBlob> blobs = new List<ICloudBlob>(); int minSnapshot = 1; int maxSnapshot = 5; int snapshotCount = random.Next(minSnapshot, maxSnapshot); for (int i = 0; i < snapshotCount; i++) { ICloudBlob blob = ((CloudBlockBlob)Blob).CreateSnapshot(); blobs.Add(blob); } blobs.Add(Blob); List<IListBlobItem> blobLists = Container.ListBlobs(string.Empty, true, BlobListingDetails.All).ToList(); Test.Assert(blobLists.Count == blobs.Count, string.Format("container {0} should contain {1} blobs, and actually it contain {2} blobs", ContainerName, blobs.Count, blobLists.Count)); FileUtil.CleanDirectory(downloadDirRoot); ((PowerShellAgent)agent).AddPipelineScript(string.Format("Get-AzureStorageContainer {0}", ContainerName)); ((PowerShellAgent)agent).AddPipelineScript("Get-AzureStorageBlob"); Test.Assert(agent.GetAzureStorageBlobContent(string.Empty, downloadDirRoot, string.Empty, true), "download blob should be successful"); Test.Assert(agent.Output.Count == blobs.Count, "Get-AzureStroageBlobContent should download {0} blobs, and actully it's {1}", blobs.Count, agent.Output.Count); for (int i = 0, count = blobs.Count(); i < count; i++) { ICloudBlob blob = blobLists[i] as ICloudBlob; string path = Path.Combine(downloadDirRoot, blobUtil.ConvertBlobNameToFileName(blob.Name, string.Empty, blob.SnapshotTime)); Test.Assert(File.Exists(path), string.Format("local file '{0}' should exists after downloading.", path)); string localMd5 = Helper.GetFileContentMD5(path); string convertedName = blobUtil.ConvertBlobNameToFileName(blob.Name, string.Empty); Test.Assert(localMd5 == blob.Properties.ContentMD5, string.Format("blob content md5 should be {0}, and actualy it's {1}", localMd5, blob.Properties.ContentMD5)); } } finally { FileUtil.CleanDirectory(downloadDirRoot); CleanupTestContainerAndBlob(); } }
/// <summary> /// 编辑一个人员 /// </summary> /// <param name="validationErrors">返回的错误信息</param> /// <param name="db">数据上下文</param> /// <param name="entity">一个人员</param> /// <returns>是否编辑成功</returns> public bool Edit(ref ValidationErrors validationErrors, SysEntities db, SysPerson entity) { /* * 不操作 原有 现有 * 增加 原没 现有 * 删除 原有 现没 */ if (entity == null) { return false; } if (CheckName(entity)) { validationErrors.Add("用户名已被占用,请换一个新的用户名"); return false; } int count = 1; SysPerson editEntity = repository.Edit(db, entity); List<string> addSysRoleId = new List<string>(); List<string> deleteSysRoleId = new List<string>(); DataOfDiffrent.GetDiffrent(entity.SysRoleId.GetIdSort(), entity.SysRoleIdOld.GetIdSort(), ref addSysRoleId, ref deleteSysRoleId); if (addSysRoleId != null && addSysRoleId.Count() > 0) { foreach (var item in addSysRoleId) { SysRole sys = new SysRole { Id = item }; db.SysRole.Attach(sys); editEntity.SysRole.Add(sys); count++; } } if (deleteSysRoleId != null && deleteSysRoleId.Count() > 0) { List<SysRole> listEntity = new List<SysRole>(); foreach (var item in deleteSysRoleId) { SysRole sys = new SysRole { Id = item }; listEntity.Add(sys); db.SysRole.Attach(sys); } foreach (SysRole item in listEntity) { editEntity.SysRole.Remove(item);//查询数据库 count++; } } if (count == repository.Save(db)) { return true; } else { validationErrors.Add("编辑人员出错了"); } return false; }
/// <summary> /// list[]转换成byte[] /// </summary> /// <param name="listTemp"></param> /// <returns></returns> public static byte[] ListToBytes(List<byte> listTemp) { if (listTemp == null) { return null; } if (listTemp.Count <= 0) { return null; } int length = listTemp.Count(); byte[] bytes = new byte[length]; for (int i = 0; i < length; i++) { bytes[i] = listTemp[i]; } return bytes; }
public void ScanSource(bool includeSubDirectories, bool generateCovers) { if (_source == null) { return; } _generateCovers = generateCovers; var option = includeSubDirectories == false ? SearchOption.TopDirectoryOnly : SearchOption.AllDirectories; _foundPdfFiles = Directory.GetFiles(_source.SourceDirectoryUrl, FileTypes.PDF, option).ToList(); Logger.Log.Debug( $"Found {_foundPdfFiles.Count()} files in {_source.SourceDirectoryUrl} with an extension of {FileTypes.PDF}"); Logger.Log.Debug( $"Importing from {_source.SourceDirectoryUrl}: Subdirectories {includeSubDirectories}: Generate Covers: {generateCovers}"); OnProgressStarted(); Worker.RunWorkerAsync(); }
/// <summary> /// 设置一个菜单 /// </summary> /// <param name="validationErrors">返回的错误信息</param> /// <param name="entity">一个菜单</param> /// <returns>是否设置成功</returns> public bool SetSysMenu(ref ValidationErrors validationErrors, SysOperation entity) { bool bResult = false; int count = 0; using (TransactionScope transactionScope = new TransactionScope()) { try { SysOperation editEntity = repository.GetById(db, entity.Id); List<string> addSysMenuId = new List<string>(); List<string> deleteSysMenuId = new List<string>(); if (entity.SysMenuId != null) { addSysMenuId = entity.SysMenuId.Split(',').ToList(); } if (entity.SysMenuIdOld != null) { deleteSysMenuId = entity.SysMenuIdOld.Split(',').ToList(); } DataOfDiffrent.GetDiffrent(addSysMenuId, deleteSysMenuId, ref addSysMenuId, ref deleteSysMenuId); if (addSysMenuId != null && addSysMenuId.Count() > 0) { foreach (var item in addSysMenuId) { SysMenu sys = new SysMenu { Id = item }; db.SysMenu.Attach(sys); editEntity.SysMenu.Add(sys); count++; } } if (deleteSysMenuId != null && deleteSysMenuId.Count() > 0) { List<SysMenu> listEntity = new List<SysMenu>(); foreach (var item in deleteSysMenuId) { SysMenu sys = new SysMenu { Id = item }; listEntity.Add(sys); db.SysMenu.Attach(sys); } foreach (SysMenu item in listEntity) { editEntity.SysMenu.Remove(item);//查询数据库 count++; } } if (count > 0 && count == repository.Save(db)) { transactionScope.Complete(); bResult = true; } else if(count == 0 ) { validationErrors.Add("数据没有改变"); } } catch (Exception ex) { Transaction.Current.Rollback(); ExceptionsHander.WriteExceptions(ex); validationErrors.Add("编辑出错了。原因"+ex.Message); } } return bResult; }
/// <summary> /// 重置分类OrderStr /// </summary> private void GetNewCategoryList(List<CategoryModel> orderlst, ref List<CategoryModel> newlst, string parentId) { List<CategoryModel> tmplist = new List<CategoryModel>(); foreach (CategoryModel c in orderlst) { if (c.ParentId == parentId) { CategoryModel category = c; category.OrderId = (newlst.Count() + 1).ToString(); newlst.Add(category); if (Utils.StrToInt(c.SubCount) > 0) { GetNewCategoryList(orderlst, ref newlst, c.CateId); } continue; } } }
/// <summary> /// 编辑一个菜单 /// </summary> /// <param name="validationErrors">返回的错误信息</param> /// <param name="db">数据上下文</param> /// <param name="entity">一个菜单</param> /// <returns>是否编辑成功</returns> public bool Edit(ref ValidationErrors validationErrors, SysEntities db, SysMenu entity) { /* * 不操作 原有 现有 * 增加 原没 现有 * 删除 原有 现没 */ if (entity == null) { return false; } int count = 1; SysMenu editEntity = repository.Edit(db, entity); List<string> addSysOperationId = new List<string>(); List<string> deleteSysOperationId = new List<string>(); DataOfDiffrent.GetDiffrent(entity.SysOperationId.GetIdSort(), entity.SysOperationIdOld.GetIdSort(), ref addSysOperationId, ref deleteSysOperationId); if (addSysOperationId != null && addSysOperationId.Count() > 0) { foreach (var item in addSysOperationId) { SysOperation sys = new SysOperation { Id = item }; db.SysOperation.Attach(sys); editEntity.SysOperation.Add(sys); count++; } } if (deleteSysOperationId != null && deleteSysOperationId.Count() > 0) { List<SysOperation> listEntity = new List<SysOperation>(); foreach (var item in deleteSysOperationId) { SysOperation sys = new SysOperation { Id = item }; listEntity.Add(sys); db.SysOperation.Attach(sys); } foreach (SysOperation item in listEntity) { editEntity.SysOperation.Remove(item);//查询数据库 count++; } } if (count == repository.Save(db)) { //修改后重置菜单编码 List<int> flags = new List<int>();//层级 GetMenus2(null, flags); db.SaveChanges(); return true; } else { validationErrors.Add("编辑菜单出错了"); } return false; }
public PagerDTO<UserDTO> GetUserPage(string searchString, int page, int pageSize, int roleId) { List<User> users = new List<User>(); if (!String.IsNullOrEmpty(searchString)) { users.AddRange( uOW.UserRepo.Get() .Where(s => (s.UserName.ToLower()).Contains(searchString.ToLower()) || (s.Email.ToLower()).Contains(searchString.ToLower())) ); } else { users.AddRange(uOW.UserRepo.Get()); } if (roleId > 0) { users = users.Where(s => (s.RoleId == roleId)).ToList(); } var pageCount = (double) users.Count()/pageSize; var model = new PagerDTO<UserDTO> { CurrentPage = page, PageCount = (int) Math.Ceiling(pageCount) }; // if asked page is greater then avilable ones if (model.PageCount < page) { return model; } var skip = pageSize*(page - 1); var resultList = Mapper.Map<IEnumerable<UserDTO>>(users.Skip(skip).Take(pageSize)).ToList(); model.Data = resultList; return model; }
public static Signal IterativeFunctionApplication(List<double> seedVals, int iterations) { Signal newValues = new Signal(seedVals.Count() + iterations); for (int i = 0; i < seedVals.Count(); i++) { newValues.Add(Math.Log10(seedVals[i])); } for (int i = 0; i < iterations; i++) { double first = Math.Pow(10,Math.Abs(newValues[i])); double second = Math.Abs(newValues[i + 1]); double third = Math.Abs(newValues[i + 2]); switch ((int)first % 4) { case 0: newValues.Add(Math.Log10(second + third)); break; case 1: newValues.Add(Math.Log10(second * third)); break; case 2: newValues.Add(Math.Log10(second / (third + 1))); break; case 3: newValues.Add(Math.Log10(Math.Abs(second - third))); break; } } return newValues; }
public void WriteFileToGK(GKDevice gkControllerDevice, Guid clientUID) { using (var gkLifecycleManager = new GKLifecycleManager(gkControllerDevice, "Запись файла в ГК")) { gkLifecycleManager.AddItem("Формирование хэша"); var gkFileInfo = new GKFileInfo(); gkFileInfo.Initialize(gkControllerDevice); var bytesList = new List<byte>(); bytesList.AddRange(gkFileInfo.InfoBlock); bytesList.AddRange(gkFileInfo.FileBytes); gkLifecycleManager.AddItem("Перевод в режим записи файла"); var sendResult = SendManager.Send(gkControllerDevice, 0, 21, 0); if (sendResult.HasError) { Error = "Невозможно начать процедуру записи "; gkLifecycleManager.AddItem("Ошибка"); return; } var progressCallback = GKProcessorManager.StartProgress("Запись файла в " + gkControllerDevice.PresentationName, null, bytesList.Count / 256, false, GKProgressClientType.Administrator, clientUID); for (var i = 0; i < bytesList.Count; i += 256) { gkLifecycleManager.Progress(i + 1, bytesList.Count); GKProcessorManager.DoProgress("Запись блока данных " + i + 1, progressCallback, clientUID); var bytesBlock = BitConverter.GetBytes((uint)(i / 256 + 1)).ToList(); bytesBlock.AddRange(bytesList.GetRange(i, Math.Min(256, bytesList.Count - i))); for (int j = 0; j < 10; j++) { sendResult = SendManager.Send(gkControllerDevice, (ushort)bytesBlock.Count(), 22, 0, bytesBlock); var result = sendResult.Bytes.Count > 0 && sendResult.Bytes[0] == 1; if (!sendResult.HasError && result) break; if (j == 9) { Error = "Невозможно записать блок данных " + i; gkLifecycleManager.AddItem("Ошибка"); return; } } } gkLifecycleManager.AddItem("Запись последнего блока данных"); var endBlock = BitConverter.GetBytes((uint)(bytesList.Count() / 256 + 1)).ToList(); sendResult = SendManager.Send(gkControllerDevice, 0, 22, 0, endBlock); var endResult = sendResult.Bytes.Count > 0 && sendResult.Bytes[0] == 0; if (sendResult.HasError || !endResult) { Error = "Невозможно завершить запись файла "; gkLifecycleManager.AddItem("Ошибка"); } var sendResultRead = SendManager.Send(gkControllerDevice, 4, 23, 256, new List<byte>(BitConverter.GetBytes(1))); if (!gkFileInfo.InfoBlock.SequenceEqual(sendResultRead.Bytes)) { Error = "Не удалось корректно записать информационный блок "; gkLifecycleManager.AddItem("Ошибка"); } } }
public void SendEquiped(Player Plr, List<UInt16> Itms) { int Invalide = Itms.Count(slot => !IsEquipedSlot(slot)); if (Invalide >= Itms.Count) return; PacketOut Out = new PacketOut((byte)Opcodes.F_PLAYER_INVENTORY); Out.WriteUInt16(_Owner.Oid); Out.WriteUInt16((UInt16)(Itms.Count - Invalide)); // Count foreach (UInt16 Slot in Itms) { if (!IsEquipedSlot(Slot)) continue; Out.WriteUInt16(Slot); Out.WriteUInt16((UInt16)(Items[Slot] != null ? Items[Slot].ModelId : 0)); } Out.WriteByte(0); if (Plr != null) Plr.SendPacket(Out); else _Owner.DispatchPacket(Out, false); }
/// <summary> /// 编辑一个部门 /// </summary> /// <param name="validationErrors">返回的错误信息</param> /// <param name="db">数据上下文</param> /// <param name="entity">一个部门</param> /// <returns>是否编辑成功</returns> public bool Edit(ref ValidationErrors validationErrors, SysEntities db, SysDepartment entity) { /* * 不操作 原有 现有 * 增加 原没 现有 * 删除 原有 现没 */ if (entity == null) { return false; } int count = 1; List<string> addSysDocumentId = new List<string>(); List<string> deleteSysDocumentId = new List<string>(); DataOfDiffrent.GetDiffrent(entity.SysDocumentId.GetIdSort(), entity.SysDocumentIdOld.GetIdSort(), ref addSysDocumentId, ref deleteSysDocumentId); List<SysDocument> listEntitySysDocument = new List<SysDocument>(); if (deleteSysDocumentId != null && deleteSysDocumentId.Count() > 0) { foreach (var item in deleteSysDocumentId) { SysDocument sys = new SysDocument { Id = item }; listEntitySysDocument.Add(sys); entity.SysDocument.Add(sys); } } SysDepartment editEntity = repository.Edit(db, entity); if (addSysDocumentId != null && addSysDocumentId.Count() > 0) { foreach (var item in addSysDocumentId) { SysDocument sys = new SysDocument { Id = item }; db.SysDocument.Attach(sys); editEntity.SysDocument.Add(sys); count++; } } if (deleteSysDocumentId != null && deleteSysDocumentId.Count() > 0) { foreach (SysDocument item in listEntitySysDocument) { editEntity.SysDocument.Remove(item); count++; } } if (count == repository.Save(db)) { return true; } else { validationErrors.Add("编辑部门出错了"); } return false; }
private void DataBind(List<Model.IModel.IModelObject> list) { Sys_FormMaster_fom_Info info = new Sys_FormMaster_fom_Info(); lvwMstr.Items.Clear(); List<Sys_FormMaster_fom_Info> infoList = new List<Sys_FormMaster_fom_Info>(); try { foreach (var t in list) { info = t as Sys_FormMaster_fom_Info; infoList.Add(info); } lvwMstr.SetDataSource<Sys_FormMaster_fom_Info>(infoList); } catch (Exception Ex) { ShowErrorMessage(Ex); } lbliCount.Text = list.Count().ToString(); }
/// <summary> /// /// </summary> /// <param name="dids"></param> /// <param name="gids"></param> /// <param name="pageSize"></param> /// <param name="pageIndex"></param> /// <param name="rowCount"></param> /// <returns></returns> protected List<P_PersonInfo> GetPersonListByGroupDepartment(string dids, string gids,out int rowCount, int pageSize=-1,int pageIndex=-1) { List<int> list_dids = new List<int>(); List<int> list_gids = new List<int>(); if (dids != "") { var list_dids_temp = (from g in dids.Split(',') where g != "" select g).ToList(); list_dids_temp.ForEach(g => list_dids.Add(int.Parse(g))); } if (gids != "") { var list_gids_temp = (from g in gids.Split(',') where g != "" select g).ToList(); list_gids_temp.ForEach(g => list_gids.Add(int.Parse(g))); } //2 根据department以及group的id查询其对应的Person对象集合 List<P_PersonInfo> list_person = new List<P_PersonInfo>(); var list_department = departmentBLL.GetListByIds(list_dids); list_department.ForEach(d => list_person.AddRange(d.P_PersonInfo)); var list_group = groupBLL.GetListByIds(list_gids); list_group.ForEach(g => list_person.AddRange(g.P_PersonInfo)); //3 将联系人集合去重 list_person = list_person.Distinct(new P_PersonEqualCompare()).ToList().Select(p => p.ToMiddleModel()).ToList(); list_person = list_person.OrderByDescending(a => a.isVIP).ToList(); rowCount = list_person.Count(); if (pageIndex != -1 && pageSize != -1) { //分页 list_person = list_person.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); } return list_person; }