Click or drag to resize

AppStandardDataItemClass Class

Stanndard SOWI App module handling with database connector
Inheritance Hierarchy
SystemObject
  SOWIData.DatabaseConnectorDataItemClass
    SOWIApp.FoundationAppStandardDataItemClass
      More...

Namespace:  SOWIApp.Foundation
Assembly:  SOWIApp.Foundation (in SOWIApp.Foundation.dll) Version: 19.1.23.1 (19.1.23.622)
Syntax
public abstract class AppStandard<DataItemClass> : Connector<DataItemClass>, 
	IAppStandard<DataItemClass>, IConnector<DataItemClass>, IAppController<DataItemClass>

Type Parameters

DataItemClass

[Missing <typeparam name="DataItemClass"/> documentation for "T:SOWIApp.Foundation.AppStandard`1"]

The AppStandardDataItemClass type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyAppName
AppName is Module name resp class name
Public propertyClientID
Gives client ID by user of the app used. Set of UserThisApp
Public propertyConnectionString
Gives database connection string of the app used
(Inherited from ConnectorDataItemClass.)
Public propertyCode exampleDataGridView
Gives translated standard DataGridView with this properties AppName, TableName, UserName and ClientID
Protected propertyDB
Database object. Sets with method SetDB.
(Inherited from ConnectorDataItemClass.)
Public propertyDictionaryUI
Gives Dictionary for UI.
Public propertyLanguageOut
Gives language for UI from User. Can't setting then set default DE
Public propertyNameUnchanged
Flag no change value in field Name Default: false
(Inherited from ConnectorDataItemClass.)
Public propertyNameUnique
Flag whether Name unique Default: false
(Inherited from ConnectorDataItemClass.)
Public propertyPermissions
Gives permissions by User and Module
Protected propertyProvider
Gives data provider type back.
(Inherited from ConnectorDataItemClass.)
Public propertyRecordStandard
Which data items read from database? All, active or archived records.
(Inherited from ConnectorDataItemClass.)
Public propertySortDirectionStandard
Standard sort direction by sort field for example method GeAll
(Inherited from ConnectorDataItemClass.)
Public propertySortFieldStandard
Standard sort field for example method GeAll
(Inherited from ConnectorDataItemClass.)
Public propertyTableName
usually TableName equal AppName
Public propertyToken
Session token, use for check permission and information for User name
Public propertyUserName
Gives user name of the app used
(Inherited from ConnectorDataItemClass.)
Public propertyUserThisApp
Gives user data item (SOWIData.Management.User) of the app used. The user is managed by UserName or set by constructor
Protected propertyXML
XML object. Sets with method SetDB
(Inherited from ConnectorDataItemClass.)
Top
Methods
  NameDescription
