Exemplo n.º 1
0
 /// <summary>
 /// Function to save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         BonusDedutionInfo infoBonusDeduction = new BonusDedutionInfo();
         BonusDedutionSP   spBonusDeduction   = new BonusDedutionSP();
         infoBonusDeduction.Date            = Convert.ToDateTime(dtpDate.Text.ToString());
         infoBonusDeduction.EmployeeId      = Convert.ToDecimal(cmbEmployeeCode.SelectedValue.ToString());
         infoBonusDeduction.Month           = Convert.ToDateTime(dtpMonth.Text.ToString());
         infoBonusDeduction.BonusAmount     = Convert.ToDecimal(txtBonusAmount.Text.ToString());
         infoBonusDeduction.DeductionAmount = Convert.ToDecimal(txtDeductionAmount.Text.ToString());
         infoBonusDeduction.Narration       = txtNarration.Text;
         infoBonusDeduction.Extra1          = string.Empty;
         infoBonusDeduction.Extra2          = string.Empty;
         if (spBonusDeduction.BonusDeductionAddIfNotExist(infoBonusDeduction))
         {
             Messages.SavedMessage();
             Clear();
         }
         else
         {
             Messages.InformationMessage(" Employee bonus deduction already exist");
             cmbEmployeeCode.Focus();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("BD2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        public string SaveFunction(string employeeId, string date, string month,
                                   string bonusAmount, string deductionAmount, string narration)
        {
            string message = string.Empty;

            try
            {
                BonusDedutionInfo infoBonusDeduction = new BonusDedutionInfo();
                BonusDedutionSP   spBonusDeduction   = new BonusDedutionSP();
                infoBonusDeduction.Date            = Convert.ToDateTime(date);
                infoBonusDeduction.EmployeeId      = Convert.ToDecimal(employeeId);
                infoBonusDeduction.Month           = Convert.ToDateTime(month);
                infoBonusDeduction.BonusAmount     = Convert.ToDecimal(bonusAmount);
                infoBonusDeduction.DeductionAmount = Convert.ToDecimal(deductionAmount);
                infoBonusDeduction.Narration       = narration;
                infoBonusDeduction.Extra1          = string.Empty;
                infoBonusDeduction.Extra2          = string.Empty;
                if (!spBonusDeduction.BonusDeductionAddIfNotExist(infoBonusDeduction))
                {
                    message = "Employee bonus deduction already exist";
                }
            }
            catch (Exception ex)
            {
            }
            return(message);
        }
        /// <summary>
        /// Function to insert values if not exists and return id
        /// </summary>
        /// <param name="bonusdedutioninfo"></param>
        /// <returns></returns>
        public bool BonusDeductionAddIfNotExist(BonusDedutionInfo bonusdedutioninfo)
        {
            bool isSave = false;

            try
            {
                isSave = SPBonusDedution.BonusDeductionAddIfNotExist(bonusdedutioninfo);
            }
            catch (Exception ex)
            {
                MessageBox.Show("BDBll10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            return(isSave);
        }