protected void CheckCheckboxes() { foreach (ListViewDataItem lvi in lvAllTickets.Items) { // Get each checkbox Listview Item on DataBound var chkSelect = (CheckBox)lvi.FindControl("cbSelect"); // Make sure we're referencing the correct control if ((((chkSelect) != null))) { // If the ID exists in our list then check the checkbox int ID = Convert.ToInt32(lvAllTickets.DataKeys[lvi.DisplayIndex].Value); chkSelect.Checked = this.IDs.Contains(ID); } } var chkSelectAll = (CheckBox)lvAllTickets.FindControl("chkboxSelectAll"); if (chkSelectAll != null) { chkSelectAll.Checked = IDs.Contains(0); lblPage.Visible = true; } else { lblPage.Visible = false; } }
private void IDchangedEvent(object sender, StringChangedEventArgs e) { if (IDs.Contains(e.ApplyString)) { } else { } }
/// <summary> Adds a new ID with all keyframes with a given type. </summary> /// <param name="id"> the ID to add </param> /// <param name="type"> the type to set each keyframe to </param> /// <returns> whether the element was added or not </returns> public bool AddID(int id, Hitbox.Type type) { if (IDs.Contains(id)) { return(false); } IDs.Add(id); foreach (HitboxKeyframe hitboxKeyframe in Keyframes) { hitboxKeyframe.States.Add(type); } return(true); }
public JsonResult Through_Categories_and_Area_and_Ratings(string[] even, string cate, string[] eve1, string eve2) { List <FeedBack> all_std = new List <FeedBack>(); List <Restaurant> all_st = new List <Restaurant>(); JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); Event_MangementEntities3 dc = new Event_MangementEntities3(); string result; result = javaScriptSerializer.Serialize(all_st); List <Event> events = new List <Event>(); var event1 = db.Events.Where(x => x.Event_Type == cate).Select(x => x.Restaurant_Id).ToList(); int f = event1.Count(); List <int> IDs; List <Restaurant> all_std4 = new List <Restaurant>(); if (eve1 != null) { int[] intArr = Array.ConvertAll <string, int>(even, new Converter <string, int>(Convert.ToInt32)); IDs = intArr.ToList(); int len = even.Length; var all_std1 = from item in dc.FeedBacks where IDs.Contains(item.Ratings) select item.Restaurant_Id; var all_std3 = from item in dc.Events where eve1.Contains(item.Event_Type) select item.Restaurant_Id; var allop = from item in dc.Restaurants where all_std1.Contains(item.Restaurant_Id) select item; var allop1 = from item in allop where all_std3.Contains(item.Restaurant_Id) select item.Restaurant_Id; var re = db.Restaurants.Where(x => x.Area == eve2).ToList(); var allop2 = from item in re where allop1.Contains(item.Restaurant_Id) select item; result = javaScriptSerializer.Serialize(allop2); } else { var ev = db.Events.Where(x => x.Event_Type == cate).Select(x => x.Restaurant_Id).ToList(); var all_std2 = from item in dc.Restaurants where ev.Contains(item.Restaurant_Id) select item; result = javaScriptSerializer.Serialize(all_std2); } return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult Get_Restaurant_for_Home(string[] eve1) { // int len = eve1.Length; List <int> IDs; int[] intArr = Array.ConvertAll <string, int>(eve1, new Converter <string, int>(Convert.ToInt32)); IDs = intArr.ToList(); List <Restaurant> all_std = new List <Restaurant>(); JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); Event_MangementEntities3 dc = new Event_MangementEntities3(); // for (int i = 0; i < len; i++) // int e = Convert.ToInt32(eve1); var all = from item in dc.Restaurants where IDs.Contains(item.Restaurant_Id) select item; string result1 = javaScriptSerializer.Serialize(all); return(Json(result1, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Randomly creates ID without a chance of a duplicate. /// </summary> /// <returns></returns> private int CreateId() { var rnd = new Random(); int rndNumber = -1; do { int num = rnd.Next(); //If IDs contains the randomly generated number (if a duplication would occur). if (!IDs.Contains(num)) { rndNumber = rnd.Next(); } //rndNumber cannot be -1 as integers returned from rnd.Next() is always a natural number. } while (rndNumber == -1); //Add the generated number to the list of used IDs IDs.Add(rndNumber); return(rndNumber); }
internal void UpdateEstimatedProfit(Dictionary <AlgorithmType, double> profits) { _updateEstimatedProfitCalled = true; if (profits == null) { return; } var containedIDs = profits.Keys.Where(key => IDs.Contains(key)).ToArray(); EstimatedProfitAllSMAPresent = IDs.Length == containedIDs.Length; EstimatedProfitAllSMAPositiveOrZero = EstimatedProfitAllSMAPresent && IDs.All(id => profits[id] >= 0); // clear old values _lastEstimatedProfitSMA.Clear(); foreach (var id in containedIDs) { _lastEstimatedProfitSMA[id] = profits[id]; } // notify changed OnPropertyChanged(nameof(CurrentEstimatedProfit)); OnPropertyChanged(nameof(CurrentEstimatedProfitStr)); OnPropertyChanged(nameof(Status)); }
Ability[] GetAbilities(params int[] IDs) { return(craft.GetAbilities().Where((x) => { return (x != null) && IDs.Contains(x.GetID()); }).ToArray()); }
public static List <Ingredient> Get(params int[] IDs) { return(PizzatoriumDB.PizzaData.Ingredients.Where(i => IDs.Contains(i.ID)).ToList()); }