我想優化下面寫的代碼,如果你有答案請快速回復我,在這段代碼中我想提出不同的條件並在每個條件下返回不同的url如果有可能與優化的方式,然後回答我:我該如何優化asp.net的代碼
if (Offer1_Rb_Yes.Checked == true || DropDownList1.SelectedIndex > 0)
{
int offerid = MyOffers[0].OfferId;
DAL.offers Offer = new DAL.offers();
Offer = obj.GetOffer(offerid);
if (Offer.CampId == "WINE-MAKERS-CHOICE")
{
url1 = url1 + "WINE-MAKERS-CHOICE&sid=TPF34" + "&email=" + Email + "&firstname=" + FirstName + "&lastname=" + LastName + "&dob=" + DOB + "&county=" + State + "&postcode=" + PostCode + "&phone1=" + Phone1 + "&c1=" + Gender;
}
else if (Offer.CampId == "LETS-INSURE-CA")
{
url1 = url1 + "LETS-INSURE-CA&sid=TPF34" + "&email=" + Email + "&firstname=" + FirstName + "&lastname=" + LastName + "&dob=" + DOB + "&county=" + State + "&postcode=" + PostCode + "&phone1=" + Phone1 + "&c1=" + Age;
}
else if (Offer.CampId == "SOLAR-BROKER")
{
url1 = url1 + "SOLAR-BROKER&sid=TPF34" + "&email=" + Email + "&firstname=" + FirstName + "&lastname=" + LastName + "&dob=" + DOB + "&county=" + State + "&postcode=" + PostCode + "&phone1=" + Phone1 + "&c1=" + Age;
}
else if (Offer.CampId == "WENATEX-AU")
{
url1 = url1 + "WENATEX-AU&sid=TPF34" + "&email=" + Email + "&firstname=" + FirstName + "&lastname=" + LastName + "&dob=" + DOB + "&street1=" + street1 + "&towncity=" + suburb + "&county=" + State + "&postcode=" + PostCode + "&phone1=" + Phone1 + "&source=" + Source;
}
else if (Offer.CampId == "MODERN-SOLAR-COMP")
{
url1 = url1 + "MODERN-SOLAR-COMP&sid=TPF34" + "&email=" + Email + "&firstname=" + FirstName + "&lastname=" + LastName + "&dob=" + DOB + "&street1=" + street1 + "&towncity=" + suburb + "&county=" + State + "&postcode=" + PostCode + "&phone1=" + Phone1 + "&phone2=" + Phone2 + "&gender=" + Gender + "&solar_pv=" + Solar_pv;
}
else if (Offer.CampId == "CAREERS-AUSTRALIA-3")
{
url1 = url1 + "CAREERS-AUSTRALIA-3&sid=TPF34" + "&firstname=" + FirstName + "&lastname=" + LastName + "&county=" + State + "&postcode=" + PostCode + "&phone1=" + Phone1;
}
else if (Offer.CampId == "GOOD-LIFE")
{
url1 = url1 + "GOOD-LIFE&sid=TPF34" + "&email=" + Email + "&firstname=" + FirstName + "&lastname=" + LastName + "&postcode=" + PostCode + "&phone1=" + Phone1;
}
else if (Offer.CampId == "GRYPHON-SOLAR")
{
url1 = url1 + "GRYPHON-SOLAR&sid=TPF34" + "&email=" + Email + "&firstname=" + FirstName + "&lastname=" + LastName + "&county=VIC&postcode=" + PostCode + "&phone1=" + Phone1 + "&source=" + Source + "&age=" + Age;
}
else if (Offer.CampId == "GRYPHON-SOLAR-WA")
{
url1 = url1 + "GRYPHON-SOLAR-WA&sid=TPF34" + "&email=" + Email + "&firstname=" + FirstName + "&lastname=" + LastName + "&county=WA&postcode=" + PostCode + "&phone1=" + Phone1 + "&source=" + Source + "&age=" + Age;
}
else if (Offer.CampId == "ACQUIRE-LEARNING")
{
url1 = url1 + "ACQUIRE-LEARNING&sid=TPF34" + "&email=" + Email + "&firstname=" + FirstName + "&lastname=" + LastName + "&county=" + State + "&postcode=" + PostCode + "&phone1=" + Phone1 + "&industry=" + Industry;
}
else if (Offer.CampId == "KOGAN")
{
url1 = url1 + "KOGAN&sid=TPF34" + "&email=" + Email + "&firstname=" + FirstName + "&lastname=" + LastName + "&dob=" + DOB + "&towncity=" + suburb + "&county=" + State + "&postcode=" + PostCode + "&phone1=" + Phone1 + "&ipaddress=" + ipaddress;
}
}
那麼你需要張貼這個問題** [這裏](HTTP://codereview.stackexchange .com /)** –