public static bool InsertNewUsertoEmailList(tblEmail user) { var dc = new AlsiWebDataContext(); var insert = (!dc.tblEmails.Any(z => z.Email == user.Email)); if (insert) { user.Active = true; dc.tblEmails.InsertOnSubmit(user); dc.SubmitChanges(); GetEmailList(); } return insert; }
partial void DeletetblEmail(tblEmail instance);
partial void UpdatetblEmail(tblEmail instance);
partial void InserttblEmail(tblEmail instance);
private void addEmailButton_Click(object sender, EventArgs e) { Cursor = Cursors.WaitCursor; var contat = new tblEmail () { Name = name_EmailTextBox.Text.Trim(), Email = emailTextBox.Text.Trim(), }; if (WebUpdate.InsertNewUsertoEmailList(contat)) { PopulateEmailTab(); emailTextBox.Clear(); name_EmailTextBox.Clear(); addEmailButton.Enabled = true; } else { MessageBox.Show("Email Already Exist"); } Cursor = Cursors.Default; }