Exemplo n.º 1
0
        public static void Run()
        {
            int sum1 = 0;
            int sum2 = 0;

            System.Collections.Generic.List <int> listInt = new System.Collections.Generic.List <int>();

            for (int i = 0; i < 10000000; i++)
            {
                listInt.Add(i);
            }

            Stopwatch sw1 = new Stopwatch();
            Stopwatch sw2 = new Stopwatch();

            sw1.Start();
            foreach (var i in listInt)
            {
                sum1 += i;
            }
            sw1.Stop();

            sw2.Start();
            listInt.ForEach(i => sum2 += i);
            sw2.Stop();

            Console.WriteLine(sum1);
            Console.WriteLine(sw1.ElapsedMilliseconds);
            Console.WriteLine(sum2);
            Console.WriteLine(sw2.ElapsedMilliseconds);
        }
Exemplo n.º 2
0
        public static System.Collections.Generic.List <SurveyNote> GetExcursionNotes(int excursionId)
        {
            DataSet ds = DatabaseOperationProvider.QueryProcedure("up_guest_getExcursionSurveyNotes", "note,items", new
            {
                excursion = excursionId
            });

            System.Collections.Generic.List <SurveyNote> result = (
                from DataRow row in ds.Tables["note"].Rows
                select SurveyProvider.factory.SurveyNote(row)).ToList <SurveyNote>();
            System.Collections.Generic.Dictionary <int, SurveyNote> notesDictionary = new System.Collections.Generic.Dictionary <int, SurveyNote>();
            result.ForEach(delegate(SurveyNote m)
            {
                notesDictionary.Add(m.Invitation, m);
            });
            SurveyNote cache = null;

            foreach (DataRow noteRow in ds.Tables["items"].Rows.Cast <DataRow>())
            {
                int invitation = noteRow.ReadInt("invitation");
                if (cache == null || cache.Invitation != invitation)
                {
                    cache = notesDictionary[invitation];
                }
                cache.Notes.Add(new SurveyNoteItem
                {
                    Category = noteRow.ReadNullableTrimmedString("id"),
                    Note     = noteRow.ReadNullableTrimmedString("note")
                });
            }
            return(result);
        }
Exemplo n.º 3
0
 private static IRecord CreateRecord(object item, System.Collections.Generic.IList <string> aliases)
 {
     System.Collections.ICollection collection = item as System.Collections.ICollection;
     if (collection != null)
     {
         System.Collections.Generic.List <object> list = collection.Cast <object>().ToList <object>();
         if (aliases != null && aliases.Count != list.Count)
         {
             aliases = null;
         }
         if (list.Count != 1)
         {
             int counter             = 0;
             DictionaryRecord record = new DictionaryRecord();
             list.ForEach(delegate(object obj)
             {
                 record.SetValue((aliases != null) ? aliases[counter++] : ("Value" + ++counter), obj);
             });
             return(record);
         }
         if (aliases != null)
         {
             aliases[0] = Pluralizer.ToSingular(aliases[0]);
         }
         item = list[0];
     }
     if (aliases == null || aliases.Count != 1)
     {
         return(RecordBase.CreateRecord(item));
     }
     return(RecordBase.CreateRecord(item, aliases[0]));
 }
Exemplo n.º 4
0
    public void pushBackground(int layer)
    {
        List <UIBackgroundController> layers = new List <UIBackgroundController>();

        backgroundControllers.ForEach((bg) =>
        {
            if (bg.Layer == layer)
            {
                layers.Add(bg);
            }
        });

        foreach (var bg in layers)
        {
            pushBackground(bg);
        }
    }
Exemplo n.º 5
0
        public async Task InsertTableEntitiesBatchAsync(System.Collections.Generic.List <T> tableEntities)
        {
            // Create the batch operation.
            TableBatchOperation batchOperation = new TableBatchOperation();

            tableEntities.ForEach(t => batchOperation.Insert(t));
            await cloudTable.ExecuteBatchAsync(batchOperation);
        }
 public virtual IEnumerable <DetentionForOffence> ModifyDetention(IEnumerable <IOffence> offences, IDEntityList <StandardDetentionForOffence, IStandardDetentionForOffence> standardDetentions)
 {
     System.Collections.Generic.List <DetentionForOffence> detentionList = new System.Collections.Generic.List <DetentionForOffence>(base.GetDetention(offences, standardDetentions));
     if (detentionList != null && detentionList.Count > 0)
     {
         detentionList.ForEach(detention => detention.DetentionInHours = detention.DetentionInHours * (1 + (this.PercentageValue / 100.0)));
     }
     return(detentionList);
 }
