Implement data dictionary in the invoicing Project

Source: Internet
Author: User

Create a dictionary

Bind dictionary content to ComboBox

Cbocategory. initializevaluelistfromdictionary ("databasescript ");

The effect is as follows:

When designing the Windows component ComboBox, the existence of the data dictionary was not taken into account, and the implementation of initializevaluelistfromdictionary was not implemented.

With the expansion of the system, the data dictionary function is implemented in the business system. However, the ComboBox component still does not know anything about the data dictionary. That is, the implementation of ComboBox cannot depend on the data dictionary function, which is not conducive to expansion and maintenance.

Do not changeCodeTo add a new method, you can use the extension method.

Public static class extensionhelper

{

Public static void initializevaluelistfromdictionary (this ComboBox combox, string dictionarycode)

{

}

}

The data dictionary function is implemented.

Continue to apply data dictionaries to employee information to bind Provinces

Cboproverince. initializevaluelistfromdictionary ("Province ");

The SQL script is as follows:

If object_id ('dbo. gbdich ') is not null

Drop table DBO. gbdich

Go

Create Table DBO. gbdich

(

Name nvarchar (50) not null,

Description nvarchar (200) null,

Suincluded bit null,

Constraint pk_gbdich primary key (name)

)

Goif object_id ('dbo. gbdicd') is not null

Drop table DBO. gbdicd

Go

Create Table DBO. gbdicd

(

Code_name nvarchar (50) not null,

Name nvarchar (50) null,

Description nvarchar (200) null,

Suincluded bit null,

Constraint pk_gbdicd primary key (code_name ),

Constraint fk_gbdicd_gbdicd foreign key (name) References DBO. gbdich (name)

)

Go

 

Unchanged data dictionary changeless

There is a type of data dictionary, and its value will not change. For example, there are only three types of message commands: Receive, send, and reply.

Public Enum messageflowtype

{

Outgoing = 0,

Incoming = 1,

Reply = 2,

}

For example, a report data source is defined as an application database, framework database, or custom database.

Public Enum reportdatasource

{

Companydatabase = 0,

Systemdatabase = 1,

Customdatabase = 2,

}

This data dictionary is directly compiledProgramCentralized, and the binding issue should be considered when designing the ComboBox component

Public void initializevaluelistfromenum (type enumtype, bool allowempty ){}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.