Example #1
0
        /// <summary>
        /// 查询店内指定车辆在指定时间的存货
        /// </summary>
        /// <param name="ShopID">店铺ID</param>
        /// <param name="VersionID">车的型号</param>
        /// <param name="StartYear">开始的年份(默认当前年份</param>
        /// <param name="StartMonth">开始的月份(默认当前月份</param>
        /// <param name="StartDay">开始的日(默认当前日</param>
        /// <param name="EndYear">结束的年份(默认当前年份</param>
        /// <param name="EndMonth">结束的月份(默认当前月份</param>
        /// <param name="EndDay">结束日(默认当前日</param>
        /// <returns></returns>
        public int SelectCarCount_ShopIDAndTime(int ShopID, int VersionID, int?StartYear, int?StartMonth, int?StartDay, int?EndYear, int?EndMonth, int?EndDay)
        {
            OrderSummery OrderSummery_Manager = new OrderSummery();
            int          OrderCount           = OrderSummery_Manager.SelectRentaledCarCount_TimeAndVersion(ShopID, VersionID, StartYear, StartMonth, StartDay, EndYear, EndMonth, EndDay);
            int          TatalCount           = DB_ViewModel.Select(P => P.Shop_ID == ShopID && P.Version_ID == VersionID).First().Version_Count;

            return(TatalCount - OrderCount);
        }
Example #2
0
        /// <summary>
        /// 查找一个市内指定时间段里是否还有指定数量的某车型
        /// </summary>
        /// <param name="CityID">城市ID</param>
        /// <param name="CarCount">所需该车的数量</param>
        /// <param name="VersionID">车的型号</param>
        /// <param name="StartYear">开始的年份(默认当前年份</param>
        /// <param name="StartMonth">开始的月份(默认当前月份</param>
        /// <param name="StartDay">开始的日(默认当前日</param>
        /// <param name="EndYear">结束的年份(默认当前年份</param>
        /// <param name="EndMonth">结束的月份(默认当前月份</param>
        /// <param name="EndDay">结束日(默认当前日</param>
        /// <returns></returns>
        public List <Car_Shop> SelectHasCar_CityIDAndTime(int CityID, int VersionID, int CarCount, int?StartYear, int?StartMonth, int?StartDay, int?EndYear, int?EndMonth, int?EndDay)
        {
            List <Car_Shop> List_Shop            = new List <Car_Shop>();
            OrderSummery    OrderSummery_Manager = new OrderSummery();

            //遍历在这个城市中每一个有该种类车型的店铺
            foreach (Car_ViewModel CarInfo in DB_ViewModel.Select(P => P.Version_ID == VersionID && P.City_ID == CityID).ToList())
            {
                //取得该店铺中剩余数量,当剩余数量大于所需数量时,返回该店铺
                int LastCount = OrderSummery_Manager.SelectRentaledCarCount_TimeAndVersion(CarInfo.Shop_ID, VersionID, StartYear, StartMonth, StartDay, EndYear, EndMonth, EndDay);
                if (LastCount > CarCount)
                {
                    List_Shop.Add(new Car_Shop()
                    {
                        Shop_ID    = CarInfo.Shop_ID,
                        Shop_Info  = CarInfo.Shop_Info,
                        Shop_Name  = CarInfo.Shop_Name,
                        Shop_Phone = CarInfo.Shop_Phone,
                        Shop_City  = CarInfo.City_ID
                    });
                }
            }
            return(List_Shop);
        }