示例#1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            Int32 intPerson_ID = Convert.ToInt32(lblPerson_ID.Text);  //Get the ID from the Label

            //Create a EBook so we can use the delete method
            PersonV2 temp = new PersonV2();

            //Use the EBook ID and pass it to the delete function
            // and get the number of records deleted
            lblFeedback.Text = temp.DeleteOnePerson(intPerson_ID);
        }
示例#2
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            //Get Data
            PersonV2 temp = new PersonV2();
            //Perform the search we created in EBook class and store the returned dataset
            DataSet ds = temp.SearchPersons(txtFName.Text, txtMName.Text, txtLName.Text, txtStreet1.Text, txtStreet2.Text, txtCity.Text, txtState.Text, txtZipcode.Text, txtPhone.Text, txtEmail.Text, txtCellphone.Text, txtInstagram.Text);

            //Display data (dataset)
            dgvResults.DataSource = ds;                                   //point datagrid to dataset
            dgvResults.DataMember = ds.Tables["Persons_Temp"].ToString(); // What table in the dataset?
        }
示例#3
0
        public Form1(int intPerson_ID)
        {
            InitializeComponent();

            btnSubmit.Visible = false;

            //Gather info about this one person and store it in a datareader
            PersonV2      temp = new PersonV2();
            SqlDataReader dr   = temp.FindOnePerson(intPerson_ID);

            //Use that info to fill out the form
            //Loop thru the records stored in the reader 1 record at a time
            // Note that since this is based on one person's ID, then we
            //  should only have one record
            while (dr.Read())
            {
                //Take the Name(s) from the datareader and copy them
                // into the appropriate text fields
                txtfName.Text     = dr["FirstName"].ToString();
                txtmName.Text     = dr["MiddleName"].ToString();
                txtlName.Text     = dr["LastName"].ToString();
                txtStreet.Text    = dr["Street1"].ToString();
                txtStreet2.Text   = dr["Street2"].ToString();
                txtcity.Text      = dr["City"].ToString();
                txtstate.Text     = dr["State"].ToString();
                txtzipcode.Text   = dr["Zipcode"].ToString();
                txtphone.Text     = dr["Phone"].ToString();
                txtemail.Text     = dr["Email"].ToString();
                txtcellphone.Text = dr["Cellphone"].ToString();
                txtinstaURL.Text  = dr["Instagram"].ToString();
                lblPerson_ID.Text = dr["Person_ID"].ToString();


                //We added this one to store the ID in a new label
                lblPerson_ID.Text = dr["Person_ID"].ToString();
            }
        }