Click or drag to resize

ControllerDataGridDataItemClassSetViewBag Method

Puts values of objects:
NameDescription
DataGridViewPuts Data Grid View from object PageDataGrid
TempDataPuts data list for selection

Namespace:  SOWIWin.Helper
Assembly:  SOWIWin.Helper (in SOWIWin.Helper.dll) Version: 19.1.23.1 (19.1.23.622)
Syntax
Remarks
This method must override because has no code
Examples
This example puts object value of DataGridView (hides all standard fields)
/// <summary>
/// Puts Data Grid View for SOWI Win standard PageDataGrid
/// </summary>
/// <remarks>
/// Setting for events (object SOWIWin Helper <see cref="SOWIWin.Helper.PageDataGrid{DataItemClass}"/>):
/// <see cref="SOWIWin.Helper.PageDataGrid{DataItemClass}.OnSetColumnsDisplayIndex(object, EventArgs)"/>,
/// <see cref="SOWIWin.Helper.PageDataGrid{DataItemClass}.OnSetColumnsReadOnly(object, EventArgs)"/> and
/// <see cref="SOWIWin.Helper.PageDataGrid{DataItemClass}.OnSetColumnsVisibility(object, EventArgs)"/>
/// Puts properties (data object SOWI Data Management <see cref="SOWIData.Management.DataGrid"/>) :
/// <see cref="SOWIData.Management.DataGrid.DataFieldName"/> (identification),
/// <see cref="SOWIData.Management.DataGrid.WinListVisible"/> (column visibility),
/// <see cref="SOWIData.Management.DataGrid.Order"/> (column order) and
/// <see cref="SOWIData.Management.DataGrid.CanEdit"/> (column field edit or read only)
/// </remarks>
/// <seealso cref="SOWIWin.Helper.ControllerDataGrid{DataItemClass}"/>
/// <seealso cref="SOWIWin.Helper.PageDataGrid{DataItemClass}"/>
/// <seealso cref="SOWIWin.Helper.PageDataGrid{DataItemClass}.DataGridView"/>
public override void SetViewBag()
{
    int lOrder = 0;
    List<SOWIData.Management.DataGrid> lDataGridView = new List<SOWIData.Management.DataGrid>();
    lDataGridView.Add(new SOWIData.Management.DataGrid("ID", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("GUID", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("ClientID", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("Name", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("NameOriginalValue", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("Label", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("Description", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("DateTimeValue", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("Value", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("Text", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("Flag", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("Checked", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("Selection", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("ActionText", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("ActionDB", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("TaskText", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("Task", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("StatusText", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("Status", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("CreateDate", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("CreateUser", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("LastEditDate", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("LastEditUser", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("DeleteDate", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("DeleteUser", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("LastUser", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("Archive", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("Help", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("ColorUI", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("Database", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("ChangeTracker", lOrder++));
    lDataGridView.Add(new SOWIData.Management.DataGrid("Configuration", lOrder++));
    this.DataGridView = lDataGridView;
}
This example puts a selection list for field Name
/// <summary>
/// Set View Bag define Data Grid View
/// </summary>
public override void SetViewBag()
{
    #region --- DataGridView ---
    int lOrder = 0;
    List<SOWIData.Management.DataGrid> lDataGridView = new List<SOWIData.Management.DataGrid>();
    // ...
    lDataGridView.Add(new SOWIData.Management.DataGrid("Name", lOrder++, true, true)
    {
        ListName = "ListName"
    });
    // ...
    this.DataGridView = lDataGridView;

    #endregion

    #region --- ListName ---
    Dictionary<string, string> lListName = new Dictionary<string, string>();
    lListName.Add("Ja", "Ja");
    lListName.Add("Nein", "Nein");
    #endregion

    #region --- TempData ---
    this.TempData = new Dictionary<string, object>();
    this.TempData.Add("ListName", lListName);
    #endregion

}
This example puts a selection list from App
#region --- selection list ---
santesuisseApp.Register lAppRegister = new santesuisseApp.Register();
List<SOWIData.IDataStandard> lListRegister = lAppRegister.GetListStandard();
#endregion

#region --- TempData ---
this.TempData = new Dictionary<string, object>();
this.TempData.Add("ListRegister", lListRegister);
#endregion
This example implemented in App class and gives a selection list for DataGrid
/// <summary>
/// Gives data list only SOWI DataStandard fields
/// </summary>
/// <seealso cref="SOWIData.IDataStandard"/>
public List<SOWIData.IDataStandard> GetListStandard()
{
    return this.GetList().ToList<SOWIData.IDataStandard>();
}
See Also