Exemplo n.º 1
0
 private void OnColumnsListViewItemCheck(object sender, ItemCheckEventArgs e)
 {
     if (!this._internalChange)
     {
         ColumnListViewItem item = (ColumnListViewItem) this._columnsListView.Items[e.Index];
         string key = this._tableListBox.Text + "." + item.Column.Name;
         if (e.CurrentValue == CheckState.Unchecked)
         {
             SetDefaultDialog form = new SetDefaultDialog(base.ServiceProvider);
             form.ColumnName = item.Column.Name;
             string defaultValue = item.Column.DefaultValue;
             if ((defaultValue != null) && (defaultValue.Length > 0))
             {
                 form.DefaultValue = defaultValue.Substring(1, defaultValue.Length - 2);
             }
             IUIService service = (IUIService) this.GetService(typeof(IUIService));
             if (service.ShowDialog(form) == DialogResult.OK)
             {
                 e.NewValue = CheckState.Checked;
                 this.Defaults[key] = form.DefaultValue;
                 this.IgnoreDefaults.Remove(key);
             }
             else
             {
                 e.NewValue = CheckState.Unchecked;
             }
         }
         else if (this.Defaults[key] is int)
         {
             e.NewValue = CheckState.Checked;
             ((IUIService) this.GetService(typeof(IUIService))).ShowMessage("You cannot set a default value for an identity column.", "Identity Column", MessageBoxButtons.OK);
         }
         else
         {
             this.Defaults.Remove(key);
             this.IgnoreDefaults[key] = string.Empty;
         }
     }
 }
Exemplo n.º 2
0
 private void OnColumnsListViewItemCheck(object sender, ItemCheckEventArgs e)
 {
     if (!this._internalChange)
     {
         ColumnListViewItem item = (ColumnListViewItem) this._columnsListView.Items[e.Index];
         string key = this._tableListBox.Text + "." + item.Column.Name;
         if (e.CurrentValue == CheckState.Unchecked)
         {
             SetDefaultDialog form = new SetDefaultDialog(base.ServiceProvider);
             string name = item.Column.Name;
             form.ColumnName = name;
             form.DefaultValue = '@' + name;
             IUIService service = (IUIService) this.GetService(typeof(IUIService));
             if (service.ShowDialog(form) == DialogResult.OK)
             {
                 e.NewValue = CheckState.Checked;
                 this.UpdateValues[key] = form.DefaultValue;
             }
             else
             {
                 e.NewValue = CheckState.Unchecked;
             }
         }
         else
         {
             this.UpdateValues.Remove(key);
         }
         this.UpdatePreview();
     }
 }