Пример #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            string strSQL = "";

            if (CName.Text != "" && CNIC.Text != "")
            {
                strSQL = "INSERT INTO Customer(CustomerName,CNIC,Phone) VALUES ('" + CName.Text + "','" + CNIC.Text + "','" + Phone.Text + "')";

                using (OleDbConnection connection = new OleDbConnection(connectionString))
                {
                    OleDbCommand command = new OleDbCommand(strSQL, connection);
                    try
                    {
                        connection.Open();
                        command.ExecuteReader();
                        connection.Close();
                        MessageBox.Show("New Renter Added");
                        CName.Clear();
                        CNIC.Clear();
                        Phone.Clear();
                        DataRecordBind("Select * from Customer");
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (text_Name.Text != string.Empty && Father_name.Text != string.Empty && DOB.Text != string.Empty && CNIC.Text != string.Empty && PhoneNo.Text != string.Empty && genderCombo.Text != string.Empty && textBox_Address.Text != string.Empty && height.Text != string.Empty && textBox_diseases.Text != string.Empty && BGroup.Text != string.Empty && donated_Date.Text != string.Empty)
            {
                try
                {
                    if (Donated_YES_rbtn.Checked == true)
                    {
                        database.con.Open();
                        SqlCommand csd = new SqlCommand("insert into Donor values('" + text_Name.Text + "','" + Father_name.Text + "','" + DOB.Text + "','" + CNIC.Text + "','" + PhoneNo.Text + "','" + genderCombo.Text + "','" + textBox_Address.Text + "','" + height.Text.ToString() + "','" + textBox_diseases.Text + "','" + BGroup.Text + "','" + Donated_YES_rbtn.Text + "','" + donated_Date.Text + "');", database.con);
                        csd.ExecuteNonQuery();
                        database.con.Close();
                        listboxdata();
                        MessageBox.Show("Info Added", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        database.con.Open();
                        SqlCommand csd = new SqlCommand("insert into Donor values('" + text_Name.Text + "','" + Father_name.Text + "','" + DOB.Text + "','" + CNIC.Text + "','" + PhoneNo.Text + "','" + genderCombo.Text + "','" + textBox_Address.Text + "','" + height.Text.ToString() + "','" + textBox_diseases.Text + "','" + BGroup.Text + "','" + Donated_NO_rbtn.Text + "','" + donated_Date.Text + "');", database.con);
                        csd.ExecuteNonQuery();
                        database.con.Close();
                        listboxdata();
                        MessageBox.Show("Info Added", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    text_Name.ResetText();
                    DOB.ResetText();
                    Father_name.ResetText();
                    textBox_diseases.ResetText();
                    textBox_Address.ResetText();
                    BGroup.ResetText();
                    CNIC.ResetText();
                    PhoneNo.ResetText();
                    height.ResetText();
                    ID.Text = "ID: ------";
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    database.con.Close();
                }
            }
            else
            {
                MessageBox.Show("Fill All Fields", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #3
0
 private void button2_Click(object sender, EventArgs e)
 {
     text_Name.ResetText();
     DOB.ResetText();
     Father_name.ResetText();
     textBox_diseases.ResetText();
     textBox_Address.ResetText();
     BGroup.ResetText();
     CNIC.ResetText();
     PhoneNo.ResetText();
     height.ResetText();
     ID.Text          = "ID: ------";
     genderCombo.Text = "";
 }
 public void clearAll()
 {
     employeeFatherName.Clear();
     employeeName.Clear();
     age.Clear();
     CNIC.Clear();
     primaryContact.Clear();
     qualification.Clear();
     HomeAddressText.Clear();
     subject.Clear();
     secondaryContact.Clear();
     MaleRadioButton.IsChecked   = false;
     FemaleRadioButton.IsChecked = false;
     nextAdmission();
 }
 private void textBox9_MouseHover(object sender, EventArgs e)
 {
     CNIC.Show("Enter CNIC: XXXXX-XXXXXXX-X", textBox9);
 }