Beispiel #1
0
        public System.Data.SqlClient.SqlTransaction GINGenerated(Guid truckId)
        {
            IGINProcess    originalGIN = new GINProcessBLL(currentGINProcess.GINProcessInformation.TransactionId);
            SqlTransaction transaction = currentGINProcess.GINGenerated(truckId);

            var ginChanges = (from oGIN in originalGIN.GINProcessInformation.Trucks
                              join cGIN in currentGINProcess.GINProcessInformation.Trucks
                              on oGIN.TruckId equals cGIN.TruckId
                              where oGIN.TruckId == truckId
                              select new object[] { oGIN, cGIN, AuditTrailWrapper.ExistingRecord });

            try
            {
                AuditTrailWrapper atw = new AuditTrailWrapper(AuditTrailWrapper.TruckWeighing, "GIN Process");
                atw.AddChange(ginChanges.ToArray());

                if (!atw.Save())
                {
                    transaction.Rollback();
                    throw new Exception("Failed to save audit trail!");
                }
            }
            catch (Exception ex)
            {
                transaction.Rollback();
                throw ex;
            }
            return(transaction);
        }
Beispiel #2
0
        public static void GINGenerated(Guid truckId)
        {
            //AuditTrailWrapper auditTrail = new AuditTrailWrapper(AuditTrailWrapper.TruckWeighing);
            IGINProcess ginProcess = GetGINProcess(true);
            //GINInfo originalGin = new GINInfo();
            //originalGin.Copy(ginProcess.GINProcessInformation.Trucks[0].GIN);
            SqlTransaction transaction = null;

            try
            {
                transaction = ginProcess.GINGenerated(truckId);
                //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);
                transaction.Commit();
            }
            catch (Exception ex)
            {
                try
                {
                    if (transaction != null)
                    {
                        transaction.Rollback();
                    }
                }
                catch (Exception ex2)
                {
                    throw ex2;
                }
                throw ex;
            }
        }