private void button3_Click(object sender, EventArgs e) { try { if (txtUserName.Text.Equals("") || txtUserName.Text == null) { msgs = new CustomMessageBox("UserName can't be Empty !"); msgs.ShowDialog(); return; } if (txtPassword.Text == "") { msgs = new CustomMessageBox("password can't be Empty !"); msgs.ShowDialog(); return; } var q = (from x in cnx.LOGINs where x.USERNAME == txtUserName.Text select x).Count(); if (q > 0) { msgs = new CustomMessageBox("User Name Already Exists !"); msgs.ShowDialog(); return; } else { LOGIN lg = new LOGIN(); lg.USERNAME = txtUserName.Text; lg.PASSWORDS = txtPassword.Text; lg.ADMINS = false; lg.images = imgName; cnx.LOGINs.InsertOnSubmit(lg); File.Copy(imageLocation, Application.StartupPath + @"\images\" + imgName); cnx.SubmitChanges(); msgs = new CustomMessageBox("Added Successfully !"); msgs.ShowDialog(); clearFields(); loadData(); } } catch { msgs = new CustomMessageBox("Something Went Wrong !"); msgs.ShowDialog(); } }
partial void UpdateLOGIN(LOGIN instance);
partial void DeleteLOGIN(LOGIN instance);
partial void InsertLOGIN(LOGIN instance);