示例#1
0
        public int Insert <T>(T entity)
        {
            Type type = entity.GetType();

            if (type == typeof(City))
            {
                return(CityTable.Insert(entity as City));
            }

            if (type == typeof(Customer))
            {
                return(CustomerTable.Insert(entity as Customer));
            }

            if (type == typeof(Distillation))
            {
                return(DistillationTable.Insert(entity as Distillation));
            }

            if (type == typeof(District))
            {
                return(DistrictTable.Insert(entity as District));
            }

            if (type == typeof(Material))
            {
                return(MaterialTable.Insert(entity as Material));
            }

            if (type == typeof(Period))
            {
                return(PeriodTable.Insert(entity as Period));
            }

            if (type == typeof(Region))
            {
                return(RegionTable.Insert(entity as Region));
            }

            if (type == typeof(Reservation))
            {
                return(ReservationTable.Insert(entity as Reservation));
            }

            if (type == typeof(Season))
            {
                return(SeasonTable.Insert(entity as Season));
            }

            if (type == typeof(UserInfo))
            {
                return(UserInfoTable.Insert(entity as UserInfo));
            }

            return(0);
        }