public override void IUD() { try { string sql = "exec [IMS].[IUDBills]"; List <string> lst = new List <string>(); lst.Add(this.BillId); lst.Add(this.IUDFlag); lst.Add(this.CustomerName); lst.Add(Convert.ToString(this.Discount)); lst.Add(Common.LoggedInUserID); DAL.StartTransaction(); DataTable dtResult = DAL.Select(sql, lst, DAL.transaction); if (dtResult != null && dtResult.Rows.Count > 0) { this.BillId = Convert.ToString(dtResult.Rows[0][0]); if (lstParticulars != null && lstParticulars.Count > 0) { sql = "exec [IMS].[DeleteBillDetails]"; lst = new List <string>(); lst.Add(this.BillId); dtResult = DAL.Select(sql, lst, DAL.transaction);// Delete Invoice Details foreach (FormEntity en in lstParticulars) { sql = "exec [IMS].[IUDBillDetails]"; lst = new List <string>(); lst.Add(string.Empty); lst.Add(this.BillId); lst.Add(this.IUDFlag); lst.Add(en.ProductId); lst.Add(en.Quantity); lst.Add(en.Rate); lst.Add(en.Per); lst.Add(en.Amount.ToString()); lst.Add(en.OtherCharges.ToString()); lst.Add(en.HSNCode); lst.Add(en.CGST.ToString()); lst.Add(en.SGST.ToString()); lst.Add(en.IGST.ToString()); lst.Add(en.TotalTax.ToString()); lst.Add(en.TaxableAmount.ToString()); lst.Add(en.TotalAmount.ToString()); lst.Add(Common.LoggedInUserID); dtResult = DAL.Select(sql, lst, DAL.transaction);// Invoice Details } } sql = "exec ims.DeleteTransaction"; lst = new List <string>(); lst.Add(this.BillId); dtResult = DAL.Select(sql, lst, DAL.transaction);// Delete Invoice Details Transactions objTransaction = new Transactions(); //foreach (InvoiceDetailsEntity en in lstParticulars) { objTransaction.IUDFlag = IUDFlag; objTransaction.TransactionID = this.BillId; objTransaction.TransactionType = "BD"; objTransaction.ProductID = string.Empty;; objTransaction.Quantity = string.Empty; objTransaction.Amount = TotalofTotalAmount.ToString(); objTransaction.AccountEntry = "C"; objTransaction.IUDTransactions(); } if (Convert.ToInt32(objTransaction.ID) > 0) { MessageBox.Show("Data Saved Successfully"); if (MessageBoxResult.Yes == MessageBox.Show("Do you want to print the Bill ?", "Print Bill", MessageBoxButton.YesNo)) { ReportsHostingForm obj = new ReportsHostingForm("Bill"); obj.ShowDialog(); } ClearFormFields(); } } } catch (Exception ex) { } finally { DAL.EndTransaction(); } }