C # Example Application summary (i)

Source: Internet
Author: User

C # Example Application summary (i)

I do not have the system to learn, C #, just in the work accumulated some, in order to facilitate the use of later development, in this summary, if there is not the place, welcome to the audience a lot of criticism and correction!

Your opinion, can make everyone better progress! Look Feel free!

The concept will not say, if you are interested, you can leave a message, and then add!

Tools with VS2013, backstage Java

One, the deletion of the GridView and change to check,

1. Enquiry

Based on the SQL query,

Servicefactory.createservice<ideptparameterservice> (). Querywaitparameter (param). Then (list =
{
This.gridControl1.DataSource = list;
});

Serviceresult<list<waitparvo>> querywaitparameter (string pkdept);

Ideptparameterservice is my service class, which only writes the method, in the upper body of the page, with "." The way that you can call out the way you write,

List with list variable to receive

This.gridControl1.DataSource = list, assign to the data source on the list of Gridcontrol you want to display, and write the corresponding name on the list!

Serviceresult<list<waitparvo>> querywaitparameter (String pkdept), which is the service layer method,

Waitparvo the entity class that corresponds to the list,

String pkdept is a parameter,

The Querywaitparameter method name.

2. New

The GridView often uses the new time, here, to provide two ways, (of course, I hope that the audience have a better way, a lot of advice.) )

These two are also depending on the condition, there is a way to insert only the database, and then, refresh the page, that is, a new row. The following will be said carefully!

Mainly the second kind,

Gridview1.addemptyrow<waitparvo> (row = string. IsNullOrEmpty (row. Code), New Waitparvo
{
Code = ar. Codeargu,
Name = ar. Nameargu,
pkorg = AppContext.Session.OrganizationId,
});

Addemptyrow is a new line method,

Waitparvo, the entity class corresponding to the GridView

Row variable name,

String. IsNullOrEmpty (row. Code) is null-judged

{} is a value that needs to be assigned to the list.

Can be changed according to the actual situation.

What AR is?

This code is what I'm sticking out of my project, and I'll tell you why I wrote it.

That's what I need at the time.

Click on the right arrow to change to this

Click on the button, the list on the left is all moved to the right, and <

The list on the left is gridControl1 and the right side is GridControl2

var ar = This.gridView2.GetFocusedRow () as Arguvo;
if (AR = = null) {
Messageboxutils.hint ("No Parameters selected");
Return
}
Gridview1.addemptyrow<waitparvo> (row = string. IsNullOrEmpty (row. Code), New Waitparvo
{
Code = ar. Codeargu,
Name = ar. Nameargu,
pkorg = AppContext.Session.OrganizationId,
});
int rowindex = Gridview2.focusedrowhandle;
Gridview2.deleterow (rowindex);

The same as left and right, first get to the list of cursor selected line This.gridView2.GetFocusedRow () as Arguvo;

Use a variable to receive, increment, and then assign to the corresponding field of the other list the value you obtained.

int rowindex = Gridview2.focusedrowhandle; Gets the subscript of the selected row, which is deleted according to the subscript of the selected row. Complete the move operation!

The way to write "

Private list<waitparvo> wlist;
Private list<arguvo> alist;


list<arguvo> s = this. Alist;
List<waitparvo> d = this. Wlist;
if (d = = NULL | | D.count < 1)
{
Messageboxutils.hint ("All selected parameters are selected");
Return
}
foreach (Var g in D)
{
Gridview2.addemptyrow<arguvo> (row = string. IsNullOrEmpty (row. CODEARGU), New Arguvo
{

Codeargu = G.code,
Nameargu = G.name,
pkorg = AppContext.Session.OrganizationId,
Pkargu = G.pkparamtemp,
Arguval = G.valdef,
Noteargu = G.descparam

});
}
This.gridControl1.DataSource = null;
This. Wlist = null;
Return

The list collection is created based on the entity class that corresponds to the

With a foreach traversal, add all the values in the collection, all new, according to the values in the collection, corresponding to the assigned value, the corresponding name of 21 lists.

This.gridControl1.DataSource = null, and the previous list is empty.

C # Example Application summary (i)

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.