private void saveButton_Click(object sender, EventArgs e) { switch (this.typeRod.Text) { case "Спінінгове": Spining spining = new Spining(); SaveCharacteristics(spining); spining.SpinningClas = valueOptionalParameter.Text; spining.ValueOptionalParameter = spining.SpinningClas; AddNewFishingRod(spining); break; case "Фідерне": Fiderni fiderni = new Fiderni(); SaveCharacteristics(fiderni); fiderni.FiderBuild = valueOptionalParameter.Text; fiderni.ValueOptionalParameter = fiderni.FiderBuild; AddNewFishingRod(fiderni); break; case "Поплавкове": Poplavkovi poplavkovi = new Poplavkovi(); SaveCharacteristics(poplavkovi); poplavkovi.TipsBuild = valueOptionalParameter.Text; poplavkovi.ValueOptionalParameter = poplavkovi.TipsBuild; AddNewFishingRod(poplavkovi); break; case "Махове": Makhovi makhovi = new Makhovi(); SaveCharacteristics(makhovi); makhovi.TipsBuild = valueOptionalParameter.Text; makhovi.ValueOptionalParameter = makhovi.TipsBuild; AddNewFishingRod(makhovi); break; case "Матчеве": Matchevy matchevy = new Matchevy(); SaveCharacteristics(matchevy); matchevy.TipsСonnection = valueOptionalParameter.Text; matchevy.ValueOptionalParameter = matchevy.TipsСonnection; AddNewFishingRod(matchevy); break; case "Зимове": Winter winter = new Winter(); SaveCharacteristics(winter); winter.TipsBuild = valueOptionalParameter.Text; winter.ValueOptionalParameter = winter.TipsBuild; AddNewFishingRod(winter); break; } this.Close(); }
private void SetCharacteristics(ProductPageExample productPage, int i) { productPage.name.Text = MainFishingRods[i].Name; productPage.brandName.Text = MainFishingRods[i].Brand; productPage.prupose.Text = MainFishingRods[i].Purpose; productPage.typeCoil.Text = MainFishingRods[i].Coil; productPage.description.Text = MainFishingRods[i].DescriptionValue; productPage.rodLenght.Text = Convert.ToString(MainFishingRods[i].Lenght); productPage.price.Text = Convert.ToString(MainFishingRods[i].Price); productPage.valueOptionalParameter.Text = MainFishingRods[i].ValueOptionalParameter; switch (MainFishingRods[i].GetTypeRoad()) { case "Спінінгове": Spining spining = new Spining(); productPage.typeRod.Text = spining.TypeRod; productPage.optionalParameter.Text = spining.SpinningClasName; break; case "Фідерне": Fiderni fiderni = new Fiderni(); productPage.typeRod.Text = fiderni.TypeRod; productPage.optionalParameter.Text = fiderni.FiderBuildName; break; case "Поплавкове": Poplavkovi poplavkovi = new Poplavkovi(); productPage.typeRod.Text = poplavkovi.TypeRod; productPage.optionalParameter.Text = poplavkovi.TipsBuildName; break; case "Махове": Makhovi makhovi = new Makhovi(); productPage.typeRod.Text = makhovi.TypeRod; productPage.optionalParameter.Text = makhovi.TipsBuildName; break; case "Матчеве": Matchevy matchevy = new Matchevy(); productPage.typeRod.Text = matchevy.TypeRod; productPage.optionalParameter.Text = matchevy.TipsСonnectionName; break; case "Зимове": Winter winter = new Winter(); productPage.typeRod.Text = winter.TypeRod; productPage.optionalParameter.Text = winter.TipsBuildName; break; } }