Regularly formatted text files inserted into the database

Source: Internet
Author: User
Existing text files: * Ricoh (Shenzhen) Industrial Development Co., Ltd. (D15) (located in Futian district) 1. 1 chef; male; under 30 years old; high school degree or above; Chinese cooking teacher intermediate or above, the original and copy of the identity card graduation certificate of floating population marriage and education must be prepared 1 copy. unqualified persons who pass the company's health check will not be hired. benefits and benefits: 8 working hours

Existing text files: * Ricoh (Shenzhen) Industrial Development Co., Ltd. (D15) (located in Futian district) 1. 1 cook; male; under 30 years old; high school degree or above; Chinese cooking teacher intermediate or above, must have an ID card/Diploma/mobile population marriage and childbearing certificate and a copy of one copy. unqualified persons who pass the company's health check will not be hired. benefits and benefits: 8 working hours

The following text files are available:

* Ricoh (Shenzhen) Industrial Development Co., Ltd. (D15) (located in Futian District)
1. 1 cook; male; under 30 years old; high school degree or above; Chinese cooking teacher intermediate or above, must have an ID card/Diploma/mobile population marriage and childbearing certificate and a copy of one copy. unqualified persons who pass the company's health check will not be hired. benefits and benefits: 8 hours/day. 5 days/week, double break and statutory holidays stipulated by the state, free Chinese food, free accommodation, and pension for employees. provides learning opportunities.
The company's business scope: design, production of copiers, fax machines, printers, etc;
If you are interested, please go to the second floor of the building for an interview on March 13, November 9.
$
* Baijia supermarket (C10) (located in Luohu District)
1. One accountant clerk; female; technical secondary school or above; more than 1 year of financial work experience; major in finance and accounting, with reconciliation experience preferred, mature and stable, able to adapt to strong work pressure.
2. Two plainclothes security guards; male; high school or above; good communication skills, hard work, experience in inspection and damage prevention, integrity, experience in working with employees preferred.
The above positions require the applicant to be healthy, able to handle food and accommodation on his own, and have annual salary leave and social security benefits.
If you are interested, please go to the second floor of the building for an interview on March 13, and March 13.
$
* Sam's member store (A14) (located in Futian District)
1. One Loss Prevention engineer; over 25 years old; College degree or above; professional professionalism and team spirit, stable personality, judgment ability and damage prevention awareness; more than two years of related experience.
2. 10 employees from the dry goods department and Electrical Equipment Department; male; high school degree or above; good communication and expression skills; Experience in electrical appliance sales is preferred.
3. 10 employees in the fruit and vegetable department and frozen product department; male; high school education or above; good customer service awareness and teamwork awareness; more than 2 years of relevant work experience is preferred.
4. Three night shift tally workers; male; high school education or above; able to adapt to the good customer service awareness and teamwork awareness of overnight work; more than 2 years of relevant work experience is preferred.
If you are interested, please go to the second floor of the building for an interview on March 13, November 13.

The company name starts with "*", and each record is separated by "$". The recruitment information starts with a numerical serial number and needs to be stored in the database according to the following data structure:
HRNewsPaper
------------------
Id (primary key)
CompanyId (corresponds to the id in the Company table)
PositionName
PositionNumber
Requirement
InfoFrom
UpdateTime

Company
------------------
Id (primary key)
CompanyName
CompanyInfo
Note
InfoFrom
UpdateTime

