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(); } }