/// <summary> /// Inserting the new RefundApplication /// </summary> /// <param name="Parameter"> formview parameter</param> /// <param name="StampDetails">stamps added by the user in the form of Datatable </param> /// <param name="ActsApplicable">Acts added by the user</param> /// <returns>true, a record is inserted</returns> public bool AddNewRefundApplication(FormViewParameter Parameter, DataTable StampDetails, DataTable ActsApplicable, Remarks rem) { // Initiate some of the fields required for the process RefundApplicationRow rowRef = (RefundApplicationRow)Parameter.Values; Guid RefundApplicationId = FileManager.OpenNewFile(rowRef.OfficeId, "REF"); FileManager.AddRemarkToFile(RefundApplicationId, rem.Subject, rem.Body); string curUser = Thread.CurrentPrincipal.Identity.Name; RefundApplicationRow row = (IGRSS.DataAccessLayer.Refund.RefundApplicationRow)Parameter.Values; try { TimeSpan ts = new TimeSpan(row.PurchasedDate.Ticks - row.ApplicationDate.Ticks); string DayDifference = ts.TotalDays.ToString(); // Insert the Refiund Application data to database decimal TotalValueOfStamps = Convert.ToDecimal(row.TotalValueOfStamps); decimal pActualStampValue = 10 * TotalValueOfStamps / 100; decimal ActualStampValue = TotalValueOfStamps - pActualStampValue; IgrssAdapters.RefundApplicationAdapter.NewRefundApplication(RefundApplicationId, row.OfficeId, row.RegistrationNo, row.TypeOfRefund, row.ApplicationDate, row.VendorLicenseId, row.PurchasedDate, row.TotalValueOfStamps, row.ReasonForNotUsing, row.ApplicantName, row.ApplicantAddress, row.City, row.District, row.PinCode, row.PhoneNo.ToString(), DateTime.Now, curUser, ActualStampValue); // For each Stamp Detail entered by user // Insert the Stamp Details for this Refund in to child table foreach (DataRow StampDetail in StampDetails.Rows) { IgrssAdapters.RefundStampDetailsAdapter.InsertStampDetails(RefundApplicationId, (Guid)StampDetail["RevenueStampId"], (string)StampDetail["ReturnedQty"], (string)StampDetail["StampNumber"]); } // For each Act selected by the user // Insert the Applicable Acts to child table foreach (DataRow Act in ActsApplicable.Rows) { IgrssAdapters.RefundActsApplicable.InsertRefundActsApplicable(RefundApplicationId, (Guid)Act["ActId"], (bool)Act["Checked"], ""); } // All database Inserts have been completed sucessfully initiate the Workflow // Create a Dioctionary to store Workflow Paramaters for Refund Dictionary <string, object> WfParams = new Dictionary <string, object>(); // Add Refund Application Id into the Workflow Parameter WfParams.Add("RefundId", RefundApplicationId); // Add Office Id in to Workflow Parameter // (to identify the process flow for the Office) WfParams.Add("InitiatingOffice", row.OfficeId); // Initiate the Refund Workflow by passing the Wf Parameters Dictionary WorkflowResults WfResult = WorkflowMediator.RunWorkflow(typeof(RefundProcess), WfParams); } catch (Exception ex) { if (ExceptionPolicy.HandleException(ex, "DAL")) { throw; } } return(true); }
public RefundApplicationUpdatedEventArgs(Guid InstanceId, RefundApplicationRow UpdatedRefundRow, DataTable StampDetails, DataTable ActsApplicable) : base(InstanceId) { this.UpdatedRefundRows = (RefundApplicationDataTable) UpdatedRefundRow.Table; UpdatedRefundRow.RefundApplicationId = new Guid(); this.UpdatedRefundRows.Rows.Add(UpdatedRefundRow); this.StampDetails = StampDetails; this.ActsApplicable = ActsApplicable; }
public RefundApplicationUpdatedEventArgs(Guid InstanceId, RefundApplicationRow UpdatedRefundRow, DataTable StampDetails, DataTable ActsApplicable) : base(InstanceId) { this.UpdatedRefundRows = (RefundApplicationDataTable)UpdatedRefundRow.Table; UpdatedRefundRow.RefundApplicationId = new Guid(); this.UpdatedRefundRows.Rows.Add(UpdatedRefundRow); this.StampDetails = StampDetails; this.ActsApplicable = ActsApplicable; }
private void OnApplicationUpdated_Invoked(object sender, ExternalDataEventArgs e) { // Type cast the event args to the required type RefundApplicationUpdatedEventArgs args = (RefundApplicationUpdatedEventArgs)e; // Retrive the row to be updated (always the frist row i.e. Rows[0]) RefundApplicationRow row = args.UpdatedRefundRows[0]; //using (TransactionScope scope = new TransactionScope()) { // Update the database row IgrssAdapters.RefundApplicationAdapter.UpdateRefundApplication1(this.RefundId, row.OfficeId, row.RegistrationNo, row.TypeOfRefund, row.ApplicationDate, row.VendorLicenseId, row.PurchasedDate, row.TotalValueOfStamps, row.ReasonForNotUsing, row.ApplicantName, row.ApplicantAddress, row.City, row.District, row.PinCode, row.PhoneNo, row.Remarks, row.ActualStampValue); // Delete all the existing StampDetails for this Refund Application IgrssAdapters.RefundStampDetailsAdapter.DeleteRefundStampDetails(this.RefundId); // Re-Enter the Stamp Details foreach (DataRow StampDetail in args.StampDetails.Rows) { IgrssAdapters.RefundStampDetailsAdapter.InsertStampDetails(this.RefundId, (Guid)StampDetail["RevenueStampId"], (string)StampDetail["ReturnedQty"], (string)StampDetail["StampNumber"]); } // Delete all the existing Acts that were selected for this Refund Application IgrssAdapters.RefundActsApplicable.DeleteRefundOrders(this.RefundId); // Re-Enter the Acts that have been selected foreach (DataRow Act in args.ActsApplicable.Rows) { IgrssAdapters.RefundActsApplicable.InsertRefundActsApplicable(this.RefundId, (Guid)Act["ActId"], (bool)Act["Checked"], ""); } //scope.Complete(); } // The Application has been modified and will require verification from all again FeedbackData CurFeedback = VerificationList[verificationIndex]; WorkflowSupport.DeleteAlerts(CurFeedback.Alerts.ToArray()); this.verificationIndex = 0; }