コード例 #1
0
        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 HttpResponseMessage Save([FromBody] CostCenter c)
 {
     if (c.ID > 0)
     {
         return(Request.CreateResponse(HttpStatusCode.OK, c.Update()));
     }
     else
     {
         return(Request.CreateResponse(HttpStatusCode.OK, c.Save()));
     }
 }
コード例 #3
0
        public void Save()
        {
            CostCenterProperties[] costcenter = new CostCenterProperties[1];
            costcenter[0] = new CostCenterProperties()
            {
                InteropID        = InteropID,
                CompanyInteropID = CompanyInteropID,
                Name             = Name,
                Description      = Description
            };
            var error = _costcenter.Save(costcenter, this.SharedSecret);

            if (error.Length > 0)
            {
                throw new Exception(error[0].InteropID + " failed: " + error[0].ErrorMessage);
            }
        }
コード例 #4
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();
        }