Ejemplo n.º 1
0
        //
        public void Lmbda()
        {
            DateTime dt = DateTime.Now;
            BI_test  db = new BI_test();

            //var a = GetByRegionID(orcl_db.COUNTRIES, 1);

            //var arr = del.Invoke(db, new DateTime(2016, 01, 01, 00, 00, 00), new DateTime(2016, 02, 01, 00, 00, 00));


            IQueryable <table1DTO> arr3 =
                from s in db.table1
                where DbFunctions.CreateDateTime(s.date1.Value.Year, s.date1.Value.Month, 01, 00, 00, 00) >= DbFunctions.CreateDateTime(2016, 01, 01, 00, 00, 00) &&
                DbFunctions.CreateDateTime(s.date1.Value.Year, s.date1.Value.Month, 01, 00, 00, 00) <= DbFunctions.CreateDateTime(2016, 02, 01, 00, 00, 00)
                group s by new { DATE = DbFunctions.CreateDateTime(s.date1.Value.Year, s.date1.Value.Month, 01, 00, 00, 00), range = s.range1 } into g
                                   select new table1DTO {
                DATE = g.Key.DATE, RANGE = g.Key.range, AMT = g.Sum(s => s.value1)
            };

            var arr4 = del_table1_group();

            int cnt = arr3.Count();

            table1Condition.addProperties(arr3.GetType());
            List <string> str = table1Condition.propertiesList;
        }
Ejemplo n.º 2
0
        //copy from existing sql database to new created sql database
        public void SQL_to_SQL_copy()
        {
            //existing database
            BI_test             db    = new BI_test();
            IQueryable <table1> table = from s in db.table1 select s;

            //new database
            BI_copy db_copy = new BI_copy();

            foreach (table1 table1_ in table)
            {
                db_copy.table1_copy.Add(table1_);
                db_copy.SaveChanges();
            }
        }