/// <summary> /// Fill controls for Update or delete /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvService_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex != -1) { ServiceSP spService = new ServiceSP(); ServiceInfo infoService = new ServiceInfo(); decServiceId = Convert.ToDecimal(dgvService.Rows[e.RowIndex].Cells["dgvtxtServiceId"].Value.ToString()); infoService = spService.ServiceView(decServiceId); txtServiceName.Text = infoService.ServiceName; cmbCategory.SelectedValue = infoService.ServiceCategoryId.ToString(); txtRate.Text = infoService.Rate.ToString(); txtNarration.Text = infoService.Narration; txtServiceNameSearch.Text = string.Empty; cmbCategorySearch.SelectedIndex = 0; btnSave.Text = "Update"; btnDelete.Enabled = true; strServiceName = infoService.ServiceName; txtServiceName.Focus(); } } catch (Exception ex) { MessageBox.Show("Ser17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to get particular values from Service Table based on the parameter /// </summary> /// <param name="serviceId"></param> /// <returns></returns> public ServiceInfo ServiceView(decimal serviceId) { ServiceInfo serviceinfo = new ServiceInfo(); try { serviceinfo = spService.ServiceView(serviceId); } catch (Exception ex) { MessageBox.Show("AL35:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(serviceinfo); }