Exemplo n.º 7
0
    private string GetContractLimitsByContractTypeAndPrj(string contractTypeID, string prjId)
    {
        System.Collections.Generic.List <string> UserCodes = new System.Collections.Generic.List <string>();
        System.Collections.Generic.List <string> ztbUsers  = (System.Collections.Generic.List <string>) new PTPrjInfoZTBUserService().GetUser(prjId);
        System.Collections.Generic.List <string> userCodesByIDThroughPrjProperty = new PTPrjInfoZTBDetailService().getUserCodesByIDThroughPrjProperty(prjId);
        System.Collections.Generic.List <string> userCode2 = new PrivBusiDataRoleService().GetUserCode(prjId);
        ConContractType byID = new ConContractTypeService().GetByID(contractTypeID);

        System.Collections.Generic.List <string> ContractTypeUsers = JsonHelper.GetListFromJson(byID.UserCodes);
        userCodesByIDThroughPrjProperty.ForEach(delegate(string userCode)
        {
            if (!ztbUsers.Contains(userCode))
            {
                ztbUsers.Add(userCode);
            }
        });
        userCode2.ForEach(delegate(string userCode)
        {
            if (!ztbUsers.Contains(userCode))
            {
                ztbUsers.Add(userCode);
            }
        });
        if (ztbUsers.Count >= ContractTypeUsers.Count)
        {
            ContractTypeUsers.ForEach(delegate(string userCode)
            {
                if (ztbUsers.Contains(userCode))
                {
                    UserCodes.Add(userCode);
                }
            });
        }
        else
        {
            ztbUsers.ForEach(delegate(string userCode)
            {
                if (ContractTypeUsers.Contains(userCode))
                {
                    UserCodes.Add(userCode);
                }
            });
        }
        if (!UserCodes.Contains("00000000"))
        {
            UserCodes.Add("00000000");
        }
        if (!UserCodes.Contains(base.UserCode))
        {
            UserCodes.Add(base.UserCode);
        }
        return(JsonHelper.Serialize(UserCodes.ToArray()));
    }
Exemplo n.º 8
0
        private static List <DummyCommand> Create_DummyCommands()
        {
            DummyCommand.DoReset_ExecutedIndex();

            System.Collections.Generic.List <DummyCommand> listCommand = new System.Collections.Generic.List <DummyCommand>();
            for (int i = 0; i < 10; i++)
            {
                listCommand.Add(new DummyCommand(i));
            }

            listCommand.ForEach(p => Assert.AreEqual(p.iExecutedIndex, 0));
            return(listCommand);
        }
