예제 #1
0
 /// <summary>
 /// Function to delete
 /// </summary>
 public void Deletefunction()
 {
     try
     {
         BonusDedutionSP spBonusDeduction = new BonusDedutionSP();
         if ((spBonusDeduction.BonusDeductionReferenceDelete(decEmployeeIdForEdit, dtMonth)) == -1)
         {
             MessageBox.Show("Can't delete,reference exist", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             Messages.DeletedMessage();
             btnSave.Text      = "Save";
             btnDelete.Enabled = false;
             this.Close();
             if (frmBonusDeductionRegisterObj != null)
             {
                 frmBonusDeductionRegisterObj.Show();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("BD7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Function to check reference and delete based on parameters
        /// </summary>
        /// <param name="EmployeeId"></param>
        /// <param name="month"></param>
        /// <returns></returns>
        public decimal BonusDeductionReferenceDelete(decimal EmployeeId, DateTime month)
        {
            decimal decReturnValue = 0;

            try
            {
                decReturnValue = SPBonusDedution.BonusDeductionReferenceDelete(EmployeeId, month);
            }
            catch (Exception ex)
            {
                MessageBox.Show("BDBll13:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(decReturnValue);
        }
        public ActionResult DeleteBonusDeduction(string employeeId, string month)
        {
            string message = string.Empty;

            try
            {
                BonusDedutionSP spBonusDeduction = new BonusDedutionSP();
                if ((spBonusDeduction.BonusDeductionReferenceDelete(Convert.ToDecimal(employeeId), Convert.ToDateTime(month))) == -1)
                {
                    message = "Can't delete,reference exist";
                }
            }
            catch (Exception ex)
            {
                return(Json(new { success = "true", ex = "BD3:" + ex.Message }));
            }
            return(Json(new { success = "true", ex = "no", message }));
        }