Nemo048

Untitled

Aug 30th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.29 KB | None | 0 0
  1. if(instance.ActiveTab.IsBusy)
  2. {
  3.     instance.ActiveTab.WaitDownloading();
  4. }
  5.  
  6. HtmlElementCollection requests = instance.ActiveTab.FindElementByAttribute("table", "class", "dt", "text", 4).FindChildrenByAttribute("tr", "fulltag", "tr", "text");
  7.  
  8. project.SendInfoToLog("Число заявок " + requests.Count.ToString(), true);
  9.  
  10. if(requests.Count == 2)
  11. {  
  12.     HtmlElement date = instance.ActiveTab.FindElementByAttribute("table", "class", "dt", "text", 0).FindChildByTag("td", 3);
  13.     MyVariables.dateOfSigningTheProtocol.Add(date.GetAttribute("innertext").ToString());
  14.     project.SendInfoToLog("Дата подписания протокола " + date.GetAttribute("innertext").ToString(), true);
  15.        
  16.     if(project.Variables["nameOfProtocol"].Value.Contains("Протокол подведения итогов"))
  17.     {
  18.         HtmlElement notifNumb = requests.Elements[1].FindChildByTag("td", 2);
  19.         project.SendInfoToLog("Номер извещения " + notifNumb.GetAttribute("innertext").ToString(), true);
  20.         MyVariables.notificationNumber.Add(notifNumb.GetAttribute("innertext").ToString().Replace(".", ","));
  21.     }
  22.     else
  23.     {
  24.         MyVariables.notificationNumber.Add(string.Empty);
  25.         project.SendInfoToLog("Номер извещения ", true);
  26.     }
  27.    
  28.     MyVariables.linkToTheProtocol.Add(instance.ActiveTab.URL.ToString());
  29.     project.SendInfoToLog("Ссылка на протокол " + instance.ActiveTab.URL.ToString(), true);
  30.    
  31.     HtmlElement name = requests.Elements[1].FindChildByTag("td", 1);
  32.     MyVariables.nameOfParticipant.Add(name.GetAttribute("innertext").ToString());
  33.     project.SendInfoToLog("Имя участника " + name.GetAttribute("innertext").ToString(), true);
  34.    
  35.     string decision = requests.Elements[1].FindChildByTag("td", 5).GetAttribute("innertext").ToString().Replace("\t", string.Empty).Replace("\n", string.Empty).Replace("\r", string.Empty).Trim(' ');
  36.     MyVariables.decisionOfTheComission.Add(decision);
  37.     project.SendInfoToLog("Решение " + decision, true);
  38.    
  39.     if(decision != "соответствует")
  40.     {
  41.         MyVariables.reasonForRejection.Add(requests.Elements[1].FindChildByTag("td", 6).GetAttribute("innertext").ToString().Replace("\t", string.Empty).Replace("\n", string.Empty).Replace("\r", string.Empty).Trim(' '));
  42.         project.SendInfoToLog("Причина отклонения " + MyVariables.reasonForRejection[MyVariables.reasonForRejection.Count - 1], true);
  43.     }
  44.     else
  45.     {
  46.         MyVariables.reasonForRejection.Add(string.Empty);
  47.         project.SendInfoToLog("Причина отклонения ", true);
  48.     }
  49. }
  50. else
  51. {
  52.     for(int i = 1; i < requests.Count; i++)
  53.     {
  54.        
  55.         if(i == 1)
  56.         {
  57.             HtmlElement date = instance.ActiveTab.FindElementByAttribute("table", "class", "dt", "text", 0).FindChildByTag("td", 3);
  58.             MyVariables.dateOfSigningTheProtocol.Add(date.GetAttribute("innerhtml").ToString());
  59.             project.SendInfoToLog("Дата подписания протокола " + date.GetAttribute("innertext").ToString(), true);
  60.            
  61.             if(project.Variables["nameOfProtocol"].Value.Contains("Протокол подведения итогов"))
  62.             {
  63.                 HtmlElement notifNumb = requests.Elements[i].FindChildByTag("td", 2);
  64.                 project.SendInfoToLog("Номер извещения " + notifNumb.GetAttribute("innertext").ToString(), true);
  65.                 MyVariables.notificationNumber.Add(notifNumb.GetAttribute("innertext").ToString().Replace(".", ","));
  66.             }
  67.             else
  68.             {
  69.                 MyVariables.notificationNumber.Add(string.Empty);
  70.                 project.SendInfoToLog("Номер извещения ", true);
  71.             }
  72.            
  73.             MyVariables.linkToTheProtocol.Add(instance.ActiveTab.URL.ToString());
  74.             project.SendInfoToLog("Ссылка на протокол " + instance.ActiveTab.URL.ToString(), true);
  75.            
  76.             HtmlElement name = requests.Elements[i].FindChildByTag("td", 1);
  77.             MyVariables.nameOfParticipant.Add(name.GetAttribute("innertext").ToString());
  78.             project.SendInfoToLog("Имя участника " + name.GetAttribute("innertext").ToString(), true);
  79.            
  80.             string decision = requests.Elements[i].FindChildByTag("td", 5).GetAttribute("innertext").ToString().Replace("\t", string.Empty).Replace("\n", string.Empty).Replace("\r", string.Empty).Trim(' ');
  81.             MyVariables.decisionOfTheComission.Add(decision);
  82.             project.SendInfoToLog("Решение " + decision, true);
  83.            
  84.             if(decision != "соответствует")
  85.             {
  86.                 MyVariables.reasonForRejection.Add(requests.Elements[i].FindChildByTag("td", 6).GetAttribute("innertext").ToString().Replace("\t", string.Empty).Replace("\n", string.Empty).Replace("\r", string.Empty).Trim(' '));
  87.                 project.SendInfoToLog("Причина отклонения " + MyVariables.reasonForRejection[MyVariables.reasonForRejection.Count - 1], true);
  88.             }
  89.             else
  90.             {
  91.                 MyVariables.reasonForRejection.Add(string.Empty);
  92.                 project.SendInfoToLog("Причина отклонения ", true);
  93.             }
  94.         }
  95.         else
  96.         {
  97.             MyVariables.sizeOfTheRequest.Add(MyVariables.sizeOfTheRequest[(MyVariables.sizeOfTheRequest.Count - 1)]);
  98.             project.SendInfoToLog("Размер заявки " + MyVariables.sizeOfTheRequest[MyVariables.sizeOfTheRequest.Count - 1], true);
  99.            
  100.             HtmlElement date = instance.ActiveTab.FindElementByAttribute("table", "class", "dt", "text", 0).FindChildByTag("td", 3);
  101.             MyVariables.dateOfSigningTheProtocol.Add(date.GetAttribute("innertext").ToString());
  102.             project.SendInfoToLog("Дата подписания протокола " + date.GetAttribute("innertext").ToString(), true);
  103.            
  104.             if(project.Variables["nameOfProtocol"].Value.Contains("Протокол подведения итогов"))
  105.             {
  106.                 HtmlElement notifNumb = requests.Elements[i].FindChildByTag("td", 2);
  107.                 project.SendInfoToLog("Номер извещения " + notifNumb.GetAttribute("innertext").ToString(), true);
  108.                 MyVariables.notificationNumber.Add(notifNumb.GetAttribute("innertext").ToString().Replace(".", ","));
  109.             }
  110.             else
  111.             {
  112.                 MyVariables.notificationNumber.Add(string.Empty);
  113.                 project.SendInfoToLog("Номер извещения ", true);
  114.             }
  115.            
  116.             MyVariables.linkToTheProtocol.Add(instance.ActiveTab.URL.ToString());
  117.             project.SendInfoToLog("Ссылка на протокол " + instance.ActiveTab.URL.ToString(), true);
  118.            
  119.             HtmlElement name = requests.Elements[i].FindChildByTag("td", 1);
  120.             MyVariables.nameOfParticipant.Add(name.GetAttribute("innertext").ToString());
  121.             project.SendInfoToLog("Имя участника " + name.GetAttribute("innertext").ToString(), true);
  122.            
  123.             string decision = requests.Elements[i].FindChildByTag("td", 5).GetAttribute("innertext").ToString().Replace("\t", string.Empty).Replace("\n", string.Empty).Replace("\r", string.Empty).Trim(' ');
  124.             MyVariables.decisionOfTheComission.Add(decision);
  125.             project.SendInfoToLog("Решение " + decision, true);
  126.            
  127.             if(decision != "соответствует")
  128.             {
  129.                 MyVariables.reasonForRejection.Add(requests.Elements[i].FindChildByTag("td", 6).GetAttribute("innertext").ToString().Replace("\t", string.Empty).Replace("\n", string.Empty).Replace("\r", string.Empty).Trim(' '));
  130.                 project.SendInfoToLog("Причина отклонения " + MyVariables.reasonForRejection[MyVariables.reasonForRejection.Count - 1], true);
  131.             }
  132.             else
  133.             {
  134.                 MyVariables.reasonForRejection.Add(string.Empty);
  135.                 project.SendInfoToLog("Причина отклонения ", true);
  136.             }
  137.         }
  138.     }
  139. }
Advertisement
Add Comment
Please, Sign In to add comment