public ShipMethodMock() { Surcharge = 0; Taxable = false; ServiceCode = "AvaTaxShipMethodMock"; Provinces = new ProvinceCollection <IShipProvince>(); }
public ITaxMethod BuildEntity(TaxMethodDto dto) { var deserialized = JsonConvert.DeserializeObject <ProvinceCollection <TaxProvince> >(dto.ProvinceData); var provinces = new ProvinceCollection <ITaxProvince>(); foreach (var p in deserialized) { provinces.Add(p); } var countryTaxRate = new TaxMethod(dto.ProviderKey, dto.CountryCode) { Key = dto.Key, Name = dto.Name, PercentageTaxRate = dto.PercentageTaxRate, Provinces = provinces, ProductTaxMethod = dto.ProductTaxMethod, UpdateDate = dto.UpdateDate, CreateDate = dto.CreateDate }; countryTaxRate.ResetDirtyProperties(); return(countryTaxRate); }
public ProvinceCollection GetAllProvinces(String username_ad, String password_ad) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var custService = AsmRepository.AllServices.GetCustomersConfigurationService(authHeader); ProvinceCollection provinces = custService.GetProvinceByCountry(1); //IEnumerable<string> enumerable = (IEnumerable<string>)provinces; List <string> list = new List <string>(); //Provinces ok1 = new Provinces(); // Loop through List with foreach. foreach (var prime in provinces) { var a = prime.Id.ToString(); list.Add(a); var b = prime.Name.ToString(); list.Add(b); } //var provinces_listString = provinces.OrderBy(x => x.Id).Select(x => new Provinces { Id_nya = (int) x.Id, Name_nya = (string) x.Name }).ToList(); //var result = ((IEnumerable<string>)provinces).Cast<object>().ToList(); return(provinces); }
/// <summary>Creates a new <see cref="Power"/> instance. /// </summary> /// <param name="name">Name.</param> public Power(string name) { this.name = name; this.units = new UnitCollection(); this.ownedSupplyProvinces = new ProvinceCollection(); this.homeProvinces = new ProvinceCollection(); }
static void Main(string[] args) { try { //Show province collection ProvinceCollection provinces = CustomerRepository.GetProvince(); ConsolePrinter.PrintProvince(provinces); //convert input from the user int provinceNo = Convert.ToInt16(Console.ReadLine()); string province = provinces[provinceNo - 1].ToString(); Console.WriteLine("Customer listing for " + province + "\n"); //Show customer data filter by province CustomerCollection customers = CustomerRepository.GetCustomerByProvince(province); ConsolePrinter.PrintCustomerCollection(customers); Console.ReadLine(); } catch (SqlException ex) { Console.WriteLine($"Data Access Error\n\n{ex.Message}\n\n{ex.StackTrace}"); } catch (Exception ex) { Console.WriteLine($"Processing Error\n\n{ex.Message}\n\n{ex.StackTrace}"); } }
public void ProvinceCollectionCanAdd() { ProvinceCollection col = new ProvinceCollection(); col.Add(new Province(1)); col.Add(new Province(2)); Assert.That(col.Count(), Is.EqualTo(2)); }
public IShipMethod BuildEntity(ShipMethodDto dto) { var deserialized = JsonConvert.DeserializeObject <ProvinceCollection <ShipProvince> >(dto.ProvinceData); // TODO : fix this mapping var provinces = new ProvinceCollection <IShipProvince>(); foreach (var p in deserialized) { provinces.Add(p); } var shipMethod = new ShipMethod(dto.ProviderKey, dto.ShipCountryKey) { Key = dto.Key, Name = dto.Name, Surcharge = dto.Surcharge, ServiceCode = dto.ServiceCode, Taxable = dto.Taxable, Provinces = provinces, UpdateDate = dto.UpdateDate, CreateDate = dto.CreateDate }; shipMethod.ResetDirtyProperties(); return(shipMethod); }
public void ProvinceCollectionCanGet() { ProvinceCollection col = new ProvinceCollection(); col.Add(new Province(1)); col.Add(new Province(2)); Assert.That(col.Get(1).Id, Is.EqualTo(1)); }
public void ProvinceCollectionUniqueIds() { ProvinceCollection pc = new ProvinceCollection(); pc.Add(new SaveProvince(1)); Assert.Throws <ArgumentException>(() => pc.Add(new SaveProvince(1))); }
public ShipMethodMock() { Surcharge = 0; Taxable = false; ServiceCode = "AvaTaxShipMethodMock"; Provinces = new ProvinceCollection<IShipProvince>(); }
//Print provice to Console public static void PrintProvince(ProvinceCollection provinces) { Console.WriteLine("Select province filter:"); for (int i = 0; i < provinces.Count; i++) { Console.WriteLine($"\t{i+1}: {provinces[i]}"); } }
public void AddRecordToRepo(Province p) { if (p == null) { throw new ArgumentNullException("Error: The argument is Null"); } ProvinceCollection.Add(p); }
/// <summary> /// Maps changes made in the <see cref="FixedRateShipMethodDisplay"/> to the <see cref="IFixedRateShippingGatewayMethod"/> /// </summary> /// <param name="fixedRateShipMethodDisplay">The <see cref="FixedRateShipMethodDisplay"/> to map</param> /// <param name="destination">The <see cref="IFixedRateShippingGatewayMethod"/> to have changes mapped to</param> /// <returns>The updated <see cref="IFixedRateShippingGatewayMethod"/></returns> /// <remarks> /// /// Note: after calling this mapping, the changes are still not persisted to the database as the .Save() method is not called. /// /// * For testing you will have to use the static .Save(IGatewayProviderService ..., as MerchelloContext.Current will likely be null /// /// </remarks> internal static IFixedRateShippingGatewayMethod ToFixedRateShipMethod(this FixedRateShipMethodDisplay fixedRateShipMethodDisplay, IFixedRateShippingGatewayMethod destination) { // RUSTY HELP: Cannot assign to these properties. How should I do this mapping? // Shipmethod destination.ShipMethod.Name = fixedRateShipMethodDisplay.ShipMethod.Name; if (destination.ShipMethod.Provinces.Any() && fixedRateShipMethodDisplay.ShipMethod.Provinces.Any()) { var provinceCollection = new ProvinceCollection <IShipProvince>(); foreach (var province in fixedRateShipMethodDisplay.ShipMethod.Provinces) { provinceCollection.Add( new ShipProvince(province.Code, province.Name) { AllowShipping = province.AllowShipping, RateAdjustment = province.RateAdjustment, RateAdjustmentType = province.RateAdjustmentType } ); } destination.ShipMethod.Provinces = provinceCollection; } // Rate table var existingRows = fixedRateShipMethodDisplay.RateTable.Rows.Where(x => !x.Key.Equals(Guid.Empty)).ToArray(); foreach (var mapRow in existingRows) { var row = destination.RateTable.Rows.FirstOrDefault(x => x.Key == mapRow.Key); if (row != null) { row.Rate = mapRow.Rate; } } // remove existing rows that previously existed but were deleted in the UI var removers = destination.RateTable.Rows.Where( row => !row.Key.Equals(Guid.Empty) && existingRows.All(x => x.Key != row.Key && !x.Key.Equals(Guid.Empty))); foreach (var remove in removers) { destination.RateTable.DeleteRow(remove); } // add any new rows foreach (var newRow in fixedRateShipMethodDisplay.RateTable.Rows.Where(x => x.Key == Guid.Empty)) { destination.RateTable.AddRow(newRow.RangeLow, newRow.RangeHigh, newRow.Rate); } return(destination); }
internal ShipMethod(Guid providerKey, Guid shipCountryKey, ProvinceCollection<IShipProvince> shipProvinces) { Mandate.ParameterCondition(Guid.Empty != providerKey, "providerKey"); Mandate.ParameterCondition(Guid.Empty != shipCountryKey, "shipCountryKey"); Mandate.ParameterNotNull(shipProvinces, "provinces"); _providerKey = providerKey; _shipCountryKey = shipCountryKey; _shipProvinces = shipProvinces; }
/// <summary> /// Converts a collection of <see cref="IProvince"/> to a new collection of <see cref="ITaxProvince"/> /// </summary> /// <param name="provinces">A collection of <see cref="IProvince"/></param> /// <returns>A collection of <see cref="ITaxProvince"/></returns> public static ProvinceCollection<ITaxProvince> ToTaxProvinceCollection(this IEnumerable<IProvince> provinces) { var provinceCollection = new ProvinceCollection<ITaxProvince>(); foreach (var p in provinces) { provinceCollection.Add(new TaxProvince(p.Code, p.Name)); } return provinceCollection; }
/// <summary> /// Converts a collection of <see cref="IProvince"/> to a new collection of <see cref="ITaxProvince"/> /// </summary> /// <param name="provinces">A collection of <see cref="IProvince"/></param> /// <returns>A collection of <see cref="ITaxProvince"/></returns> public static ProvinceCollection <ITaxProvince> ToTaxProvinceCollection(this IEnumerable <IProvince> provinces) { var provinceCollection = new ProvinceCollection <ITaxProvince>(); foreach (var p in provinces) { provinceCollection.Add(new TaxProvince(p.Code, p.Name)); } return(provinceCollection); }
/// <summary> /// Maps changes made in the <see cref="FixedRateShipMethodDisplay"/> to the <see cref="IFixedRateShippingGatewayMethod"/> /// </summary> /// <param name="fixedRateShipMethodDisplay">The <see cref="FixedRateShipMethodDisplay"/> to map</param> /// <param name="destination">The <see cref="IFixedRateShippingGatewayMethod"/> to have changes mapped to</param> /// <returns>The updated <see cref="IFixedRateShippingGatewayMethod"/></returns> /// <remarks> /// /// Note: after calling this mapping, the changes are still not persisted to the database as the .Save() method is not called. /// /// * For testing you will have to use the static .Save(IGatewayProviderService ..., as MerchelloContext.Current will likely be null /// /// </remarks> internal static IFixedRateShippingGatewayMethod ToFixedRateShipMethod(this FixedRateShipMethodDisplay fixedRateShipMethodDisplay, IFixedRateShippingGatewayMethod destination) { // RUSTY HELP: Cannot assign to these properties. How should I do this mapping? // Shipmethod destination.ShipMethod.Name = fixedRateShipMethodDisplay.ShipMethod.Name; if (destination.ShipMethod.Provinces.Any() && fixedRateShipMethodDisplay.ShipMethod.Provinces.Any()) { var provinceCollection = new ProvinceCollection<IShipProvince>(); foreach (var province in fixedRateShipMethodDisplay.ShipMethod.Provinces) { provinceCollection.Add( new ShipProvince(province.Code, province.Name) { AllowShipping = province.AllowShipping, RateAdjustment = province.RateAdjustment, RateAdjustmentType = province.RateAdjustmentType } ); } destination.ShipMethod.Provinces = provinceCollection; } // Rate table var existingRows = fixedRateShipMethodDisplay.RateTable.Rows.Where(x => !x.Key.Equals(Guid.Empty)).ToArray(); foreach (var mapRow in existingRows) { var row = destination.RateTable.Rows.FirstOrDefault(x => x.Key == mapRow.Key); if (row != null) { row.Rate = mapRow.Rate; } } // remove existing rows that previously existed but were deleted in the UI var removers = destination.RateTable.Rows.Where( row => !row.Key.Equals(Guid.Empty) && existingRows.All(x => x.Key != row.Key && !x.Key.Equals(Guid.Empty))); foreach (var remove in removers) { destination.RateTable.DeleteRow(remove); } // add any new rows foreach (var newRow in fixedRateShipMethodDisplay.RateTable.Rows.Where(x => x.Key == Guid.Empty)) { destination.RateTable.AddRow(newRow.RangeLow, newRow.RangeHigh, newRow.Rate); } return destination; }
public static ProvinceCollection GetProvinces() { ProvinceCollection provinces; using (SqlConnection conn = new SqlConnection(connString)) { string query = $@"SELECT ProvinceId, Sort, Abbreviation, Name FROM {provinceTableName} ORDER BY Abbreviation"; using (SqlCommand cmd = new SqlCommand()) { cmd.CommandType = CommandType.Text; cmd.CommandText = query; cmd.Connection = conn; conn.Open(); provinces = new ProvinceCollection(); using (SqlDataReader reader = cmd.ExecuteReader()) { int provinceId; int sort; string abbreviation; string name = null; while (reader.Read()) { provinceId = (int)reader["ProvinceId"]; sort = (int)reader["Sort"]; abbreviation = reader["Abbreviation"] as string; if (!reader.IsDBNull(3)) { name = reader["Name"] as string; } provinces.Add(new Province { ProvinceId = provinceId, Sort = sort, Abbreviation = abbreviation, Name = name }); name = null; } } return(provinces); } } }
public void ProvinceCollectionGetCorrectOutOfOrder() { ProvinceCollection pc = new ProvinceCollection(); pc.Add(new SaveProvince(2)); pc.Add(new SaveProvince(3)); pc.Add(new SaveProvince(1)); CollectionAssert.AreEqual(new[] { 1, 2, 3 }, pc.Select(x => x.Id)); Assert.AreEqual(1, pc.Get(1).Id); Assert.AreEqual(2, pc.Get(2).Id); Assert.AreEqual(3, pc.Get(3).Id); }
public ProvinceCollection GetProvinceByCountryId(String username_ad, String password_ad, int id) { Authentication_class var_auth = new Authentication_class(); AuthenticationHeader authHeader = var_auth.getAuthHeader(username_ad, password_ad); AsmRepository.SetServiceLocationUrl(var_auth.var_service_location_url); var custService = AsmRepository.AllServices.GetCustomersConfigurationService(authHeader); ProvinceCollection provinces = custService.GetProvinceByCountry(id); //parameter id return(provinces); }
public void ProvinceCollectionGetCorrectGaps() { ProvinceCollection pc = new ProvinceCollection(); pc.Add(new SaveProvince(3)); pc.Add(new SaveProvince(5)); pc.Add(new SaveProvince(1)); CollectionAssert.AreEqual(new[] { 1, 3, 5 }, pc.Select(x => x.Id)); Assert.AreEqual(1, pc.Get(1).Id); Assert.AreEqual(3, pc.Get(3).Id); Assert.AreEqual(5, pc.Get(5).Id); }
public void ProvinceCollectionGetCorrectOutOfOrder() { ProvinceCollection pc = new ProvinceCollection(); pc.Add(new SaveProvince(2)); pc.Add(new SaveProvince(3)); pc.Add(new SaveProvince(1)); CollectionAssert.AreEqual(new[] { 1, 2, 3 }, pc.Select(x => x.Id)); Assert.AreEqual(1, pc.Get(1).Id); Assert.AreEqual(2, pc.Get(2).Id); Assert.AreEqual(3, pc.Get(3).Id); }
public void ProvinceCollectionGetCorrectGaps() { ProvinceCollection pc = new ProvinceCollection(); pc.Add(new SaveProvince(3)); pc.Add(new SaveProvince(5)); pc.Add(new SaveProvince(1)); CollectionAssert.AreEqual(new[] { 1, 3, 5 }, pc.Select(x => x.Id)); Assert.AreEqual(1, pc.Get(1).Id); Assert.AreEqual(3, pc.Get(3).Id); Assert.AreEqual(5, pc.Get(5).Id); }
/// <summary> /// Loads a collection of Province objects from the database. /// </summary> /// <returns>A collection containing all of the Province objects in the database.</returns> public static ProvinceCollection LoadCollection(string spName, SqlParameter[] parms) { ProvinceCollection result = new ProvinceCollection(); using (SqlDataReader reader = SqlHelper.Default.ExecuteReader(spName, parms)) { while (reader.Read()) { Province tmp = new Province(); tmp.LoadFromReader(reader); result.Add(tmp); } } return(result); }
private void ClientEditDialog_Load(object sender, EventArgs e) { provinces = ProvinceRepository.GetProvinces(); setBindings(); populateComboBox(); if (IsAddClient) // AddClient Dialog { maskedTextBoxClientCode.ReadOnly = false; } else // EditClient Dialog { selectProvince(); textBoxCompanyName.Select(); textBoxCompanyName.SelectAll(); } }
//get all province from customer database public static ProvinceCollection GetProvince() { ProvinceCollection customerProvince; //connect to database using (SqlConnection conn = new SqlConnection(connString)) { //query to retrieve Provice from Customer table string query = @"SELECT Province From Customer GROUP BY province WITH ROLLUP"; using (SqlCommand cmd = new SqlCommand()) { cmd.CommandType = CommandType.Text; cmd.CommandText = query; cmd.Connection = conn; conn.Open(); customerProvince = new ProvinceCollection(); //read data using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { string provinceName = null; if (!reader.IsDBNull(0)) { provinceName = reader["Province"] as string; } else { provinceName = "ALL"; } customerProvince.Add(new Province(provinceName)); provinceName = null; } } return(customerProvince); } } }
public void DeleteRecordFromRepo(int id) { if (id == 0) { throw new Exception("Record ID cannot be null"); } int index = 0; while (index < ProvinceCollection.Count) { if (ProvinceCollection[index].ProvinceID == id) { ProvinceCollection.RemoveAt(index); break; } index++; } }
/// <summary> /// Displays a list of provinces to select in a comboBox /// </summary> /// <param name="sender">the control/object to set</param> /// <param name="e">the event data to set</param> private void comboBoxProvinces_Click(object sender, EventArgs e) { ProvinceCollection provinces = ClientValidation.GetProvinces(); try { comboBoxProvinces.DataSource = provinces; comboBoxProvinces.DisplayMember = "Abbreviation"; comboBoxProvinces.ValueMember = "Abbreviation"; } catch (SqlException ex) { MessageBox.Show(ex.Message, "DB Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception ex) { MessageBox.Show(ex.Message, "Processing Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void CreateGatewayProviderData() { var extended = new ExtendedDataCollection(); // TODO - move this to a package action _database.Insert("merchGatewayProvider", "Key", new GatewayProviderDto() { Key = Constants.ProviderKeys.Shipping.FixedRateShippingProviderKey, Name = "Fixed Rate Shipping Provider", ProviderTfKey = EnumTypeFieldConverter.GatewayProvider.GetTypeField(GatewayProviderType.Shipping).TypeKey, ExtendedData = new ExtendedDataCollection().SerializeToXml(), EncryptExtendedData = false, TypeFullName = "Merchello.Core.Gateways.Shipping.FixedRate.FixedRateShippingGatewayProvider, Merchello.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", CreateDate = DateTime.Now, UpdateDate = DateTime.Now }); // add the everywhere else shipcountry _database.Insert("merchShipCountry", "Key", new ShipCountryDto() { Key = Guid.NewGuid(), CatalogKey = Constants.DefaultKeys.Warehouse.DefaultWarehouseCatalogKey, CountryCode = Constants.CountryCodes.EverywhereElse, Name = "Everywhere Else", CreateDate = DateTime.Now, UpdateDate = DateTime.Now }); // TODO - move this to a package action _database.Insert("merchGatewayProvider", "Key", new GatewayProviderDto() { Key = Constants.ProviderKeys.Taxation.FixedRateTaxationProviderKey, Name = "Fixed Rate Tax Provider", ProviderTfKey = EnumTypeFieldConverter.GatewayProvider.GetTypeField(GatewayProviderType.Taxation).TypeKey, ExtendedData = new ExtendedDataCollection().SerializeToXml(), EncryptExtendedData = false, TypeFullName = "Merchello.Core.Gateways.Taxation.FixedRate.FixedRateTaxationGatewayProvider, Merchello.Core, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null", CreateDate = DateTime.Now, UpdateDate = DateTime.Now }); var taxProvinces = new ProvinceCollection<ITaxProvince>(); var provinceData = JsonConvert.SerializeObject(taxProvinces); _database.Insert("merchTaxMethod", "Key", new TaxMethodDto() { Key = Guid.NewGuid(), CountryCode = Constants.CountryCodes.EverywhereElse, Name = "Everywhere Else", PercentageTaxRate = 0, ProviderKey = Constants.ProviderKeys.Taxation.FixedRateTaxationProviderKey, ProvinceData = provinceData, UpdateDate = DateTime.Now, CreateDate = DateTime.Now }); // TODO - move this to a package action _database.Insert("merchGatewayProvider", "Key", new GatewayProviderDto() { Key = Constants.ProviderKeys.Payment.CashPaymentProviderKey, Name = "Cash Payment Provider", ProviderTfKey = EnumTypeFieldConverter.GatewayProvider.GetTypeField(GatewayProviderType.Payment).TypeKey, ExtendedData = new ExtendedDataCollection().SerializeToXml(), EncryptExtendedData = false, TypeFullName = "Merchello.Core.Gateways.Payment.Cash.CashPaymentGatewayProvider, Merchello.Core, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null", CreateDate = DateTime.Now, UpdateDate = DateTime.Now }); _database.Insert("merchPaymentMethod", "Key", new PaymentMethodDto() { Key = Guid.NewGuid(), Name = "Cash", PaymentCode = "Cash", Description = "Cash Payment", ProviderKey = Constants.ProviderKeys.Payment.CashPaymentProviderKey, CreateDate = DateTime.Now, UpdateDate = DateTime.Now }); }
public void ProvinceCollectionEnsureIncrementalAdd() { ProvinceCollection col = new ProvinceCollection(); col.Add(new Province(1)); Assert.Throws<ApplicationException>(() => col.Add(new Province(3))); }
/// <summary>Creates a new <see cref="Route"/> instance, based on another <see cref="Route"/>. /// </summary> /// <param name="route">Route.</param> public Route(Route route) { Robustness.ValidateArgumentNotNull("route", route); this.route = new ProvinceCollection(route.route); }
/// <summary>Creates a new <see cref="Route"/> instance. /// </summary> /// <param name="province">Province.</param> public Route(Province province) { route = new ProvinceCollection(); Add(province); }
public static void OutputProvinces( string outputModName, ProvinceCollection provinces, Title.LandedTitles titles ) { // output provinces to files named after their de jure kingdoms var alreadyOutputtedProvinces = new HashSet <ulong>(); var deJureKingdoms = titles.Where( t => t.Rank == TitleRank.kingdom && t.DeJureVassals.Count > 0 ); foreach (var kingdom in deJureKingdoms) { var filePath = $"output/{outputModName}/history/provinces/{kingdom.Id}.txt"; using var historyOutput = new StreamWriter(filePath); foreach (var province in provinces) { if (kingdom.KingdomContainsProvince(province.Id)) { ProvinceOutputter.OutputProvince(historyOutput, province); alreadyOutputtedProvinces.Add(province.Id); } } } if (alreadyOutputtedProvinces.Count != provinces.Count) { var filePath = $"output/{outputModName}/history/provinces/onlyDeJureDuchy.txt"; using var historyOutput = new StreamWriter(filePath); var deJureDuchies = titles.Where( t => t.Rank == TitleRank.duchy && t.DeJureVassals.Count > 0 ); foreach (var duchy in deJureDuchies) { foreach (var province in provinces) { if (alreadyOutputtedProvinces.Contains(province.Id)) { continue; } if (duchy.DuchyContainsProvince(province.Id)) { historyOutput.WriteLine($"# {duchy.Id}"); ProvinceOutputter.OutputProvince(historyOutput, province); alreadyOutputtedProvinces.Add(province.Id); } } } } //create province mapping file var provinceMappingFilePath = $"output/{outputModName}/history/province_mapping/province_mapping.txt"; using var provinceMappingStream = File.OpenWrite(provinceMappingFilePath); using (var provinceMappingOutput = new StreamWriter(provinceMappingStream, System.Text.Encoding.UTF8)) { if (alreadyOutputtedProvinces.Count != provinces.Count) { foreach (var province in provinces) { if (alreadyOutputtedProvinces.Contains(province.Id)) { continue; } var baseProvId = province.BaseProvinceId; if (baseProvId is null) { Logger.Warn($"Leftover province {province.Id} has no base province id!"); } else { provinceMappingOutput.WriteLine($"{province.Id} = {baseProvId}"); alreadyOutputtedProvinces.Add(province.Id); } } } } if (alreadyOutputtedProvinces.Count != provinces.Count) { Logger.Error("Not all provinces were outputted!"); } }
private Route() { route = new ProvinceCollection(); }
public void ProvinceCollectionUniqueIds() { ProvinceCollection pc = new ProvinceCollection(); pc.Add(new SaveProvince(1)); Assert.Throws<ArgumentException>(() => pc.Add(new SaveProvince(1))); }
/// <summary> /// The create gateway provider settings data. /// </summary> private void CreateGatewayProviderSettingsData() { var extended = new ExtendedDataCollection(); // TODO - move this to a package action _database.Insert("merchGatewayProviderSettings", "Key", new GatewayProviderSettingsDto() { Key = Constants.ProviderKeys.Shipping.FixedRateShippingProviderKey, Name = "Fixed Rate Shipping Provider", ProviderTfKey = EnumTypeFieldConverter.GatewayProvider.GetTypeField(GatewayProviderType.Shipping).TypeKey, ExtendedData = new ExtendedDataCollection().SerializeToXml(), EncryptExtendedData = false, CreateDate = DateTime.Now, UpdateDate = DateTime.Now }); // add the everywhere else shipcountry _database.Insert("merchShipCountry", "Key", new ShipCountryDto() { Key = Guid.NewGuid(), CatalogKey = Constants.DefaultKeys.Warehouse.DefaultWarehouseCatalogKey, CountryCode = Constants.CountryCodes.EverywhereElse, Name = "Everywhere Else", CreateDate = DateTime.Now, UpdateDate = DateTime.Now }); // TODO - move this to a package action _database.Insert("merchGatewayProviderSettings", "Key", new GatewayProviderSettingsDto() { Key = Constants.ProviderKeys.Taxation.FixedRateTaxationProviderKey, Name = "Fixed Rate Tax Provider", ProviderTfKey = EnumTypeFieldConverter.GatewayProvider.GetTypeField(GatewayProviderType.Taxation).TypeKey, ExtendedData = new ExtendedDataCollection().SerializeToXml(), EncryptExtendedData = false, CreateDate = DateTime.Now, UpdateDate = DateTime.Now }); var taxProvinces = new ProvinceCollection <ITaxProvince>(); var provinceData = JsonConvert.SerializeObject(taxProvinces); _database.Insert("merchTaxMethod", "Key", new TaxMethodDto() { Key = Guid.NewGuid(), CountryCode = Constants.CountryCodes.EverywhereElse, Name = "Everywhere Else", PercentageTaxRate = 0, ProviderKey = Constants.ProviderKeys.Taxation.FixedRateTaxationProviderKey, ProvinceData = provinceData, UpdateDate = DateTime.Now, CreateDate = DateTime.Now }); // TODO - move this to a package action _database.Insert("merchGatewayProviderSettings", "Key", new GatewayProviderSettingsDto() { Key = Constants.ProviderKeys.Payment.CashPaymentProviderKey, Name = "Cash Payment Provider", ProviderTfKey = EnumTypeFieldConverter.GatewayProvider.GetTypeField(GatewayProviderType.Payment).TypeKey, ExtendedData = new ExtendedDataCollection().SerializeToXml(), EncryptExtendedData = false, CreateDate = DateTime.Now, UpdateDate = DateTime.Now }); _database.Insert("merchPaymentMethod", "Key", new PaymentMethodDto() { Key = Guid.NewGuid(), Name = "Cash", PaymentCode = "Cash", Description = "Cash Payment", ProviderKey = Constants.ProviderKeys.Payment.CashPaymentProviderKey, CreateDate = DateTime.Now, UpdateDate = DateTime.Now }); }
/// <summary>Creates a new <see cref="Map"/> instance. /// </summary> public Map() { this.provinces = new Dictionary<string, Province>(); this.supplyCenters = new ProvinceCollection(); }
public void LoadData() { if (ProvinceCollection != null) { ProvinceCollection.Add(new Province { ProvinceId = 1, ProvinceName = "ALBERTA", Parks = new List <Park> { new Park { ParkId = 1, ParkName = "Banff National Park", diff = 3 }, new Park { ParkId = 2, ParkName = "Jasper National Park", diff = 6 }, new Park { ParkId = 3, ParkName = "Waterton Lakes National Park", diff = 10 } }, SliderCollection = new List <Slidercontrol1> { new Slidercontrol1 { SliderId1 = 1, SliderName1 = 1 }, new Slidercontrol1 { SliderId1 = 2, SliderName1 = 2 }, new Slidercontrol1 { SliderId1 = 3, SliderName1 = 3 } } }); ProvinceCollection.Add(new Province { ProvinceId = 2, ProvinceName = "BRITISH COLUMBIA", Parks = new List <Park> { new Park { ParkId = 4, ParkName = "Glacier National Park" }, new Park { ParkId = 5, ParkName = "Kootenay National Park" }, new Park { ParkId = 6, ParkName = "Yoho National Park" } } }); ProvinceCollection.Add(new Province { ProvinceId = 3, ProvinceName = "MANITOBA", Parks = new List <Park> { new Park { ParkId = 7, ParkName = "Nopiming" }, new Park { ParkId = 77, ParkName = "Riding Mountain" }, new Park { ParkId = 546, ParkName = "Wapusk National Park" } } }); ProvinceCollection.Add(new Province { ProvinceId = 4, ProvinceName = "NEW BRUNSWICK", Parks = new List <Park> { new Park { ParkId = 7324, ParkName = "Fundy" }, new Park { ParkId = 77234234, ParkName = "Mount Carleton" }, new Park { ParkId = 542342346, ParkName = "Parlee Beach" } } }); ProvinceCollection.Add(new Province { ProvinceId = 5, ProvinceName = "NEWFOUNDLAND and LABRADOR", Parks = new List <Park> { new Park { ParkId = 7324324, ParkName = "Gros Morne" }, new Park { ParkId = 231, ParkName = "Terra Nova" }, new Park { ParkId = 23123, ParkName = "Western Brook" } } }); ProvinceCollection.Add(new Province { ProvinceId = 6, ProvinceName = "NOVA SCOTIA", Parks = new List <Park> { new Park { ParkId = 4535, ParkName = "Cape Breton" }, new Park { ParkId = 4543543, ParkName = "Kejimkujik" }, new Park { ParkId = 234234, ParkName = "Sable Island" } } }); ProvinceCollection.Add(new Province { ProvinceId = 7, ProvinceName = "ONTARIO", Parks = new List <Park> { new Park { ParkId = 756856, ParkName = "Bruce Peninsula" }, new Park { ParkId = 456, ParkName = "Point Pelee" }, new Park { ParkId = 56, ParkName = "Sandbanks" } } }); ProvinceCollection.Add(new Province { ProvinceId = 8, ProvinceName = "PRINCE EDWARD ISLAND", Parks = new List <Park> { new Park { ParkId = 345435, ParkName = "Cabot Beach" }, new Park { ParkId = 345435, ParkName = "Northumberland" }, new Park { ParkId = 7868, ParkName = "Union Corner" } } }); ProvinceCollection.Add(new Province { ProvinceId = 9, ProvinceName = "QUEBEC", Parks = new List <Park> { new Park { ParkId = 435345, ParkName = "Hautes-Gorges" }, new Park { ParkId = 4534543, ParkName = "Jacques Cartier" }, new Park { ParkId = 435, ParkName = "Gaspesie" } } }); ProvinceCollection.Add(new Province { ProvinceId = 10, ProvinceName = "SASCATCHEWAN", Parks = new List <Park> { new Park { ParkId = 345, ParkName = "Grasslands" }, new Park { ParkId = 34543543, ParkName = "Meadow Lake" }, new Park { ParkId = 34534, ParkName = "Prince Albert" } } }); ProvinceCollection.Add(new Province { ProvinceId = 11, ProvinceName = "NORTHWEST TERRITORIES", Parks = new List <Park> { new Park { ParkId = 456456, ParkName = "Nahanni" }, new Park { ParkId = 56, ParkName = "Grand Teton" }, new Park { ParkId = 456456765, ParkName = "Olympic" } } }); ProvinceCollection.Add(new Province { ProvinceId = 12, ProvinceName = "NUNAVUT", Parks = new List <Park> { new Park { ParkId = 123213, ParkName = "Auyuittuq" }, new Park { ParkId = 324324, ParkName = "Quttinirpaaq" }, new Park { ParkId = 3434, ParkName = "Ukkusiksalik " } } }); ProvinceCollection.Add(new Province { ProvinceId = 13, ProvinceName = "YUKON", Parks = new List <Park> { new Park { ParkId = 1234214, ParkName = "Ivvavik " }, new Park { ParkId = 34343, ParkName = "Kluane" }, new Park { ParkId = 34342, ParkName = "Vuntut" } } }); } }
public List <Province> GetAllProvinces() { return(ProvinceCollection.ToList()); }
public Province GetProvince(int provinceID) { return(ProvinceCollection.FirstOrDefault(n => n.ProvinceID == provinceID)); }
/// <summary>Creates a new <see cref="Province"/> instance. /// </summary> /// <param name="name">Name.</param> /// <param name="type">Type.</param> public Province(string name, ProvinceType type) { this.name = name; this.type = type; this.locations = new LocationCollection(); this.adjacentProvinces = new ProvinceCollection(); }