public void InsertCostCenterTest()
        {
            Random     random     = new Random();
            CostCenter costCenter = new CostCenter(connManager);

            costCenter.IdInergyLocation = random.Next(1, 2);
            costCenter.IdDepartment     = random.Next(1, 1);
            costCenter.IsActive         = true;
            costCenter.Code             = "UTCode " + Guid.NewGuid().ToString();
            costCenter.Name             = "UTName " + Guid.NewGuid().ToString();
            costCenter.SetNew();
            costCenter.Id = costCenter.Save();

            Assert.Greater(costCenter.Id, 0);

            costCenter.SetDeleted();
            costCenter.Save();
        }
示例#2
0
        public void InsertHourlyRateTest()
        {
            Random random = new Random();

            Region region = new Region(connManager);

            region.Name = "UTRegion";
            region.Code = "UTCode";
            region.Rank = random.Next(100000, 110000);
            region.SetNew();
            region.Id = region.Save();

            Currency currency = new Currency(connManager);

            currency.Code = "UTCode";
            currency.Name = "UTCurrency";
            currency.SetNew();
            currency.Id = currency.Save();

            Country country = new Country(connManager);

            country.Code       = "UTCode";
            country.Name       = "UTCountry";
            country.IdCurrency = currency.Id;
            country.IdRegion   = region.Id;
            country.Rank       = random.Next(100000, 110000);
            country.SetNew();
            country.Id = country.Save();

            InergyLocation inergyLocation = new InergyLocation(connManager);

            inergyLocation.IdCountry = country.Id;
            inergyLocation.Code      = "UTCode";
            inergyLocation.Name      = "UTName";
            inergyLocation.Rank      = random.Next(100000, 110000);
            inergyLocation.SetNew();
            inergyLocation.Id = inergyLocation.Save();

            Department department = new Department(connManager);

            department.IdFunction = 1;
            department.Name       = "UTDepartment";
            department.Rank       = random.Next(100000, 110000);
            department.SetNew();
            department.Id = department.Save();

            CostCenter costCenter = new CostCenter(connManager);

            costCenter.IdInergyLocation = inergyLocation.Id;
            costCenter.IdDepartment     = department.Id;
            costCenter.IsActive         = true;
            costCenter.Code             = "UTCode";
            costCenter.Name             = "UTName";
            costCenter.SetNew();
            costCenter.Id = costCenter.Save();

            HourlyRate hourlyRate = new HourlyRate(connManager);

            hourlyRate.IdCostCenter = costCenter.Id;
            hourlyRate.IdCurrency   = currency.Id;
            hourlyRate.YearMonth    = 199010;
            hourlyRate.Value        = 1.5M;
            hourlyRate.SetNew();
            hourlyRate.Id = hourlyRate.Save();

            hourlyRate.SetDeleted();
            hourlyRate.Save();

            costCenter.SetDeleted();
            costCenter.Save();

            department.SetDeleted();
            department.Save();

            inergyLocation.SetDeleted();
            inergyLocation.Save();

            BLTestUtils.DeleteCountryGLAccounts(country.Id, connManager);
            country.SetDeleted();
            country.Save();

            currency.SetDeleted();
            currency.Save();

            region.SetDeleted();
            region.Save();
        }