/// <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); } }