ASP. NET upload parts are sent by time segment

Source: Internet
Author: User
Tags mailmessage smtpclient

Using System;
Using System. Collections;
Using System. Configuration;
Using System. Data;
Using System. Linq;
Using System. Web;
Using System. Web. Security;
Using System. Web. UI;
Using System. Web. UI. HtmlControls;
Using System. Web. UI. WebControls;
Using System. Web. UI. WebControls. WebParts;
Using System. Xml. Linq;
Using System. Threading;
Using System. Data. SqlClient;
Using System. Net. Mail;

Public partial class PJQGD: System. Web. UI. Page
{
Protected void Page_Load (object sender, EventArgs e)
{

}
Public void SendSMTPEMail (string strSmtpServer, string strFrom, string strFromPass, string strto, string strSubject, string strBody)
{
System. Net. Mail. SmtpClient client = new SmtpClient (strSmtpServer );
Client. usedefacrecredentials = false;
Client. Credentials = new System. Net. NetworkCredential (strFrom, strFromPass );
Client. DeliveryMethod = SmtpDeliveryMethod. Network;
System. Net. Mail. MailMessage message = new MailMessage (strFrom, strto, strSubject, strBody );
Message. BodyEncoding = System. Text. Encoding. UTF8;
Message. isbodyhtml = true;
Client. Send (Message );
}
Protected void timereffectick (Object sender, eventargs E)
{
String week = datetime. Now. dayofweek. tostring (); // week indicates the week;
If (week = "Sunday") // No message is sent on Sunday;
{

}
Else
{
Int nowhour = convert. toint32 (datetime. Now. Hour. tostring (); // retrieve the first hour;
If (nowhour = 8 | nowhour = 9 | nowhour = 10 | nowhour = 11 | nowhour = 12 | nowhour = 14 | nowhour = = 15 | nowhour = 16 | nowhour = 17)
{
Int it = 1;
While (it <1)
{
Thread. Sleep (1000 );
It ++;
}
If (it = 1)
{
Try
{
String str = "server = 192.168.3.127; database = FlowMaster; UId = sa; password = bruce_zhao888418 ";
Sqlconnection sqlcon = new sqlconnection (STR );
Sqlcon. open ();
Sqldataadapter sqlda = new sqldataadapter (@ "select * From pjqgd_view with (updlock) where (applyid = 'maintain 'or applyid = '000000' or applyid = '000000' or applyid = '000000') and (nows> = '2017/13 ') and (flag is null or flag = '') and (step = 'cd02e866-68b4-47df-9835-028ae56f7241 ') and 1 = 1", sqlcon );
DataSet ds = new DataSet ();
Sqlda. Fill (ds );
Int num = ds. Tables [0]. Rows. Count;
If (num> 0)
{
For (INT I = 0; I <num; I ++)
{
String subject = Ds. Tables [0]. Rows [I] [6]. tostring ();
String explain = Ds. Tables [0]. Rows [I] [7]. tostring ();
String pinming1 = Ds. Tables [0]. Rows [I] [8]. tostring ();
String pinming2 = Ds. Tables [0]. Rows [I] [9]. tostring ();
String pinming3 = Ds. Tables [0]. Rows [I] [10]. tostring ();
String pinming4 = Ds. Tables [0]. Rows [I] [11]. tostring ();
String pinming5 = Ds. Tables [0]. Rows [I] [12]. tostring ();
String norm1 = Ds. Tables [0]. Rows [I] [13]. tostring ();
String norm2 = Ds. Tables [0]. Rows [I] [14]. tostring ();
String norm3 = Ds. Tables [0]. Rows [I] [15]. tostring ();
String norm4 = Ds. Tables [0]. Rows [I] [16]. tostring ();
String norm5 = ds. Tables [0]. Rows [I] [17]. ToString ();
String SequenceID = ds. Tables [0]. Rows [I] [18]. ToString ();

String server = "192.168.2.8"; // defines the server address.
String sendEmail = "mis10@tjpcb.com"; // defines the sender's mailbox
String sendEmailPassWord = "123456"; // defines the sender's email password.
String getEmail = "sunny@tjpcb.com"; // get the recipient's email address
String titleEmail = "Please submit a ticket for updating accessories"; // define the subject of the email
String context = "table simple flow statement:" + sequenceid + "<br>" + "table simple subject:" + Subject + "<br>" + "Description: "+ explain +" <br> "+" Product Name 1: "+ pinming1 +" product specifications: "+ norm1 +" <br> "+" product name 2: "+ pinming2 +" product specifications: "+ norm2 +" <br> "+" Product Name 3: "+ pinming3 +" Product Specification: "+ norm3 +" <br> "+" product name 4: "+ pinming4 +" product specifications: "+ norm4 +" <br> "+" product name 5: "+ pinming5 +" Product Specification: "+ norm5; // defines the content of the email.
Sendsmtpemail (server, sendemail, sendemailpassword, getemail, titleemail, context );
SendSMTPEMail (server, sendEmail, sendEmailPassWord, "guojianghua@tjpcb.com", titleEmail, context );
SendSMTPEMail (server, sendEmail, sendEmailPassWord, "gaohua@tjpcb.com", titleEmail, context );

}
String sqlstr = @ "update PJQGD_View set flag = 'havingsend' where (ApplyID = 'maintain ') or (ApplyID = '000000') or (ApplyID = '000000 ') or (ApplyID = '000000') and (nows> = '2017/13') and (Step = 'cd02e866-68B4-47DF-9835-028AE56F7241 ')";
SqlCommand cmd = new SqlCommand (sqlstr, sqlcon );
Cmd. ExecuteNonQuery ();
}
}
Catch (exception ER)
{
}
}
}
}
}
}

Related Article

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.