예제 #1
0
 /// <summary>
 /// delete function
 /// </summary>
 public void Delete()
 {
     try
     {
         if (PublicVariables.isMessageDelete)
         {
             if (Messages.DeleteMessage())
             {
                 TaxInfo infoTax = new TaxInfo();
                 TaxDetailsInfo infoTaxDetails = new TaxDetailsInfo();
                 TaxBll bllTax = new TaxBll();
                 AccountLedgerBll bllAccountLedger = new AccountLedgerBll();
                 bool isExist = bllTax.TaxReferenceCheck(decTaxId);
                 if (!isExist)
                 {
                     if ((bllTax.TaxReferenceDelete(decTaxId,decLedgerId)) == -1)
                     {
                         Messages.ReferenceExistsMessage();
                     }
                     else
                     {
                         bllTax.TaxDetailsDeleteWithTaxId(decTaxId);
                         bllAccountLedger.AccountLedgerDelete(decLedgerId);
                         Messages.DeletedMessage();
                         TaxSearchGridFill();
                         TaxSelectionGridFill();
                         Clear();
                         SearchClear();
                     }
                 }
                 else
                 {
                     Messages.ReferenceExistsMessage();
                 }
             }
         }
         else
         {
             TaxInfo infoTax = new TaxInfo();
             TaxDetailsInfo infoTaxDetails = new TaxDetailsInfo();
             TaxBll bllTax = new TaxBll();
             bool isExist = bllTax.TaxReferenceCheck(decTaxId);
             if (!isExist)
             {
                 if ((bllTax.TaxReferenceDelete(decTaxId,decLedgerId)) == -1)
                 {
                     Messages.ReferenceExistsMessage();
                 }
                 else
                 {
                     bllTax.TaxDetailsDeleteWithTaxId(decTaxId);
                     Messages.DeletedMessage();
                     TaxSearchGridFill();
                     TaxSelectionGridFill();
                     Clear();
                     SearchClear();
                 }
             }
             else
             {
                 Messages.ReferenceExistsMessage();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("TC11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// delete function
        /// </summary>
        public void DeleteFunction()
        {
            try
            {
                AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo();
                AccountLedgerBll bllAccountLedger = new AccountLedgerBll();
                if (bllAccountLedger.SupplierCheckreferenceAndDelete(Convert.ToDecimal(strLedgerId.ToString())) == -1)
                {
                    Messages.ReferenceExistsMessage();

                }
                else
                {
                    bllAccountLedger.PartyBalanceDeleteByVoucherTypeVoucherNoAndReferenceType(decLedger.ToString(), 1);
                    bllAccountLedger.LedgerPostingDeleteByVoucherTypeAndVoucherNo(decLedger.ToString(), 1);
                    bllAccountLedger.AccountLedgerDelete(decLedger);
                    Messages.DeletedMessage();
                    Clear();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("SUP11" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }