Simple methods for checking in C # (such as getting data from a database into an Excel table)

Source: Internet
Author: User

var path = new FileStream ((Server.MapPath ("~") + "basic situation of administrative personnel of content\\data\\cause\\ institution. xls"), FileMode.Open, FileAccess.Read);
var wb = new Hssfworkbook (path);
var Shet = wb. Getsheet ("Page 1");
var chain = Shet. Chain ("D7");
var rowfun = new List<func<personinfo, bool>>
{
Total
M=>true,
M=>m.sex.equals ("female"),
M=>!m.familyname.contains ("Han"),
M=>m.politicalface.contains ("Party member"),
M=>m.higthdeggee.contains ("Doctor"),
M=>m.higthdeggee.contains ("Master"),
M=>true,

M=>m.higthdeggee.contains ("graduate student"),
M=>m.higthdeggee.contains ("university degree"),
M=>m.higthdeggee.contains ("University specialty"),
M=>m.higthdeggee.contains ("secondary School"),
M=>m.higthdeggee.contains ("High School and Below"),
Age
M=>m.agegroup.contains ("35 years and Below"),
M=>m.agegroup.contains ("36 to 40 years old"),
M=>m.agegroup.contains ("41 to 45 years old"),
M=>m.agegroup.contains ("46 to 50 years old"),
M=>m.agegroup.contains ("51 to 54 years old"),
M=>m.agegroup.contains ("55 to 59 years old"),
M=>m.agegroup.contains ("60 years and Above"),


};
var colfun = new List<func<personinfo, bool>>
{

M=>true,

M=>m.sex.equals ("female"),
M=>!m.familyname.contains ("Han"),//minority family
M=>m.managegrage.contains ("First-class staff"),
M=>m.managegrage.contains ("Level two staff"),
M=>m.managegrage.contains ("Level three staff"),
M=>m.managegrage.contains ("Level four staff"),
M=>m.managegrage.contains ("Level five staff"),
M=>m.managegrage.contains ("level six staff"),
M=>m.managegrage.contains ("Level seven staff"),
M=>m.managegrage.contains ("level eight staff"),
M=>m.managegrage.contains ("Level nine staff"),
M=>m.managegrage.contains ("Level 10 staff"),
M=>m.managegrage.contains ("other ratings"),
Non-scheduled official personnel
M=>!m.laborform.contains ("formally") &&!m.laborform.contains ("Labor Dispatch"),

};

var person = session. Find<personinfo> ();//This is our own encapsulated class that queries the data in the table
for (var k = 0; k < colfun.count; k++)
{
var col = colfun[k];
for (var i = 0; i < Rowfun.count; i++)
{
var row = Rowfun[i];

var result = person. Where (COL). Where (Row). ToList ();
Chain. Output (result. Count ());//output is our own encapsulated class that automatically changes to the next box


}


Chain. NextRow ();//nexnow is our own encapsulated class, automatically to the next line, such as the number of their own exports +1 can be
}
you can export it directly below.

Simple methods for checking in C # (such as getting data from a database into an Excel table)

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.