Beispiel #1
0
 public Guid Add(Setting entity)
 {
     using (var ctx = new OpenPOSDbEntities())
     {
         ctx.Settings.AddObject(entity);
         ctx.SaveChanges();
         return entity.Id;
     }
 }
Beispiel #2
0
        public void Update(Setting entity)
        {
            using (OpenPOSDbEntities ctx = new OpenPOSDbEntities())
            {
                try
                {

                    ctx.Settings.Attach(entity);
                    ctx.ObjectStateManager.ChangeObjectState(entity, System.Data.EntityState.Modified);

                    ctx.Settings.ApplyCurrentValues(entity);
                    ctx.SaveChanges();
                }
                catch (Exception ex)
                {
                    LogService.Error("Error while updating settings", ex);
                    throw ex;
                }
            }
        }
        void vm_NewTemplateNotice(object sender, SimpleMvvmToolkit.NotificationEventArgs<bool, Core.Model.Setting> e)
        {
            bool isDone = false;
            var vm = new Setting();
            var win = new NewSettingsWindow();
            win.DataContext = vm;
            win.btnSave.Click += (ss, ee) =>
            {
                isDone = true;
                win.Close();
                e.Completed(vm);
            };

            win.ShowDialog();

            if (!isDone)
            {
                e.Completed(null);
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the Settings EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSettings(Setting setting)
 {
     base.AddObject("Settings", setting);
 }
 /// <summary>
 /// Create a new Setting object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="status">Initial value of the Status property.</param>
 public static Setting CreateSetting(global::System.Guid id, global::System.String name, global::System.Boolean status)
 {
     Setting setting = new Setting();
     setting.Id = id;
     setting.Name = name;
     setting.Status = status;
     return setting;
 }