Step by step, we will teach you how to use the agileeas. net base class library for application development-winform application-demonstration of using reports to build the UI-warehouse receiving service query module

Source: Internet
Author: User
Review and description

We have summarized or demonstrated the "commodity Dictionary", "commodity warehouse receiving", and "commodity inventory query" modules in detail, these modules involve simple data addition, deletion, and repair, as well as complex business processing transactions and business layer extraction, common query and report printing technologies and basic dictionary cache query technologies in MIS systems.

Content

Today, we will use another technology to implement another module "commodity warehouse receiving query". What technology will we use? In fact, it is also a very simple technology. We will use the report Technology in building UI applications, that is, we use the print preview report Technology in the subject UI of the Business query application, as shown in:

Manufacturing Interface

First, we need to add a winform productinqueryform Drag Control in the UI project to achieve the following results:

Here, we need to note that a report preview control should be placed on the interface. The report preview control is composed of EAS. Report. ControlsProgramSet bearer, type EAS. Report. Controls. rdlreportviewer, print preview control toolbar display position is determined by the attribute toolboxdockstyle, we set to dockstyle. Bottom.

Process Query

Next we will compile the query-relatedCodeFirst, add the following code to the iproductinlist file of iproductinlist in the data layer interface project:

 
1:/// <Summary>
 
2:///Table Interface iproductinlist (product warehouse receiving ).
 
3:/// </Summary>
 
4:Public partial InterfaceIproductinlist
 
5:{
6:/// <Summary>
 
7:///Query warehouse receiving details based on the warehouse receiving ticket number.
 
8:/// </Summary>
 
9:/// <Param name = "billcode">Warehouse receiving ticket number.</Param>
 
10:VoidGetproductinlist (StringBillcode );
 
11: 
12:/// <Summary>
 
13:///Query the warehouse receiving details based on the warehouse receiving time and the pinyin simplified code.
 
14:/// </Summary>
 
15:/// <Param name = "starttime">Start time.</Param>
 
16:/// <Param name = "endtime">End Time.</Param>
17:/// <Param name = "pycode">Pinyin short code.</Param>
 
18:VoidGetproductinlist (DatetimeStarttime,DatetimeEndtime,StringPycode );
 
19:}

Similarly, we need to implement this method in the data layer Implementation Project:

1:Public voidGetproductinlist (DatetimeStarttime,DatetimeEndtime,StringPycode)
 
2:{
 
3:ConditionCondition =This. Createcondition ();
 
4: 
 
5:If(! Starttime. Equals (endtime ))
 
6:{
7:List<Datetime> Times =NewList<Datetime> (2 );
 
8:Times. Add (starttime );
 
9:Times. Add (endtime );
 
10: 
 
11:Condition. addelement ("Intime", Times,Elementtype. );
 
12:}
 
13: 
14:If(Pycode. length> 0)
 
15:Condition. addelement ("Sqltext","Code in (select code from DBO. Product where pycode like '"+ Pycode +"% ')",Elementtype. Sqlcondition );
 
16: 
 
17:This. Query (condition );
 
18:}

Let's take a closer look at this place. Because there is no pinyin simple Code defining the product in the product inventory table, I used a word query and wrote it in the form of SQL conditions, in implementation applications, you should add a simplified Chinese pinyin dictionary to the product inventory table to facilitate query.

Prepare a report

This step is beforeArticleHas been described in detail, in this simple walk, open the report designer, select the object report, the data object is product. dal. sqlserver. productinlist:

Note that in this report, I add a group to group by document number and display group statistics. After the report is designed, save it in the Reports folder in the compilation target directory and name it "product warehouse receiving query report. RDL ".

Integration code

Next, modify the program, mount the report, and write the event processing code for the "query" button:

 
1:Private voidBtnsearch_click (ObjectSender,EventargsE)
 
2:{
 
3:// Load the report
 
4:
5:If(This. Reportviewer. sourcerdl =Null)
 
6:{
 
7:System. Io.TextreaderTextreader =Null;
 
8:Try
 
9:{
 
10:StringFilename =Path. Combine (Application. Startuppath,"Reports \ product warehouse receiving query report. RDL");
11:Textreader =NewSystem. Io.Streamreader(Filename );
 
12:This. Reportviewer. sourcerdl = textreader. readtoend ();
 
13:}
 
14:Finally
 
15:{
 
16:If(Textreader! =Null)
 
17:Textreader. Close ();
 
18:}
19:}
 
20: 
 
21:// Process data
 
22:IproductinlistTable =Dalhelper. Dalmanager. createproductinlist ();
 
23:Table. getproductinlist (This. Dtpstarttime. value,This. Dtpendtime. value,This. Tbsearch. Text );
 
24:This. Reportviewer. dataobject = table;
 
25:}

Running result

Compile and run the program. Let's take a look at the running effect:

Print preview:

Export the report and select export Excel format:

Here, we need to note that the Excel export format only supports the excel2007 format, which makes me very entangled. I don't like the huge office2007 equipment, and 2010 won't be used for a month, the format cannot be opened by the WPS table software.

So far, the processing of the "commodity warehouse receiving query" module has ended. Next I will introduce another Implementation of the "commodity Dictionary" and demonstrate the binding technology between the ORM object and the datagridview dview, I hope you will be interested in agileeas. if you are interested in the. NET platform, you can download the complete code and check it for yourself. If you have any questions, please contact me in time.

For the structure of the data table involved in this example, refer to based on agileeas. NET platform basic library for application development-General description and data definition, for data object model definition files, documents, DDL scripts download: Workshop.

Link

Step by step teach you how to use the agileeas. net base class library for application development-series directory

Agileeas. NET platform development guide-series Directories

Introduction to agileeas. NET application development platform-Index

Agileeas. NET platform application development tutorial-case plan

Official website of agileeas. net

Agile Software Engineering Lab

QQ: 116773358

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.