コード例 #1
0
ファイル: frmUnit.cs プロジェクト: salmanmushtaq/openmiracle
 /// <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
ファイル: frmUnit.cs プロジェクト: jsoques/openmiracle
        /// <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);
            }
        }