Example #1
0
 public static string InsertOrUpdateDomain(Domain domainDtls)
 {
     try
     {
         using (WebPresenceEntities _context = new WebPresenceEntities())
         {
             if (domainDtls.ID > 0)
             {
                 _context.Domains.Single(o => o.ID == domainDtls.ID);
                 _context.Domains.ApplyCurrentValues(domainDtls);
             }
             else
             {
                 _context.Domains.AddObject(domainDtls);
             }
             _context.SaveChanges();
             return domainDtls.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 Domains EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDomains(Domain domain)
 {
     base.AddObject("Domains", domain);
 }
 /// <summary>
 /// Create a new Domain object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="websiteName">Initial value of the WebsiteName property.</param>
 /// <param name="domainUrl">Initial value of the DomainUrl property.</param>
 /// <param name="keyWords">Initial value of the KeyWords property.</param>
 /// <param name="city">Initial value of the City property.</param>
 /// <param name="state">Initial value of the State property.</param>
 /// <param name="country">Initial value of the Country property.</param>
 /// <param name="isActive">Initial value of the IsActive property.</param>
 /// <param name="createdBy">Initial value of the CreatedBy property.</param>
 /// <param name="createdDate">Initial value of the CreatedDate property.</param>
 /// <param name="modifiedBy">Initial value of the ModifiedBy property.</param>
 /// <param name="modifiedDate">Initial value of the ModifiedDate property.</param>
 public static Domain CreateDomain(global::System.Int32 id, global::System.String websiteName, global::System.String domainUrl, global::System.String keyWords, global::System.String city, global::System.String state, global::System.String country, global::System.Boolean isActive, global::System.Int32 createdBy, global::System.DateTime createdDate, global::System.Int32 modifiedBy, global::System.DateTime modifiedDate)
 {
     Domain domain = new Domain();
     domain.ID = id;
     domain.WebsiteName = websiteName;
     domain.DomainUrl = domainUrl;
     domain.KeyWords = keyWords;
     domain.City = city;
     domain.State = state;
     domain.Country = country;
     domain.IsActive = isActive;
     domain.CreatedBy = createdBy;
     domain.CreatedDate = createdDate;
     domain.ModifiedBy = modifiedBy;
     domain.ModifiedDate = modifiedDate;
     return domain;
 }