Example #1
0
        private void btnCancel_Click(object sender, EventArgs e)
        {
            var am = new AdminPage();

            am.ClearAllTextBoxes(this);
            EnableTextBoxes(this, false);
            btnCancel.Enabled = false;
            btnUpdate.Enabled = false;
        }
Example #2
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                conn = new SqlConnection {
                    ConnectionString = constr
                };



                conn.Open();
                // string insrtlg = "INSERT INTO LoginTB(Username,Password,Access_Level) VALUES(@usr,@pass,@role)";
                string insrtInPat = "INSERT INTO InPatientReg(Fname,Lname,Birth,Gender,Phone,Address,Occupation,MaritalStatus,Age,Status,AdmissionDate,Symptoms,Departement,AssignedDoc,WardNo,BedNo) VALUES(@FirstName,@LastName,@DOB,@Gender,@PhoneNumber,@Address,@Occupation,@Mstatus,@Age,@Status,@AdminDate,@Sympt,@Dept,@Doc,@WNo,@BNo)";


                SqlCommand cmd1 = new SqlCommand(insrtInPat, conn);

                //Adding Registration Infos

                cmd1.Parameters.AddWithValue("@FirstName", txtFirstName.Text);
                cmd1.Parameters.AddWithValue("@LastName", txtLastName.Text);
                cmd1.Parameters.AddWithValue("@DOB", txtDateOfBirth.Text);
                cmd1.Parameters.AddWithValue("@Gender", txtGender.SelectedItem);
                cmd1.Parameters.AddWithValue("@PhoneNumber", txtPhoneNumber.Text);
                cmd1.Parameters.AddWithValue("@Address", txtAddress.Text);

                cmd1.Parameters.AddWithValue("@Occupation", txtOccupation.Text);
                cmd1.Parameters.AddWithValue("@Mstatus", txtMaritalStatus.SelectedItem);
                cmd1.Parameters.AddWithValue("@Age", txtAge.Text);
                cmd1.Parameters.AddWithValue("@Status", txtStatus.SelectedItem);
                cmd1.Parameters.AddWithValue("@AdminDate", lblCurrentDateTime.Text);
                cmd1.Parameters.AddWithValue("@Sympt", txtSymptoms.Text);
                cmd1.Parameters.AddWithValue("@Dept", txtDepartment.SelectedItem);
                cmd1.Parameters.AddWithValue("@Doc", txtAssignDoctor.Text);
                cmd1.Parameters.AddWithValue("@WNo", txtWardNo.SelectedItem);
                cmd1.Parameters.AddWithValue("@BNo", txtBedNumber.Value);

                cmd1.ExecuteNonQuery();
                conn.Close();
                MessageBox.Show(this, "User successfully inserted into database. ", "Report", MessageBoxButtons.OK, MessageBoxIcon.Information);
                var am = new AdminPage();
                am.ClearAllTextBoxes(this);
            }
            catch (Exception ex)
            {
                lblErrorMess.Text = ex.Message;
            }
        }