Example #1
0
        public void UOW_init()
        {
            context = new SQLDB_CHANGE(@"SQLDB");

            usersRepo     = new Repository <USERS_SQL>(context);
            clientsRepo   = new Repository <KEY_CLIENTS_SQL>(context);
            merchantsRepo = new Repository <MERCHANT_LIST_SQL>(context);

            uow_CUT = new UOW();

            uow_CUT.BindRepoUsers(usersRepo);
            uow_CUT.BindRepoClients(clientsRepo);
            uow_CUT.BindRepoMerchants(merchantsRepo);

            UserNameToGet    = @"NAME2";
            UserSernameToGet = @"SERNAME2";

            SetUserID = 3;
            GetUSerID = -1;

            UserSernameSetted = @"SERNAME3";

            merchantsForUserCnt = 3;

            merchantsToInsert = new List <MERCHANT_LIST_SQL>()
            {
                new MERCHANT_LIST_SQL()
                {
                    MERCHANT = 9290000090, USER_ID = 3, UPDATE_DATE = new DateTime(2017, 08, 05, 00, 00, 08)
                }
                , new MERCHANT_LIST_SQL()
                {
                    MERCHANT = 9290000091, USER_ID = 3, UPDATE_DATE = new DateTime(2017, 08, 05, 00, 00, 08)
                }
                , new MERCHANT_LIST_SQL()
                {
                    MERCHANT = 9290000081, USER_ID = 4, UPDATE_DATE = new DateTime(2017, 08, 05, 00, 00, 08)
                }
                , new MERCHANT_LIST_SQL()
                {
                    MERCHANT = 9290000082, USER_ID = 4, UPDATE_DATE = new DateTime(2017, 08, 05, 00, 00, 08)
                }
                , new MERCHANT_LIST_SQL()
                {
                    MERCHANT = 9290000083, USER_ID = 4, UPDATE_DATE = new DateTime(2017, 08, 05, 00, 00, 08)
                }
            };

            //Merchant list generating
            merchantsGen    = new List <MERCHANT_LIST_SQL>();
            refmerchantsGen = new List <REFMERCHANTS_SQL>();
            usersGen        = new List <USERS_SQL>();
            acqGen          = new List <T_ACQ_M_SQL>();

            for (long i = 9290000100; i < (9290000100 + 100); i++)
            {
                int user = random.Next(4, 7);
                merchantsGen.Add(new MERCHANT_LIST_SQL {
                    MERCHANT = i, USER_ID = user, UPDATE_DATE = DateTime.Now
                });
                refmerchantsGen.Add(new REFMERCHANTS_SQL()
                {
                    MERCHANT = i, USER_ID = user
                });

                for (short i2 = 0; i2 <= 50; i2++)
                {
                    acqGen.Add(new T_ACQ_M_SQL()
                    {
                        MERCHANT = i, AMT = i2, DATE = DateTime.Now
                    });
                }
            }
            for (short i = 7; i < 10; i++)
            {
                usersGen.Add(new USERS_SQL()
                {
                    Name = @"Name" + i, Sername = @"Sername" + i
                });
            }

            clientsListByUserID = clientsRepo.GetALL().Where(s => s.RESPONSIBILITY_MANAGER == UserSernameSetted);
        }