private void chkDisCD_SelectedIndexChanged(object sender, EventArgs e) { if (chkDisCD.SelectedIndex == -1) { return; } CD deregCD = new CD(); //deregCD.getCD(Convert.ToInt32(chkDisCD.Text.Substring(0, 3))); deregCD.getCD(Convert.ToInt32(chkDisCD.Text.Substring(0, 5))); if (deregCD.getCDID().Equals(0)) { MessageBox.Show("No details found", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); txtDisCDID.Focus(); return; } txtDisCDID.Text = deregCD.getCDID().ToString("00000"); txtDeregAlbum.Text = deregCD.getAlbumName(); txtDeregArtist.Text = deregCD.getArtist().ToString(); txtDisYr.Text = deregCD.getYr().ToString(); txtDisArtLabel.Text = deregCD.getArtLabel(); txtDisCostPrice.Text = deregCD.getCostPrice().ToString(); txtDisQty.Text = deregCD.getQty().ToString(); grpDisCD.Visible = true; }
private void cboupdCD_SelectedIndexChanged(object sender, EventArgs e) { if (cboupdCD.SelectedIndex == -1) { return; } CD updCD = new CD(); //updCD.getCD(Convert.ToInt32(cboupdCD.Text.Substring(0, 3))); updCD.getCD(Convert.ToInt32(cboupdCD.Text.Substring(0, 4))); if (updCD.getCDID().Equals(0)) { MessageBox.Show("No details found", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); txtCDID.Focus(); return; } //display Stock details txtCDID.Text = updCD.getCDID().ToString("00000"); txtUAlbum.Text = updCD.getAlbumName(); txtUArtist.Text = updCD.getArtist().ToString(); txtYr.Text = updCD.getYr().ToString(); txtUArtistLbl.Text = updCD.getArtLabel(); txtUCostPrice.Text = updCD.getCostPrice().ToString(); txtuQty.Text = updCD.getQty().ToString(); cboSuppliers.SelectedItem = updCD.getSuppID().ToString("000"); DataSet ds = new DataSet(); ds = Supplier.getAllActiveSuppliers(ds); //load suppliers for (int i = 0; i < ds.Tables["ss"].Rows.Count; i++) { cboSuppliers.Items.Add(ds.Tables[0].Rows[i][0].ToString().PadLeft(3, '0') + " " + ds.Tables[0].Rows[i][1].ToString()); } int theSuppID = updCD.getSuppID(); cboSuppliers.SelectedIndex = 0; while (!cboSuppliers.Text.Substring(0, 3).Equals(theSuppID.ToString("000"))) { cboSuppliers.SelectedIndex++; } grpUCD.Visible = true; }