/// <summary> /// save function /// </summary> public void SaveFunction() { try { UnitSP spUnit = new UnitSP(); UnitInfo infoUnit = new UnitInfo(); infoUnit.UnitName = txtUnitname.Text.Trim(); infoUnit.noOfDecimalplaces = Convert.ToDecimal(txtDecimalPlaces.Text.ToString()); infoUnit.Narration = txtNarration.Text.Trim(); infoUnit.formalName = txtFormalName.Text.Trim(); infoUnit.Extra1 = string.Empty; infoUnit.Extra2 = string.Empty; infoUnit.ExtraDate = DateTime.Now; if (spUnit.UnitCheckExistence(txtUnitname.Text.Trim(), 0) == false) { decUnit = spUnit.UnitAdd(infoUnit); if (decUnit > 0) { Messages.SavedMessage(); GridFill(); Clear(); } } else { Messages.InformationMessage(" Unit name already exist"); txtUnitname.Focus(); } } catch (Exception ex) { MessageBox.Show("U3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public bool UnitCheckExistence(string strUnitName, decimal decUnitid) { bool isEdit = false; try { isEdit = spUnit.UnitCheckExistence(strUnitName, decUnitid); } catch (Exception ex) { MessageBox.Show("UBLL2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(isEdit); }
/// <summary> /// here checking the unit name if already exists for create new unit /// </summary> /// <returns></returns> public bool CheckExistenceOfUnitName() { bool isExist = false; try { UnitSP spUnit = new UnitSP(); isExist = spUnit.UnitCheckExistence(txtUnitname.Text.Trim(), 0); if (isExist) { string strUnitNames = txtUnitname.Text.Trim(); if (strUnitNames.ToLower() == strUnitName.ToLower()) { isExist = false; } } } catch (Exception ex) { MessageBox.Show("U2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(isExist); }