Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
 private void IDchangedEvent(object sender, StringChangedEventArgs e)
 {
     if (IDs.Contains(e.ApplyString))
     {
     }
     else
     {
     }
 }
Exemplo n.º 3
0
 /// <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);
 }
Exemplo n.º 4
0
        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));
        }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        /// <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);
        }
Exemplo n.º 7
0
        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));
        }
Exemplo n.º 8
0
 Ability[] GetAbilities(params int[] IDs)
 {
     return(craft.GetAbilities().Where((x) => { return (x != null) && IDs.Contains(x.GetID()); }).ToArray());
 }
Exemplo n.º 9
0
 public static List <Ingredient> Get(params int[] IDs)
 {
     return(PizzatoriumDB.PizzaData.Ingredients.Where(i => IDs.Contains(i.ID)).ToList());
 }