示例#1
0
 /// <summary>
 /// Function to save new rack
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         RackSP   spRack   = new RackSP();
         RackInfo rackInfo = new RackInfo();
         rackInfo.RackName  = txtRackName.Text.Trim();
         rackInfo.GodownId  = Convert.ToDecimal(cmbGodown.SelectedValue.ToString());
         rackInfo.Narration = txtNarration.Text.Trim();
         rackInfo.ExtraDate = DateTime.Now;
         rackInfo.Extra1    = string.Empty;
         rackInfo.Extra2    = string.Empty;
         decimal decGodounId = Convert.ToDecimal(cmbGodown.SelectedValue.ToString());
         if (spRack.RackCheckExistence(txtRackName.Text.Trim(), 0, decGodounId) == false)
         {
             decIdForOtherForms = spRack.RackAdd(rackInfo);
             if (decIdForOtherForms > 0)
             {
                 Messages.SavedMessage();
                 Clear();
             }
         }
         else
         {
             Messages.InformationMessage(" Rack name already exist");
             txtRackName.Focus();
         }
     }
     catch (Exception ex)
     {
         formMDI.infoError.ErrorString = "R7:" + ex.Message;
     }
 }
示例#2
0
        /// <summary>
        /// Function to check rack name alredy exist or not
        /// </summary>
        /// <returns></returns>
        public bool CheckExistenceOfRackName()
        {
            bool isExist = false;

            try
            {
                RackSP spRack = new RackSP();
                isExist = spRack.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)
            {
                formMDI.infoError.ErrorString = "R6:" + ex.Message;
            }
            return(isExist);
        }