Ejemplo n.º 1
0
        public static void MigrateByDate <T>(DateTime st_, DateTime fn_) where T : class, IEntity, IDate
        {
            try
            {
                DWH_entities dwh = new DWH_entities();
                SQL_entity   sql = new SQL_entity();

                sql.Database.Initialize(true);

                Repository <T> acq_rep_dwh = new Repository <T>(dwh);
                Repository <T> acq_rep_sql = new Repository <T>(sql);

                IQueryable <T> a = acq_rep_dwh.DWHGetByDate(st_, fn_);

                int cnt = a.Count();

                foreach (var t in a)
                {
                    acq_rep_sql.Add(t);
                    acq_rep_sql.Save();
                }
            }
            catch (Exception e)
            {
            }
        }
Ejemplo n.º 2
0
 public Edit_UOF()
 {
     ent          = new SQL_entity();
     ACQ_D        = new EditRepo <T_ACQ_D>(ent);
     REFMERCHANTS = new UserFilterRepo <DAL.REFMERCHANTS>(ent);
     KK           = new SectorFilterRepo <KEY_CLIENTS>(ent);
 }
Ejemplo n.º 3
0
        public static dynamic RepoFromString(string name_, SQL_entity ent)
        {
            dynamic result = null;

            switch (name_)
            {
            case "TEMP_ACQ_D":
                result = new Repo.Repository <TEMP_ACQ_D>(ent);
                break;

            case "TEMP_ACQ_M":
                result = new Repo.Repository <TEMP_ACQ_M>(ent);
                break;

            case "TEMP_ECOMM_D":
                result = new Repo.Repository <TEMP_ECOMM_D>(ent);
                break;

            case "TEMP_ACQ":
                result = new Repo.Repository <TEMP_ACQ>(ent);
                break;

            case "TEMP_CTL_D":
                result = new Repo.Repository <TEMP_ACQ>(ent);
                break;

            default:
                result = null;
                break;
            }
            return(result);
        }
Ejemplo n.º 4
0
        public static void ReadRepoCheck()
        {
            SQL_entity         ent     = new SQL_entity();
            ReadRepo <T_ACQ_D> readRep = new ReadRepo <T_ACQ_D>(ent);
            MerchantFilterRepo <KEY_CLIENTS, REFMERCHANTS> filtRep = new MerchantFilterRepo <KEY_CLIENTS, REFMERCHANTS>(ent);
            DateFilterRepo <T_ACQ_D>  dateFilter = new DateFilterRepo <T_ACQ_D>(ent);
            ChainingRepo <TEMP_ACQ_D> chainRep   = new ChainingRepo <TEMP_ACQ_D>(ent);

            DateTime stDt = new DateTime(2016, 08, 21, 00, 00, 00);
            DateTime fnDt = new DateTime(2016, 08, 22, 00, 00, 00);

            DateTime st = new DateTime(2016, 02, 01, 00, 00, 00);
            DateTime fn = new DateTime(2016, 06, 01, 00, 00, 00);

            //48
            int cnt_1 = readRep.GetByFilter <T_ACQ_D>(s => s.MERCHANT == 9294109921).Count();

            //50830
            int cnt_2 = dateFilter.GetByDate(stDt, fnDt).Count();
            //128
            int cnt_3 = filtRep.GetByMerchantFilter <T_ACQ_D>().Count();

            //2042
            int cnt_4 = chainRep.FilterByDate(st, fn)._result.Count();
            //597
            int cnt_5 = chainRep.FilterByMerchants <REFMERCHANTS>()._result.Count();
        }
Ejemplo n.º 5
0
        public void MerchantsCheck()
        {
            SQL_entity ent = new SQL_entity();
            Repository <TEMP_ACQ_D> rep = new Repository <TEMP_ACQ_D>(ent);

            var a   = rep.SQLGetList();
            int cnt = a.Count();
        }
Ejemplo n.º 6
0
 public UtilityRepository(SQL_entity ent)
 {
     this.context = ent;
     REFMERCHANTS = context.Set <REFMERCHANTS>();
     KEY_CLIENTS  = context.Set <KEY_CLIENTS>();
     SECTOR_NAMES = context.Set <SECTOR>();
     SECTOR_MASKS = context.Set <SECTOR_MASK>();
     //Masks_Init();
     Entity_check();
 }