Exemplo n.º 9
0
 static public int ForEach(IntPtr l)
 {
     try {
         System.Collections.Generic.List <WWWRequest> self = (System.Collections.Generic.List <WWWRequest>)checkSelf(l);
         System.Action <WWWRequest> a1;
         checkDelegate(l, 2, out a1);
         self.ForEach(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemplo n.º 10
0
    private string GetContractLimits(string ContractTypeId)
    {
        System.Collections.Generic.List <string> userCodes = new System.Collections.Generic.List <string>();
        userCodes.Add(base.UserCode);
        if (base.UserCode != "00000000")
        {
            userCodes.Add("00000000");
        }
        ContractType      contractType = new ContractType();
        ContractTypeModel model        = contractType.GetModel(ContractTypeId);

        if (model != null)
        {
            System.Collections.Generic.List <string> listFromJson = JsonHelper.GetListFromJson(model.UserCodes);
            listFromJson.ForEach(delegate(string userCode)
            {
                if (!userCodes.Contains(userCode))
                {
                    userCodes.Add(userCode);
                }
            });
        }
        string text = this.hdnProjectCode.Value.Trim();

        System.Collections.Generic.List <string> list = (System.Collections.Generic.List <string>) new PTPrjInfoZTBUserService().GetUser(text);
        list.ForEach(delegate(string userCode)
        {
            if (!userCodes.Contains(userCode))
            {
                userCodes.Add(userCode);
            }
        });
        System.Collections.Generic.List <string> userCodesByIDThroughPrjProperty = new PTPrjInfoZTBDetailService().getUserCodesByIDThroughPrjProperty(text);
        System.Collections.Generic.List <string> userCode2 = new PrivBusiDataRoleService().GetUserCode(text);
        userCodesByIDThroughPrjProperty.ForEach(delegate(string userCode)
        {
            if (!userCodes.Contains(userCode))
            {
                userCodes.Add(userCode);
            }
        });
        userCode2.ForEach(delegate(string userCode)
        {
            if (!userCodes.Contains(userCode))
            {
                userCodes.Add(userCode);
            }
        });
        return(JsonHelper.Serialize(userCodes.ToArray()));
    }
        /// <summary>
        /// Get a list of items whose metadata must be persisted to the data store, either because it has been added or because
        /// it has been modified. All IGalleryObjectMetadataItem whose HasChanges property are true are returned. This is called during a
        /// save operation to indicate which metadata items must be saved. Guaranteed to not return null. If no items
        /// are found, an empty collection is returned.
        /// </summary>
        /// <returns>
        /// Returns a list of items whose metadata must be updated with the metadata currently in the media object's file.
        /// </returns>
        public IGalleryObjectMetadataItemCollection GetItemsToSave()
        {
            // We know galleryObjectMetadataItems is actually a List<IGalleryObjectMetadataItem> because we passed it to the constructor.
            System.Collections.Generic.List <IGalleryObjectMetadataItem> galleryObjectMetadataItems = (System.Collections.Generic.List <IGalleryObjectMetadataItem>)Items;
            IGalleryObjectMetadataItemCollection metadataItemsCollection = new GalleryObjectMetadataItemCollection();

            galleryObjectMetadataItems.ForEach(delegate(IGalleryObjectMetadataItem metaItem)
            {
                if (metaItem.HasChanges)
                {
                    metadataItemsCollection.Add(metaItem);
                }
            });

            return(metadataItemsCollection);
        }
Exemplo n.º 12
0
        private void RemoveEventBookedProductAndCharges(EventBookedProductModel product)
        {
            _eventsDataUnit.EventChargesRepository.Delete(product.EventCharge.EventCharge);
            _eventsDataUnit.EventBookedProductsRepository.Delete(product.EventBookedProduct);
            var eventCharges = new System.Collections.Generic.List <EventChargeModel>();

            _event.EventCharges.ForEach(eventCharge =>
            {
                if (eventCharge.EventCharge.ID == product.EventCharge.EventCharge.ID)
                {
                    eventCharges.Add(eventCharge);
                }
            });
            eventCharges.ForEach(echarge => _event.EventCharges.Remove(echarge));

            _event.EventBookedProducts.Remove(product);
        }
Exemplo n.º 13
0
        static StackObject *ForEach_3(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Action <global::UISprite> @action = (System.Action <global::UISprite>) typeof(System.Action <global::UISprite>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Collections.Generic.List <global::UISprite> instance_of_this_method = (System.Collections.Generic.List <global::UISprite>) typeof(System.Collections.Generic.List <global::UISprite>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.ForEach(@action);

            return(__ret);
        }
Exemplo n.º 14
0
        protected virtual void InitPanelNode()
        {
            if (preComponentList == null)
            {
                preComponentList = new ReorderableList(components, typeof(ComponentItem));
                preComponentList.drawHeaderCallback = DrawComponetHeader;
                //preComponentList.elementHeight = itemDrawer.singleLineHeight;
                preComponentList.showDefaultBackground  = true;
                preComponentList.elementHeightCallback += (index) =>
                {
                    var prop = components[index];
                    return(itemDrawer.GetItemHeight(prop, BindingAble));
                };
                preComponentList.drawElementCallback += (rect, index, isFocused, isActive) =>
                {
                    itemDrawer.DrawItemOnRect(rect, index, components[index], BindingAble);
                };
                preComponentList.drawElementBackgroundCallback += (rect, index, isFocused, isActive) =>
                {
                    if (components.Count > index && index >= 0)
                    {
                        itemDrawer.DrawBackground(rect, isFocused, components[index], BindingAble);
                    }
                };
            }

            if (components != null)
            {
                components.ForEach((x) =>
                {
                    if (x.target != null)
                    {
                        x.components = GenCodeUtil.SortComponent(x.target);
                    }
                });
            }

            if (panelCompnent)
            {
                GenCodeUtil.AnalysisComponent(panelCompnent, components);
            }
        }
Exemplo n.º 15
0
 public void Random()
 {
     BinaryTree<int> Tree = new BinaryTree<int>();
     System.Collections.Generic.List<int> Values = new System.Collections.Generic.List<int>();
     System.Random Rand = new System.Random();
     for (int x = 0; x < 10; ++x)
     {
         int Value = Rand.Next();
         Values.Add(Value);
         Tree.Add(Value);
     }
     for (int x = 0; x < 10; ++x)
     {
         Assert.Contains(Values[x], Tree);
     }
     Values.Sort();
     StringBuilder Builder = new StringBuilder();
     Values.ForEach((x) => Builder.Append(x.ToString() + " "));
     Assert.Equal(Builder.ToString(), Tree.ToString());
 }
        static void Main(string[] args)
        {
            string text = "Microsoft announced its next generation C# compiler today. It" +
                          "uses advanced parser and special optimizer for the Microsoft CLR.";

            Console.WriteLine(text);

            List <Word> words = new System.Collections.Generic.List <Word>();

            words.Add(new Word()
            {
                SearchWord = "C#", ReplaceWord = "**"
            });
            words.Add(new Word()
            {
                SearchWord = "Microsoft", ReplaceWord = "*********"
            });
            words.ForEach(w => text = text.Replace(w.SearchWord, w.ReplaceWord));

            Console.WriteLine(text);
        }
Exemplo n.º 17
0
    public void TestShuffle()
    {
        System.Collections.Generic.List <int> intList = new System.Collections.Generic.List <int>()
        {
            1, 2, 3, 4, 5, 6, 7, 8, 9
        };
        System.Collections.Generic.List <int> intListOrig = new System.Collections.Generic.List <int>(intList);
        intList.Shuffle();
        Assert.AreNotEqual(intListOrig, intList); // this can (very rarely) return a false negative
        Assert.AreEqual(intListOrig.Count, intList.Count);
        int sum = 0;

        intList.ForEach((t) => sum += t);
        Assert.AreEqual(45, sum);

        string[] strArray = new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
        Assert.AreEqual("123456789", strArray.Join(""));
        strArray.Shuffle();
        Assert.AreNotEqual("123456789", strArray.Join("")); // this can (very rarely) return a false negative, enjoy
        Assert.AreEqual(9, strArray.Length);
    }
Exemplo n.º 18
0
        /// <summary>Canonicalizes the specified Access Control List.</summary>
        /// <param name="acl">The Access Control List.</param>
        public static void Canonicalize(this RawAcl acl)
        {
            if (acl == null)
            {
                throw new ArgumentNullException(nameof(acl));
            }

            // Extract aces to list
            var aces = new System.Collections.Generic.List <GenericAce>(acl.Cast <GenericAce>());

            // Sort aces based on canonical order
            aces.Sort((a, b) => System.Collections.Generic.Comparer <byte> .Default.Compare(GetComparisonValue(a), GetComparisonValue(b)));

            // Add sorted aces back to ACL
            while (acl.Count > 0)
            {
                acl.RemoveAce(0);
            }
            var aceIndex = 0;

            aces.ForEach(ace => acl.InsertAce(aceIndex++, ace));
        }
Exemplo n.º 19
0
        public void Random()
        {
            BinaryTree <int> Tree = new BinaryTree <int>();

            System.Collections.Generic.List <int> Values = new System.Collections.Generic.List <int>();
            System.Random Rand = new System.Random();
            for (int x = 0; x < 10; ++x)
            {
                int Value = Rand.Next();
                Values.Add(Value);
                Tree.Add(Value);
            }
            for (int x = 0; x < 10; ++x)
            {
                Assert.Contains(Values[x], Tree);
            }
            Values.Sort();
            StringBuilder Builder = new StringBuilder();

            Values.ForEach((x) => Builder.Append(x.ToString() + " "));
            Assert.Equal(Builder.ToString(), Tree.ToString());
        }
Exemplo n.º 20
0
        static int _m_ForEach(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            System.Collections.Generic.List <object> __cl_gen_to_be_invoked = (System.Collections.Generic.List <object>)translator.FastGetCSObj(L, 1);


            try {
                {
                    System.Action <object> action = translator.GetDelegate <System.Action <object> >(L, 2);

                    __cl_gen_to_be_invoked.ForEach(action);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Exemplo n.º 21
0
        protected override void Seed(FoodCourtManagement.DAL.FoodCourtContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
            //  to avoid creating duplicate seed data.
            var FoodCategorys = new List <FoodCategory>
            {
                new FoodCategory {
                    categoryId = 100, categoryType = "Vegetarian"
                },
                new FoodCategory {
                    categoryId = 101, categoryType = "Non-Vegetarian"
                }
            };

            FoodCategorys.ForEach(s => context.FoodCategories.Add(s));
            context.SaveChanges();

            var customers = new List <Customer>
            {
                new Customer {
                    customer_ID = 500, first_Name = "Raj", last_Name = "Kumar", cust_ContactNo = "9874563210", cust_MailID = "*****@*****.**", cust_Address = "50 /st Floor,Krishna Niwas,Yusuf Mehrali Rd,Mandvi", Cust_city = "chennai", Cust_password = "******", Cust_gender = "Male"
                },
                new Customer {
                    customer_ID = 501, first_Name = "Alex", last_Name = "Vetri", cust_ContactNo = "9874563211", cust_MailID = "Alexv@[email protected]", cust_Address = "2,Pearly Shellapartments,Junction Of Tank Rd", Cust_city = "chennai", Cust_password = "******", Cust_gender = "Male"
                },
                new Customer {
                    customer_ID = 502, first_Name = "Alford", last_Name = "John", cust_ContactNo = "9874563212", cust_MailID = "Alfordj@[email protected]", cust_Address = "Nimesh Apartment, S.v Patel Road, Borivli(w)", Cust_city = "chennai", Cust_password = "******", Cust_gender = "Male"
                },
                new Customer {
                    customer_ID = 503, first_Name = "Ravi", last_Name = "Raj", cust_ContactNo = "9874563213", cust_MailID = "*****@*****.**", cust_Address = "348  Yogeshwar,  Kazi Syed Street, Mandvi", Cust_city = "chennai", Cust_password = "******", Cust_gender = "Male"
                },
                new Customer {
                    customer_ID = 504, first_Name = "Anderson", last_Name = "James", cust_ContactNo = "9874563214", cust_MailID = "*****@*****.**", cust_Address = "A-60, Midc,additional Ambernath, Ambernath", Cust_city = "chennai", Cust_password = "******", Cust_gender = "Male"
                },
                new Customer {
                    customer_ID = 505, first_Name = "Raja", last_Name = "Krishnan", cust_ContactNo = "9874563215", cust_MailID = "*****@*****.**", cust_Address = "264 , Balchandra Road, Prembaug, Matunga", Cust_city = "chennai", Cust_password = "******", Cust_gender = "Male"
                },
                new Customer {
                    customer_ID = 506, first_Name = "Mukesh", last_Name = "Kumar", cust_ContactNo = "9874563216", cust_MailID = "*****@*****.**", cust_Address = "Gr Flr, Acropolish Bldg, 3rd Cross Road, Lokhandwala Complex,nr 4 Bungalows, Andheri", Cust_city = "chennai", Cust_password = "******", Cust_gender = "Male"
                },
                new Customer {
                    customer_ID = 507, first_Name = "Benjamin", last_Name = "Franklin", cust_ContactNo = "9874563217", cust_MailID = "*****@*****.**", cust_Address = "81 , Tantanpura Street, Chinch Bunder", Cust_city = "chennai", Cust_password = "******", Cust_gender = "Male"
                },
                new Customer {
                    customer_ID = 508, first_Name = "Priya", last_Name = "Kumar", cust_ContactNo = "9874563218", cust_MailID = "*****@*****.**", cust_Address = "190, labour colony, guindy industrial estate", Cust_city = "chennai", Cust_password = "******", Cust_gender = "Female"
                },
                new Customer {
                    customer_ID = 509, first_Name = "Lakshmi", last_Name = "Ram", cust_ContactNo = "9874563219", cust_MailID = "*****@*****.**", cust_Address = "140, GST Road Kumaran nagar, Tambaramm west", Cust_city = "chennai", Cust_password = "******", Cust_gender = "Female"
                },
                new Customer {
                    customer_ID = 510, first_Name = "Jayashree", last_Name = "Jegan", cust_ContactNo = "9874563290", cust_MailID = "*****@*****.**", cust_Address = "30/120, GST Road R.S puram, Royapuram", Cust_city = "chennai", Cust_password = "******", Cust_gender = "Female"
                },
            };

            customers.ForEach(s => context.customers.Add(s));
            context.SaveChanges();

            var foodProducts = new List <FoodProduct>
            {
                new FoodProduct {
                    foodProductID = 300, foodProductName = "Chicken Biryani", foodProductPrice = 200, foodProductImage = "http://*****:*****@sangeetha.com", rest_Contactno = "7896541230", rest_Website = "www.SangeethaRestaurant.com", rest_loaction = "chennai", rest_Address = "Old 110/1 New 138, Habibullah Road, T. Nagar", rest_DeliveryTime = "30 Minutes", restaurantType_id = 100, rest_Rating = 4.0, rest_image = "http://*****:*****@Bishmillah.com", rest_Contactno = "7896841230", rest_Website = "www.RestaurantBishmillah.com", rest_loaction = "chennai", rest_Address = "New 14/11 Kundrathur Main Road, T. Nagar", rest_DeliveryTime = "40 Minutes", restaurantType_id = 101, rest_Rating = 4.5, rest_image = "http://*****:*****@Thalapakatti.com", rest_Contactno = "7896441230", rest_Website = "www.RestaurantThalapakatti.com", rest_loaction = "chennai", rest_Address = "/1, Prakasam Road, Parthasarathi Puram, T Nagar", rest_DeliveryTime = "20 Minutes", restaurantType_id = 101, rest_Rating = 4.0, rest_image = "http://*****:*****@Sukkubai.com", rest_Contactno = "7896540230", rest_Website = "www.RestaurantSukkubai.com", rest_loaction = "chennai", rest_Address = "1/293, Mariamman Koil Street, Mugalivakkam", rest_DeliveryTime = "50 Minutes", restaurantType_id = 101, rest_Rating = 4.5, rest_image = "http://*****:*****@YaMohaideen.com", rest_Contactno = "7896541130", rest_Website = "www.RestaurantYaMohaideen.com", rest_loaction = "chennai", rest_Address = "28, Kundrathur Main Road, Porur", rest_DeliveryTime = "45 Minutes", restaurantType_id = 101, rest_Rating = 4.7, rest_image = "http://*****:*****@Amburbiryani.com", rest_Contactno = "7896591230", rest_Website = "www.RestaurantAmburbiryani.com", rest_loaction = "chennai", rest_Address = "New 2, Old 1, Venu Reddy Street, Guindy", rest_DeliveryTime = "35 Minutes", restaurantType_id = 101, rest_Rating = 5.0, rest_image = "http://*****:*****@AasifBiryaani.com", rest_Contactno = "7836541230", rest_Website = "www.RestaurantSAasif.com", rest_loaction = "chennai", rest_Address = "634, Near Maduvankarai, MKN Road, Guindy", rest_DeliveryTime = "30 Minutes", restaurantType_id = 101, rest_Rating = 5.0, rest_image = "http://*****:*****@KFC.com", rest_Contactno = "7896541730", rest_Website = "www.RestaurantKFC.com", rest_loaction = "chennai", rest_Address = "65, Anna Salai, Guindy", rest_DeliveryTime = "60 Minutes", restaurantType_id = 101, rest_Rating = 3.5, rest_image = "http://*****:*****@McDonalds.com", rest_Contactno = "7866541230", rest_Website = "www.RestaurantMcDonalds.com", rest_loaction = "chennai", rest_Address = "4/223, Thiruvalluvar Salai, Ramapuram", rest_DeliveryTime = "35 Minutes", restaurantType_id = 101, rest_Rating = 3.0, rest_image = "http://*****:*****@PizzaHut.com", rest_Contactno = "7896741230", rest_Website = "www.RestaurantSPizzaHut.com", rest_loaction = "chennai", rest_Address = "DLF IT Park, Mount Poonamallee Road, Manapakkam", rest_DeliveryTime = "25 Minutes", restaurantType_id = 101, rest_Rating = 4.0, rest_image = "http://localhost:4200/assets/images/Pizzahut.jpg"
                }
            };

            restaurants.ForEach(s => context.Restaurants.Add(s));
            context.SaveChanges();



            var foodOrders = new List <FoodOrder>()
            {
                new FoodOrder {
                    Order_ID = 800, RestaurantID = 1, orderCustomerId = 500, OrderPrice = 420, paymentMode = "Online"
                },
                new FoodOrder {
                    Order_ID = 801, RestaurantID = 2, orderCustomerId = 502, OrderPrice = 470, paymentMode = "Online"
                },
                new FoodOrder {
                    Order_ID = 802, RestaurantID = 3, orderCustomerId = 501, OrderPrice = 305, paymentMode = "Cash"
                }
            };

            foodOrders.ForEach(s => context.FoodOrders.Add(s));
            context.SaveChanges();


            var orderedProduct = new List <OrderProduct>()
            {
                new OrderProduct {
                    orderProductKey = 1000, OrderId = 800, fProductid = 302, productQuantity = 2, productPrice = 300
                },
                new OrderProduct {
                    orderProductKey = 1001, OrderId = 800, fProductid = 306, productQuantity = 1, productPrice = 120
                },
                new OrderProduct {
                    orderProductKey = 1002, OrderId = 801, fProductid = 307, productQuantity = 1, productPrice = 180
                },
                new OrderProduct {
                    orderProductKey = 1003, OrderId = 801, fProductid = 308, productQuantity = 1, productPrice = 290
                },
                new OrderProduct {
                    orderProductKey = 1004, OrderId = 802, fProductid = 309, productQuantity = 1, productPrice = 285
                },
                new OrderProduct {
                    orderProductKey = 1005, OrderId = 802, fProductid = 310, productQuantity = 1, productPrice = 20
                }
            };

            orderedProduct.ForEach(s => context.OrderProducts.Add(s));
            context.SaveChanges();
        }
Exemplo n.º 22
0
	public void createMinionAndTowerButtons()
	{
        var children = new System.Collections.Generic.List<GameObject>();
		foreach (Transform child in createMinionTowerContainer.transform) 
            children.Add(child.gameObject);
        children.ForEach(child => GameObject.Destroy(child));

		int btnIndex = 0;
		button_CreateTower.SetActive(true);
		button_CreateMinion.SetActive(true);

        // sort minions order by cost
        List<Type> minionsSortedByCost = new List<Type>();
        for (int j = 0; j < PlayerMe.availableMinionTypes.Count; j++)
            if (TypeIdGeneratorGUI.minionGuiInst.ContainsKey(TypeIdGenerator.getMinionId(PlayerMe.availableMinionTypes[j])))
                minionsSortedByCost.Add(PlayerMe.availableMinionTypes[j]);
        minionsSortedByCost.Sort( delegate(Type t1, Type t2) {
            Minion m1 = TypeIdGenerator.getMinionClass(TypeIdGenerator.getMinionId(t1));
            Minion m2 = TypeIdGenerator.getMinionClass(TypeIdGenerator.getMinionId(t2));
            if (m1.getCost() < m2.getCost()) return -1;
            else return 1; 
        });

		foreach(Type minionType in minionsSortedByCost)
		{
            int minionTypeId = TypeIdGenerator.getMinionId(minionType);
			if(TypeIdGeneratorGUI.minionGuiInst.ContainsKey(minionTypeId))
			{
				GameObject button = (GameObject)GameObject.Instantiate(button_CreateMinion);
				button.transform.parent = createMinionTowerContainer.transform;
				button.transform.localScale = new Vector3(1, 1, 1);
				button.transform.localPosition = button_CreateMinion.transform.localPosition + new Vector3(50 * btnIndex, 0, 0);

				UIButtonMessage[] button_messages = button.GetComponents<UIButtonMessage>();
				foreach (var btn_msg in button_messages)
					btn_msg.parameter = minionTypeId.ToString();

				IMinionGUI minionGUI = TypeIdGeneratorGUI.minionGuiInst[minionTypeId];
				minionGUI.drawCreateMinionButtonGUI(button);
                towerAndMinionButtons.Add(minionType, button);
				btnIndex++;
			}
		}

        // sort towers order by cost
        List<Type> towersSortedByCost = new List<Type>();
        for (int j = 0; j < PlayerMe.availableTowerTypes.Count; j++)
            if (TypeIdGeneratorGUI.towerGuiInst.ContainsKey(TypeIdGenerator.getTowerId(PlayerMe.availableTowerTypes[j])))
                towersSortedByCost.Add(PlayerMe.availableTowerTypes[j]);
        towersSortedByCost.Sort(delegate(Type t1, Type t2)
        {
            Tower m1 = TypeIdGenerator.getTowerClass(TypeIdGenerator.getTowerId(t1));
            Tower m2 = TypeIdGenerator.getTowerClass(TypeIdGenerator.getTowerId(t2));
            if (m1.getCost() < m2.getCost()) return -1;
            else return 1;
        });

		btnIndex = 0;
		foreach(Type towerType in towersSortedByCost)
		{
            int towerTypeId = TypeIdGenerator.getTowerId(towerType);
			if(TypeIdGeneratorGUI.towerGuiInst.ContainsKey(towerTypeId))
			{
				GameObject button = (GameObject)GameObject.Instantiate(button_CreateTower);
				button.transform.parent = createMinionTowerContainer.transform;
				button.transform.localScale = new Vector3(1, 1, 1);
				button.transform.localPosition = button_CreateTower.transform.localPosition + new Vector3(50 * btnIndex, 0, 0);

				UIButtonMessage[] button_messages = button.GetComponents<UIButtonMessage>();
				foreach (var btn_msg in button_messages)
					btn_msg.parameter = towerTypeId.ToString();
				
				ITowerGUI towerGUI = TypeIdGeneratorGUI.towerGuiInst[towerTypeId];
				towerGUI.drawCreateTowerButtonGUI(button);
                towerAndMinionButtons.Add(towerType, button);
				btnIndex++;
			}
		}

		button_CreateTower.SetActive(false);
		button_CreateMinion.SetActive(false);
	}
Exemplo n.º 23
0
 public static void DrawAll(SpriteBatch spriteBatch, Vector2 scale, Texture2D spriteSheet)
 {
     Actors.ForEach(a => a.Draw(spriteBatch, scale, spriteSheet));
 }
Exemplo n.º 24
0
 public void ForEach(Action <T> action)
 {
     list.ForEach(action);
 }
        private void RemoveEventBookedProductAndCharges(EventBookedProductModel product)
        {
            _eventsDataUnit.EventChargesRepository.Delete(product.EventCharge.EventCharge);
            _eventsDataUnit.EventBookedProductsRepository.Delete(product.EventBookedProduct);
            var eventCharges = new System.Collections.Generic.List<EventChargeModel>();
            _event.EventCharges.ForEach(eventCharge =>
            {
                if (eventCharge.EventCharge.ID == product.EventCharge.EventCharge.ID)
                {
                    eventCharges.Add(eventCharge);
                }
            });
            eventCharges.ForEach(echarge => _event.EventCharges.Remove(echarge));

            _event.EventBookedProducts.Remove(product);

        }
Exemplo n.º 26
0
        public static void InstallAddIns(System.Collections.Generic.List <string> disabled)
        {
            if (!System.IO.Directory.Exists(AddInManager.addInInstallTemp))
            {
                return;
            }
            if (!System.IO.Directory.Exists(AddInManager.userAddInPath))
            {
                System.IO.Directory.CreateDirectory(AddInManager.userAddInPath);
            }
            string path = System.IO.Path.Combine(AddInManager.addInInstallTemp, "remove.txt");
            bool   flag = true;

            System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>();
            if (System.IO.File.Exists(path))
            {
                using (System.IO.StreamReader streamReader = new System.IO.StreamReader(path))
                {
                    string text;
                    while ((text = streamReader.ReadLine()) != null)
                    {
                        text = text.Trim();
                        if (!string.IsNullOrEmpty(text))
                        {
                            string targetDir = System.IO.Path.Combine(AddInManager.userAddInPath, text);
                            if (!AddInManager.UninstallAddIn(disabled, text, targetDir))
                            {
                                list.Add(text);
                                flag = false;
                            }
                        }
                    }
                }
                if (list.Count == 0)
                {
                    System.IO.File.Delete(path);
                }
                else
                {
                    using (System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(path))
                    {
                        list.ForEach(new System.Action <string>(streamWriter.WriteLine));
                    }
                }
            }
            string[] directories = System.IO.Directory.GetDirectories(AddInManager.addInInstallTemp);
            for (int i = 0; i < directories.Length; i++)
            {
                string text2    = directories[i];
                string fileName = System.IO.Path.GetFileName(text2);
                string text3    = System.IO.Path.Combine(AddInManager.userAddInPath, fileName);
                if (!list.Contains(fileName))
                {
                    if (AddInManager.UninstallAddIn(disabled, fileName, text3))
                    {
                        System.IO.Directory.Move(text2, text3);
                    }
                    else
                    {
                        flag = false;
                    }
                }
            }
            if (flag)
            {
                try
                {
                    System.IO.Directory.Delete(AddInManager.addInInstallTemp, false);
                }
                catch (System.Exception)
                {
                }
            }
        }
Exemplo n.º 27
0
    public void createMinionAndTowerButtons()
    {
        var children = new System.Collections.Generic.List <GameObject>();

        foreach (Transform child in createMinionTowerContainer.transform)
        {
            children.Add(child.gameObject);
        }
        children.ForEach(child => GameObject.Destroy(child));

        int btnIndex = 0;

        button_CreateTower.SetActive(true);
        button_CreateMinion.SetActive(true);

        // sort minions order by cost
        List <Type> minionsSortedByCost = new List <Type>();

        for (int j = 0; j < PlayerMe.availableMinionTypes.Count; j++)
        {
            if (TypeIdGeneratorGUI.minionGuiInst.ContainsKey(TypeIdGenerator.getMinionId(PlayerMe.availableMinionTypes[j])))
            {
                minionsSortedByCost.Add(PlayerMe.availableMinionTypes[j]);
            }
        }
        minionsSortedByCost.Sort(delegate(Type t1, Type t2) {
            Minion m1 = TypeIdGenerator.getMinionClass(TypeIdGenerator.getMinionId(t1));
            Minion m2 = TypeIdGenerator.getMinionClass(TypeIdGenerator.getMinionId(t2));
            if (m1.getCost() < m2.getCost())
            {
                return(-1);
            }
            else
            {
                return(1);
            }
        });

        foreach (Type minionType in minionsSortedByCost)
        {
            int minionTypeId = TypeIdGenerator.getMinionId(minionType);
            if (TypeIdGeneratorGUI.minionGuiInst.ContainsKey(minionTypeId))
            {
                GameObject button = (GameObject)GameObject.Instantiate(button_CreateMinion);
                button.transform.parent        = createMinionTowerContainer.transform;
                button.transform.localScale    = new Vector3(1, 1, 1);
                button.transform.localPosition = button_CreateMinion.transform.localPosition + new Vector3(50 * btnIndex, 0, 0);

                UIButtonMessage[] button_messages = button.GetComponents <UIButtonMessage>();
                foreach (var btn_msg in button_messages)
                {
                    btn_msg.parameter = minionTypeId.ToString();
                }

                IMinionGUI minionGUI = TypeIdGeneratorGUI.minionGuiInst[minionTypeId];
                minionGUI.drawCreateMinionButtonGUI(button);
                towerAndMinionButtons.Add(minionType, button);
                btnIndex++;
            }
        }

        // sort towers order by cost
        List <Type> towersSortedByCost = new List <Type>();

        for (int j = 0; j < PlayerMe.availableTowerTypes.Count; j++)
        {
            if (TypeIdGeneratorGUI.towerGuiInst.ContainsKey(TypeIdGenerator.getTowerId(PlayerMe.availableTowerTypes[j])))
            {
                towersSortedByCost.Add(PlayerMe.availableTowerTypes[j]);
            }
        }
        towersSortedByCost.Sort(delegate(Type t1, Type t2)
        {
            Tower m1 = TypeIdGenerator.getTowerClass(TypeIdGenerator.getTowerId(t1));
            Tower m2 = TypeIdGenerator.getTowerClass(TypeIdGenerator.getTowerId(t2));
            if (m1.getCost() < m2.getCost())
            {
                return(-1);
            }
            else
            {
                return(1);
            }
        });

        btnIndex = 0;
        foreach (Type towerType in towersSortedByCost)
        {
            int towerTypeId = TypeIdGenerator.getTowerId(towerType);
            if (TypeIdGeneratorGUI.towerGuiInst.ContainsKey(towerTypeId))
            {
                GameObject button = (GameObject)GameObject.Instantiate(button_CreateTower);
                button.transform.parent        = createMinionTowerContainer.transform;
                button.transform.localScale    = new Vector3(1, 1, 1);
                button.transform.localPosition = button_CreateTower.transform.localPosition + new Vector3(50 * btnIndex, 0, 0);

                UIButtonMessage[] button_messages = button.GetComponents <UIButtonMessage>();
                foreach (var btn_msg in button_messages)
                {
                    btn_msg.parameter = towerTypeId.ToString();
                }

                ITowerGUI towerGUI = TypeIdGeneratorGUI.towerGuiInst[towerTypeId];
                towerGUI.drawCreateTowerButtonGUI(button);
                towerAndMinionButtons.Add(towerType, button);
                btnIndex++;
            }
        }

        button_CreateTower.SetActive(false);
        button_CreateMinion.SetActive(false);
    }