public void checkname(String name) { DataClasses1DataContext context = new DataClasses1DataContext(); bool flag = false; foreach (USER b in context.USERs) { if (b.User_Name.ToLower() == name) { flag = true; MessageBox.Show("User name taken"); } } AWAITING_CONFIRMATION u = new AWAITING_CONFIRMATION(); if (flag == false) { u.Name = usernamebox.Text; u.Password = passwordbox.Text; using (DataClasses1DataContext c = new DataClasses1DataContext()) { c.AWAITING_CONFIRMATIONs.InsertOnSubmit(u); c.SubmitChanges(); } } }
private void submitbutton_Click(object sender, EventArgs e) { DataClasses1DataContext context = new DataClasses1DataContext(); AWAITING_CONFIRMATION u = new AWAITING_CONFIRMATION(); u.Name = usernamebox.Text; u.Password = passwordbox.Text; bool flag = false; foreach (USER b in context.USERs) { if (b.User_Name.ToLower() == u.Name.ToLower()) { flag = true; MessageBox.Show("User name taken"); } } if (flag == false) { using (DataClasses1DataContext c = new DataClasses1DataContext()) { c.AWAITING_CONFIRMATIONs.InsertOnSubmit(u); c.SubmitChanges(); MessageBox.Show("Awaiting for confirmation"); } } }
partial void UpdateAWAITING_CONFIRMATION(AWAITING_CONFIRMATION instance);
partial void DeleteAWAITING_CONFIRMATION(AWAITING_CONFIRMATION instance);
partial void InsertAWAITING_CONFIRMATION(AWAITING_CONFIRMATION instance);