Ejemplo n.º 7
0
        //>>!!! To Unit Test
        public static void TypeInsertCheck()
        {
            SQL_entity             ent     = new SQL_entity();
            EditRepo <KEY_CLIENTS> editRep = new EditRepo <KEY_CLIENTS>(ent);
            UnitOfWorkGeneric      uof     = new UnitOfWorkGeneric(ent);

            uof.RefreshValues();
            EntityInitialization entityInit = new EntityInitialization();

            entityInit.KEY_CLIENTS_add(uof, 9290000009, 9, "ABCD");
            var a = editRep.GetByFilter <KEY_CLIENTS>(s => s.ID != null).Count();
        }
Ejemplo n.º 8
0
        public void Chainingcheck()
        {
            SQL_entity ent = new SQL_entity();
            Repository <TEMP_ACQ_D> rep = new Repository <TEMP_ACQ_D>(ent);

            rep.SQLGetByDay(st, fn);


            //chn.GetByMerchant();
            var a = rep.GetResult();
            int c = a.Count();
        }
Ejemplo n.º 9
0
        public void SQL_cehck()
        {
            SQL_entity ent             = new SQL_entity();
            Repository <TEMP_ACQ_D> rp = new Repository <TEMP_ACQ_D>(ent);

            var a = from s in rp.SQLGetByMonth(st, fn) select s;
            int b = a.Count();

            var a_ = from s in ent.TEMP_ACQ_D
                     where DbFunctions.CreateDateTime(s.DATE.Value.Year, s.DATE.Value.Month, s.DATE.Value.Day, 00, 00, 00) == st
                     select s;

            int b_ = a_.Count();
        }
Ejemplo n.º 10
0
        public void KeyClientsInsertCheck()
        {
            SQL_entity        ent = new SQL_entity();
            UtilityRepository ur  = new UtilityRepository(ent);

            KEY_CLIENTS kk = new DAL.KEY_CLIENTS {
                SECTOR_ID = 2, SE_NUMBER = 929001
            };

            ur.MerchantsCount();
            ur.Key_Clients_Insert(kk);
            ur.contextSaveChanges();
            ur.Key_Clients_DeleteAll();
            ur.contextSaveChanges();
        }
Ejemplo n.º 11
0
        public void TypeCheck(string typename_)
        {
            SQL_entity ent = new SQL_entity();

            var a = ent.GetType();

            PropertyInfo[] b = a.GetProperties();
            foreach (PropertyInfo c in b)
            {
                if (c.Name == typename_)
                {
                    //Repository<a> rep = new Repository<a>();
                }
            }
        }
Ejemplo n.º 12
0
        public void CallDisconnectedProcedureTest()
        {
            SQL_entity        ent = new SQL_entity();
            UnitOfWorkGeneric uof = new UnitOfWorkGeneric(ent);

            uof.RefreshValues();

            /*
             *
             * //12
             * var a = uof.GetByDate<T_ACQ_D>(st, fn).Count();
             * //5
             * var b = uof.GetByMerchants<KEY_CLIENTS>().Count();
             * //10
             * var c = uof.MerchantListCount();
             *
             *
             * ReadRepo<KEY_CLIENTS> kkRead = new ReadRepo<KEY_CLIENTS>(ent);
             * //5
             * var d = uof.GetByMerchants<KEY_CLIENTS>().Count();
             * uof.DeleteBySector(2);
             * uof.SaveAll();
             * //4
             * var e = uof.GetByMerchants<KEY_CLIENTS>().Count();
             *
             *
             * EditRepo<REFMERCHANTS> rfEdit = new EditRepo<REFMERCHANTS>(ent);
             * //10
             * var f = uof.MerchantListCount();
             * uof.DeleteByUserID(0);
             * uof.SaveAll();
             * //9
             * var g = uof.MerchantListCount();
             *
             * uof.RefreshValues();
             *
             * //27
             * var h =
             * uof.GetByDate<T_ACQ_D>(st, fn).Count()
             + uof.GetByMerchants<KEY_CLIENTS>().Count()
             + uof.MerchantListCount();
             +
             */

            Assert.Fail();
        }
