示例#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;
            }
        }
示例#2
0
 private Setting PopulateEntity(SystemSetting set)
 {
     return new Setting(set.SystemSettingId)
                {
                    Name = set.KeyName,
                    Value = set.KeyValue,
                    IsSystem = set.IsSystem
                };
 }
示例#3
0
 private void CopySettingEntityToSystemSetting(Setting setting, SystemSetting set)
 {
     set.KeyName = setting.Name;
      set.KeyValue = setting.Value;
      set.IsSystem = setting.IsSystem;
 }
示例#4
0
 partial void DeleteSystemSetting(SystemSetting instance);
示例#5
0
 partial void UpdateSystemSetting(SystemSetting instance);
示例#6
0
 partial void InsertSystemSetting(SystemSetting instance);