protected void Button1Click(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.CreateNewAd(1, 1, 1, "yahoo.com", 1, "../Advertiser/Ads/Ad1.gif", "hello ther", "keyword", 55, 50, 100, Convert.ToDateTime(DateTime.Now.ToString(CultureInfo.InvariantCulture)), Convert.ToDateTime(DateTime.Now.ToString(CultureInfo.InvariantCulture)), false, userID, 1, 1, 1, 256, "USA", 126, "Overland", null, null, "66203", 25, "Profession", Convert.ToDateTime(DateTime.Now.ToString(CultureInfo.InvariantCulture)), Helpers.Utility.GetAudienceAdID(), "AdName", 2,"US", Helpers.Utility.GetFlagPath(256), "5,15,20,74"); } } }
protected void SaveAd() { int y = GetTempAdID(); using (var context2 = new AdDatabaseModel.AdDatabaseEntities()) { var tempad = (from ad in context2.TempAds where ad.ID == y select ad).FirstOrDefault(); context2.CreateNewAd(tempad.SiteID, tempad.SectionID, tempad.PositionID, tempad.NavigateUrl, tempad.FormatID, tempad.ImageUrl, tempad.AlternateText, tempad.Keyword, tempad.Impressions, tempad.Width, tempad.Height, tempad.StartDate, tempad.EndDate , false, GetUserID(), tempad.LanguageID, tempad.GenderID, tempad.AgeRangeID, tempad.CountryID, tempad.CountryName, tempad.RegionID, tempad.RegionName, tempad.CityID, tempad.CityName, tempad.Zipcode, tempad.IndustryID, tempad.Profession, tempad.DateCreated, GetTempAdID(), tempad.AdName, tempad.AdTypeID, tempad.CountryCode, tempad.FlagPath, tempad.ProfessionID); } }