/// <summary> /// Save Function /// </summary> public void SaveFunction() { try { ServicesBll BllService = new ServicesBll(); 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 (BllService.ServiceCheckExistence(txtServiceName.Text.Trim(), 0) == false) { decIdForOtherForms = BllService.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> /// ServiceName Checking Existance /// </summary> /// <returns></returns> public bool CheckExistenceOfServiceName() { bool isExist = false; try { ServicesBll BllService = new ServicesBll(); isExist = BllService.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; }