private void loadPartDataToComboBox(ComboBox cb) { DataTable dt = PartDAO.GetAllData(); cb.DataSource = dt; cb.DisplayMember = "PartName"; cb.ValueMember = "PartID"; }
private void loadPartDataWithFieldAllToComboBox(ComboBox cb) { DataTable dt = PartDAO.GetAllData(); DataRow dr = dt.NewRow(); dr["PartName"] = "Tất cả"; dt.Rows.InsertAt(dr, 0); cb.DataSource = dt; cb.DisplayMember = "PartName"; cb.ValueMember = "PartID"; }
private void createPart() { PartDTO partDTO = new PartDTO(); partDTO.Id = tbPartIdCreate.Text; partDTO.Name = tbPartNameCreate.Text; partDTO.Sign = tbPartSignCreate.Text; partDTO.Amount = int.Parse(tbPartAmountCreate.Text); partDTO.Limit = int.Parse(tbPartIdCreate.Text); PartDAO.Insert(partDTO); loadPartList(); }
private void updatePart() { PartDTO partDTO = new PartDTO(); partDTO.Id = tbPartIdEdit.Text; partDTO.Name = tbPartNameEdit.Text; partDTO.Sign = tbPartSignEdit.Text; partDTO.Amount = int.Parse(tbPartAmountEdit.Text); partDTO.Limit = int.Parse(tbPartIdEdit.Text); PartDAO.Update(partDTO); loadPartList(); }
/* * Part data */ private void loadPartList() { dgvPartList.DataSource = PartDAO.GetAllData(); }