void ListMatches(List<Team> TeamsBeforeBye) { if (TeamsBeforeBye.Count % 2 != 0) { TeamsBeforeBye.Add(new Team() {Name = "Bye"}); } int matchAmmount = (TeamsBeforeBye.Count - 1); int halfSize = TeamsBeforeBye.Count / 2; List<Team> teams = new List<Team>(); teams.AddRange(TeamsBeforeBye); teams.RemoveAt(0); int teamsSize = teams.Count; for (int match = 0; match < matchAmmount; match++) { Console.WriteLine("Match {0}", (match + 1)); int teamIndex = match % teamsSize; Console.WriteLine("{0} vs {1}", teams[teamIndex], TeamsBeforeBye[0]); for (int index = 1; index < halfSize; index++) { int firstTeam = (match + index % teamsSize); int secondTeam = (match + teamsSize - index % teamsSize); Console.WriteLine("{0} vs {1}", teams[firstTeam], teams[secondTeam]); } } }
public List<Test> FindTest(string name) { List<Test> tests = new List<Test>(); if (name != null) tests.AddRange(Db.Read().Where(t => t.Name.Contains(name))); return tests; }
public List<AccessoriesList> listAcces(string prmWhere) { List<AccessoriesList> lists = new List<AccessoriesList>(); NBear.Common.WhereClip _where = new NBear.Common.WhereClip(prmWhere, null, null, null); where = AccessoriesList._.AccessoriesCD > 0 & _where; orderby = AccessoriesList._.AccessoriesCD.Desc; lists.AddRange(db.FindArray<AccessoriesList>(where, orderby)); return lists; }
/// <summary> /// �����û�ӵ�е��� /// </summary> /// <param name="Userid"></param> /// <returns></returns> public List<cachetList> GetByUserid(object prmUsID) { WhereClip where = new WhereClip(); where.Sql = "clUsids like '%" + prmUsID.ToString() + ",%'"; List<cachetList> lists = new List<cachetList>(); lists.AddRange(db.FindArray<cachetList>(where)); return lists; }
IList<Page> IVisualStudioService.GetPages(ProjectItems projectItems) { List<Page> pages = new List<Page>(); foreach (ProjectItem item in projectItems) { pages.AddRange(GetPages(item)); } return pages; }
/// <summary> /// 分页列表--带条件 /// </summary> /// <param name="prmPageindex"></param> /// <param name="prmPagesize"></param> /// <param name="prmPagecount"></param> /// <param name="prmRecordcount"></param> /// <param name="prmWhere"></param> /// <returns></returns> public List<meetingnotice> listMeetingNotice(int prmPageindex, int prmPagesize, out int prmPagecount, out int prmRecordcount, string prmWhere) { List<meetingnotice> lists = new List<meetingnotice>(); NBear.Common.WhereClip _where = new NBear.Common.WhereClip(prmWhere, null, null, null); where = meetingnotice._.mnID > 0 & _where; orderby = meetingnotice._.mnID.Desc; PageSelector<meetingnotice> pages = db.GetPageSelector<meetingnotice>(where, orderby, prmPagesize); prmPagecount = pages.PageCount; prmRecordcount = pages.RowCount; lists.AddRange(db.From<meetingnotice>().Where(where).OrderBy(orderby).ToArray<meetingnotice>(prmPagesize, prmPagesize * (prmPageindex - 1))); return lists; }
/// <summary> /// 分页列表--带条件 /// </summary> /// <param name="prmPageindex"></param> /// <param name="prmPagesize"></param> /// <param name="prmPagecount"></param> /// <param name="prmRecordcount"></param> /// <param name="prmWhere"></param> /// <returns></returns> public List<InceptDoc> listIncept(int prmPageindex, int prmPagesize, out int prmPagecount, out int prmRecordcount, string prmWhere) { List<InceptDoc> lists = new List<InceptDoc>(); NBear.Common.WhereClip _where = new NBear.Common.WhereClip(prmWhere, null, null, null); where = InceptDoc._.idID > 0 & _where; orderby = InceptDoc._.idID.Desc; PageSelector<InceptDoc> pages = db.GetPageSelector<InceptDoc>(where, orderby, prmPagesize); prmPagecount = pages.PageCount; prmRecordcount = pages.RowCount; lists.AddRange(db.From<InceptDoc>().Where(where).OrderBy(orderby).ToArray<InceptDoc>(prmPagesize, prmPagesize * (prmPageindex - 1))); return lists; }
IEnumerable<Page> IVisualStudioService.GetPages(ProjectItems projectItems) { List<Page> pages = new List<Page>(); foreach (ProjectItem folder in projectItems) { if (folder.Name == "Views") { pages.AddRange(GetPages(folder, string.Empty)); } else if (folder.Name == "Areas") { foreach (ProjectItem area in folder.ProjectItems) { pages.AddRange(GetPages(area, area.Name)); } } } return pages; }
/// <summary> /// ��ҳ�б�--������ /// </summary> /// <param name="prmPageindex"></param> /// <param name="prmPagesize"></param> /// <param name="prmPagecount"></param> /// <param name="prmRecordcount"></param> /// <param name="prmWhere"></param> /// <returns></returns> public List<AccessoriesList> listAcces(int prmPageindex, int prmPagesize, out int prmPagecount, out int prmRecordcount, string prmWhere) { List<AccessoriesList> lists = new List<AccessoriesList>(); NBear.Common.WhereClip _where = new NBear.Common.WhereClip(prmWhere, null, null, null); where = AccessoriesList._.AccessoriesCD > 0 & _where; orderby = AccessoriesList._.AccessoriesCD.Desc; PageSelector<AccessoriesList> pages = db.GetPageSelector<AccessoriesList>(where, orderby, prmPagesize); prmPagecount = pages.PageCount; prmRecordcount = pages.RowCount; lists.AddRange(db.From<AccessoriesList>().Where(where).OrderBy(orderby).ToArray<AccessoriesList>(prmPagesize, prmPagesize * (prmPageindex - 1))); return lists; }
/// <summary> /// 分页列表--带条件 /// </summary> /// <param name="prmPageindex"></param> /// <param name="prmPagesize"></param> /// <param name="prmPagecount"></param> /// <param name="prmRecordcount"></param> /// <param name="prmWhere"></param> /// <returns></returns> public List<FlowLog> listFlowLog(int prmPageindex, int prmPagesize, out int prmPagecount, out int prmRecordcount, string prmWhere) { List<FlowLog> lists = new List<FlowLog>(); NBear.Common.WhereClip _where = new NBear.Common.WhereClip(prmWhere, null, null, null); where = FlowLog._.fgID > 0 & _where; orderby = FlowLog._.fgOrder.Asc; PageSelector<FlowLog> pages = db.GetPageSelector<FlowLog>(where, orderby, prmPagesize); prmPagecount = pages.PageCount; prmRecordcount = pages.RowCount; lists.AddRange(db.From<FlowLog>().Where(where).OrderBy(orderby).ToArray<FlowLog>(prmPagesize, prmPagesize * (prmPageindex - 1))); return lists; }
/// <summary> /// Create QR Codes given a DealerPA, creates based upon what QRCodes and Catalogs already exist in the database. /// </summary> /// <param name="dealerPa"></param> /// <returns></returns> public TransactionResponse CreateQRCodeByDealerPa(string dealerPa, string userName) { var response = new TransactionResponse(); try { var dealerSproc = new DealerGetDealerPaStoredProcedure(); dealerSproc.SprocParameters["@DealerPa"] = dealerPa; var dealers = _responseController.SprocController.ExecuteEntitySet<DealerGetDealerPaStoredProcedure, Dealer>(dealerSproc); var catalogs = _responseController.SprocController.ExecuteEntitySet<CatalogGetInDealerQrCodesStoredProcedure, Catalog>(new CatalogGetInDealerQrCodesStoredProcedure()); var dealerQrCodes = new List<DealerQRCode>(); foreach (var catalog in catalogs) { dealerQrCodes.AddRange(BuildDealerQRCodes(catalog, dealers)); } var qrCodes = BuildQRCodes(dealerQrCodes); var container = BuildDealerQRCodeContainer(dealerQrCodes, qrCodes); response.ResponseCode = 200; ProcessQrCodes(container, ref response, userName); response.Message = "Success."; } catch (Exception exc) { response.Message = string.Format("Error! {0}", exc.Message); //response.Count = 0; response.ResponseCode = 500; //response.DealerPa = dealerPa; LogWriter.LogException(new Exception(string.Format("Qr Code Create For Dealers, DealerPa: {0}", dealerPa)), exc); } return response; }
public List<Equipment> GetAllEquips() { List<Equipment> Equipments = new List<Equipment>(); Equipments.AddRange(new Equipment[] { this.Necklace, this.Ring, this.Head, this.Body, this.Hand, this.Cape, this.Feet, this.Charm, this.Mirror }); var equips = Equipments.Where(x => x != null); return equips.ToList(); }
/// <summary> /// Adds the view model and views. /// </summary> /// <param name="textTemplateInfos">The text template infos.</param> /// <returns> /// The messages. /// </returns> public IEnumerable<string> AddViewModelAndViews( IEnumerable<TextTemplateInfo> textTemplateInfos) { TraceService.WriteLine("ViewModelViewsService::AddViewModelAndViews"); List<string> messages = new List<string>(); List<TextTemplateInfo> textTemplates = textTemplateInfos.ToList(); messages.AddRange(this.visualStudioService.SolutionService.AddItemTemplateToProjects(textTemplates, this.SettingsService.OutputTextTemplateContentToTraceFile)); //// now add any post action commands foreach (TextTemplateInfo textTemplateInfo in textTemplates) { if (textTemplateInfo.FileOperations != null) { foreach (FileOperation fileOperation in textTemplateInfo.FileOperations) { this.fileOperationService.ProcessCommand(fileOperation); foreach (TextTemplateInfo childTemplateInfo in textTemplateInfo.ChildItems) { foreach (FileOperation childFileOperation in childTemplateInfo.FileOperations) { this.fileOperationService.ProcessCommand(childFileOperation); } } } } } TraceService.WriteLine("ViewModelViewsService::AddViewModelAndViews END"); return messages; }
/// <summary> /// Adds the view models and views. /// </summary> /// <param name="views">The views.</param> /// <returns>A list of views.</returns> public IEnumerable<string> AddViewModelsAndViews(IEnumerable<View> views) { TraceService.WriteLine("ViewModelViewsService::AddViewModelsAndViews"); List<string> messages = new List<string>(); this.visualStudioService.WriteStatusBarMessage(NinjaMessages.AddingViewModelAndViews); if (this.SettingsService.FrameworkType == FrameworkType.MvvmCrossAndXamarinForms) { this.SettingsService.BindXamlForXamarinForms = true; this.SettingsService.BindContextInXamlForXamarinForms = false; } else { this.SettingsService.BindXamlForXamarinForms = true; this.SettingsService.BindContextInXamlForXamarinForms = true; } foreach (View view in views) { if (view.Existing == false) { string viewModelName = view.Name + "ViewModel"; this.visualStudioService.WriteStatusBarMessage(NinjaMessages.AddingViewModelAndViews + " (" + viewModelName + ")"); IEnumerable<TextTemplateInfo> textTemplateInfos = this.viewModelAndViewsFactory.GetRequiredTextTemplates( view, viewModelName, this.viewModelAndViewsFactory.AllowedUIViews, this.visualStudioService.CoreTestsProjectService != null); IEnumerable<string> viewModelMessages = this.AddViewModelAndViews( textTemplateInfos); messages.AddRange(viewModelMessages); } } TraceService.WriteLine("ViewModelViewsService::AddViewModelsAndViews END"); return messages; }
/// <summary> /// Gets the MVVM cross tests commands. /// </summary> /// <returns>A list of Nuget commands.</returns> public IEnumerable<string> GetMvvmCrossTestsCommands() { TraceService.WriteLine("NugetCommandsService::GetMvvmCrossTestsCommands"); string testingFrameworkNugetPackage = ScorchioMvvmCrossMsTestTests; switch (this.settingsService.TestingFramework) { case TestingConstants.NUnit.Name: testingFrameworkNugetPackage = ScorchioMvvmCrossNUnitTests; break; case TestingConstants.XUnit.Name: testingFrameworkNugetPackage = ScorchioMvvmCrossXUnitTests; break; } List<string> commands = new List<string> { this.GetMvvmCrossCommand(MvvmCrossCore), this.GetMvvmCrossCommand(MvvmCrossTests), this.GetNinjaCommand(testingFrameworkNugetPackage, false), }; IEnumerable<string> testCommands = this.GetTestCommands(); commands.AddRange(testCommands); return commands; }
/// <summary> /// Bereken de taak voortgang van een sprint. /// </summary> /// <param name="sprint"></param> /// <returns></returns> public static TaskProgress GetTaskProgress(Sprint sprint) { TaskProgress taskProgress = new TaskProgress(); //Dit kan niet in het model, dus loopen, of een List<Task> als argument geven. // TakenVanSprintQuery takenVanSprintQuery = new TakenVanSprintQuery(); // takenVanSprintQuery.Sprint = sprint; // // IList tasks = takenVanSprintQuery.GetQuery(UnitOfWork.CurrentSession).List(); List<Task> tasks = new List<Task>(); if(sprint != null) { foreach (SprintStory sprintStory in sprint.SprintStories) { tasks.AddRange(sprintStory.Story.Tasks); } } foreach (Task task in tasks) { taskProgress.TotalTasks++; if (task.Status == Status.Afgesloten) taskProgress.CompletedTasks++; else taskProgress.IncompleteTasks++; if (task.Behandelaar == null) taskProgress.UnassignedTasks++; else taskProgress.AssignedTasks++; } return taskProgress; }
/// <summary> /// Gets all the forms that are the children of the folder with the specified ID. /// </summary> /// <param name="parentId">The parent ID.</param> /// <returns> /// The forms. /// </returns> /// <remarks> /// You can specify a parent ID of null to get the root forms. /// </remarks> public IEnumerable<IEntity> RetrieveChildren(Guid? parentId) { var children = new List<IEntity>(); children.AddRange(Folders.RetrieveChildren(parentId)); children.AddRange(Forms.RetrieveChildren(parentId)); children.AddRange(Layouts.RetrieveChildren(parentId)); children.AddRange(Validations.RetrieveChildren(parentId)); return children; }
private IList<Page> GetPages(ProjectItem item, string area) { var files = new List<Page>(); if (item.ProjectItems.Count == 0) { if (CheckIsPage(item))//check its not an empty folder { GetPageData(item, files, area); } } else { foreach (ProjectItem currentItem in item.ProjectItems) { files.AddRange(GetPages(currentItem, area)); } } return files; }
/// <summary> /// Lấy dữ liệu bảng hàng hóa và gói hàng (Chạy 1 lần để lấy dữ liệu và gán vào biến dùng chung) /// </summary> /// <returns></returns> List<ThongTinMaVach> GetHangHoaGoiHang() { List<ThongTinMaVach> dsThongTinMaVachs = new List<ThongTinMaVach>(); try { //Lấy MaHangHoa,TenHangHoa,GiaNhap,GiaBanBuon,GiaBanLe,GhiChu từ bảng HÀNG HÓA cl = new Server_Client.Client(); client = cl.Connect(Luu.IP, Luu.Ports); ThongTinMaVach row1 = new ThongTinMaVach("Select"); clientstrem = cl.SerializeObj(client, "ThongTinMaVachHangHoa", row1); ThongTinMaVach[] dsHangHoa = new ThongTinMaVach[0]; dsHangHoa = (ThongTinMaVach[])cl.DeserializeHepper(clientstrem, dsHangHoa); client.Close(); clientstrem.Close(); if (dsHangHoa != null) dsThongTinMaVachs.AddRange(dsHangHoa); } catch { } try { //Lấy a.GoiHangID,a.MaKho,a.MaGoiHang,a.TenGoiHang,a.MaNhomHang,b.TenNhomHang,a.GiaNhap,a.GiaBanBuon,a.GiaBanLe,a.Deleted //FROM GoiHang a join NhomHang b on a.MaNhomHang=b.MaNhomHang WHERE a.Deleted='False' cl = new Server_Client.Client(); client = cl.Connect(Luu.IP, Luu.Ports); GoiHang goi = new GoiHang("Select"); clientstrem = cl.SerializeObj(client, "GoiHang", goi); GoiHang[] goiHang = new GoiHang[0]; goiHang = (GoiHang[])cl.DeserializeHepper1(clientstrem, goiHang); if (goiHang != null) { foreach (GoiHang item in goiHang) { if (item.Deleted) continue; ThongTinMaVach row = new ThongTinMaVach { MaHangHoa = item.MaGoiHang, TenHangHoa = item.TenGoiHang, GiaNhap = item.GiaNhap, GiaBanBuon = item.GiaBanBuon, GiaBanLe = item.GiaBanLe }; dsThongTinMaVachs.Add(row); } } } catch { } return dsThongTinMaVachs; }
/// <summary> /// Gets the projects. /// </summary> /// <param name="instance">The instance.</param> /// <returns>The projects.</returns> public static IEnumerable<Project> GetProjects(this Solution2 instance) { ////TraceService.WriteLine("SolutionExtensions::GetProjects"); List<Project> projects = instance.Projects.Cast<Project>().ToList(); List<Project> list = new List<Project>(); List<Project>.Enumerator item = projects.GetEnumerator(); while (item.MoveNext()) { Project project = item.Current; if (project == null) { continue; } if (project.Kind == VSConstants.VsProjectKindSolutionItems) { list.AddRange(project.GetSolutionFolderProjects()); } else { list.Add(project); } } return list; }
/// <summary> /// 读取人事列表 /// </summary> /// <param name="prmWhere">SQL条件</param> /// <returns></returns> public List<StaffInfo> listUserInfo(string prmWhere) { List<StaffInfo> lists = new List<StaffInfo>(); NBear.Common.WhereClip _where = new NBear.Common.WhereClip(prmWhere, null, null, null); where = StaffInfo._.Id > 0 & _where; lists.AddRange(db.FindArray<StaffInfo>(where)); return lists; }
/// <summary> /// Processes the specified form. /// </summary> /// <param name="nugetPackagesViewModel">The nuget packages view model.</param> /// <param name="xamarinFormsLabsViewModel">The xamarin forms labs view model.</param> internal void Process( NugetPackagesViewModel nugetPackagesViewModel, XamarinFormsLabsViewModel xamarinFormsLabsViewModel) { TraceService.WriteLine("NugetPackagesController::Process"); this.VisualStudioService.WriteStatusBarMessage(NinjaMessages.NinjaIsRunning); TraceService.WriteLine("ProjectsController::Process"); string commands = string.Empty; this.VisualStudioService.WriteStatusBarMessage(NinjaMessages.NinjaIsRunning); List<string> messages = new List<string>(); if (nugetPackagesViewModel != null) { List<Plugin> packages = nugetPackagesViewModel.GetRequiredPackages().ToList(); if (packages.Any()) { commands += string.Join( Environment.NewLine, this.pluginsService.GetNugetCommands(packages, false)); messages.AddRange(this.pluginsService.GetNugetMessages(packages)); } } if (xamarinFormsLabsViewModel != null) { List<Plugin> plugins = xamarinFormsLabsViewModel.GetRequiredPlugins().ToList(); if (plugins.Any()) { commands += string.Join( Environment.NewLine, pluginsService.GetNugetCommands(plugins, false)); messages.AddRange(this.pluginsService.GetNugetMessages(plugins)); } } if (this.SettingsService.OutputNugetCommandsToReadMe) { messages.Add(Environment.NewLine); messages.Add(this.ReadMeService.GetSeperatorLine()); messages.Add(commands); messages.Add(this.ReadMeService.GetSeperatorLine()); } this.ReadMeService.AddLines( this.GetReadMePath(), "Add Nuget Packages", messages); TraceService.WriteHeader("RequestedNugetCommands=" + commands); if (this.SettingsService.ProcessNugetCommands) { this.nugetService.Execute( this.GetReadMePath(), commands, this.SettingsService.SuspendReSharperDuringBuild); } this.VisualStudioService.WriteStatusBarMessage(NinjaMessages.NugetDownload); }
/// <summary> /// 读取部门列表 /// </summary> /// <returns></returns> public List<Department> getAllDpt() { List<Department> lists = new List<Department>(); lists.AddRange(db.FindArray<Department>()); return lists; }
public void AutoGenerateMatches() { var matches = new List<Match>(); foreach (var item in GeneratedGroups) { if (item.Teams.Count % 2 != 0) { item.Teams.Add(new Team() { Name = "UnEven"+item.Name, Win = 0, Draw = 0, Loss = 0, Players = new List<Player>() }); } int numMatch = (item.Teams.Count - 1); int halfSize = item.Teams.Count / 2; List<Team> teams = new List<Team>(); teams.AddRange(item.Teams); // Copy all the elements. teams.RemoveAt(0); // To exclude the first team. int teamsSize = teams.Count; for (int match = 0; match < numMatch; match++) { string round = (match + 1).ToString(); int teamIdx = match % teamsSize; matches.Add(new Match() { Round = round, HomeTeam = teams[teamIdx], AwayTeam = item.Teams[0] }); for (int idx = 1; idx < halfSize; idx++) { int firstTeam = (match + idx) % teamsSize; int secondTeam = (match + teamsSize - idx) % teamsSize; matches.Add(new Match() { Round = round, HomeTeam = teams[firstTeam], AwayTeam = teams[secondTeam] }); } } } GeneratedMatches = matches; }
private IList<Page> GetPages(ProjectItem item) { var files = new List<Page>(); if (item.ProjectItems.Count == 0) { if (CheckIsPage(item))//maybe its an empty folder? { GetPageData(item, files); } } else { if (CheckIsPage(item))//aspx page ? { GetPageData(item, files); } else { foreach (ProjectItem currentItem in item.ProjectItems) { files.AddRange(GetPages(currentItem)); } } } return files; }
private void CheckCollisions(bool Extinguisher) { #region Player collisions Sphere heroSphere = new Sphere(Player.Position, Player.Velocity, Player.modelRadius); List<Primitive> primitivesNearby = new List<Primitive>(); LevelQuadTree.RetrieveNearbyObjects(heroSphere, ref primitivesNearby,2); /*foreach (Primitive bx in primitivesNearby) { if (!TotalNearbyBoxes.Contains(bx)) TotalNearbyBoxes.Add(bx); }*/ Contact EndingContact = heroSphere.Collides(EscapeSpot); if (EndingContact != null && (Player.ItemsList.ContainsKey(key1) || Player.ItemsList.ContainsKey(key2))) { GameStates.GameStates.ZombieGameState = GameStates.GameStates.GameState.End; } primitivesNearby.AddRange(fireHazards); foreach (Primitive p in primitivesNearby) { Contact c = heroSphere.Collides(p as Box); if (c != null) { ResolveStaticCollision(c, Player, heroSphere); if(fireDamageDelay <=0) { if(((Box)p).Tag == "Fire1" || ((Box)p).Tag == "Fire2" || ((Box)p).Tag == "Fire3" || ((Box)p).Tag == "Fire4") { Player.TakeDamage(25); fireDamageDelay = 5; } } } } if (Extinguisher) { Sphere ExtSphere = new Sphere(Player.Position + (Player.Velocity / Player.Velocity.Length()) * 20, Vector3.One, 10); for (int i = 0; i < fireHazards.Count;i++) { Sphere boxSphere = new Sphere(fireHazards[i].Position, Vector3.One, fireHazards[i].Size.X / 2); Contact contact = ExtSphere.Collides(boxSphere); if (contact != null) { if (fireHazards[i].Tag == "Fire1") { FireEmitter.particleGroups[0].controller.LifeSpan -= 5; if (FireEmitter.particleGroups[0].controller.LifeSpan <= 0) { FireEmitter.Stop(); fireHazards.Remove(fireHazards[i]); } } if (fireHazards.Count > 0) { if (fireHazards[i].Tag == "Fire2") { FireEmitter2.particleGroups[0].controller.LifeSpan -= 5; if (FireEmitter2.particleGroups[0].controller.LifeSpan <= 0) { FireEmitter2.Stop(); fireHazards.Remove(fireHazards[i]); } } if (fireHazards[i].Tag == "Fire3") { FireEmitter3.particleGroups[0].controller.LifeSpan -= 5; if (FireEmitter3.particleGroups[0].controller.LifeSpan <= 0) { FireEmitter3.Stop(); fireHazards.Remove(fireHazards[i]); } } if (fireHazards[i].Tag == "Fire4") { FireEmitter4.particleGroups[0].controller.LifeSpan -= 5; if (FireEmitter4.particleGroups[0].controller.LifeSpan <= 0) { FireEmitter4.Stop(); fireHazards.Remove(fireHazards[i]); } } } } } } #endregion #region Zombie collisions foreach (Zombie z in zombies) { // Check for zombies in sight radius and zombies who are not wandering if ((z.Position - Player.Position).Length() < SIGHT_RADIUS || z.BehaviouralState != BehaviourState.Wander) { Sphere zombieSphere = new Sphere(z.Position, z.Velocity, z.modelRadius); List<Primitive> primitives = new List<Primitive>(); LevelQuadTree.RetrieveNearbyObjects(zombieSphere, ref primitives); primitives.AddRange(fireHazards); foreach (Primitive p in primitives) { Contact c = zombieSphere.Collides(p as Box); if (c != null) { if (z.BehaviouralState == BehaviourState.Wander) z.Velocity = Vector3.Cross( z.Velocity, Vector3.Up); ResolveStaticCollision(c, z, zombieSphere); } } } } #endregion foreach (Zombie z1 in zombies) { if ((z1.Position - Player.Position).Length() < SIGHT_RADIUS || z1.BehaviouralState != BehaviourState.Wander) { checkZombietoPlayer(z1); foreach (Zombie z2 in zombies) { if (!z2.Equals(z1) && ((z2.Position - Player.Position).Length() < SIGHT_RADIUS || z2.BehaviouralState != BehaviourState.Wander)) { checkZombietoZombie(z1, z2); } } } } checkItemCollisions(); }
public async Task<SearchResult> Search(SearchArea searchArea) { SearchError error = null; List<CoffeeShop> coffeeShops = new List<CoffeeShop>(); int numFound; int offset = 0; do { numFound = 0; SearchOptions query = new SearchOptions { GeneralOptions = new GeneralOptions { category_filter = "coffee", offset = offset, limit = 20, sort = 1, }, LocationOptions = new BoundOptions { sw_latitude = searchArea.SouthwestCorner.latitude, sw_longitude = searchArea.SouthwestCorner.longitude, ne_latitude = searchArea.NortheastCorner.latitude, ne_longitude = searchArea.NortheastCorner.longitude, }, }; Task<SearchResults> searchTask = this._yelp.Search(query); SearchResults results = await searchTask; if (results.error != null) { YelpSharp.Data.SearchError yelpError = results.error; error = new SearchError { Id = ErrorId.YelpError, Description = string.Format("ID: {0}; Description: {1}; Text: {2}; Field: {3}", yelpError.id, yelpError.description, yelpError.text, yelpError.field), }; } else if (results.total >= MaxSearchResults) { error = new SearchError { Id = ErrorId.TooManyResults, Description = string.Format("Maximum number of results exceeded, use a smaller region. Max Results: {0}", MaxSearchResults), }; } else { numFound = results.businesses.Count; IEnumerable<CoffeeShop> newShops = results.businesses .Where(b => b.location.city.IndexOf("seattle", StringComparison.OrdinalIgnoreCase) != -1) .Select(b => new CoffeeShop { Name = b.name, Location = new Coordinates { Latitude = b.location.coordinate.latitude, Longitude = b.location.coordinate.longitude, }, YelpId = b.id, }); coffeeShops.AddRange(newShops); offset += numFound; } } while (error == null && numFound > 0); return new SearchResult { Error = error, Results = coffeeShops, }; }
private void GetirPersonelSorumluListe() { List<Personel> masrafSahipleri = new List<Personel>(); if (GirisYapanPersonel.PersonelTurId != (byte)PersonelTuruEnum.Muhasebe) { masrafSahipleri.Add(GirisYapanPersonel); masrafSahipleri.AddRange(PI.GetirPersonelBySorumluId(GirisYapanPersonel.Id)); } else { masrafSahipleri.AddRange(PI.GetirTumPersonel()); } cmbMasrafSahibi.DataSource = masrafSahipleri; }
void LoadData() { var nhanVien = cbbChonNhanVien.SelectedItem as NhanVien; if (nhanVien == null) return; string maNhanVien = nhanVien.MaNhanVien; string tungay = dteTuNgay.Value.ToString("MM/dd/yyyy"); string denngay = dteDenNgay.Value.ToString("MM/dd/yyyy"); #region lấy dữ liệu hóa đơn bán hàng //Lấy danh sách hàng hóa được bán trong khoảng thời gian này, bởi nhân viên này const string sql = "select HDBanHang.MaHDBanHang, HDBanHang.NgayBan, HDBanHang.MaKho, HDBanHang.MaNhanVien, " + "ChiTietHDBanHang.MaHangHoa, ChiTietHDBanHang.TenHangHoa, ChiTietHDBanHang.SoLuong, ChiTietHDBanHang.DonGia, ChiTietHDBanHang.Thue, ChiTietHDBanHang.PhanTramChietKhau " + "from HDBanHang INNER JOIN ChiTietHDBanHang on HDBanHang.MaHDBanHang = ChiTietHDBanHang.MaHDBanHang " + "where HDBanHang.MaNhanVien = '{0}' and HDBanHang.NgayBan between Convert(Datetime,'{1}',101) and Convert(Datetime,'{2}',101) and HDBanHang.Deleted = 0"; string input = string.Format(sql, maNhanVien, tungay, denngay); object output; bool kq = Utils.GetDataFromServer("RunSql", input, out output); if (!kq) return; List<BcThongKeMatHangBanRaTheoNhanVien> bcThongKeMatHangBanRaTheoNhanViens = Utils.ConvertToList<BcThongKeMatHangBanRaTheoNhanVien>((DataTable)output); #endregion #region lấy dữ liệu khách hàng trả lại //lấy danh sách hàng hóa được trả lại trong khoảng thời gian này const string sqlKhtl = "select KhachHangTraLai.MaKhachHangTraLai, KhachHangTraLai.MaHoaDonMuaHang, KhachHangTraLai.NgayNhap, KhachHangTraLai.MaKho, " + "ChiTietKhachHangTraLai.MaHangHoa, ChiTietKhachHangTraLai.TenHangHoa, ChiTietKhachHangTraLai.SoLuong, ChiTietKhachHangTraLai.DonGia, ChiTietKhachHangTraLai.Thue, ChiTietKhachHangTraLai.PhanTramChietKhau " + "from KhachHangTraLai INNER JOIN ChiTietKhachHangTraLai on KhachHangTraLai.MaKhachHangTraLai = ChiTietKhachHangTraLai.MaKhachHangTraLai " + "where KhachHangTraLai.NgayNhap between Convert(Datetime,'{0}',101) and Convert(Datetime,'{1}',101) and KhachHangTraLai.Deleted = 0"; string inputKhtl = string.Format(sqlKhtl, tungay, denngay); object outputKhtl; bool kqKhtl = Utils.GetDataFromServer("RunSql", inputKhtl, out outputKhtl); if (!kqKhtl) return; List<BcThongKeMatHangBanRaTheoNhanVienKhtl> bcThongKeMatHangBanRaTheoNhanVienKhtls = Utils.ConvertToList<BcThongKeMatHangBanRaTheoNhanVienKhtl>((DataTable)outputKhtl); #endregion //danh sách hóa đơn cần xét liệu có hàng trả lại hay không? List<string> dshoadon = bcThongKeMatHangBanRaTheoNhanViens.Select(k => k.MaHDBanHang).Distinct().ToList(); //lọc các hàng hóa trả lại sao cho thuộc tập hóa đơn trên List<BcThongKeMatHangBanRaTheoNhanVienKhtl> bcThongKeMatHangBanRaTheoNhanVienKhtlsStand = bcThongKeMatHangBanRaTheoNhanVienKhtls.Where(k => dshoadon.Contains(k.MaHoaDonMuaHang)).ToList(); //convert dữ liệu sang List<BcThongKeMatHangBanRaTheoNhanVien> với giá trị âm của số lượng và giá trị List<BcThongKeMatHangBanRaTheoNhanVien> bcThongKeMatHangBanRaTheoNhanViensStand = bcThongKeMatHangBanRaTheoNhanVienKhtlsStand.Select(k => new BcThongKeMatHangBanRaTheoNhanVien { MaHDBanHang = k.MaHoaDonMuaHang, NgayBan = k.NgayNhap, MaKho = k.MaKho, MaNhanVien = string.Empty, TenNhanVien = string.Empty, MaHangHoa = k.MaHangHoa, TenHangHoa = k.TenHangHoa, SoLuong = -k.SoLuong, DonGia = k.DonGia }).ToList(); //gộp 2 list _bcThongKeMatHangBanRaTheoNhanViens.Clear(); _bcThongKeMatHangBanRaTheoNhanViens.AddRange(bcThongKeMatHangBanRaTheoNhanViens); _bcThongKeMatHangBanRaTheoNhanViens.AddRange(bcThongKeMatHangBanRaTheoNhanViensStand); _bcThongKeMatHangBanRaTheoNhanViensGroup = (from k in _bcThongKeMatHangBanRaTheoNhanViens group k by k.MaHangHoa into kk select new BcThongKeMatHangBanRaTheoNhanVien { MaHangHoa = kk.Key, TenHangHoa = kk.FirstOrDefault().TenHangHoa, SoLuong = kk.Sum(kkk => kkk.SoLuong), DonGia = kk.Sum(kkk => kkk.SoLuong * kkk.DonGia * 0.01 * (100 + kkk.Thue)) }).ToList(); List<BcThongKeMatHangBanRaTheoNhanVien> hienthi = new List<BcThongKeMatHangBanRaTheoNhanVien>(); if (_bcThongKeMatHangBanRaTheoNhanViensGroup.Count > 0) { //hiển thị tiền foreach (var item in _bcThongKeMatHangBanRaTheoNhanViensGroup) { item.SoLuongView = item.SoLuong.ToString(); item.DonGiaView = new Common.Utilities().FormatMoney(item.DonGia); } hienthi.AddRange(_bcThongKeMatHangBanRaTheoNhanViensGroup); //thêm dòng tổng hienthi.Add(new BcThongKeMatHangBanRaTheoNhanVien { TenHangHoa = "Tổng cộng:", SoLuongView = _bcThongKeMatHangBanRaTheoNhanViensGroup.Sum(k => k.SoLuong).ToString(), DonGiaView = new Common.Utilities().FormatMoney(_bcThongKeMatHangBanRaTheoNhanViensGroup.Sum(k => k.DonGia)) }); } uGrid.DataSource = hienthi; }
/// <summary> /// For when yous need to save some values that can't be directly bound to UI elements. /// Not called when moving previous (see WizardViewModel.MoveToNextStep). /// </summary> /// <returns> /// An object that may modify the route /// </returns> public override RouteModifier OnNext() { List<Plugin> samplePlugins = new List<Plugin>(); IEnumerable<Plugin> plugins = this.GetRequiredNugetPackages(); foreach (Plugin plugin in plugins.Where(plugin => plugin.NinjaSamples.Any())) { samplePlugins.AddRange(plugin.NinjaSamples); } this.cachingService.ApplicationSamplePlugIns.ToList().AddRange(samplePlugins); return this.GetRouteModifier(); }