public static void InsertOnMailTable(ToLet.Classes.Mail mail) { DataClasses1DataContext cntx = ToLet.Database.DBConnectionProvider.getDBConnection(); MailTable mailtable = new MailTable(); mailtable.to = mail.To; mailtable.fromu = mail.From; mailtable.message = mail.Message; mailtable.delefrom = 0; mailtable.deletto = 0; cntx.MailTables.InsertOnSubmit(mailtable); cntx.SubmitChanges(); }
private void SendMailBTN_Click(object sender, EventArgs e) { if (ToTB.Text == user) { MessageBox.Show("Wanna send mail to yourself !!!"); } else { DataClasses1DataContext cntx = ToLet.Database.DBConnectionProvider.getDBConnection(); ToLet.Database.DBConnectionProvider.getDBConnection(); ToLet.Classes.Mail mail = new ToLet.Classes.Mail(ToTB.Text, user, ComposeTB.Text); ToLet.DBDataProvider.DBDataProvider.InsertOnMailTable(mail); MessageBox.Show("Mail Sent Successfully !!"); ToTB.Text = ""; ComposeTB.Text = ""; GetData(); } }