コード例 #1
0
 /// <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);
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        /// <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);
        }