示例#1
0
 /// <summary>
 /// Function for Edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         PayHeadSP   spPayhead   = new PayHeadSP();
         PayHeadInfo infoPayhead = new PayHeadInfo();
         infoPayhead.PayHeadId   = decPayHeadId;
         infoPayhead.PayHeadName = txtPayheadName.Text.Trim();
         infoPayhead.Type        = cmbPayheadType.Text;
         infoPayhead.Narration   = txtPayheadNarration.Text.Trim();
         if (spPayhead.PayheadCheckExistence(txtPayheadName.Text.Trim(), infoPayhead.PayHeadId) == false)
         {
             spPayhead.PayHeadEdit(infoPayhead);
             GridFill();
             Messages.UpdatedMessage();
             Clear();
         }
         else
         {
             Messages.InformationMessage("Payhead name already exist");
             txtPayheadName.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PH2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
示例#2
0
 /// <summary>
 /// Function for save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         PayHeadSP   spPayhead   = new PayHeadSP();
         PayHeadInfo infoPayhead = new PayHeadInfo();
         infoPayhead.PayHeadName = txtPayheadName.Text.Trim();
         infoPayhead.Type        = cmbPayheadType.SelectedItem.ToString();
         infoPayhead.Narration   = txtPayheadNarration.Text.Trim();
         infoPayhead.ExtraDate   = DateTime.Parse(DateTime.Now.ToString());
         infoPayhead.Extra1      = string.Empty;
         infoPayhead.Extra2      = string.Empty;
         if (btnPayheadSave.Text == "Save")
         {
             if (spPayhead.PayheadCheckExistence(txtPayheadName.Text.Trim(), 0) == false)
             {
                 Messages.SavedMessage();
                 spPayhead.PayHeadAdd(infoPayhead);
                 GridFill();
                 Clear();
             }
             else
             {
                 Messages.InformationMessage("Payhead name already exist");
                 txtPayheadName.Focus();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PH1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        public bool PayheadCheckExistence(string PaheadName, decimal PayHeadId)
        {
            bool isResult = false;

            try
            {
                isResult = SPPayHead.PayheadCheckExistence(PaheadName, PayHeadId);
            }
            catch (Exception ex)
            {
                MessageBox.Show("CB:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(isResult);
        }