当前位置: 首页>>代码示例>>C#>>正文


C# touch_for_foodEntities.Dispose方法代码示例

本文整理汇总了C#中TouchForFood.Models.touch_for_foodEntities.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# touch_for_foodEntities.Dispose方法的具体用法?C# touch_for_foodEntities.Dispose怎么用?C# touch_for_foodEntities.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TouchForFood.Models.touch_for_foodEntities的用法示例。


在下文中一共展示了touch_for_foodEntities.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FilterListBySide

        /**
         * Filters the sides and only returns those that are not already assigned to the menu
         * that is passed in.
         * */
        public static IList<side> FilterListBySide(menu_category menu_category)
        {
            touch_for_foodEntities db = new touch_for_foodEntities();
            List<side> filteredList = new List<side>();

            int resto_id = menu_category.menu.resto_id;
            //  We want all sides that do not exist in this menu_category and that belong to this restaurant.
            //  is_deleted and is_active need to be considered too. Show only sides where is_active is false
            //  if side is_deleted is true, then there should be another page to revert that. the side functionality
            //  I'm putting should only set a side to is_active is true or false
            List<side> restaurantSides = db.sides.Where
                (
                    si =>
                        si.menu_category.menu.resto_id == resto_id
                        && si.is_active == false
                        && si.is_deleted == false
                ).ToList();

            foreach (var side in restaurantSides)
            {
                if (side.menu_category_id.Equals(menu_category.id))
                {
                    filteredList.Add(side);
                }
            }
            db.Dispose();
            return filteredList;
        }
开发者ID:pmoda,项目名称:TFFCode,代码行数:32,代码来源:SideUtil.cs

示例2: MyClassCleanup

 public static void MyClassCleanup()
 {
     touch_for_foodEntities db = new touch_for_foodEntities();
     review r = db.reviews.Find(m_review.id);
     db.reviews.Remove(r);
     db.SaveChanges();
     db.Dispose();
 }
开发者ID:pmoda,项目名称:TFFCode,代码行数:8,代码来源:ReviewOMTest.cs

示例3: MyClassInitialize

        public static void MyClassInitialize(TestContext testContext)
        {
            touch_for_foodEntities db = new touch_for_foodEntities();
            m_review = new review();
            m_review.restaurant_id = db.restaurants.First().id;
            m_review.rating = 1;
            m_review.is_anonymous = true;

            db.reviews.Add(m_review);
            db.SaveChanges();
            db.Dispose();
        }
开发者ID:pmoda,项目名称:TFFCode,代码行数:12,代码来源:ReviewOMTest.cs

示例4: AddFriendship

        /// <summary>
        /// Creates a friendship entity
        /// </summary>
        /// <param name="user1">The first user in the friendship</param>
        /// <param name="user2">The second user in the friendship</param>
        /// <returns>the created friendship entity</returns>
        public friendship AddFriendship(user user1, user user2)
        {
            //Initialise
            db = new touch_for_foodEntities();
            friendship testFriendship = new friendship();

            //Set Attributes
            testFriendship.first_user = user1.id;
            testFriendship.second_user = user2.id;

            //Save
            db.friendships.Add(testFriendship);
            db.SaveChanges();
            db.Dispose();

            return testFriendship;
        }
开发者ID:pmoda,项目名称:TFFCode,代码行数:23,代码来源:TestDatabaseHelper.cs

示例5: AddCategory

        /// <summary>
        /// Adds a category entry to the database
        /// </summary>
        /// <returns>The created category entity.</returns>
        public category AddCategory()
        {
            //Initialise
            db = new touch_for_foodEntities();
            category testCategory = new category();

            //Set attributes
            testCategory.name = "UnitTest";
            testCategory.version = 0;

            //Save
            db.categories.Add(testCategory);
            db.SaveChanges();
            db.Dispose();

            return testCategory;
        }
开发者ID:pmoda,项目名称:TFFCode,代码行数:21,代码来源:TestDatabaseHelper.cs

示例6: filterListByItem

        /**
            * Filters the categories and only returns those that are not already assigned to the menu
            * that is passed in.
        * */
        public static IList<item> filterListByItem(menu_category menu_category,touch_for_foodEntities db)
        {
            List<item> filteredList = new List<item>();
            MenuItemIM im = new MenuItemIM(db);
            int resto_id = menu_category.menu.resto_id;
            bool reject = false;

            foreach (item i in db.items.ToList())
            {
                reject = false;
                //First check that the category does belong to the restaurant
                //Find all usages of the category in question in the current restaurant
                List<menu_item> usages = db.menu_item.Where(mi => mi.item_id == i.id && mi.menu_category.menu.resto_id == resto_id).ToList();

                //If it was never used by this restaurant, then the restaurant could not have created it
                // because create automatically adds the created item to the menu
                if (usages.Count == 0)
                {
                    reject = true;
                }

                if (menu_category.category.id == i.category_id)
                {
                    foreach (menu_item m_i in im.find(false, menu_category.id))
                    {
                        if (i.id == m_i.item_id)
                        {
                            reject = true;
                            break;
                        }
                    }
                    if (!reject)
                    {
                        filteredList.Add(i);
                    }
                }
            }
            db.Dispose();
            return filteredList;
        }
开发者ID:pmoda,项目名称:TFFCode,代码行数:44,代码来源:ItemUtil.cs

示例7: RemoveSide

 /// <summary>
 /// Removes a side item from the database.
 /// </summary>
 /// <param name="testSide">The side to be removed.</param>
 public void RemoveSide(side testSide)
 {
     db = new touch_for_foodEntities();
     if (db.sides.Find(testSide.id) != null)
     {
         db.sides.Remove(db.sides.Find(testSide.id));
         db.SaveChanges();
     }
     db.Dispose();
 }
