Пример #1
0
        private void searchDB()
        {
            try
            {
                upDateSup update = new upDateSup();
                update.Kwrd = txtbSearch.Text;
                DataTable Table = update.dTable();

                ListViewItem entry = null;
                listViewSupplier.Items.Clear();

                foreach (DataRow row in Table.Rows)
                {
                    entry = new ListViewItem(row["SupplierID"].ToString());
                    entry.SubItems.Add(row["CompanyName"].ToString());
                    entry.SubItems.Add(row["ContactSurname"].ToString());
                    entry.SubItems.Add(row["ContactFirstname"].ToString());
                    entry.SubItems.Add(row["CompanyAddress"].ToString());
                    entry.SubItems.Add(row["Address"].ToString());
                    entry.SubItems.Add(row["Gender"].ToString());
                    entry.SubItems.Add(row["Marital_Status"].ToString());
                    entry.SubItems.Add(row["Email"].ToString());
                    entry.SubItems.Add(row["PhoneNumber"].ToString());
                    listViewSupplier.Items.Add(entry);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            upDateSup getSupUpdate = new upDateSup();

            getSupUpdate.SupID    = txtbSupID.Text; getSupUpdate.CompName = txtbCompName.Text;
            getSupUpdate.CFname   = txtbCntctFname.Text; getSupUpdate.CSname = txtbCntctSname.Text;
            getSupUpdate.CompAddr = txtbCompAddr.Text; getSupUpdate.gender = combGender.Text;
            getSupUpdate.email    = txtbEmail.Text; getSupUpdate.Mstatus = combMarSt.Text;
            getSupUpdate.Addr     = txtbSupAddr.Text; getSupUpdate.Phone = txtbPhone.Text;
            getSupUpdate.UpDateSupplierInfo();

            txtbSupID.Text      = null; txtbCompName.Text = null;
            txtbCntctFname.Text = null; txtbCntctSname.Text = null;
            txtbCompAddr.Text   = null; combGender.Text = null;
            txtbEmail.Text      = null; combMarSt.Text = null;
            txtbSupAddr.Text    = null; txtbPhone.Text = null;
            MessageBox.Show("Supplier's record updated successfully", "Record Updated", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Пример #3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DialogResult Confirm = MessageBox.Show("Are you sure you want to delete this supplier's record?", "Confirm Deletion", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (Confirm == DialogResult.Yes)
            {
                upDateSup delete = new upDateSup();
                delete.SupID = txtbSupID.Text;
                delete.deleteSup();

                txtbSupID.Text      = null; txtbCompName.Text = null;
                txtbCntctFname.Text = null; txtbCntctSname.Text = null;
                txtbCompAddr.Text   = null; combGender.Text = null;
                txtbEmail.Text      = null; combMarSt.Text = null;
                txtbSupAddr.Text    = null; txtbPhone.Text = null;
                MessageBox.Show("Supplier's record deleted successfully", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (Confirm == DialogResult.No)
            {
            }
        }
Пример #4
0
        private void FetchListView()
        {
            string supplierid = null;

            try
            {
                if (string.IsNullOrEmpty(listViewSupplier.FocusedItem.Text))
                {
                }
                else
                {
                    supplierid = listViewSupplier.FocusedItem.Text;
                    upDateSup update = new upDateSup();
                    update.supplierid = supplierid;
                    DataTable table = update.GetSupplierTable();

                    foreach (DataRow row in table.Rows)
                    {
                        txtbSupID.Text      = row["SupplierID"].ToString();
                        txtbCompName.Text   = row["CompanyName"].ToString();
                        txtbCntctSname.Text = row["ContactSurname"].ToString();
                        txtbCntctFname.Text = row["ContactFirstname"].ToString();
                        txtbCompAddr.Text   = row["CompanyAddress"].ToString();
                        txtbSupAddr.Text    = row["Address"].ToString();
                        combGender.Text     = row["Gender"].ToString();
                        combMarSt.Text      = row["Marital_Status"].ToString();
                        txtbEmail.Text      = row["Email"].ToString();
                        txtbPhone.Text      = row["PhoneNumber"].ToString();
                    }
                    tabUpdateDelete.SelectedTab = pgUpdateDelete; // Activates the Update employee form tab page
                }
            }
            catch
            {
                Interaction.MsgBox("Please select record to update", MsgBoxStyle.Exclamation, "Update");
                return;
            }
        }