private void btnDelete_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("Are you sure you wanna delete this? ", "Computer Parts", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { int index = this.gridManageComputers.Rows.IndexOf((GridViewDataRowInfo)this.gridManageComputers.CurrentRow); if (index < 0) { return; } BO.Computer computer = (BO.Computer)gridManageComputers.Rows[index].DataBoundItem; if (index != null) { _computersBll.Remove(computer.ComputerID); } } else if (dialogResult == DialogResult.No) { this.Hide(); ManageComputers mg = new ManageComputers(); mg.ShowDialog(); } }
private void btnRefresh_Click(object sender, EventArgs e) { this.Hide(); ManageComputers mg = new ManageComputers(); mg.ShowDialog(); }
private void ValidateFields() { if (txtPricePerHour.Text == "") { erpPricePerhour.SetError(txtPricePerHour, "This cannot be blank"); } //if (txtPartID.Text == "") //{ // erpPartID.SetError(txtPartID, "This cannot be blank"); //} else { Computer computer = new Computer(); //computer.PartID = int.Parse(txtPartID.Text); computer.PricePerHour = double.Parse(txtPricePerHour.Text); computer.PartID = int.Parse(cmbPC.SelectedItem.ToString()); computer.Insertby = txtInsertBY.Text; computer.InserDate = DateTime.Parse(txtInsertDate.Text); computersBLL.ADD(computer); ManageComputers mg = new ManageComputers(); mg.gridManageComputers.Refresh(); mg.InitData(); this.Close(); } }
private void btnSave_Click(object sender, EventArgs e) { Computer computer = new Computer(); computer.PartID = int.Parse(cmbPC.SelectedItem.ToString()); computer.ComputerID = int.Parse(txtComputerID.Text); computer.PricePerHour = double.Parse(txtPricePerHour.Text); computer.UpdatedBy = txtupdateby.Text; computer.UpdateDate = DateTime.Parse(txtUpdateDate.Text); computer.LastUpdate = int.Parse(txtUpdateNo.Text); var result = computersBll.Modify(computer); if (result != null) { ManageComputers mg = new ManageComputers(); mg.InitData(); this.Close(); } }