public static void AcknowledgePickupNotice(PUNAcknowledgementInformation puna)//, AuditTrailWrapper auditTrail) { IPickupNotice pun = GetPUN(true); AuditTrailWrapper auditTrail = new AuditTrailWrapper(AuditTrailWrapper.PUNInitiation, "PUN Process"); PUNAcknowledgementInformation originalPUN = new PUNAcknowledgementInformation(); originalPUN.Copy(pun.PUNAInformation); auditTrail.AddChange(new object[][] { new object[] { originalPUN, puna, AuditTrailWrapper.NewRecord } }); SqlTransaction transaction = null; string transactionId = null; try { transaction = pun.AcknowledgePickupNotice(puna); transactionId = StartPUNWorkflow(); if (transactionId != string.Empty) { puna.TransactionId = transactionId; pun.AcknowledgePickupNotice(puna, transaction); if (!WarehouseTrackingNoBLL.Save(transactionId, transaction)) { GINProcessWrapper.RemoveWorkflowTask(transactionId); throw new Exception("Failed to start PUN Transaction"); } } else { throw new Exception("Failed to start PUN Transaction"); } if (!auditTrail.Save()) { throw new Exception("Failed to save audit trail"); } transaction.Commit(); } catch (Exception ex) { try { if ((transactionId != null) && (transactionId != string.Empty)) { GINProcessWrapper.RemoveWorkflowTask(transactionId); } } catch (Exception ex2) { throw ex2; } finally { if (transaction != null) { transaction.Rollback(); } } throw ex; } }
public static void CompleteLoading(Guid truckId) { //check if page being processed outside a workflow context PageDataTransfer transferedData = new PageDataTransfer(HttpContext.Current.Request.Path); IGINProcess ginProcess = GetGINProcess(true); SqlTransaction transaction = null; try { AuditTrailWrapper auditTrail = new AuditTrailWrapper(AuditTrailWrapper.TruckLoading, "GIN Process"); //GINInfo originalGIN = new GINInfo(); //originalGIN.Copy(ginProcess.GINProcessInformation.Trucks[0].GIN); transaction = ginProcess.CompleteLoading(truckId); GINTruckInfo theTruck = ginProcess.GINProcessInformation.Trucks.Find(trk => trk.TruckId == truckId); foreach (var loadedStack in theTruck.Load.Stacks) { InventoryServices.GetInventoryService().LoadFromStack(loadedStack.StackId, loadedStack.Bags, 0, transaction); auditTrail.AddChange( new TruckLoadInfo(), new TruckLoadInfo(loadedStack.TruckId, theTruck.Load.DateLoaded, theTruck.Load.BagType, string.Empty), AuditTrailWrapper.NewRecord); if (!auditTrail.Save()) { throw new Exception("Unable to log audit trail"); } } //auditTrail.AddChange(originalGIN, ginProcess.GINProcessInformation.Trucks[0].GIN); //if (!auditTrail.Save()) // throw new Exception("Failed to save audit trail!"); CompleteWorkflowTask(ginProcess.GINProcessInformation.Trucks[0].TransactionId); //CompleteWorkflowTask(ginProcess.GINProcessInformation.Trucks[0].TransactionId); transaction.Commit(); } catch (Exception ex) { try { if (transaction != null) { transaction.Rollback(); } } catch (Exception ex2) { throw ex2; } throw ex; } }
public static void AbortPun() { IGINProcess ginProcess = GetGINProcess(true); IPickupNotice pun = new PickupNoticeBLL(ginProcess.GINProcessInformation.PickupNoticeId); PickupNoticeInformation puni = new PickupNoticeInformation(); SqlTransaction transaction = null; try { puni.Copy(pun.PickupNoticeInformation); transaction = pun.Aborted(); CompleteWorkflowTask(ginProcess.GINProcessInformation.TransactionId); transaction.Commit(); AuditTrailWrapper punAudit = new AuditTrailWrapper(AuditTrailWrapper.PUNAbortion, new object[][] { new object[] { puni, pun.PickupNoticeInformation } }, "PUN Abortion"); if (!punAudit.Save()) { throw new Exception("Failed to save audit trail!"); } UpdatePUNStatus( pun.PickupNoticeInformation.PickupNoticeId, pun.LookupSource.GetLookup("Status")[pun.PickupNoticeInformation.Status]); } catch (Exception ex) { try { if (transaction != null) { transaction.Rollback(); } } catch (Exception ex2) { throw ex2; } throw ex; } }