Exemplo n.º 1
0
        public bool Commit(Setting entity)
        {
            using (var db = DbFactory.GetDataContext()) {
                var setting = new SystemSetting();
                if (entity.Id != null) {
                    setting = db.SystemSettings.First(x => x.SystemSettingId == entity.Id.Value);
                    if (setting == null)
                        throw new UnknownEntityException("Could not find System Setting with Id " + entity.Id.Value);
                }

                CopySettingEntityToSystemSetting(entity, setting);
                if (entity.Id == null)
                    db.SystemSettings.InsertOnSubmit(setting);

                db.SubmitChanges();
                entity.Inserted(setting.SystemSettingId);

                return true;
            }
        }
Exemplo n.º 2
0
 private Setting PopulateEntity(SystemSetting set)
 {
     return new Setting(set.SystemSettingId)
                {
                    Name = set.KeyName,
                    Value = set.KeyValue,
                    IsSystem = set.IsSystem
                };
 }
Exemplo n.º 3
0
 private void CopySettingEntityToSystemSetting(Setting setting, SystemSetting set)
 {
     set.KeyName = setting.Name;
      set.KeyValue = setting.Value;
      set.IsSystem = setting.IsSystem;
 }
Exemplo n.º 4
0
 partial void DeleteSystemSetting(SystemSetting instance);
Exemplo n.º 5
0
 partial void UpdateSystemSetting(SystemSetting instance);
Exemplo n.º 6
0
 partial void InsertSystemSetting(SystemSetting instance);