The following lists the key code:
If (this. IsPostBack)
{
String infos = hR_Content.Text.Trim ();
String [] arrInfos = infos. Split (new char [] {'$ '});
String [] companyName = new string [arrInfos. Length];
StringBuilder sbNote = new StringBuilder ();
String [] notes = new string [arrInfos. Length];

// Read enterprise information one by one
For (int I = 0; I <arrInfos. Length; I ++)
{
String info = arrInfos [I]. Trim (new char [] {'/R','/N '});
String [] arrInfo = info. Split (new char [] {'/N '});
Int k = 0;

String [] positionName = new string [arrInfo. Length];
Int [] positionNumber = new int [arrInfo. Length];
String [] requirement = new string [arrInfo. Length];

// Read the recruitment information of each enterprise row by row
For (int j = 0; j <arrInfo. Length; j ++)
{
String strLine = arrInfo [j]. Trim (new char [] {'/R','/N '});
// Obtain the company name
If (strLine. StartsWith ("*"))
{
CompanyName [I] = strLine. Substring (1 );
}
Else
{
// Obtain the position, number of places, required
// StrLine = @ "1. 200 chefs: male, under 30 years old, with a high school degree or above, and intermediate or higher Chinese cookers, one original and one copy of the ID card/Diploma/floating population marriage and childbearing certificate are required. unqualified persons who pass the company's health check will not be hired. ";
Regex r = new Regex (@ "/d + /.(? /D + )(? /D + )(? Name ;)");
Match m = r. Match (strLine );
If (m. Success)
{
PositionName [k] = m. Groups ["positionName"]. Value;
If (m. Groups ["positionNumber"]. Value! = Null)
{
PositionNumber [k] = int. Parse (m. Groups ["positionNumber"]. Value );
}

Int index = m. Groups ["chineseMin"]. Index + 2;

Requirement [k] = strLine. Substring (index );

K ++;
}
Else
{
// Obtain the additional plain text
SbNote. Append (strLine +"
");
}
}
Notes [I] = sbNote. ToString (). Trim ("
". ToCharArray ());
}
SbNote = new StringBuilder ();
// Warehouse receiving
String aa = "";
If (positionName. Length <= 0) return;

String myConnectString = ConfigurationSettings. deleettings ["ConnString"];
SqlConnection myConnection = new SqlConnection (myConnectString );

SqlCommand sqlCmd = myConnection. CreateCommand ();

String strSql = "insert into company (CompanyName, CompanyInfo, Note, InfoFrom)" +
"VALUES (@ CompanyName, @ CompanyInfo, @ Note, @ InfoFromCompany );";
StrSql + = "Select @ IDENTITY ";

SqlCmd. CommandText = strSql;
SqlCmd. CommandType = CommandType. Text;

SqlParameter CompanyName = sqlCmd. Parameters. Add
("@ CompanyName", SqlDbType. VarChar, 256 );
CompanyName. Value = companyName [I]. Replace ("(", "("). Replace (")",")");

SqlParameter CompanyInfo = sqlCmd. Parameters. Add
("@ CompanyInfo", SqlDbType. VarChar, 4000 );
CompanyInfo. Value = "";

SqlParameter Note = sqlCmd. Parameters. Add
("@ Note", SqlDbType. VarChar, 4000 );
Note. Value = notes [I];

SqlParameter InfoFromCompany = sqlCmd. Parameters. Add
("@ InfoFromCompany", SqlDbType. Char, 10 );
InfoFromCompany. Value = this. infoFrom;

MyConnection. Open ();
_ LastID = int. Parse (sqlCmd. ExecuteScalar (). ToString ());
// SqlCmd. ExecuteNonQuery ();
SqlCmd. Dispose ();

For (int m = 0; m <positionName. Length; m ++)
{
If (positionName [m]! = Null)
{
// Warehouse receiving
SqlCmd = myConnection. CreateCommand ();

StrSql = "insert into HRNewsPaper (CompanyId, PositionName, PositionNumber, Requirement, InfoFrom)" +
"VALUES (@ CompanyId, @ PositionName, @ PositionNumber, @ Requirement, @ InfoFromHR )";

SqlCmd. CommandText = strSql;
SqlCmd. CommandType = CommandType. Text;

SqlParameter CompanyId = sqlCmd. Parameters. Add
("@ CompanyId", SqlDbType. Int );
CompanyId. Value = this. LastID;

SqlParameter PositionName = sqlCmd. Parameters. Add
("@ PositionName", SqlDbType. VarChar, 60 );
PositionName. Value = positionName [m];

SqlParameter PositionNumber = sqlCmd. Parameters. Add
("@ PositionNumber", SqlDbType. VarChar, 60 );
PositionNumber. Value = positionNumber [m];

SqlParameter Requirement = sqlCmd. Parameters. Add
("@ Requirement", SqlDbType. VarChar, 4000 );
Requirement. Value = requirement [m];

SqlParameter InfoFromHR = sqlCmd. Parameters. Add
("@ InfoFromHR", SqlDbType. Char, 10 );
InfoFromHR. Value = this. infoFrom;

SqlCmd. ExecuteNonQuery ();
SqlCmd. Dispose ();
}
}

MyConnection. Close ();

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.