private void btnSave_Click(object sender, EventArgs e) { db = new db_MiletecDataContext(); //staff registration if (cmbUser.Text == "Staff") { if (txtLastName.Text != string.Empty && txtFirstName.Text != string.Empty && txtMiddleName.Text != string.Empty && txtUserName.Text != string.Empty && txtPassword.Text != string.Empty) { if (count == 0) { if (txtFirstName.Text == "Firstname" && txtLastName.Text == "Lastname" && txtMiddleName.Text == "Middle Name") { MessageBox.Show("Please fill up everything!!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else if (txtUserName.Text == "Username" || txtPassword.Text == "Password") { MessageBox.Show("Generate Username and Password first!!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { db.sp_insert_User(txtUserStaffID.Text, txtLastName.Text, txtFirstName.Text, txtMiddleName.Text, txtUserName.Text, txtPassword.Text, "Active", null, null, cmbUser.Text); db.SubmitChanges(); MessageBox.Show("Registered Successfully!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); txtFirstName.Text = "Firstname"; txtLastName.Text = "Lastname"; txtMiddleName.Text = "Middle Name"; txtUserName.Text = "Username"; txtPassword.Text = "Password"; } } } else { MessageBox.Show("Please fill up everything!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (cmbUser.Text == "Administrator") { db = new db_MiletecDataContext(); if (count == 0) { if (txtFirstName.Text == "Firstname" && txtLastName.Text == "Lastname" && txtMiddleName.Text == "Middle Name") { MessageBox.Show("Please fill up everything!!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else if (txtUserName.Text == "Username" || txtPassword.Text == "Password") { MessageBox.Show("Generate Username and Password first!!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { db.sp_insert_User(txtUserStaffID.Text, txtLastName.Text, txtFirstName.Text, txtMiddleName.Text, txtUserName.Text, txtPassword.Text, "Active", null, null, cmbUser.Text); db.SubmitChanges(); MessageBox.Show("Registered Successfully!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); txtFirstName.Text = "Firstname"; txtLastName.Text = "Lastname"; txtMiddleName.Text = "Middle Name"; txtUserName.Text = "Username"; txtPassword.Text = "Password"; } } } else { MessageBox.Show("Please Fill up everything!", "NOTE", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } GenerateUserID(txtUserStaffID); }