private void btnSave_Click(object sender, EventArgs e) { var en = new AddReceptionistEntity(); var re = new AddReceptionistRepo(); if (ValidateToSave() == true) { en.GeneratedId = txtId.Text; en.Name = txtName.Text; en.Age = int.Parse(txtAge.Text); en.Sex = cmbSex.SelectedItem.ToString(); en.Reference = txtReference.Text; en.Address = txtAddress.Text; en.Phone = txtPhoneNo.Text; en.UserName = txtUserName.Text; en.Password = txtPassword.Text; lblId.Text = txtId.Text; mtxtName.Text = txtName.Text; mtxtAge.Text = txtAge.Text; mtxtUserName.Text = txtUserName.Text; mtxtPassword.Text = txtPassword.Text; mtxtSex.Text = cmbSex.SelectedItem.ToString(); mtxtReference.Text = txtReference.Text; mtxtAddress.Text = txtAddress.Text; mtxtPhone.Text = txtPhoneNo.Text; re.AddReceptionist(en); pnlDetails.Visible = true; } else { MessageBox.Show("Invalid Input"); } }
private void btnUpdate_Click(object sender, EventArgs e) { var en = new AddReceptionistEntity(); var re = new AddReceptionistRepo(); en.GeneratedId = lblId.Text; en.Name = mtxtName.Text; en.Age = int.Parse(mtxtAge.Text); en.Sex = mtxtSex.Text; en.Reference = mtxtReference.Text; en.Address = mtxtAddress.Text; en.Phone = mtxtPhone.Text; en.UserName = mtxtUserName.Text; en.Password = mtxtPassword.Text; re.UpdateInfo(en); }