Public methodCount(Records)
Gives the count by all, active or archive data records
(Inherited from ConnectorDataItemClass.)
Public methodCount(String, Records)
Gives the count by all, active or archive data records and filtering by Name
(Inherited from ConnectorDataItemClass.)
Public methodCode exampleDelete(ListInt32)
Delete all data items
(Inherited from ConnectorDataItemClass.)
Public methodDelete(Int32)
Delete a data item - set Status = Delete (except XML provider)
(Inherited from ConnectorDataItemClass.)
Public methodDelete(String)
Delete data item by Name
(Inherited from ConnectorDataItemClass.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodExist(Int32)
Check exist data item by ID (hits can be multiple)
(Inherited from ConnectorDataItemClass.)
Public methodExist(String)
Check exist data item by Name (can be multiple)
(Inherited from ConnectorDataItemClass.)
Public methodExistOne
Check exist one data item by Name
(Inherited from ConnectorDataItemClass.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetAll
Get data list by standards value without parameter.
(Inherited from ConnectorDataItemClass.)
Public methodGetAll(Records)
Get data list by Records (all, active, archived)
(Inherited from ConnectorDataItemClass.)
Public methodGetAll(String, SortDirections)
Get data list details with sort parameters
(Inherited from ConnectorDataItemClass.)
Public methodGetAll(String, Operators, Object)
Get data list by search parameter.
(Inherited from ConnectorDataItemClass.)
Public methodGetAll(String, SortDirections, String, Operators, Object, Records)
Get data list with all parameters.
(Inherited from ConnectorDataItemClass.)
Public methodGetByID
Gives one data item by ID
(Inherited from ConnectorDataItemClass.)
Public methodGetByName
Data item search by field Name
(Inherited from ConnectorDataItemClass.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Protected methodCode exampleGetList
Gives raw data list and is basis for all data processing (example for method GetAll)
(Inherited from ConnectorDataItemClass.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodCode exampleGetView(ListViewConfig, DictionaryString, String)
Gives a list of data by settings of ListView Config. The list is divided into pages (paging).
Public methodCode exampleGetView(ListViewConfig, String, DictionaryString, String)
Data list configured by List View Config
Public methodImport(DataTable)
Data import from a data table
Public methodImport(String)
Data import from a CSV file. First row is column label.
Public methodImport(Stream, String, String)
Data import from a stream with CSV structure. First row is column label.
Protected methodCode exampleImportItem
Import a data item
Protected methodInitialize
Database setting for use module
Public methodInsert(ListDataItemClass)
Insert list of data items
(Inherited from ConnectorDataItemClass.)
Public methodInsert(DataItemClass)
Insert data item
(Inherited from ConnectorDataItemClass.)
Public methodInsertOrUpdateByName
If not exists data record by Name then call method Insert. If exists data record unique then call method Update. If more data records then trigger an exception DataFoundMoreAsOne
(Inherited from ConnectorDataItemClass.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOnDBActionDone
event for override
Protected methodOnDBActionPermission
Permission handling
Protected methodOnDBActionPrepare
Data prepare before database handling
Private methodOnDBActionPrepareApp
Set Client ID
Protected methodOnValidating
Validating for required fields and can override
Public methodPermissionCheck(CRUD)
Check Permission CRUD and Session Token of this App and User
Public methodPermissionCheck(CRUD)
Check Permission CRUD and Session Token of this App and User
Protected methodCode exampleSetDB
Sets database
(Inherited from ConnectorDataItemClass.)
Private methodSetUserThisApp
Setting object property UserThisApp (SOWIData.Management.User) by UserName
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUpdate(ListDataItemClass)
Data list update
(Inherited from ConnectorDataItemClass.)
Public methodUpload(String)
Data content upload - not implemented
Public methodUpload(DataItemClass, FileContent)
Save file data to data item. This method can be overwrite.
Public methodValidate
Validate data item
(Inherited from ConnectorDataItemClass.)
Private methodValidateEventArgData
Private methodValidateRequired
Validate with Data Grid View (Required)
Public methodWrite
Write a document. This not implemented.
Top
Fields
  NameDescription
Public fieldDBActionAfter
Triggered by methods Get*, Insert, Update and Delete
(Inherited from ConnectorDataItemClass.)
Public fieldDBActionBefore
Triggered by methods Get*, Insert, Update and Delete
(Inherited from ConnectorDataItemClass.)
Protected fieldDBActionDone
Triggered by methods Get*, Insert, Update and Delete
(Inherited from ConnectorDataItemClass.)
Protected fieldDBActionPermission
Triggered by methods Get*, Insert, Update and Delete
(Inherited from ConnectorDataItemClass.)
Protected fieldCode exampleDBActionPrepare
Triggered by methods Get*, Insert, Update and Delete
(Inherited from ConnectorDataItemClass.)
Protected fieldValidating
Triggered by method Validate
(Inherited from ConnectorDataItemClass.)
Top
Extension Methods
  NameDescription
Public Extension MethodCode exampleDatabaseIsChangedDataItemClass
Check is object pApp null, is parameter pConnectionString no equal to App property, is parameter pUserName no equal to App property
(Defined by Helper.)
Public Extension MethodGetObjectToBytes
Convert an object to byte array
(Defined by Extensions.)
Public Extension MethodIsNumber
Check is value a number
(Defined by Convert.)
Public Extension MethodToHTMLDisplay(DataGrid, TempDataDictionary)Overloaded. (Defined by Extensions.)
Public Extension MethodCode exampleToHTMLDisplay(String, DataGridDataTypes, String, String, String, String, TempDataDictionary)Overloaded.
Gives HTML code for display.
(Defined by Extensions.)
Public Extension MethodToHTMLEditor(DataGrid, TempDataDictionary, String)Overloaded. (Defined by Extensions.)
Public Extension MethodToHTMLEditor(String, DataGridDataTypes, String, String, String, TempDataDictionary, Boolean, String, DataPlacements, String, String)Overloaded.
Gives HTML code for Input field
(Defined by Extensions.)
Public Extension MethodCode exampleToHTMLHidden(String)Overloaded.
Gives HTML code for hidden data
(Defined by Extensions.)
Public Extension MethodToHTMLHidden(DataGrid)Overloaded.
Gives HTML code for hidden data
(Defined by Extensions.)
Public Extension MethodXMLWrite
Gives XML string from data item
(Defined by Helper.)
Top
Remarks
Examples
This example used the AppStandard class
public class QualiTemplate : SOWIApp.Foundation.AppStandard<SOWIData.App.QualiTemplate>
{
    /// <summary>
    /// Qualification template
    /// </summary>
    /// <param name="pToken">user session token</param>
    public QualiTemplate(Guid pToken) : base(pToken) { }

    /// <summary>
    /// Set database
    /// </summary>
    protected override void SetDB()
    {
        try
        {
            this.DB = new SOWIData.App.Database.Tables(this.ConnectionString);
            if (!this.DB.Database.Exists()) { throw new Exception("Database not exists!"); }
        }
        catch (Exception ex)
        {
            SIC.Protocol.Write(ref ex);
            throw ex;
        }
    }

    /// <summary>
    /// Gives raw data list and is basis for all data processing
    /// </summary>
    /// <returns>a data list with filter by Status ≠ Delete and Client ID</returns>
    protected override List<SOWIData.App.QualiTemplate> GetList()
    {
        try
        {
            var lDB = (SOWIData.App.Database.Tables)this.DB;
            string lStatus = SOWIData.Statuses.Delete.ToString();
            var lList = (from p in lDB.QualiTemplate
                         where (p.StatusText != lStatus) && (p.ClientID == this.ClientID)
                         select p).ToList();
            return lList;
        }
        catch (Exception ex)
        {
            SIC.Protocol.Write(ref ex);
            throw ex;
        }
    }

}
See Also
Inheritance Hierarchy