コード例 #1
0
 private void SelectItemInDropDown(DropDownList list, CommonSettingsManager.SettingsNames value)
 {
     SettingsDto.CommonSettingsRow[] rows = (SettingsDto.CommonSettingsRow[])_SettingsDto.CommonSettings.Select(String.Format("Name='{0}'", value));
     if (rows != null && rows.Length > 0)
     {
         ManagementHelper.SelectListItemIgnoreCase(list, rows[0].Value);
     }
 }
コード例 #2
0
        private void FillItemFromDropDown(DropDownList list, CommonSettingsManager.SettingsNames setting, ref SettingsDto dto)
        {
            SettingsDto.CommonSettingsRow[] rows = (SettingsDto.CommonSettingsRow[])dto.CommonSettings.Select(String.Format("Name='{0}'", setting));
            if (rows != null && rows.Length > 0)
            {
                rows[0].Value = list.SelectedValue;
            }
            else
            {
                // create new row
                SettingsDto.CommonSettingsRow row = dto.CommonSettings.NewCommonSettingsRow();
                row.ApplicationId = AppContext.Current.ApplicationId;
                row.Name          = setting.ToString();
                row.Value         = list.SelectedValue;

                if (row.RowState == DataRowState.Detached)
                {
                    dto.CommonSettings.Rows.Add(row);
                }
            }
        }