protected void Button2Click(object sender, EventArgs e) { MembershipUser user = Membership.GetUser(); if (user != null) { var userKey = user.ProviderUserKey; if (userKey != null) { var userID = (Guid) userKey; using (var context2 = new AdDatabaseModel.AdDatabaseEntities()) context2.AddTempAd(Helpers.Utility.GetTempAdID(), 2, 3, 4, "Http://www.google.com", 3, "imageurl", "text", "Home", 200, 300, 100, Convert.ToDateTime(DateTime.Now.ToString(CultureInfo.InvariantCulture)), Convert.ToDateTime(DateTime.Now.ToString(CultureInfo.InvariantCulture)), userID, 1, 2, 3,256, "usa",128,"OverlandPark",null,null, "zipcode", 300, 4, "Painter,Mechanic,doctor,eletrician", Convert.ToDateTime(DateTime.Now.ToString(CultureInfo.InvariantCulture)), "adName", 3, "US", Helpers.Utility.GetFlagPath(256), "5,15,20,74"); //context2.AddTempAd( 2, "facebook.com", 2, 3, "http://www.google.com", 2, "imageurl", // "alternativetext", "keyword", 50, 200, 700, // Convert.ToDateTime(DateTime.Now.ToString(CultureInfo.InvariantCulture)) // , Convert.ToDateTime(DateTime.Now.ToString(CultureInfo.InvariantCulture)), // false, // userID, 1, 1, 1, "country", 200, "code", "region", "city", "zipcode", 2, 4, // "Painter,Electrician,doctor,Mecanic", // Convert.ToDateTime(DateTime.Now.ToString(CultureInfo.InvariantCulture)) // , 5, "adName"); } } }
protected void InsertNewTempAd(Guid userID) { ////////////////////Currently; providing regular compaing:Type 1///////////////// //If sponsorship arise in the feature, then will need to implement other adType const int adTypeID = 1; _currentTempID = Helpers.Utility.GetTempAdID(); if (AsyncFileUpload1 != null) { var adPath = "Ads/" + User.Identity.Name + "/" + AsyncFileUpload1.FileName.ToString(CultureInfo.InvariantCulture); using (var context2 = new AdDatabaseModel.AdDatabaseEntities()) context2.AddTempAd(_currentTempID, SiteDropDownList.SelectedIndex, SectionDropDownList.SelectedIndex, Convert.ToInt32(Helpers.Utility.GetPosition(PositionDropDownList.SelectedIndex)), GetDestinationURL(), FormatDropDownList.SelectedIndex, adPath, AlternativeText(), GetKeywordString(), Helpers.Utility.GetImpression(SpecialityListBox1, SpecialityListBox2, SpecialityListBox3), GetCreativeWidth(FormatDropDownList.SelectedIndex), GetCreativeHeight(FormatDropDownList.SelectedIndex), GetStartDate(), GetEndDate(), userID, LanguageDropDownList.SelectedIndex, GenderDropDownList.SelectedIndex, AgeDropDownList.SelectedIndex, Convert.ToInt32(CountryDropDownList.SelectedValue), CountryDropDownList.SelectedItem.Text, Convert.ToInt32(RegionsDropDownList.SelectedValue), RegionsDropDownList.SelectedItem.Text, CitiesDropDownList.SelectedIndex, GetCityName(), Helpers.Utility.GetZipcode(Convert.ToInt32(CountryDropDownList.SelectedValue), Convert.ToInt32(RegionsDropDownList.SelectedValue), GetCityName(), ZipcodeTextBox.Text), IndustryDropDownList.SelectedIndex, Helpers.Utility.GetNumberOfProfession(SpecialityListBox1, SpecialityListBox2, SpecialityListBox3), Helpers.Utility.GetProfession( SpecialityListBox1, SpecialityListBox2, SpecialityListBox3), Convert.ToDateTime(DateTime.Now.ToString(CultureInfo.InvariantCulture)), NewCampaingTextBox.Text, adTypeID, Helpers.Utility.GetCountryCode(Convert.ToInt32(CountryDropDownList.SelectedValue)), Helpers.Utility.GetFlagPath(Convert.ToInt32(CountryDropDownList.SelectedValue)), Helpers.Utility.GetProfessionID(SpecialityListBox1, SpecialityListBox2, SpecialityListBox3)); } }