Inheritance: System.Data.Objects.DataClasses.EntityObject
 /// <summary>
 /// Create a new DialPlanDataEntry object.
 /// </summary>
 /// <param name="dataOwner">Initial value of the DataOwner property.</param>
 /// <param name="dataKey">Initial value of the DataKey property.</param>
 /// <param name="dataValue">Initial value of the DataValue property.</param>
 public static DialPlanDataEntry CreateDialPlanDataEntry(global::System.String dataOwner, global::System.String dataKey, global::System.String dataValue)
 {
     DialPlanDataEntry dialPlanDataEntry = new DialPlanDataEntry();
     dialPlanDataEntry.DataOwner = dataOwner;
     dialPlanDataEntry.DataKey = dataKey;
     dialPlanDataEntry.DataValue = dataValue;
     return dialPlanDataEntry;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the DialPlanData EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToDialPlanData(DialPlanDataEntry dialPlanDataEntry)
 {
     base.AddObject("DialPlanData", dialPlanDataEntry);
 }
Esempio n. 3
0
        public void DBWrite(string authUsername, string key, string value)
        {
            using (var entities = new SIPSorceryEntities())
            {
                var existingEntry = entities.DialPlanData.Where(x => x.DataOwner == authUsername && x.DataKey == key).SingleOrDefault();

                if (existingEntry != null)
                {
                    existingEntry.DataValue = value;
                }
                else
                {
                    var newEntry = new DialPlanDataEntry() { DataOwner = authUsername, DataKey = key, DataValue = value };
                    entities.AddToDialPlanData(newEntry);
                }

                entities.SaveChanges();
            }
        }