SHARE
TWEET

Untitled

a guest Sep 4th, 2018 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public class Class1 : IExternalApplication
  2.     {
  3.         public void Execute()
  4.         {
  5.             //Create a list of trans that groupsby same item numbers
  6.             List<Item> lstTrans = Job.Items.Where(x => x.CID == 2).ToList();
  7.             var TransitionGroups = lstTrans.GroupBy(x => x.Number);
  8.            
  9.            
  10.             foreach (var TransitionGroup in TransitionGroups)
  11.             {
  12.                 var TransitionList = TransitionGroup.ToList();
  13.  
  14.                 foreach (var Trans1 in TransitionList)
  15.                 {
  16.  
  17.                     // Get a list of transitions that does not include the current Trans1
  18.                     var TransitionCompareList = TransitionList.Where(x => x.UniqueId != Trans1.UniqueId).ToList();
  19.                    
  20.                     //Compare Trans1 to Trans2
  21.                     foreach (var Trans2 in TransitionCompareList)
  22.                     {
  23.                         double Trans1Value = Trans1.Dimensions[0].Value + Trans1.Dimensions[1].Value + Trans1.Dimensions[2].Value +
  24.                                              Trans1.Dimensions[3].Value + Trans1.Dimensions[4].Value;
  25.                         double Trans2Value = Trans2.Dimensions[0].Value + Trans2.Dimensions[1].Value + Trans2.Dimensions[2].Value +
  26.                                              Trans2.Dimensions[3].Value + Trans2.Dimensions[4].Value;
  27.  
  28.                         if (Trans1Value != Trans2Value)
  29.                         {
  30.                             MessageBox.Show("Duplicate Found, Please fix before sending" + "\n" + "Check Item Number: " +
  31.                                              Trans1.Number, "Important Note", MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
  32.                                              MessageBoxDefaultButton.Button1);
  33.                         }
  34.                     }
  35.                 }
  36.             }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top