コード例 #1
0
 partial void DeleteBill(Bill instance);
コード例 #2
0
 partial void UpdateBill(Bill instance);
コード例 #3
0
        private int toDatabase(String line)
        {
            
                int inline = 0;

                if (line.Length > 13)
                {


                    if (line.Substring(0, 14) == "Authorization:")
                    {
                        string[] partsA = line.Trim().Split(':');
                        auth = partsA[1];
                    }
                }
                if (line.Length > 14)
                {
                    if (line.Substring(0, 14) == "Authorization ")
                    {
                        string[] partsA = line.Trim().Split(':');
                        department = partsA[1];

                    }
                }

                string[] parts = line.Trim().Split((char[])null, StringSplitOptions.RemoveEmptyEntries);

                Bill Row = new Bill();
                if (parts.Length == 10 && line.Contains("OUT"))
                {

                    string[] date_parts = parts[0].Split('/');
                    Row.Date = new DateTime(int.Parse(date_parts[0]), int.Parse(date_parts[1]), int.Parse(date_parts[2]));
                    Row.Day = parts[1];
                    Row.Time = parts[2];
                    Row.Type = parts[3];
                    Row.Number = parts[4];
                    Row.Location = parts[5] + " " + parts[6] + " " + parts[7];
                    Row.Duration = parts[8];
                    Row.Charge = parts[9];
                    Row.Authorization = auth;
                    Row.Department = department;
                    listDb.Bills.InsertOnSubmit(Row);
                    inline = 1;
                }

                if (parts.Length == 9 && line.Contains("OUT"))
                {

                    string[] date_parts = parts[0].Split('/');
                    Row.Date = new DateTime(int.Parse(date_parts[0]), int.Parse(date_parts[1]), int.Parse(date_parts[2]));
                    Row.Day = parts[1];
                    Row.Time = parts[2];
                    Row.Type = parts[3];
                    Row.Number = parts[4];
                    Row.Location = parts[5] + " " + parts[6];
                    Row.Duration = parts[7];
                    Row.Charge = parts[8];
                    Row.Department = department;
                    Row.Authorization = auth;
                    listDb.Bills.InsertOnSubmit(Row);
                    inline = 1;

                }
                if (parts.Length == 8 && line.Contains("OUT"))
                {

                    string[] date_parts = parts[0].Split('/');
                    Row.Date = new DateTime(int.Parse(date_parts[0]), int.Parse(date_parts[1]), int.Parse(date_parts[2]));
                    Row.Day = parts[1];
                    Row.Time = parts[2];
                    Row.Type = parts[3];
                    Row.Number = parts[4];
                    Row.Location = parts[5];
                    Row.Duration = parts[6];
                    Row.Charge = parts[7];
                    Row.Authorization = auth;
                    Row.Department = department;
                    listDb.Bills.InsertOnSubmit(Row);
                    inline = 1;

                
                
            }

                return inline;

        }
コード例 #4
0
 partial void InsertBill(Bill instance);
コード例 #5
0
ファイル: SendMail.xaml.cs プロジェクト: tshipa/BillReporter2
    private void sendFromSMTP(Bill bill, string reportPath,string body,string toEmail, string pickedMonth, string smtp, string email, string pass)
{
    
           //Bill bill = (from a in db.GetTable<Bill>() select a).FirstOrDefault();
          System.Net.Mail.MailMessage mail = new MailMessage();
          System.Net.Mail.SmtpClient SmtpServer = new System.Net.Mail.SmtpClient(smtp);

           mail.From = new MailAddress(email);
           mail.To.Add(toEmail);
           mail.Subject = "Telephone Bill for"+" "+ bill.Authorization;
           mail.Body = body;
           
           System.Net.Mail.Attachment attachment;
           string fileAttach = toPDF2(bill.Authorization,reportPath, pickedMonth);
           attachment = new System.Net.Mail.Attachment(fileAttach);
         
           mail.Attachments.Add(attachment);
           
           SmtpServer.Credentials = new System.Net.NetworkCredential(email, pass);
           

           SmtpServer.Send(mail);
           attachment.Dispose();
           File.Delete(fileAttach);
           //MessageBox.Show("mail Send");
         
           
           

}