/// <summary> /// Save Function /// </summary> public void SaveFunction() { try { ServiceSP spService = new ServiceSP(); ServiceInfo infoService = new ServiceInfo(); infoService.ServiceName = txtServiceName.Text.Trim(); infoService.ServiceCategoryId = Convert.ToDecimal(cmbCategory.SelectedValue.ToString()); infoService.Rate = Convert.ToDecimal(txtRate.Text.ToString()); infoService.Narration = txtNarration.Text.Trim(); infoService.ExtraDate = PublicVariables._dtCurrentDate; infoService.Extra1 = string.Empty; infoService.Extra2 = string.Empty; if (spService.ServiceCheckExistence(txtServiceName.Text.Trim(), 0) == false) { decIdForOtherForms = spService.ServiceAddWithReturnIdentity(infoService); Messages.SavedMessage(); Clear(); GridFill(); } else { Messages.InformationMessage("Service name already exist"); txtServiceName.Focus(); } if (frmServiceVoucherObj != null) { this.Close(); } } catch (Exception ex) { MessageBox.Show("Ser11 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to check existence of Service based on parameters /// </summary> /// <param name="strServiceName"></param> /// <param name="decServiceId"></param> /// <returns></returns> public bool ServiceCheckExistence(string strServiceName, decimal decServiceId) { bool isEdit = false; try { isEdit = spService.ServiceCheckExistence(strServiceName, decServiceId); } catch (Exception ex) { MessageBox.Show("AL35:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(isEdit); }
/// <summary> /// ServiceName Checking Existance /// </summary> /// <returns></returns> public bool CheckExistenceOfServiceName() { bool isExist = false; try { ServiceSP spService = new ServiceSP(); isExist = spService.ServiceCheckExistence(txtServiceName.Text.Trim(), 0); if (isExist) { string strServiceNames = txtServiceName.Text.Trim(); if (strServiceNames.ToLower() == strServiceName.ToLower()) { isExist = false; } } } catch (Exception ex) { MessageBox.Show("Ser10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(isExist); }