public void GetAllInergyLocationsTest() { InergyLocation inergyLocation = new InergyLocation(connManager); DataSet ds = inergyLocation.GetAll(); Assert.AreEqual(8, ds.Tables[0].Columns.Count); }
public void InsertInergyLocationTest() { 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(); Assert.Greater(country.Id, 0); inergyLocation.SetDeleted(); inergyLocation.Save(); BLTestUtils.DeleteCountryGLAccounts(country.Id, connManager); country.SetDeleted(); country.Save(); currency.SetDeleted(); currency.Save(); region.SetDeleted(); region.Save(); }
private void PopulateControls() { #region Inergy Locations List InergyLocation inergyLocation = new InergyLocation(SessionManager.GetSessionValueNoRedirect((IndPopUpBasePage)this.Page, SessionStrings.CONNECTION_MANAGER)); DataSet dsInergyLocations = inergyLocation.GetAll(); lstInergyLogins.DataSource = dsInergyLocations; lstInergyLogins.DataMember = dsInergyLocations.Tables[0].ToString(); lstInergyLogins.DataValueField = "Id"; lstInergyLogins.DataTextField = "Name"; lstInergyLogins.DataBind(); LstDataSource = dsInergyLocations; #endregion Inergy Locations List #region Currency Combo //Currency currency = new Currency(SessionManager.GetSessionValueNoRedirect((IndPopUpBasePage)this.Page, SessionStrings.CONNECTION_MANAGER)); //DataSet dsCurrencies = currency.GetAll(); //cmbCurrency.DataSource = dsCurrencies; //cmbCurrency.DataMember = dsCurrencies.Tables[0].ToString(); //cmbCurrency.DataValueField = "Id"; //cmbCurrency.DataTextField = "Name"; //cmbCurrency.DataBind(); #endregion Currency Combo }
private void LoadInergyLocationsCombo() { cmbInergyLocation.Items.Clear(); cmbInergyLocation.Items.Add(new RadComboBoxItem("All", ApplicationConstants.INT_NULL_VALUE.ToString())); InergyLocation inergyLocation = new InergyLocation(SessionManager.GetConnectionManager(this)); int cmbSelectedValue = string.IsNullOrEmpty(cmbCountry.SelectedValue) ? ApplicationConstants.INT_NULL_VALUE : int.Parse(cmbCountry.SelectedValue); //if current user is with financial team then he is restricted to his country if (cmbSelectedValue == ApplicationConstants.INT_NULL_VALUE && currentUser.UserRole.Id == ApplicationConstants.ROLE_FINANCIAL_TEAM) { cmbSelectedValue = currentUser.IdCountry; } if (cmbSelectedValue != CountryAllValue) { inergyLocation.IdCountry = cmbSelectedValue; } DataSet ds = inergyLocation.SelectInergyLocation_Country(); cmbInergyLocation.DataSource = ds; cmbInergyLocation.DataTextField = "Name"; cmbInergyLocation.DataValueField = "Id"; cmbInergyLocation.DataBind(); cmbCountry.SelectedValue = cmbSelectedValue.ToString(); }
private string GetInergyCurrency(DataRow selectedRow) { InergyLocation inergyLocation = new InergyLocation(selectedRow, SessionManager.GetSessionValueNoRedirect((IndPopUpBasePage)this.Page, SessionStrings.CONNECTION_MANAGER)); return(inergyLocation.CurrencyName.ToString()); }
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(); }