Ejemplo n.º 1
0
 private void BtnClear_Click(object sender, EventArgs e)
 {
     TxtFirstName.Clear();
     TxtLastName.Clear();
     TxtGrade.Clear();
     TxtAddress.Clear();
     TxtContactNo.Clear();
 }
Ejemplo n.º 2
0
 private void BtnUpdate_Click(object sender, EventArgs e)
 {
     if (TxtFirstName.Text == "")
     {
         MessageBox.Show("Please fill empty fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (TxtLastName.Text == "")
     {
         MessageBox.Show("Please fill empty fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (TxtGrade.Text == "")
     {
         MessageBox.Show("Please fill empty fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (TxtAddress.Text == "")
     {
         MessageBox.Show("Please fill empty fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (TxtContactNo.Text == "")
     {
         MessageBox.Show("Please fill empty fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         var result = MessageBox.Show("Confirm editing new record?", "Edit New Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             using (var con = new MySqlConnection(GetConnection()))
             {
                 string command = $"UPDATE `lms.sad`.`tblusers`" +
                                  $" SET " +
                                  $"`First_Name`='{TxtFirstName.Text}',`Last_Name`='{TxtLastName.Text}',`Year_Level`='{TxtGrade.Text}',`Address`='{TxtAddress.Text}',`Contact_Number`='{TxtContactNo.Text}'" +
                                  $" WHERE `User_ID`='{TxtUserID.Text}'";
                 con.Open();
                 using (var cmd = new MySqlCommand(command, con))
                 {
                     cmd.CommandType = CommandType.Text;
                     var i = cmd.ExecuteNonQuery();
                     if (i > 0)
                     {
                         MessageBox.Show("Successfully Updated! Please refresh Book List to view entry!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         TxtFirstName.Clear();
                         TxtLastName.Clear();
                         TxtGrade.Clear();
                         TxtAddress.Clear();
                         TxtContactNo.Clear();
                         TxtUserID.Clear();
                     }
                 }
                 con.Close();
             }
         }
     }
 }
Ejemplo n.º 3
0
 public void clr()
 {
     txtId.Clear();
     txtLastName.Clear();
     txtSalary.Clear();
     txtSpecialization.Clear();
     txtFirstName.Clear();
     txtConatctNo.Clear();
     TxtAddress.Clear();
     cmbSchedule.SelectedIndex = -1;
 }
Ejemplo n.º 4
0
 private void BtnRegister_Click(object sender, EventArgs e)
 {
     if (TxtFirstName.Text == "")
     {
         MessageBox.Show("Please enter missing fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (TxtLastName.Text == "")
     {
         MessageBox.Show("Please enter missing fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (TxtGrade.Text == "")
     {
         MessageBox.Show("Please enter missing fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (TxtAddress.Text == "")
     {
         MessageBox.Show("Please enter missing fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else if (TxtContactNo.Text == "")
     {
         MessageBox.Show("Please enter missing fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         var result = MessageBox.Show("Confirm adding new record?", "Add New Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             using (var con = new MySqlConnection(GetConnection()))
             {
                 string command = $"INSERT INTO `lms.sad`.`tblusers` (`First_Name`,`Last_Name`, `Year_Level`, `Address`,`Contact_Number`) " +
                                  "VALUES " +
                                  $"('{TxtFirstName.Text}','{TxtLastName.Text}','{TxtGrade.Text}','{TxtAddress.Text}','{TxtContactNo.Text}')";
                 con.Open();
                 using (var cmd = new MySqlCommand(command, con))
                 {
                     cmd.CommandType = CommandType.Text;
                     var i = cmd.ExecuteNonQuery();
                     if (i > 0)
                     {
                         MessageBox.Show("Successfully Added! Please refresh Borrower List to view entry!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                         TxtFirstName.Clear();
                         TxtLastName.Clear();
                         TxtGrade.Clear();
                         TxtAddress.Clear();
                         TxtContactNo.Clear();
                     }
                 }
                 con.Close();
             }
         }
     }
 }
 private void BtnClear_Click(object sender, EventArgs e)
 {
     TxtTcnumber.Clear();
     TxtName.Clear();
     TxtSurname.Clear();
     TxtAddress.Clear();
     TxtDays.Clear();
     MskTxtPhoneNumber.Clear();
     TxtEmail.Clear();
     TxtPayment.Clear();
     TxtRoomNumber.Clear();
     dateTimePicker1.ResetText();
     DtpCheckin.ResetText();
     DtpCheckout.ResetText();
 }
Ejemplo n.º 6
0
 /// <summary>
 /// actually clears each textbox in the form
 /// </summary>
 private void ClearNewEmpForm()
 {
     EpForm.Clear();
     TxtID.Clear();
     TxtFirstName.Clear();
     TxtLastName.Clear();
     TxtAddress.Clear();
     TxtCity.Clear();
     CBxState.SelectedIndex = -1;
     CBxEmpType.SelectedIndex = -1;
     TxtZip.Clear();
     TxtHireDate.Clear();
     CBxMarriageStatus.SelectedIndex = -1;
     TxtDept.Clear();
     TxtJobTitle.Clear();
     LblAfterSubmitMsg.Text = "";
     TxtPayAmount.Visible = false;
     LblPayAmount.Visible = false;
     LblSecondInput.Visible = false;
     TxtSecondInput.Visible = false;
 }