private void btnSave_Click(object sender, EventArgs e) { if (reportNameTextBox.Text == "" || chargesTextBox.Text == "" || ddlDepartment.SelectedValue.ToInt32() == 0) { MessageBox.Show("Please Provide Department, Report Name and Charges", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { labReportsBindingSource.EndEdit(); LabReports obj = (LabReports)labReportsBindingSource.Current; obj.labDeptID = ddlDepartment.SelectedValue.ToInt32(); obj.catID = cmbxCat.SelectedValue.ToInt32(); obj.labDeptName = ((LabDepartment)ddlDepartment.SelectedItem).labDeptName; obj.reportName = reportNameTextBox.Text.Trim(); obj.charges = chargesTextBox.Text.ToDecimal(); obj.ETA = eTATextBox.Text.ToInt32(); obj.crtBy = lblUserName.Text; obj.crtDate = DateTime.Now; obj.modBy = lblUserName.Text; obj.modDate = DateTime.Now; /*if (ddlDepartment.Text == "Chemistry"){*/ obj.orderNo = orderNoTextBox.Text.ToInt32();//} obj.isPrintOnNextPage = chkIsprintNext.Checked; obj.isHidden = chkIsHidden.Checked; obj.Save(); pnlMain.Hide(); fillGrid(); } }
private void lblEdit_Click(object sender, EventArgs e) { LabReports obj = (LabReports)labReportsBindingSource.Current; pnlMain.Show(); ddlDepartment.Focus(); }
private void btnCancel_Click(object sender, EventArgs e) { pnlMain.Hide(); LabReports us = (LabReports)labReportsBindingSource.Current; if (us.reportID == 0) { labReportsBindingSource.RemoveCurrent(); } }