private void btnSave_Click(object sender, EventArgs e) { if (IsCorrectData()) { using (OfficialBusiness ob = new OfficialBusiness()) { ob.UserName = cmbRequestor.SelectedValue.ToString(); ob.DateFile = clsDateTime.CombineDateTime(dtpFileDate.Value, dtpFileTime.Value); ob.Reason = txtReason.Text; ob.OBType = cmbOBType.SelectedValue.ToString(); ob.DepartmentCode = cmbRender.SelectedValue.ToString(); if (cmbOBType.SelectedValue.ToString() == "1") { ob.RAName = cmbRApprover.SelectedValue.ToString(); ob.RADate = clsDateTime.CombineDateTime(dtpRDate.Value, dtpRTime.Value); ob.RARemarks = txtRRemarks.Text; ob.RAStatus = cmbRStatus.SelectedValue.ToString(); } ob.HAName = cmbHApprover.SelectedValue.ToString(); ob.HADate = clsDateTime.CombineDateTime(dtpHDate.Value, dtpHTime.Value); ob.HARemarks = txtHRemarks.Text; ob.HAStatus = cmbHStatus.SelectedValue.ToString(); ob.Status = cmbStatus.SelectedValue.ToString(); if (ob.InsertAdmin() > 0) { frmOBEdit pForm = new frmOBEdit(); pForm.FormOBList = _frmOBList; pForm.FormOBNew = this; pForm.OBCode = ob.OBCode; pForm.FormCaller = FormCallers.OBNew; pForm.ShowDialog(); } } } }
private void tbtnEdit_Click(object sender, EventArgs e) { if (dgOBList.SelectedRows.Count > 0) { frmOBEdit pForm = new frmOBEdit(); pForm.FormOBList = this; pForm.OBCode = dgOBList.SelectedRows[0].Cells[0].Value.ToString(); pForm.ShowDialog(); } }