Ejemplo n.º 13
0
        //>>!!! To Unit Test
        public static void UOWcheck()
        {
            SQL_entity        ent = new SQL_entity();
            UnitOfWorkGeneric uof = new UnitOfWorkGeneric(ent);

            //12
            var a = uof.GetByDate <T_ACQ_D>(st, fn).Count();
            //5
            var b = uof.GetByMerchants <KEY_CLIENTS>().Count();
            //10
            var c = uof.MerchantListCount();


            ReadRepo <KEY_CLIENTS> kkRead = new ReadRepo <KEY_CLIENTS>(ent);
            //5
            var d = uof.GetByMerchants <KEY_CLIENTS>().Count();

            uof.DeleteBySector(2);
            uof.SaveAll();
            //4
            var e = uof.GetByMerchants <KEY_CLIENTS>().Count();

            EditRepo <REFMERCHANTS> rfEdit = new EditRepo <REFMERCHANTS>(ent);
            //10
            var f = uof.MerchantListCount();

            uof.DeleteByUserID(0);
            uof.SaveAll();
            //9
            var g = uof.MerchantListCount();

            uof.RefreshValues();

            //27
            var h =
                uof.GetByDate <T_ACQ_D>(st, fn).Count()
                + uof.GetByMerchants <KEY_CLIENTS>().Count()
                + uof.MerchantListCount();
        }
Ejemplo n.º 14
0
        //>>!!! To Unit Test
        public static void UOFinsertCheck()
        {
            SQL_entity             ent     = new SQL_entity();
            EditRepo <KEY_CLIENTS> editRep = new EditRepo <KEY_CLIENTS>(ent);
            UnitOfWorkGeneric      uof     = new UnitOfWorkGeneric(ent);

            uof.RefreshValues();

            KEY_CLIENTS kk = new KEY_CLIENTS {
                SE_NUMBER = 9290000009, MERCHANT = 9290000009, SECTOR_ID = 9
            };

            //5
            var a = editRep.GetByFilter <KEY_CLIENTS>(s => s.ID != null).Count();

            uof.Add <KEY_CLIENTS>(kk);
            //6
            var b = editRep.GetByFilter <KEY_CLIENTS>(s => s.ID != null).Count();

            uof.RefreshValues();
            //5
            var c = editRep.GetByFilter <KEY_CLIENTS>(s => s.ID != null).Count();
        }
Ejemplo n.º 15
0
        public static void Initialize()
        {
            SQL_entity         context = new SQL_entity();
            SECTOR             sector;
            List <SECTOR_MASK> masks = new List <SECTOR_MASK>();
            Random             rand  = new Random();

            context.SECTOR_NAMES.RemoveRange(from s in context.SECTOR_NAMES select s);
            context.SECTOR_MASKS.RemoveRange(from s in context.SECTOR_MASKS select s);
            context.REFMERCHANTS.RemoveRange(from s in context.REFMERCHANTS select s);

            List <SECTOR> names = new List <SECTOR>();

            sector = new SECTOR {
                SECTOR_NAME = @"Retail&Telecom"
            };
            masks.Add(new SECTOR_MASK {
                MASK = @"((retail(.*)telecom)|(telecom(.*)retail))", SECTOR = sector
            });
            sector = new SECTOR {
                SECTOR_NAME = @"Travel$Restaurants"
            };
            masks.Add(new SECTOR_MASK {
                MASK = @"((travel(.*)restaurants)|(restaurants(.*)travel))", SECTOR = sector
            });
            sector = new SECTOR {
                SECTOR_NAME = @"ECOMM"
            };
            masks.Add(new SECTOR_MASK {
                MASK = @"((.*)ECOMM(.*))", SECTOR = sector
            });
            sector = new SECTOR {
                SECTOR_NAME = @"Hotels"
            };
            masks.Add(new SECTOR_MASK {
                MASK = @"((.*)hotels(.*))", SECTOR = sector
            });
            foreach (SECTOR_MASK ms in masks)
            {
                context.SECTOR_MASKS.Add(ms);
            }
            context.SaveChanges();

            List <REFMERCHANTS> rf = new List <REFMERCHANTS>();
            int    upper           = rand.Next(1000, 3000);
            int    merch_gen       = rand.Next(29000000, 59999999);
            long   merch_solid     = 9000000000;
            string merch           = merch_solid.ToString();

            for (int i = 0; i < upper; i++)
            {
                merch_solid = 9000000000;
                int type1 = rand.Next(290000000, 299999999);
                int type2 = rand.Next(590000000, 599999999);

                if (type1 % 2 == 0)
                {
                    merch_solid += type1;
                }
                else
                {
                    merch_solid += type2;
                }

                merch = merch_solid.ToString();
                context.REFMERCHANTS.Add(new REFMERCHANTS {
                    ITEM_ID = merch_solid.ToString(), USER_ID = 0
                });
            }
            context.SaveChanges();
        }