예제 #1
0
 /// <summary>
 /// Delete Function
 /// </summary>
 public void Delete()
 {
     try
     {
         DeliveryNoteMasterSP spDeliveryNoteMaster = new DeliveryNoteMasterSP();
         DeliveryNoteDetailsSP spDeliveryNoteDetails = new DeliveryNoteDetailsSP();
         StockPostingSP spStockPosting = new StockPostingSP();
         if (!spDeliveryNoteMaster.DeliveryNoteCheckReferenceInSalesInvoice(decDelivryNoteIdToEdit))
         {
             decimal decResult1 = 0;
             decimal decResult2 = spDeliveryNoteMaster.DeliveryNoteMasterDelete(decDelivryNoteIdToEdit);
             for (int inI = 0; inI < dgvProduct.Rows.Count - 1; inI++)
             {
                 if (Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtDetailsId"].Value) != 0)
                 {
                     decResult1 = spDeliveryNoteDetails.DeliveryNoteDetailsDelete(Convert.ToDecimal(dgvProduct.Rows[0].Cells["dgvtxtDetailsId"].Value.ToString()));
                 }
             }
             spStockPosting.StockPostingDeleteByVoucherTypeAndVoucherNo(strVoucherNo, decDeliveryNoteVoucherTypeId);
             if (decResult2 > 0)
             {
                 Messages.DeletedMessage();
             }
             else
             {
                 Messages.ReferenceExistsMessage();
             }
             if (frmDeliveryNoteRegisterObj != null)
             {
                 this.Close();
                 frmDeliveryNoteRegisterObj.GridFill();
             }
             if (frmDeliveryNoteReportObj != null)
             {
                 this.Close();
                 frmDeliveryNoteReportObj.GridFill();
             }
             if (frmDayBookObj != null)
             {
                 this.Close();
             }
             if (objVoucherSearch != null)
             {
                 this.Close();
             }
             if (objVoucherProduct != null)
             {
                 this.Close();
             }
         }
         else
         {
             Messages.ReferenceExistsMessage();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("DN42:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #2
0
 /// <summary>
 /// RemoveDeliveryNoteDetails If any row was removed at the time of update
 /// </summary>
 public void RemoveDeliveryNoteDetails()
 {
     try
     {
         DeliveryNoteDetailsSP spDeliveryNoteDetails = new DeliveryNoteDetailsSP();
         foreach (string str in lstArrOfRemove)
         {
             decimal decDeleteId = Convert.ToDecimal(str);
             spDeliveryNoteDetails.DeliveryNoteDetailsDelete(decDeleteId);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("DN37:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }