public static string InsertOrUpdateDomainConfigure(DomainConfigure domainConfigure) { try { using (WebPresenceEntities _context = new WebPresenceEntities()) { if (domainConfigure.Id > 0) { _context.DomainConfigures.Single(o => o.Id == domainConfigure.Id); _context.DomainConfigures.ApplyCurrentValues(domainConfigure); } else { _context.DomainConfigures.AddObject(domainConfigure); } _context.SaveChanges(); return domainConfigure.Id.ToString(); } } catch (Exception ex) { throw ex; } }
protected void btnsave_Click(object sender, EventArgs e) { if (Page.IsValid) { using (WebPresenceEntities _context = new WebPresenceEntities()) { try { Domain dom = new Domain(); DomainConfigure domconfg = new DomainConfigure(); dom.WebsiteName = txtwebname.Text; dom.DomainUrl = txtWebAddress.Text; dom.KeyWords = txtKeywords.Text; dom.Country = txtLocation.Text; dom.City = txtCity.Text; dom.State = txtState.Text; dom.IsActive = true; dom.CreatedDate = CommonClass.CurrentTime(); dom.CreatedBy = 2; dom.ModifiedBy = 2; dom.ModifiedDate = CommonClass.CurrentTime(); string id = DomainManager.InsertOrUpdateDomain(dom); if (Convert.ToInt32(id) > 0) { domconfg.DomainId = Convert.ToInt32(id); domconfg.Advertising = false; domconfg.AdvertisingToken = ""; domconfg.Traffic = false; domconfg.TrafficToken = ""; domconfg.Facebook = false; domconfg.FacebookToken = ""; domconfg.YouTube = false; domconfg.YoutubeToken = ""; domconfg.Twitter = false; domconfg.TwitterToken = ""; domconfg.Conversions = false; domconfg.ConversionsToken = ""; domconfg.CallTracking = false; domconfg.CallTrackingToken = ""; domconfg.CreatedDate = CommonClass.CurrentTime(); domconfg.CreatedBy = 2; domconfg.IsDeleted = false; domconfg.ModifiedDate = CommonClass.CurrentTime(); string ID = DomainManager.InsertOrUpdateDomainConfigure(domconfg); if (Convert.ToInt32(ID) > 0) { } else { } } } catch (Exception ex) { throw ex; } } } }
/// <summary> /// Deprecated Method for adding a new object to the DomainConfigures EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToDomainConfigures(DomainConfigure domainConfigure) { base.AddObject("DomainConfigures", domainConfigure); }
/// <summary> /// Create a new DomainConfigure object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="domainId">Initial value of the DomainId property.</param> /// <param name="advertising">Initial value of the Advertising property.</param> /// <param name="advertisingToken">Initial value of the AdvertisingToken property.</param> /// <param name="facebook">Initial value of the Facebook property.</param> /// <param name="facebookToken">Initial value of the FacebookToken property.</param> /// <param name="twitter">Initial value of the Twitter property.</param> /// <param name="twitterToken">Initial value of the TwitterToken property.</param> /// <param name="youTube">Initial value of the YouTube property.</param> /// <param name="youtubeToken">Initial value of the YoutubeToken property.</param> /// <param name="traffic">Initial value of the Traffic property.</param> /// <param name="trafficToken">Initial value of the TrafficToken property.</param> /// <param name="conversions">Initial value of the Conversions property.</param> /// <param name="conversionsToken">Initial value of the ConversionsToken property.</param> /// <param name="callTracking">Initial value of the CallTracking property.</param> /// <param name="callTrackingToken">Initial value of the CallTrackingToken property.</param> /// <param name="isDeleted">Initial value of the IsDeleted property.</param> /// <param name="createdDate">Initial value of the CreatedDate property.</param> /// <param name="createdBy">Initial value of the CreatedBy property.</param> /// <param name="modifiedDate">Initial value of the ModifiedDate property.</param> public static DomainConfigure CreateDomainConfigure(global::System.Int32 id, global::System.Int32 domainId, global::System.Boolean advertising, global::System.String advertisingToken, global::System.Boolean facebook, global::System.String facebookToken, global::System.Boolean twitter, global::System.String twitterToken, global::System.Boolean youTube, global::System.String youtubeToken, global::System.Boolean traffic, global::System.String trafficToken, global::System.Boolean conversions, global::System.String conversionsToken, global::System.Boolean callTracking, global::System.String callTrackingToken, global::System.Boolean isDeleted, global::System.DateTime createdDate, global::System.Int32 createdBy, global::System.DateTime modifiedDate) { DomainConfigure domainConfigure = new DomainConfigure(); domainConfigure.Id = id; domainConfigure.DomainId = domainId; domainConfigure.Advertising = advertising; domainConfigure.AdvertisingToken = advertisingToken; domainConfigure.Facebook = facebook; domainConfigure.FacebookToken = facebookToken; domainConfigure.Twitter = twitter; domainConfigure.TwitterToken = twitterToken; domainConfigure.YouTube = youTube; domainConfigure.YoutubeToken = youtubeToken; domainConfigure.Traffic = traffic; domainConfigure.TrafficToken = trafficToken; domainConfigure.Conversions = conversions; domainConfigure.ConversionsToken = conversionsToken; domainConfigure.CallTracking = callTracking; domainConfigure.CallTrackingToken = callTrackingToken; domainConfigure.IsDeleted = isDeleted; domainConfigure.CreatedDate = createdDate; domainConfigure.CreatedBy = createdBy; domainConfigure.ModifiedDate = modifiedDate; return domainConfigure; }