/// <summary> /// Function to save new rack /// </summary> public void SaveFunction() { try { RackBll BllRack = new RackBll(); RackInfo InfoRack = new RackInfo(); InfoRack.RackName = txtRackName.Text.Trim(); InfoRack.GodownId = Convert.ToDecimal(cmbGodown.SelectedValue.ToString()); InfoRack.Narration = txtNarration.Text.Trim(); InfoRack.ExtraDate = DateTime.Now; InfoRack.Extra1 = string.Empty; InfoRack.Extra2 = string.Empty; decimal decGodounId=Convert.ToDecimal(cmbGodown.SelectedValue.ToString()); if (BllRack.RackCheckExistence(txtRackName.Text.Trim(), 0, decGodounId) == false) { decIdForOtherForms = BllRack.RackAdd(InfoRack); if (decIdForOtherForms > 0) { Messages.SavedMessage(); Clear(); } } else { Messages.InformationMessage(" Rack name already exist"); txtRackName.Focus(); } } catch (Exception ex) { MessageBox.Show("R7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to check rack name alredy exist or not /// </summary> /// <returns></returns> public bool CheckExistenceOfRackName() { bool isExist = false; try { RackBll BllRack = new RackBll(); isExist = BllRack.RackCheckExistence(txtRackName.Text.Trim(), 0, Convert.ToDecimal(cmbGodown.SelectedValue.ToString())); if (isExist) { string strRackNames = txtRackName.Text.Trim(); if (strRackNames.ToLower() == strRackName.ToLower()) { isExist = false; } } } catch (Exception ex) { MessageBox.Show("R6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return isExist; }