public void Pick() { if (!Id.HasValue || HasPicked()) { return; } var candidates = DataRepository.GetAll <Account>() .Where(a => a.Id != Id && a.HasBeenPicked() == false && !DoNotPick.Contains(a.Id.Value) && !a.DoNotPick.Contains(Id.Value) ); // Special-case it when only 2 options are left, and choosing // one of these options means that there'd be dangling candidate // that nobody chose. // // Example 1: // Item Receive Give // x no no // y no yes // In this case, choosing 'y' will leave 'x' dangling. // // Example 2: // Item Receive Give // x no yes // y no yes // In this case there's no possibility of a dangling candidate. // // Example 3: // Item Receive Give // x no no // y no no // In this case there's no possibility of a dangling candidate. if (candidates.Count() == 2 && !candidates.All(a => a.HasPicked())) { candidates = candidates.Where(a => !a.HasPicked()); } if (candidates.Count() > 1) { // if there's more than one potential candidate, // make sure not to pick the same person as the previous year candidates = candidates.Where(a => !Picked.Any(y => y.Key == (DateHelper.Year - 1) && y.Value == a.Id) ); } int rand = new Random().Next(0, candidates.Count()); if (!Picked.ContainsKey(DateHelper.Year)) { Picked.Add(DateHelper.Year, null); } Picked[DateHelper.Year] = candidates.ElementAt(rand).Id; DataRepository.Save(this); }
/// <summary> /// 确认 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Confirm_Clicked(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtInput.Text)) { Picked?.Invoke(this, txtInput.Text); } }
// GET: Postings/Details/5 public ActionResult Details(int?id, int userID) { if (id == null) { logger.Info("Details/ Bad HTTP Request with ID {0}", id); return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } string userName = db.Applicants.Where(a => a.ID == userID).Select(a => a.apFirstName).SingleOrDefault(); int n_y = db.JobGroups.Max(jg => jg.ID); Posting posting = db.Postings.Find(id); int jobTypeID = posting.Position.JobGroupID; Picked pickedToEdit = db.Pickeds.Where(p => p.PickedID == userID).SingleOrDefault(); if (pickedToEdit != null) { pickedToEdit.jobTypePrevPicked2 = pickedToEdit.jobTypePrevPicked1; pickedToEdit.jobTypePrevPicked1 = pickedToEdit.jobTypeJustPicked; pickedToEdit.jobTypeJustPicked = jobTypeID; pickedToEdit.firstTimeAccess = false; recommenderSystem.FavoriteJobType_train(userID, pickedToEdit.jobTypePrevPicked1, pickedToEdit.jobTypePrevPicked2, pickedToEdit.jobTypeJustPicked, n_y, userName); db.SaveChanges(); } if (posting == null) { logger.Info("Details/ Failed to find Posting with ID {0}", id); return(HttpNotFound()); } ViewBag.JobRequirements = db.JobRequirements.Where(j => j.PostingID == id); ViewBag.JobLocations = db.JobLocations.Where(jl => jl.PostingID == id); ViewBag.PostingSkills = db.PostingSkills.Where(ps => ps.PostingID == id); return(View(posting)); }
private void Pick() { Picked?.Invoke(this); GetComponent <MeshRenderer>().enabled = false; GetComponent <Collider>().enabled = false; }
private void OnTriggerEnter(Collider other) { if (_state == ProductionState.READY && other.TryGetComponent(out PlayerCollector _collector)) { Picked.Invoke(); StartCoroutine(CollectAction()); } }
public Account GetPicked() { if (Picked != null && Picked.ContainsKey(DateHelper.Year)) { return(DataRepository.Get <Account>(Picked[DateHelper.Year])); } return(null); }
private void Cancel() { Picked.Invoke(this, new PickedEventArgs() { pickedLibrary = null }); Close(); }
public IEnumerable <SelectListItem> GetPickOptions() { return(DataRepository.GetAll <Account>() .Where(a => !a.Id.Equals(AccountId) && !DoNotPick.Contains(a.Id.Value)) .Select(a => new SelectListItem { Text = a.DisplayName, Value = a.Id.ToString(), Selected = Picked.Equals(a.Id) })); }
private void ObjWebLibraryListControl_OnWebLibrarySelected(WebLibraryDetail web_library_detail) { Logging.Info("User clicked on a library entry in Library picker: {0}", web_library_detail); Picked.Invoke(this, new PickedEventArgs() { pickedLibrary = web_library_detail }); Close(); }
void Mouse_OnLeftButtonDown(int x, int y) { // Get the instance of the entity and display it's information on the UI. var entity = Mouse.HitBaseEntity; if (entity != null) { Log.Info <EntityPicker>(GetEntityInfo(entity)); Picked?.Invoke(entity); } }
private static IntPtr HookProc(int nCode, NativeMethods.Message wParam, ref NativeMethods.MSLLHOOKSTRUCT lParam) { if (nCode >= 0 && wParam != NativeMethods.Message.WM_MOUSEMOVE) { Stop(); if (wParam == NativeMethods.Message.WM_LBUTTONDOWN) { Picked?.Invoke(PickWindowTitle(lParam.pt)); return((IntPtr)1); } } return(NativeMethods.CallNextHookEx(_hHook, nCode, wParam, ref lParam)); }
private void OnCollision(object sender, string tag) { switch (tag) { case "Player": Picked?.Invoke(this, EventArgs.Empty); break; case "Finish": Over?.Invoke(this, EventArgs.Empty); break; } }
public PopProgressBarView(string message) { try { InitializeComponent(); BindingContext = new { Message = message, Icon = "check-circle" }; Task.Run(async() => { try { var _globalService = App.Resolve <IGlobalService>(); _globalService?.GetAPPFeatures(); for (int i = 1; i <= 50; i++) { await Task.Delay(10); Device.BeginInvokeOnMainThread(() => { var value = Convert.ToDouble(i / 10); defaultProgressBar.Progress = value; }); } Picked?.Invoke(this, true); } catch (Exception ex) { Crashes.TrackError(ex); } }); defaultProgressBar.Progress = 0; } catch (Exception ex) { Crashes.TrackError(ex); } }
public IActionResult OnPost() { Picked = Picked.Trim(); if (Picked == "CT") { TreeDataToJson(viewModel.TreeOfCuttingTools); DataToTable(dataTable.wiertlatabs); } if (Picked == "EQ") { TreeDataToJson(viewModel.TreeOfEquipments); DataToTable(dataTable.opsklos); } if (Picked == "MT") { TreeDataToJson(viewModel.TreeOfMachineTools); DataToTable(dataTable.lathes); } Resources = resources.GetAllResources(); return(Page()); }
public virtual int _GetUniqueIdentifier() { var hashCode = 399326290; hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (TransactionDateOccured?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (Status?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (Shipped.GetHashCode()); hashCode = hashCode * -1521134295 + (Invoiced.GetHashCode()); hashCode = hashCode * -1521134295 + (ShippedDateOccured?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (InvoicedDateOccured?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (Cancelled.GetHashCode()); hashCode = hashCode * -1521134295 + (InTransit.GetHashCode()); hashCode = hashCode * -1521134295 + (Picked.GetHashCode()); hashCode = hashCode * -1521134295 + (PaymentStatus.GetHashCode()); hashCode = hashCode * -1521134295 + (InitialOrderDate?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (FinalOrderDate?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (Delivered.GetHashCode()); hashCode = hashCode * -1521134295 + (Ordered.GetHashCode()); return(hashCode); }
///// <summary> ///// 焦点输入 ///// </summary> //public void FocusEntry() //{ // txtInput.Focus(); //} /// <summary> /// 确认 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Confirm_Clicked(object sender, EventArgs e) { Picked?.Invoke(this, new Tuple <DateTime, DateTime>(startDateTimeInput.Date, endDateTimeInput.Date)); }
private void Confirm_Clicked(object sender, EventArgs e) { Picked?.Invoke(this, txtInput.Text); }
private void Cancel_Clicked(object sender, EventArgs e) { Picked?.Invoke(this, null); }
private void Pick_Clicked(object sender, EventArgs e) { Picked?.Invoke(this, false); }
private void Take_Clicked(object sender, EventArgs e) { Picked?.Invoke(this, true); }
private void Options_Clicked(object sender, EventArgs e) { Picked?.Invoke(this, 0); }
private void Logout_Clicked(object sender, EventArgs e) { Picked?.Invoke(this, 1); }
public void Invoke() { Picked?.Invoke(this, true); }
public void Confirm_Clicked(object sender, EventArgs e) { Picked?.Invoke(this, CurrentColor); }