Наследование: System.Data.Objects.DataClasses.EntityObject
Пример #1
0
 /// <summary>
 /// Create a new WebCallback object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="owner">Initial value of the Owner property.</param>
 /// <param name="dialString1">Initial value of the DialString1 property.</param>
 /// <param name="dialString2">Initial value of the DialString2 property.</param>
 /// <param name="inserted">Initial value of the Inserted property.</param>
 public static WebCallback CreateWebCallback(global::System.String id, global::System.String owner, global::System.String dialString1, global::System.String dialString2, global::System.String inserted)
 {
     WebCallback webCallback = new WebCallback();
     webCallback.ID = id;
     webCallback.Owner = owner;
     webCallback.DialString1 = dialString1;
     webCallback.DialString2 = dialString2;
     webCallback.Inserted = inserted;
     return webCallback;
 }
Пример #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the WebCallbacks EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToWebCallbacks(WebCallback webCallback)
 {
     base.AddObject("WebCallbacks", webCallback);
 }
Пример #3
0
        public void UpdateWebCallback(string authUser, WebCallback webcallback)
        {
            if (authUser.IsNullOrBlank())
            {
                throw new ArgumentException("An authenticated user is required for UpdateWebCallback.");
            }

            using (var sipSorceryEntities = new SIPSorceryEntities())
            {
                var existingAccount = (from wc in sipSorceryEntities.WebCallbacks where wc.ID == webcallback.ID && wc.Owner == authUser.ToLower() select wc).FirstOrDefault();

                if (existingAccount == null)
                {
                    throw new ApplicationException("The web callback to update could not be found.");
                }
                else if (existingAccount.Owner != authUser.ToLower())
                {
                    throw new ApplicationException("Not authorised to update the web callback.");
                }

                logger.Debug("Updating web callback " + existingAccount.Description + " for " + existingAccount.Owner + ".");

                existingAccount.DialString1 = webcallback.DialString1;
                existingAccount.DialString2 = webcallback.DialString2;
                existingAccount.Description = webcallback.Description;

                sipSorceryEntities.SaveChanges();
            }
        }
Пример #4
0
        public void DeleteWebCallback(string authUser, WebCallback webCallback)
        {
            using (var sipSorceryEntities = new SIPSorceryEntities())
            {
                var existingAccount = (from wc in sipSorceryEntities.WebCallbacks where wc.ID == webCallback.ID && wc.Owner == authUser.ToLower() select wc).FirstOrDefault();

                if (existingAccount == null)
                {
                    throw new ApplicationException("The web callback to delete could not be found.");
                }
                else if (existingAccount.Owner != authUser.ToLower())
                {
                    throw new ApplicationException("Not authorised to delete the web callback.");
                }

                sipSorceryEntities.WebCallbacks.DeleteObject(existingAccount);
                sipSorceryEntities.SaveChanges();
            }
        }
Пример #5
0
        public void InsertWebCallback(string authUser, WebCallback webcallback)
        {
            if (authUser.IsNullOrBlank())
            {
                throw new ArgumentException("An authenticated user is required for InsertWebCallback.");
            }

            using (var sipSorceryEntities = new SIPSorceryEntities())
            {
                webcallback.ID = Guid.NewGuid().ToString();
                webcallback.Owner = authUser.ToLower();
                webcallback.Inserted = DateTimeOffset.UtcNow.ToString("o");

                sipSorceryEntities.WebCallbacks.AddObject(webcallback);
                sipSorceryEntities.SaveChanges();
            }
        }