public void TestLoadTemplate() { ServiceRest rest = new ServiceRest(); var xml = new LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite(); InfoRuleTemplate infoRuleTemplate = (InfoRuleTemplate)xml.ReadXml("D:\\InfoRuleTemplate.xml", typeof(InfoRuleTemplate)); var t = rest.LoadInfoTemplateToDataBase(infoRuleTemplate); }
/// <summary> /// Запуск БП /// Налоговое администрирование\Урегулирование задолженности\Взыскание задолженности за счет ден. средств\Запуск БП /// </summary> /// <param name="statusButton">Кнопка старт</param> /// <param name="pathList">Полный путь к списку с ИНН</param> public void StartProcess(StatusButtonMethod statusButton, string pathList) { DispatcherHelper.Initialize(); if (File.Exists(pathList)) { Task.Run(delegate { DispatcherHelper.CheckBeginInvokeOnUI(statusButton.StatusRed); KclicerButton clickerButton = new KclicerButton(); LibraryAIS3Windows.Window.WindowsAis3 ais3 = new LibraryAIS3Windows.Window.WindowsAis3(); LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite read = new LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite(); object obj = read.ReadXml(pathList, typeof(AutoGenerateSchemes)); AutoGenerateSchemes modelList = (AutoGenerateSchemes)obj; if (ais3.WinexistsAis3() == 1) { foreach (var modelListTaxArr in modelList.TaxArrears) { if (statusButton.Iswork) { clickerButton.Click35(modelListTaxArr.Inn, modelListTaxArr.Kpp); read.DeleteAtributXml(pathList, LibaryXMLAuto.GenerateAtribyte.GeneratorAtribute.GenerateAtrAutoGenerateSchemes(modelListTaxArr.Inn)); } } DispatcherHelper.UIDispatcher.Invoke(statusButton.StatusYellow); } else { MessageBox.Show(LibraryAIS3Windows.Status.StatusAis.Status1); } }); } }
/// <summary> /// Автомат изменения статуса лица /// </summary> /// <param name="statusButton">Кнопка старт автомат</param> /// <param name="pathfileinn">Путь к значениям</param> /// <param name="pathjurnalerror">Путь к журналу с ошибками</param> /// <param name="pathjurnalok">Путь к отработаным значениям</param> public void Update(StatusButtonMethod statusButton, string pathfileinn, string pathjurnalerror, string pathjurnalok) { try { DispatcherHelper.Initialize(); if (File.Exists(pathfileinn)) { Task.Run(delegate { LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite read = new LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite(); var snumodelmass = (Face)read.ReadXml(pathfileinn, typeof(Face)); if (snumodelmass.Fid != null) { DispatcherHelper.CheckBeginInvokeOnUI(statusButton.StatusRed); KclicerButton clickerButton = new KclicerButton(); Exit exit = new Exit(); WindowsAis3 ais3 = new WindowsAis3(); if (ais3.WinexistsAis3() == 1) { foreach (var fid in snumodelmass.Fid) { if (statusButton.Iswork) { clickerButton.Click9(pathjurnalerror, pathjurnalok, fid.FidFace); read.DeleteAtributXml(pathfileinn, LibaryXMLAuto.GenerateAtribyte.GeneratorAtribute.GenerateAtributeFaceFid(fid.FidFace)); statusButton.Count++; } else { break; } } var status = exit.Exitfunc(statusButton.Count, snumodelmass.Fid.Length, statusButton.Iswork); statusButton.Count = status.IsCount; statusButton.Iswork = status.IsWork; DispatcherHelper.CheckBeginInvokeOnUI(delegate { statusButton.StatusGrinandYellow(status.Stat); }); } else { MessageBox.Show(LibaryAIS3Windows.Status.StatusAis.Status1); DispatcherHelper.CheckBeginInvokeOnUI(statusButton.StatusGrin); } } else { MessageBox.Show(LibaryAIS3Windows.Status.StatusAis.Status7); } }); } else { MessageBox.Show(LibaryAIS3Windows.Status.StatusAis.Status5); } } catch (Exception e) { MessageBox.Show(e.Message); } }
public void TestTemplateRule() { //var t = CultureInfo.CreateSpecificCulture("ru-Ru").DateTimeFormat.MonthGenitiveNames; ServiceRest rest = new ServiceRest(); var xml = new LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite(); UserRules rule = (UserRules)xml.ReadXml("D:\\UserRule.xml", typeof(UserRules)); var t = rest.GenerateTemplateRule(rule); }
/// <summary> ///Налоговое администрирование\Собственность\02. Доопределение данных об объектах собственности\ ///14. КС – Корректировка сведений о правах не зарегистрированных в органах Росреестра и правах наследования на ОН и ЗУ /// </summary> /// <param name="statusButton">Кнопка контроля состояний</param> /// <param name="pathfilefid">Путь к файлу с Фидами</param> /// <param name="pathjurnalerror">Путь к журналу с ошибками</param> /// <param name="pathjurnalok">Путь к отаботаным спискам</param> public void AutoClicerEditPravo(StatusButtonMethod statusButton, string pathfilefid, string pathjurnalerror, string pathjurnalok) { DispatcherHelper.Initialize(); if (File.Exists(pathfilefid)) { Task.Run(delegate { LibaryAIS3Windows.ButtonsClikcs.SelectQbe.EventOkp.EventOkp eventqbe = new LibaryAIS3Windows.ButtonsClikcs.SelectQbe.EventOkp.EventOkp(); EventOkp selectevent = new EventOkp(); DispatcherHelper.CheckBeginInvokeOnUI(statusButton.StatusRed); KclicerButton clickerButton = new KclicerButton(); Exit exit = new Exit(); LibaryAIS3Windows.Window.WindowsAis3 ais3 = new LibaryAIS3Windows.Window.WindowsAis3(); LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite read = new LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite(); object obj = read.ReadXml(pathfilefid, typeof(FidFactZemlyOrImushestvo)); FidFactZemlyOrImushestvo fidmodel = (FidFactZemlyOrImushestvo)obj; if (ais3.WinexistsAis3() == 1) { foreach (var fid in fidmodel.Fid) { if (statusButton.Iswork) { if (statusButton.IsChekcs) { selectevent.AddEvent(eventqbe); selectevent.RemoveEvent(eventqbe); DispatcherHelper.CheckBeginInvokeOnUI(statusButton.IsCheker); } clickerButton.Click5(pathjurnalerror, pathjurnalok, fid.FidZemlyOrImushestvo); read.DeleteAtributXml(pathfilefid, LibaryXMLAuto.GenerateAtribyte.GeneratorAtribute.GenerateAtributeFid(fid.FidZemlyOrImushestvo)); statusButton.Count++; } else { break; } } var status = exit.Exitfunc(statusButton.Count, fidmodel.Fid.Length, statusButton.Iswork); statusButton.Count = status.IsCount; statusButton.Iswork = status.IsWork; DispatcherHelper.CheckBeginInvokeOnUI(delegate { statusButton.StatusGrinandYellow(status.Stat); }); } else { MessageBox.Show(LibaryAIS3Windows.Status.StatusAis.Status1); DispatcherHelper.CheckBeginInvokeOnUI(statusButton.StatusGrin); } }); } else { MessageBox.Show(LibaryAIS3Windows.Status.StatusAis.Status5); } }
public void TestTemplateRule() { ServiceRest rest = new ServiceRest(); var xml = new LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite(); UserRules rule = (UserRules)xml.ReadXml("C:\\UserRule.xml", typeof(UserRules)); var groupelement = rule.User.Where(x => x.Number != "Скрипт").GroupBy(x => new { x.Dates, x.Number, x.Otdel }).Select(x => new { x.Key.Number, x.Key.Dates, x.Key.Otdel }).ToList(); int i = 0; foreach (var gr in groupelement) { //if (template.Otdel == null) //{ // template.Otdel = new LibaryXMLAutoModelXmlAuto.OtdelRuleUsers.Otdel[groupelement.Count]; //} //template.Otdel[i] = Inventarization.Database.SqlQuery<LibaryXMLAutoModelXmlAuto.OtdelRuleUsers.Otdel>(sqlselect.LogicaSelect.SelectUser, new SqlParameter(sqlselect.LogicaSelect.SelectedParametr.Split(',')[0], 1), // new SqlParameter(sqlselect.LogicaSelect.SelectedParametr.Split(',')[1], gr.Otdel.Replace("№ ", "№")), // new SqlParameter(sqlselect.LogicaSelect.SelectedParametr.Split(',')[2], gr.Number)).ToList()[0]; //template.Otdel[i].Dates = gr.Dates; var user = rule.User.Where(userrule => (userrule.Dates == gr.Dates) && (userrule.Number == gr.Number) && (userrule.Otdel == gr.Otdel)).Select(u => new { u.Dates, u.Fio, u.SysName, u.Dolj, u.Otdel, u.Number }).Distinct().ToList(); //int j = 0; foreach (var userule in user) { var ruleall = rule.User.Where(u => u.Dates == userule.Dates && u.Dolj == userule.Dolj && u.Otdel == userule.Otdel && u.Fio == userule.Fio && u.SysName == userule.SysName && u.Number == userule.Number). Select(x => x.Rule).Aggregate((element, next) => element.Concat(next).ToArray()); ruleall.Select(elem => $"{elem.Types}: {elem.Name}").Aggregate( (element, next) => element + (string.IsNullOrWhiteSpace(element) ? string.Empty : ", ") + next); // var elemt = ruleall.ToList() //.Select(elem => $"{elem.Types}: {elem.Name}").Aggregate( // (element, next) => element + (string.IsNullOrWhiteSpace(element) ? string.Empty : ", ") + next) //if (template.Otdel[i].Users == null) //{ // template.Otdel[i].Users = new LibaryXMLAutoModelXmlAuto.OtdelRuleUsers.Users[user.Count]; //} //template.Otdel[i].Users[j] = Inventarization.Database.SqlQuery<LibaryXMLAutoModelXmlAuto.OtdelRuleUsers.Users>(sqlselect.LogicaSelect.SelectUser, new SqlParameter(sqlselect.LogicaSelect.SelectedParametr.Split(',')[0], 2), // new SqlParameter(sqlselect.LogicaSelect.SelectedParametr.Split(',')[1], userule.SysName.Split('@')[0]), // new SqlParameter(sqlselect.LogicaSelect.SelectedParametr.Split(',')[2], DBNull.Value)).ToList()[0]; //template.Otdel[i].Users[j].RuleTemplate = userule.Rule.Select(elem => $"{elem.Types}: {elem.Name}").Aggregate( // (element, next) => element + (string.IsNullOrWhiteSpace(element) ? string.Empty : ", ") + next); //template.Otdel[i].Users[j].Pushed = userule.Rule[0].Pushed; //j++; } i++; } }
/// <summary> /// Авто кликер для ветки /// Налоговое администрирование\Физические лица\1.06. Формирование и печать CНУ\ /// 1. Создание заявки на формирование СНУ для массовой печати /// </summary> /// <param name="statusButton">Кнопка контроля состояний</param> /// <param name="pathfileinn">Путь к файлу с массовыми ИНН</param> /// <param name="pathjurnalerror">Путь к журналу с ошибками</param> /// <param name="pathjurnalok">Путь к отаботаным спискам</param> public void AutoClicerSnuMassInnForm(StatusButtonMethod statusButton, string pathfileinn, string pathjurnalerror, string pathjurnalok) { DispatcherHelper.Initialize(); if (File.Exists(pathfileinn)) { Task.Run(delegate { DispatcherHelper.CheckBeginInvokeOnUI(statusButton.StatusRed); KclicerButton clickerButton = new KclicerButton(); Exit exit = new Exit(); WindowsAis3 ais3 = new WindowsAis3(); LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite read = new LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite(); object obj = read.ReadXml(pathfileinn, typeof(INNList)); INNList snumodelmass = (INNList)obj; if (ais3.WinexistsAis3() == 1) { foreach (var inn in snumodelmass.ListInn) { if (statusButton.Iswork) { clickerButton.Click4(pathjurnalerror, pathjurnalok, inn.MyInnn); read.DeleteAtributXml(pathfileinn, LibaryXMLAuto.GenerateAtribyte.GeneratorAtribute.GenerateAtributeMassNumCollection(inn.NumColection.ToString())); statusButton.Count++; } else { break; } } var status = exit.Exitfunc(statusButton.Count, snumodelmass.ListInn.Length, statusButton.Iswork); statusButton.Count = status.IsCount; statusButton.Iswork = status.IsWork; DispatcherHelper.CheckBeginInvokeOnUI(delegate { statusButton.StatusGrinandYellow(status.Stat); }); } else { MessageBox.Show(LibraryAIS3Windows.Status.StatusAis.Status1); DispatcherHelper.CheckBeginInvokeOnUI(statusButton.StatusGrin); } }); } else { MessageBox.Show(LibraryAIS3Windows.Status.StatusAis.Status5); } }
public void StartVisualBank(StatusButtonMethod statusButton, string pathfileid, string pathjurnalerror, string pathjurnalok) { DispatcherHelper.Initialize(); if (File.Exists(pathfileid)) { Task.Run(delegate { try { KclicerButton clickerButton = new KclicerButton(); Exit exit = new Exit(); WindowsAis3 ais = new WindowsAis3(); LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite read = new LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite(); object obj = read.ReadXml(pathfileid, typeof(VisualIdent)); VisualIdent idmodel = (VisualIdent)obj; if (idmodel.IdZapros != null) { DispatcherHelper.CheckBeginInvokeOnUI(statusButton.StatusRed); if (ais.WinexistsAis3() == 1) { foreach (var id in idmodel.IdZapros) { if (statusButton.Iswork) { clickerButton.Click21(id.VisualId, pathjurnalerror, pathjurnalok); DispatcherHelper.CheckBeginInvokeOnUI(statusButton.IsCheker); read.DeleteAtributXml(pathfileid, LibaryXMLAuto.GenerateAtribyte.GeneratorAtribute.GenerateAtributeIdIden(id.VisualId)); statusButton.Count++; } else { break; } } } else { MessageBox.Show(LibraryAIS3Windows.Status.StatusAis.Status1); DispatcherHelper.CheckBeginInvokeOnUI(statusButton.StatusGrin); } var status = exit.Exitfunc(statusButton.Count, idmodel.IdZapros.Length, statusButton.Iswork); statusButton.Count = status.IsCount; statusButton.Iswork = status.IsWork; DispatcherHelper.CheckBeginInvokeOnUI(delegate { statusButton.StatusGrinandYellow(status.Stat); }); } else { MessageBox.Show(LibraryAIS3Windows.Status.StatusAis.Status7); } } catch (Exception e) { MessageBox.Show(e.ToString()); } }); } else { MessageBox.Show(LibraryAIS3Windows.Status.StatusAis.Status5); } }
/// <summary> /// Команда отработки пользовательского задания Регистрациии /// Налоговое администрирование\Собственность\05. Взаимодействие с органами Росреестра – Земельные участки\03. Обработка ФПД от РР - ФЛ - Анализ результатов обработки документов /// Можно пропустить и другие ветки логика меняется только в Click3 /// </summary> /// <param name="qbeselect">Значения ФПД </param> /// <param name="branch">Ветка для обработки режима</param> /// <param name="statusButton">Модель кнопки </param> /// <param name="pathjurnalerror">Журнал ошибок</param> /// <param name="pathjurnalok">Журнал ОК</param> /// <param name="pathfilefpd">Значения ФПД </param> public void ZemlyAuto(QbeClass qbeselect, Branch branch, StatusButtonMethod statusButton, string pathfilefpd, string pathjurnalerror, string pathjurnalok) { DispatcherHelper.Initialize(); if (File.Exists(pathfilefpd)) { if (branch.IsValidation()) { Task.Run(delegate { try { DispatcherHelper.CheckBeginInvokeOnUI(statusButton.StatusRed); KclicerButton clickerButton = new KclicerButton(); SelectEventQbe selectQbe = new SelectEventQbe(); SelectQbe qbeselectmethod = new SelectQbe(); Exit exit = new Exit(); WindowsAis3 ais = new WindowsAis3(); LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite read = new LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite(); object obj = read.ReadXml(pathfilefpd, typeof(LibaryXMLAutoModelXmlAuto.FpdReg.TreatmentFPD)); LibaryXMLAutoModelXmlAuto.FpdReg.TreatmentFPD fpdmodel = (LibaryXMLAutoModelXmlAuto.FpdReg.TreatmentFPD)obj; if (ais.WinexistsAis3() == 1) { foreach (var fpd in fpdmodel.Fpd) { if (statusButton.Iswork) { if (statusButton.IsChekcs) { selectQbe.AddEvent(qbeselect, branch, qbeselectmethod); selectQbe.RemoveEvent(branch, qbeselectmethod); DispatcherHelper.CheckBeginInvokeOnUI(statusButton.IsCheker); } clickerButton.Click3(fpd.FpdId, pathjurnalerror, pathjurnalok); read.DeleteAtributXml(pathfilefpd, LibaryXMLAuto.GenerateAtribyte.GeneratorAtribute.GenerateAtributeFpd( fpd.FpdId)); statusButton.Count++; } else { break; } } var status = exit.Exitfunc(statusButton.Count, fpdmodel.Fpd.Length, statusButton.Iswork); statusButton.Count = status.IsCount; statusButton.Iswork = status.IsWork; DispatcherHelper.CheckBeginInvokeOnUI( delegate { statusButton.StatusGrinandYellow(status.Stat); }); } else { MessageBox.Show(LibaryAIS3Windows.Status.StatusAis.Status1); DispatcherHelper.CheckBeginInvokeOnUI(statusButton.StatusGrin); } } catch (Exception e) { MessageBox.Show(e.ToString()); } }); } } else { MessageBox.Show(LibaryAIS3Windows.Status.StatusAis.Status5); } }
/// <summary> /// Поиск пользователей и ролей по сегментам /// </summary> /// <param name="statusButton">Кнопка запуска</param> /// <param name="libraryAutomation">Автоматизация библиотека</param> /// <param name="pathJournalInfoUserTemplateRule">Путь сохранения информации по пользователям и их ролям с шаблонами</param> private void FindUserTemplateAndRule(StatusButtonMethod statusButton, LibraryAutomations libraryAutomation, string pathJournalInfoUserTemplateRule) { var rowNumber = 1; PublicGlobalFunction.PublicGlobalFunction.WindowElementClick(libraryAutomation, ItElementName.ApplicationTabUsers); PublicGlobalFunction.PublicGlobalFunction.WindowElementClick(libraryAutomation, ItElementName.FindUsers); libraryAutomation.IsEnableElement(ItElementName.ListRowUsersGrid); if (File.Exists(pathJournalInfoUserTemplateRule)) { var readFileInfoRule = new LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite(); var fileInfoRuleTemplate = (InfoUserTemlateAndRule)readFileInfoRule.ReadXml(pathJournalInfoUserTemplateRule, typeof(InfoUserTemlateAndRule)); if (fileInfoRuleTemplate.Users != null) { var nameAttributes = fileInfoRuleTemplate.Users.Last().Name; var index = 0; var stop = false; libraryAutomation.SelectAutomationColrction(libraryAutomation.FindElement).Cast <AutomationElement>() .Where(elem => elem.Current.Name.Contains("List`")) .ToList().ForEach(element => { if (stop) { return; } else { element.SetFocus(); AutoIt.AutoItX.Sleep(2000); if (libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers(libraryAutomation.SelectAutomationColrction(element) .Cast <AutomationElement>().First(elem => elem.Current.Name.Contains("Пользователь"))) == nameAttributes) { rowNumber = index; rowNumber++; stop = true; } index++; } }); } } AutomationElement automationElementRow; while ((automationElementRow = libraryAutomation.IsEnableElements(string.Format(ItElementName.ListRowUsers, rowNumber), null, true, 5)) != null) { if (statusButton.Iswork) { var infoRuleTemplate = new InfoUserTemlateAndRule() { Users = new Users[1] }; automationElementRow.SetFocus(); AutoIt.AutoItX.Sleep(1000); infoRuleTemplate.Users[0] = new Users() { Name = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementRow).Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Пользователь"))), Code = Convert.ToInt32(libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementRow).Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Код НО")))), TabelNumber = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementRow).Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Табельный номер"))), Department = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementRow).Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Отдел"))), Position = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementRow).Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Должность"))), Organization = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementRow).Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Организация"))), Bloking = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementRow).Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Блокировка"))), NumberActiveDirectory = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementRow).Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Учетная запись"))) }; var containerTab = libraryAutomation.SelectAutomationColrction(libraryAutomation.IsEnableElements(ItElementName.ApplicationContainerTab, null, true)); PublicGlobalFunction.PublicGlobalFunction.WindowElementClick(libraryAutomation, ItElementName.ApplicationTabTemplate, containerTab[1]); var templatesNumber = 1; List <AutomationElement> listTemplate = libraryAutomation.SelectAutomationColrction( libraryAutomation.IsEnableElements(ItElementName.ListAllTemplatesUsers, containerTab[1], true, 1)).Cast <AutomationElement>() .Where(elem => elem.Current.Name.Contains("List`1 row")).ToList(); infoRuleTemplate.Users[0].Template = new Template[listTemplate.Count()]; foreach (AutomationElement automationElement in listTemplate) { automationElement.SetFocus(); infoRuleTemplate.Users[0].Template[templatesNumber - 1] = new Template() { NameTemplate = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElement) .Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Шаблон"))), Info = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElement) .Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Описание"))), Category = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElement) .Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Категории"))), }; templatesNumber++; } var sigmentNumber = 1; PublicGlobalFunction.PublicGlobalFunction.WindowElementClick(libraryAutomation, ItElementName.ApplicationTabRule, containerTab[1]); List <AutomationElement> listSegment = libraryAutomation.SelectAutomationColrction( libraryAutomation.IsEnableElements(ItElementName.ListAllRulesUsers, containerTab[1], true, 1)).Cast <AutomationElement>() .Where(elem => elem.Current.Name.Contains("List`1 row")).ToList(); infoRuleTemplate.Users[0].Sigment = new Sigment[listSegment.Count()]; foreach (AutomationElement automationElementTemplates in listSegment) { automationElementTemplates.SetFocus(); SendKeys.SendWait(ButtonConstant.Plus); infoRuleTemplate.Users[0].Sigment[sigmentNumber - 1] = new Sigment() { Name = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementTemplates) .Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Сегмент"))) }; List <AutomationElement> listApp = libraryAutomation.SelectAutomationColrction(automationElementTemplates).Cast <AutomationElement>() .Where(elem => elem.Current.Name.Contains("Apps row")).ToList(); infoRuleTemplate.Users[0].Sigment[sigmentNumber - 1].Applications = new Applications[listApp.Count()]; var rulesAppNumber = 1; foreach (AutomationElement automationElementTemplatesRulesApp in listApp) { automationElementTemplatesRulesApp.SetFocus(); SendKeys.SendWait(ButtonConstant.Plus); infoRuleTemplate.Users[0].Sigment[sigmentNumber - 1].Applications[rulesAppNumber - 1] = new Applications() { Name = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementTemplatesRulesApp) .Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Приложение"))) }; List <AutomationElement> listRole = libraryAutomation.SelectAutomationColrction(automationElementTemplatesRulesApp).Cast <AutomationElement>() .Where(elem => elem.Current.Name.Contains("RoleList row")).ToList(); infoRuleTemplate.Users[0].Sigment[sigmentNumber - 1].Applications[rulesAppNumber - 1].RuleTemplate = new RuleTemplate[listRole.Count()]; var rulesRulesAppRuleNumber = 1; foreach (AutomationElement automationElementTemplatesRulesAppRule in listRole) { infoRuleTemplate.Users[0].Sigment[sigmentNumber - 1].Applications[rulesAppNumber - 1].RuleTemplate[rulesRulesAppRuleNumber - 1] = new RuleTemplate() { NameRule = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementTemplatesRulesAppRule) .Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Роль"))), Info = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementTemplatesRulesAppRule) .Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Описание"))), Category = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementTemplatesRulesAppRule) .Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Категории"))), }; rulesRulesAppRuleNumber++; } automationElementTemplatesRulesApp.SetFocus(); AutoIt.AutoItX.Sleep(500); SendKeys.SendWait(ButtonConstant.Minus); rulesAppNumber++; } automationElementTemplates.SetFocus(); AutoIt.AutoItX.Sleep(500); SendKeys.SendWait(ButtonConstant.Minus); sigmentNumber++; } LibaryXMLAuto.ErrorJurnal.ReportMigration.CreateFileInfoUserRuleTemplate(pathJournalInfoUserTemplateRule, infoRuleTemplate); rowNumber++; } else { break; } } }
/// <summary> /// Сбор информации о шаблонах папках и ветках и ролях по ветке modelTree /// </summary> /// <param name="statusButton">Кнопка запуска</param> /// <param name="pathJournalInfoRule">Путь сохранения информации</param> public void SelectAllTemplateAndRule(StatusButtonMethod statusButton, string pathJournalInfoRule) { var rowNumber = 1; var sw = modelTreeMyRule.Split('\\').Last(); var fullTree = string.Concat(PublicElementName.FullTree, $"Name:{sw}"); LibraryAutomations libraryAutomation = new LibraryAutomations(WindowsAis3.AisNalog3); if (!libraryAutomation.IsEnableExpandTree(modelTreeMyRule)) { return; } libraryAutomation.FindFirstElement(fullTree, null, true); libraryAutomation.FindElement.SetFocus(); libraryAutomation.ClickElements(fullTree, null, false, 25, 0, 0, 2); PublicGlobalFunction.PublicGlobalFunction.WindowElementClick(libraryAutomation, ItElementName.ApplicationTab); PublicGlobalFunction.PublicGlobalFunction.WindowElementClick(libraryAutomation, ItElementName.ButtonAdd); PublicGlobalFunction.PublicGlobalFunction.WindowElementClick(libraryAutomation, ItElementName.AutoInfo); libraryAutomation.IsEnableElement(ItElementName.GridRule); if (File.Exists(pathJournalInfoRule)) { var readFileInfoRule = new LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite(); var fileInfoRuleTemplate = (InfoRuleTemplate)readFileInfoRule.ReadXml(pathJournalInfoRule, typeof(InfoRuleTemplate)); var nameAttributes = fileInfoRuleTemplate.SystemAis.Last().Name; var index = 0; var stop = false; libraryAutomation.SelectAutomationColrction(libraryAutomation.FindElement).Cast <AutomationElement>() .Where(elem => elem.Current.Name.Contains("List`")) .ToList().ForEach(element => { if (stop) { return; } else { if (libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers(libraryAutomation.SelectAutomationColrction(element) .Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Подсистема"))) == nameAttributes) { rowNumber = index; rowNumber++; stop = true; } index++; } }); } AutomationElement automationElementRow; while ((automationElementRow = libraryAutomation.IsEnableElements(string.Format(ItElementName.ListRow, rowNumber), null, true, 30)) != null) { if (statusButton.Iswork) { var infoRuleTemplate = new InfoRuleTemplate() { SystemAis = new SystemAis[1] }; automationElementRow.SetFocus(); SendKeys.SendWait(ButtonConstant.Plus); infoRuleTemplate.SystemAis[0] = new SystemAis() { Name = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementRow).Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Подсистема"))) }; var foldersNumber = 1; var listFolder = libraryAutomation .SelectAutomationColrction(automationElementRow).Cast <AutomationElement>() .Where(elem => elem.Current.Name.Contains("Folders row")); infoRuleTemplate.SystemAis[0].Folders = new Folders[listFolder.Count()]; AutomationElement automationElementFolder; while ((automationElementFolder = libraryAutomation.IsEnableElements(string.Format(ItElementName.ListFolders, rowNumber, foldersNumber), null, true, 30)) != null) { automationElementFolder.SetFocus(); SendKeys.SendWait(ButtonConstant.Plus); infoRuleTemplate.SystemAis[0].Folders[foldersNumber - 1] = new Folders() { Name = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementFolder) .Cast <AutomationElement>().First(elem => elem.Current.Name.Contains("Папка"))) }; var tasksNumber = 1; var listTask = libraryAutomation .SelectAutomationColrction(automationElementFolder).Cast <AutomationElement>() .Where(elem => elem.Current.Name.Contains("Tasks row")); infoRuleTemplate.SystemAis[0].Folders[foldersNumber - 1].Tasks = new Tasks[listTask.Count()]; AutomationElement automationElementTask; while ((automationElementTask = libraryAutomation.IsEnableElements(string.Format(ItElementName.ListTasks, rowNumber, foldersNumber, tasksNumber), null, true, 1)) != null) { automationElementTask.SetFocus(); SendKeys.SendWait(ButtonConstant.Plus); infoRuleTemplate.SystemAis[0].Folders[foldersNumber - 1].Tasks[tasksNumber - 1] = new Tasks() { Name = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementTask) .Cast <AutomationElement>().First(elem => elem.Current.Name.Contains("Задача"))), TypeTask = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementTask) .Cast <AutomationElement>().First(elem => elem.Current.Name.Contains("Тип"))), Curator = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementTask) .Cast <AutomationElement>().First(elem => elem.Current.Name.Contains("Куратор"))) }; var rolesNumber = 1; var listRole = libraryAutomation .SelectAutomationColrction(automationElementTask).Cast <AutomationElement>() .Where(elem => elem.Current.Name.Contains("Roles row")); infoRuleTemplate.SystemAis[0].Folders[foldersNumber - 1].Tasks[tasksNumber - 1] .RolesTemplate = new RolesTemplate[listRole.Count()]; AutomationElement automationElementRole; while ((automationElementRole = libraryAutomation.IsEnableElements(string.Format(ItElementName.ListRoles, rowNumber, foldersNumber, tasksNumber, rolesNumber), null, true, 1)) != null) { automationElementRole.SetFocus(); SendKeys.SendWait(ButtonConstant.Plus); infoRuleTemplate.SystemAis[0].Folders[foldersNumber - 1].Tasks[tasksNumber - 1] .RolesTemplate[rolesNumber - 1] = new RolesTemplate() { Name = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementRole) .Cast <AutomationElement>().First(elem => elem.Current.Name.Contains("Роль"))) }; var taskTemplateNumber = 1; var listTaskTemplate = libraryAutomation .SelectAutomationColrction(automationElementRole).Cast <AutomationElement>() .Where(elem => elem.Current.Name.Contains("TaskTemplates row")); infoRuleTemplate.SystemAis[0].Folders[foldersNumber - 1].Tasks[tasksNumber - 1] .RolesTemplate[rolesNumber - 1].Templates = new Templates[listTaskTemplate.Count()]; AutomationElement automationElementTaskTemplate; while ((automationElementTaskTemplate = libraryAutomation.IsEnableElements(string.Format(ItElementName.ListTaskTemplates, rowNumber, foldersNumber, tasksNumber, rolesNumber, taskTemplateNumber), null, true, 1)) != null) { automationElementTaskTemplate.SetFocus(); infoRuleTemplate.SystemAis[0].Folders[foldersNumber - 1] .Tasks[tasksNumber - 1].RolesTemplate[rolesNumber - 1] .Templates[taskTemplateNumber - 1] = new Templates() { Name = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementTaskTemplate) .Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Шаблон"))), Category = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementTaskTemplate) .Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Категории"))) }; taskTemplateNumber++; } automationElementRole.SetFocus(); SendKeys.SendWait(ButtonConstant.Minus); rolesNumber++; } automationElementTask.SetFocus(); SendKeys.SendWait(ButtonConstant.Minus); tasksNumber++; } automationElementFolder.SetFocus(); SendKeys.SendWait(ButtonConstant.Minus); foldersNumber++; } automationElementRow.SetFocus(); SendKeys.SendWait(ButtonConstant.Minus); LibaryXMLAuto.ErrorJurnal.ReportMigration.CreateFileInfoRuleTemplate(pathJournalInfoRule, infoRuleTemplate); rowNumber++; } else { break; } } }
/// <summary> /// Поиск только шаблонов и ролей в них /// </summary> /// <param name="statusButton">Кнопка запуска</param> /// <param name="libraryAutomation">Автоматизация библиотека</param> /// <param name="pathJournalInfoUserTemplateRule">Путь сохранения информации по пользователям и их ролям с шаблонами</param> private void FindAllTemplateAndRule(StatusButtonMethod statusButton, LibraryAutomations libraryAutomation, string pathJournalInfoUserTemplateRule) { var rowNumber = 1; PublicGlobalFunction.PublicGlobalFunction.WindowElementClick(libraryAutomation, ItElementName.ApplicationTabRules); PublicGlobalFunction.PublicGlobalFunction.WindowElementClick(libraryAutomation, ItElementName.SendRulesTemplate); libraryAutomation.IsEnableElement(ItElementName.ListRowRulesGrid); if (File.Exists(pathJournalInfoUserTemplateRule)) { var readFileInfoRule = new LibaryXMLAuto.ReadOrWrite.XmlReadOrWrite(); var fileInfoRuleTemplate = (InfoUserTemlateAndRule)readFileInfoRule.ReadXml(pathJournalInfoUserTemplateRule, typeof(InfoUserTemlateAndRule)); if (fileInfoRuleTemplate.Template != null) { var nameAttributes = fileInfoRuleTemplate.Template.Last().NameTemplate; var index = 0; var stop = false; libraryAutomation.SelectAutomationColrction(libraryAutomation.FindElement) .Cast <AutomationElement>().Where(elem => elem.Current.Name.Contains("List`")).ToList().ForEach(elem => { if (stop) { return; } else { elem.SetFocus(); AutoIt.AutoItX.Sleep(1000); if (libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers(libraryAutomation.SelectAutomationColrction(elem).Cast <AutomationElement>() .First(element => element.Current.Name.Contains("Шаблон"))) == nameAttributes) { rowNumber = index; rowNumber++; stop = true; } index++; } }); } } AutomationElement automationElementRow; while ((automationElementRow = libraryAutomation.IsEnableElements(string.Format(ItElementName.ListRowRules, rowNumber), null, true, 5)) != null) { if (statusButton.Iswork) { var infoRuleTemplate = new InfoUserTemlateAndRule() { Template = new Template[1] }; automationElementRow.SetFocus(); AutoIt.AutoItX.Sleep(1000); infoRuleTemplate.Template[0] = new Template() { NameTemplate = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementRow).Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Шаблон"))), Info = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementRow).Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Описание"))), Category = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementRow).Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Категории"))), }; while (true) { libraryAutomation.ClickElement(libraryAutomation.SelectAutomationColrction(automationElementRow).Cast <AutomationElement>().First(elem => elem.Current.Name.Contains("Шаблон")), 180); if (libraryAutomation.IsEnableElements(ItElementName.WinAll) != null) { break; } } var winElement = libraryAutomation.FindElement; var sigmentNumber = 1; List <AutomationElement> listSegment = libraryAutomation.SelectAutomationColrction( libraryAutomation.IsEnableElements(ItElementName.WinSigment, null, true)).Cast <AutomationElement>() .Where(elem => elem.Current.Name.Contains("List")).ToList(); infoRuleTemplate.Template[0].Sigment = new Sigment[listSegment.Count()]; foreach (AutomationElement automationElementTemplates in listSegment) { automationElementTemplates.SetFocus(); SendKeys.SendWait(ButtonConstant.Plus); infoRuleTemplate.Template[0].Sigment[sigmentNumber - 1] = new Sigment() { Name = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementTemplates) .Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Сегмент"))) }; List <AutomationElement> listApp = libraryAutomation.SelectAutomationColrction(automationElementTemplates).Cast <AutomationElement>() .Where(elem => elem.Current.Name.Contains("Apps row")).ToList(); infoRuleTemplate.Template[0].Sigment[sigmentNumber - 1].Applications = new Applications[listApp.Count()]; var rulesAppNumber = 1; foreach (AutomationElement automationElementTemplatesRulesApp in listApp) { automationElementTemplatesRulesApp.SetFocus(); SendKeys.SendWait(ButtonConstant.Plus); infoRuleTemplate.Template[0].Sigment[sigmentNumber - 1].Applications[rulesAppNumber - 1] = new Applications() { Name = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementTemplatesRulesApp) .Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Приложение"))) }; List <AutomationElement> listRole = libraryAutomation.SelectAutomationColrction(automationElementTemplatesRulesApp).Cast <AutomationElement>() .Where(elem => elem.Current.Name.Contains("RoleList row")).ToList(); infoRuleTemplate.Template[0].Sigment[sigmentNumber - 1].Applications[rulesAppNumber - 1].RuleTemplate = new RuleTemplate[listRole.Count()]; var rulesRulesAppRuleNumber = 1; foreach (AutomationElement automationElementTemplatesRulesAppRule in listRole) { infoRuleTemplate.Template[0].Sigment[sigmentNumber - 1].Applications[rulesAppNumber - 1].RuleTemplate[rulesRulesAppRuleNumber - 1] = new RuleTemplate() { NameRule = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementTemplatesRulesAppRule) .Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Роль"))), Info = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementTemplatesRulesAppRule) .Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Описание"))), Category = libraryAutomation.ParseElementLegacyIAccessiblePatternIdentifiers( libraryAutomation.SelectAutomationColrction(automationElementTemplatesRulesAppRule) .Cast <AutomationElement>() .First(elem => elem.Current.Name.Contains("Категории"))), }; rulesRulesAppRuleNumber++; } automationElementTemplatesRulesApp.SetFocus(); AutoIt.AutoItX.Sleep(500); SendKeys.SendWait(ButtonConstant.Minus); rulesAppNumber++; } automationElementTemplates.SetFocus(); AutoIt.AutoItX.Sleep(500); SendKeys.SendWait(ButtonConstant.Minus); sigmentNumber++; } libraryAutomation.CloseWindowPattern(winElement); LibaryXMLAuto.ErrorJurnal.ReportMigration.CreateFileInfoUserRuleTemplate(pathJournalInfoUserTemplateRule, infoRuleTemplate); rowNumber++; } else { break; } } }