开发者ID:pmoda,项目名称:TFFCode,代码行数:14,代码来源:TestDatabaseHelper.cs

示例8: RemoveReviewOrderItem

 public void RemoveReviewOrderItem(review_order_item reviewEntityOI)
 {
     db = new touch_for_foodEntities();
     if (db.review_order_item.Find(reviewEntityOI.id) != null)
     {
         db.review_order_item.Remove(db.review_order_item.Find(reviewEntityOI.id));
         db.SaveChanges();
     }
     db.Dispose();
 }
开发者ID:pmoda,项目名称:TFFCode,代码行数:10,代码来源:TestDatabaseHelper.cs

示例9: RemoveServiceRequest

 /// <summary>
 /// Removes a service request item from the database.
 /// </summary>
 /// <param name="serviceRequest">The service request to be removed.</param>
 public void RemoveServiceRequest(service_request serviceRequest)
 {
     db = new touch_for_foodEntities();
     if (db.service_request.Find(serviceRequest.id) != null)
     {
         db.service_request.Remove(db.service_request.Find(serviceRequest.id));
         db.SaveChanges();
     }
     db.Dispose();
 }
开发者ID:pmoda,项目名称:TFFCode,代码行数:14,代码来源:TestDatabaseHelper.cs

示例10: AddServiceRequest

        /// <summary>
        /// Creates an entry of type service request in the database.
        /// </summary>
        /// <param name="tableEntity">the table the service request is associated to.</param>
        /// <returns>The created service request entity.</returns>
        public service_request AddServiceRequest(table tableEntity)
        {
            //Initialise
            db = new touch_for_foodEntities();
            service_request testServiceRequest = new service_request();

            //Set Attributes
            testServiceRequest = new service_request();
            testServiceRequest.note = "UnitTest";
            testServiceRequest.created = DateTime.Now;
            testServiceRequest.status = (int)ServiceRequestUtil.ServiceRequestStatus.OPEN;
            testServiceRequest.version = 0;
            testServiceRequest.table_id = tableEntity.id;

            //Save
            db.service_request.Add(testServiceRequest);
            db.SaveChanges();
            db.Dispose();

            return testServiceRequest;
        }
开发者ID:pmoda,项目名称:TFFCode,代码行数:26,代码来源:TestDatabaseHelper.cs

示例11: RemoveBill

 ///<summary>
 /// Removes a bill from the database.
 /// </summary>
 /// <param name="billEntity">Bill to be removed.</param>
 public void RemoveBill(bill billEntity)
 {
     db = new touch_for_foodEntities();
     if (db.bills.Find(billEntity.id) != null)
     {
         db.bills.Remove(db.bills.Find(billEntity.id));
         db.SaveChanges();
     }
     db.Dispose();
 }
开发者ID:pmoda,项目名称:TFFCode,代码行数:14,代码来源:TestDatabaseHelper.cs

示例12: AddBill

        /// <summary>
        /// Adds a bill entry to the database
        /// </summary>
        /// <param name="orderEntity">The associated order</param>
        /// <returns>The created bill entity.</returns>
        internal bill AddBill(order orderEntity)
        {
            //Initialise
            db = new touch_for_foodEntities();
            bill testBill = new bill();

            //Set attributes
            testBill.order_id = orderEntity.id;
            testBill.is_deleted = false;

            //Save
            db.bills.Add(testBill);
            db.SaveChanges();
            db.Dispose();

            return testBill;
        }
开发者ID:pmoda,项目名称:TFFCode,代码行数:22,代码来源:TestDatabaseHelper.cs

示例13: AddTable

        /// <summary>
        /// Creates an entry of type table in the database.
        /// </summary>
        /// <param name="restaurantEntity">The restaurant where the table is located.</param>
        /// <returns>The created table entity.</returns>
        public table AddTable(restaurant restaurantEntity)
        {
            //Initialise
            db = new touch_for_foodEntities();
            table testTable = new table();

            //Set Attributes
            testTable.name = "Unit Test";
            testTable.restaurant_id = restaurantEntity.id;

            //Save
            db.tables.Add(testTable);
            db.SaveChanges();
            db.Dispose();

            return testTable;
        }
开发者ID:pmoda,项目名称:TFFCode,代码行数:22,代码来源:TestDatabaseHelper.cs

示例14: RemoveMenuCategory

 /// <summary>
 /// Remove menu item from database.
 /// </summary>
 /// <param name="menuCategoryEntity">Menu Category item to be removed.</param>
 public void RemoveMenuCategory(menu_category menuCategoryEntity)
 {
     db = new touch_for_foodEntities();
     if (db.menu_category.Find(menuCategoryEntity.id) != null)
     {
         db.menu_category.Remove(db.menu_category.Find(menuCategoryEntity.id));
         db.SaveChanges();
     }
     db.Dispose();
 }
开发者ID:pmoda,项目名称:TFFCode,代码行数:14,代码来源:TestDatabaseHelper.cs

示例15: RemoveMenuItem

 /// <summary>
 /// Remove menu item item from database.
 /// </summary>
 /// <param name="menuEntity">Menu item item to be removed.</param>
 public void RemoveMenuItem(menu_item menuItemEntity)
 {
     db = new touch_for_foodEntities();
     if (db.menu_item.Find(menuItemEntity.id) != null)
     {
         db.menu_item.Remove(db.menu_item.Find(menuItemEntity.id));
         db.SaveChanges();
     }
     db.Dispose();
 }
开发者ID:pmoda,项目名称:TFFCode,代码行数:14,代码来源:TestDatabaseHelper.cs


注:本文中的TouchForFood.Models.touch_for_foodEntities.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。