commit a25f5cc0d312aeae57f139e0f2cdb921d76fa633 Author: Giuliano Paschoalino Date: Mon Jul 14 13:27:12 2025 -0300 Import inicial: migração de arquivos da rede diff --git a/.vs/PipefyAddCompanies/CopilotIndices/17.12.38.29086/CodeChunks.db b/.vs/PipefyAddCompanies/CopilotIndices/17.12.38.29086/CodeChunks.db new file mode 100644 index 0000000..2a82721 Binary files /dev/null and b/.vs/PipefyAddCompanies/CopilotIndices/17.12.38.29086/CodeChunks.db differ diff --git a/.vs/PipefyAddCompanies/CopilotIndices/17.12.38.29086/SemanticSymbols.db b/.vs/PipefyAddCompanies/CopilotIndices/17.12.38.29086/SemanticSymbols.db new file mode 100644 index 0000000..bff68b4 Binary files /dev/null and b/.vs/PipefyAddCompanies/CopilotIndices/17.12.38.29086/SemanticSymbols.db differ diff --git a/.vs/PipefyAddCompanies/CopilotIndices/17.12.38.29086/SemanticSymbols.db-shm b/.vs/PipefyAddCompanies/CopilotIndices/17.12.38.29086/SemanticSymbols.db-shm new file mode 100644 index 0000000..a2a1981 Binary files /dev/null and b/.vs/PipefyAddCompanies/CopilotIndices/17.12.38.29086/SemanticSymbols.db-shm differ diff --git a/.vs/PipefyAddCompanies/CopilotIndices/17.12.38.29086/SemanticSymbols.db-wal b/.vs/PipefyAddCompanies/CopilotIndices/17.12.38.29086/SemanticSymbols.db-wal new file mode 100644 index 0000000..8f330bd Binary files /dev/null and b/.vs/PipefyAddCompanies/CopilotIndices/17.12.38.29086/SemanticSymbols.db-wal differ diff --git a/.vs/PipefyAddCompanies/DesignTimeBuild/.dtbcache.v2 b/.vs/PipefyAddCompanies/DesignTimeBuild/.dtbcache.v2 new file mode 100644 index 0000000..531dea3 Binary files /dev/null and b/.vs/PipefyAddCompanies/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/PipefyAddCompanies/FileContentIndex/4f5708dd-539c-4099-a453-cbdab08066a2.vsidx b/.vs/PipefyAddCompanies/FileContentIndex/4f5708dd-539c-4099-a453-cbdab08066a2.vsidx new file mode 100644 index 0000000..f473aa1 Binary files /dev/null and b/.vs/PipefyAddCompanies/FileContentIndex/4f5708dd-539c-4099-a453-cbdab08066a2.vsidx differ diff --git a/.vs/PipefyAddCompanies/config/applicationhost.config b/.vs/PipefyAddCompanies/config/applicationhost.config new file mode 100644 index 0000000..0d88f0d --- /dev/null +++ b/.vs/PipefyAddCompanies/config/applicationhost.config @@ -0,0 +1,1016 @@ + + + + + + + +
+
+
+
+
+
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+ + +
+
+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.vs/PipefyAddCompanies/v17/.futdcache.v2 b/.vs/PipefyAddCompanies/v17/.futdcache.v2 new file mode 100644 index 0000000..ae34efc Binary files /dev/null and b/.vs/PipefyAddCompanies/v17/.futdcache.v2 differ diff --git a/.vs/PipefyAddCompanies/v17/.suo b/.vs/PipefyAddCompanies/v17/.suo new file mode 100644 index 0000000..c54d711 Binary files /dev/null and b/.vs/PipefyAddCompanies/v17/.suo differ diff --git a/.vs/PipefyAddCompanies/v17/DocumentLayout.backup.json b/.vs/PipefyAddCompanies/v17/DocumentLayout.backup.json new file mode 100644 index 0000000..09fa757 --- /dev/null +++ b/.vs/PipefyAddCompanies/v17/DocumentLayout.backup.json @@ -0,0 +1,260 @@ +{ + "Version": 1, + "WorkspaceRootPath": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|x:\\back\\carteira x.x\\codigo\\pipefyaddcompanies\\ui\\views\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|solutionrelative:ui\\views\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|x:\\back\\carteira x.x\\codigo\\pipefyaddcompanies\\core\\services\\planilhaservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|solutionrelative:core\\services\\planilhaservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|x:\\back\\carteira x.x\\codigo\\pipefyaddcompanies\\ui\\viewmodels\\mainwindowviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|solutionrelative:ui\\viewmodels\\mainwindowviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|x:\\back\\carteira x.x\\codigo\\pipefyaddcompanies\\core\\services\\pipefyservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|solutionrelative:core\\services\\pipefyservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|x:\\back\\carteira x.x\\codigo\\pipefyaddcompanies\\ui\\views\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}", + "RelativeMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|solutionrelative:ui\\views\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}" + }, + { + "AbsoluteMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|x:\\back\\carteira x.x\\codigo\\pipefyaddcompanies\\core\\models\\empresa.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|solutionrelative:core\\models\\empresa.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|x:\\back\\carteira x.x\\codigo\\pipefyaddcompanies\\core\\usecases\\processadordeempresas.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|solutionrelative:core\\usecases\\processadordeempresas.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|x:\\back\\carteira x.x\\codigo\\pipefyaddcompanies\\ui\\relaycommand.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|solutionrelative:ui\\relaycommand.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|x:\\back\\carteira x.x\\codigo\\pipefyaddcompanies\\core\\services\\httpservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|solutionrelative:core\\services\\httpservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 200, + "SelectedChildIndex": 26, + "Children": [ + { + "$type": "Bookmark", + "Name": "ST:128:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:129:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:134:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:131:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:132:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:131:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:132:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:133:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:134:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:135:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:136:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:137:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:138:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:139:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:140:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:141:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:142:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:143:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:130:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:133:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}" + }, + { + "$type": "Document", + "DocumentIndex": 2, + "Title": "MainWindowViewModel.cs", + "DocumentMoniker": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\UI\\ViewModels\\MainWindowViewModel.cs", + "RelativeDocumentMoniker": "UI\\ViewModels\\MainWindowViewModel.cs", + "ToolTip": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\UI\\ViewModels\\MainWindowViewModel.cs", + "RelativeToolTip": "UI\\ViewModels\\MainWindowViewModel.cs", + "ViewState": "AgIAAA8AAAAAAAAAAAAAACQAAAAlAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-11-14T22:13:26.779Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 6, + "Title": "ProcessadorDeEmpresas.cs", + "DocumentMoniker": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\UseCases\\ProcessadorDeEmpresas.cs", + "RelativeDocumentMoniker": "Core\\UseCases\\ProcessadorDeEmpresas.cs", + "ToolTip": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\UseCases\\ProcessadorDeEmpresas.cs", + "RelativeToolTip": "Core\\UseCases\\ProcessadorDeEmpresas.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAA0AAAAfAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-11-14T22:13:18.925Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 1, + "Title": "PlanilhaService.cs", + "DocumentMoniker": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\Services\\PlanilhaService.cs", + "RelativeDocumentMoniker": "Core\\Services\\PlanilhaService.cs", + "ToolTip": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\Services\\PlanilhaService.cs", + "RelativeToolTip": "Core\\Services\\PlanilhaService.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAwAAAAJAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-11-14T22:13:04.285Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 3, + "Title": "PipefyService.cs", + "DocumentMoniker": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\Services\\PipefyService.cs", + "RelativeDocumentMoniker": "Core\\Services\\PipefyService.cs", + "ToolTip": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\Services\\PipefyService.cs", + "RelativeToolTip": "Core\\Services\\PipefyService.cs", + "ViewState": "AgIAAE0AAAAAAAAAAAAwwB4AAAAbAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-11-14T22:12:54.259Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "MainWindow.xaml.cs", + "DocumentMoniker": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\UI\\Views\\MainWindow.xaml.cs", + "RelativeDocumentMoniker": "UI\\Views\\MainWindow.xaml.cs", + "ToolTip": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\UI\\Views\\MainWindow.xaml.cs", + "RelativeToolTip": "UI\\Views\\MainWindow.xaml.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAABEAAAAXAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-11-14T22:13:47.731Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 4, + "Title": "MainWindow.xaml", + "DocumentMoniker": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\UI\\Views\\MainWindow.xaml", + "RelativeDocumentMoniker": "UI\\Views\\MainWindow.xaml", + "ToolTip": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\UI\\Views\\MainWindow.xaml", + "RelativeToolTip": "UI\\Views\\MainWindow.xaml", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|", + "WhenOpened": "2024-11-14T22:13:35.582Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 7, + "Title": "RelayCommand.cs", + "DocumentMoniker": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\UI\\RelayCommand.cs", + "RelativeDocumentMoniker": "UI\\RelayCommand.cs", + "ToolTip": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\UI\\RelayCommand.cs", + "RelativeToolTip": "UI\\RelayCommand.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAABAAAAA0AAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-11-14T22:13:55.579Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 5, + "Title": "Empresa.cs", + "DocumentMoniker": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\Models\\Empresa.cs", + "RelativeDocumentMoniker": "Core\\Models\\Empresa.cs", + "ToolTip": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\Models\\Empresa.cs", + "RelativeToolTip": "Core\\Models\\Empresa.cs", + "ViewState": "AgIAADsAAAAAAAAAAAAIwFIAAAAxAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-11-18T19:53:45.328Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 8, + "Title": "HttpService.cs", + "DocumentMoniker": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\Services\\HttpService.cs", + "RelativeDocumentMoniker": "Core\\Services\\HttpService.cs", + "ToolTip": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\Services\\HttpService.cs", + "RelativeToolTip": "Core\\Services\\HttpService.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-04-09T17:22:54.493Z", + "EditorCaption": "" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/.vs/PipefyAddCompanies/v17/DocumentLayout.json b/.vs/PipefyAddCompanies/v17/DocumentLayout.json new file mode 100644 index 0000000..a1aea11 --- /dev/null +++ b/.vs/PipefyAddCompanies/v17/DocumentLayout.json @@ -0,0 +1,254 @@ +{ + "Version": 1, + "WorkspaceRootPath": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|x:\\back\\carteira x.x\\codigo\\pipefyaddcompanies\\ui\\viewmodels\\mainwindowviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|solutionrelative:ui\\viewmodels\\mainwindowviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|x:\\back\\carteira x.x\\codigo\\pipefyaddcompanies\\ui\\views\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|solutionrelative:ui\\views\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|x:\\back\\carteira x.x\\codigo\\pipefyaddcompanies\\ui\\views\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}", + "RelativeMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|solutionrelative:ui\\views\\mainwindow.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}" + }, + { + "AbsoluteMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|x:\\back\\carteira x.x\\codigo\\pipefyaddcompanies\\core\\services\\planilhaservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|solutionrelative:core\\services\\planilhaservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|x:\\back\\carteira x.x\\codigo\\pipefyaddcompanies\\core\\services\\pipefyservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|solutionrelative:core\\services\\pipefyservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|x:\\back\\carteira x.x\\codigo\\pipefyaddcompanies\\core\\models\\empresa.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|solutionrelative:core\\models\\empresa.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|x:\\back\\carteira x.x\\codigo\\pipefyaddcompanies\\core\\usecases\\processadordeempresas.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|solutionrelative:core\\usecases\\processadordeempresas.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|x:\\back\\carteira x.x\\codigo\\pipefyaddcompanies\\ui\\relaycommand.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|solutionrelative:ui\\relaycommand.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|x:\\back\\carteira x.x\\codigo\\pipefyaddcompanies\\core\\services\\httpservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{838A6A59-682B-4DF7-A258-C67E65072DEC}|PipefyAddCompanies.csproj|solutionrelative:core\\services\\httpservice.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 200, + "SelectedChildIndex": 22, + "Children": [ + { + "$type": "Bookmark", + "Name": "ST:128:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:129:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:134:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:131:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:132:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:131:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:132:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:133:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:134:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:135:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:136:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:137:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:138:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:139:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:140:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:141:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:142:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:143:0:{1fc202d4-d401-403c-9834-5b218574bb67}" + }, + { + "$type": "Bookmark", + "Name": "ST:130:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:133:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" + }, + { + "$type": "Bookmark", + "Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "MainWindowViewModel.cs", + "DocumentMoniker": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\UI\\ViewModels\\MainWindowViewModel.cs", + "RelativeDocumentMoniker": "UI\\ViewModels\\MainWindowViewModel.cs", + "ToolTip": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\UI\\ViewModels\\MainWindowViewModel.cs", + "RelativeToolTip": "UI\\ViewModels\\MainWindowViewModel.cs", + "ViewState": "AgIAAFsAAAAAAAAAAAAuwIIAAAANAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-11-14T22:13:26.779Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 6, + "Title": "ProcessadorDeEmpresas.cs", + "DocumentMoniker": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\UseCases\\ProcessadorDeEmpresas.cs", + "RelativeDocumentMoniker": "Core\\UseCases\\ProcessadorDeEmpresas.cs", + "ToolTip": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\UseCases\\ProcessadorDeEmpresas.cs", + "RelativeToolTip": "Core\\UseCases\\ProcessadorDeEmpresas.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAA0AAAAfAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-11-14T22:13:18.925Z" + }, + { + "$type": "Document", + "DocumentIndex": 3, + "Title": "PlanilhaService.cs", + "DocumentMoniker": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\Services\\PlanilhaService.cs", + "RelativeDocumentMoniker": "Core\\Services\\PlanilhaService.cs", + "ToolTip": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\Services\\PlanilhaService.cs", + "RelativeToolTip": "Core\\Services\\PlanilhaService.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAwAAAAJAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-11-14T22:13:04.285Z" + }, + { + "$type": "Document", + "DocumentIndex": 4, + "Title": "PipefyService.cs", + "DocumentMoniker": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\Services\\PipefyService.cs", + "RelativeDocumentMoniker": "Core\\Services\\PipefyService.cs", + "ToolTip": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\Services\\PipefyService.cs", + "RelativeToolTip": "Core\\Services\\PipefyService.cs", + "ViewState": "AgIAAE0AAAAAAAAAAAAwwB4AAAAbAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-11-14T22:12:54.259Z" + }, + { + "$type": "Document", + "DocumentIndex": 1, + "Title": "MainWindow.xaml.cs", + "DocumentMoniker": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\UI\\Views\\MainWindow.xaml.cs", + "RelativeDocumentMoniker": "UI\\Views\\MainWindow.xaml.cs", + "ToolTip": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\UI\\Views\\MainWindow.xaml.cs", + "RelativeToolTip": "UI\\Views\\MainWindow.xaml.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAABMAAAA0AAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-11-14T22:13:47.731Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 2, + "Title": "MainWindow.xaml", + "DocumentMoniker": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\UI\\Views\\MainWindow.xaml", + "RelativeDocumentMoniker": "UI\\Views\\MainWindow.xaml", + "ToolTip": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\UI\\Views\\MainWindow.xaml", + "RelativeToolTip": "UI\\Views\\MainWindow.xaml", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|", + "WhenOpened": "2024-11-14T22:13:35.582Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 7, + "Title": "RelayCommand.cs", + "DocumentMoniker": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\UI\\RelayCommand.cs", + "RelativeDocumentMoniker": "UI\\RelayCommand.cs", + "ToolTip": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\UI\\RelayCommand.cs", + "RelativeToolTip": "UI\\RelayCommand.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAABAAAAA0AAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-11-14T22:13:55.579Z" + }, + { + "$type": "Document", + "DocumentIndex": 5, + "Title": "Empresa.cs", + "DocumentMoniker": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\Models\\Empresa.cs", + "RelativeDocumentMoniker": "Core\\Models\\Empresa.cs", + "ToolTip": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\Models\\Empresa.cs", + "RelativeToolTip": "Core\\Models\\Empresa.cs", + "ViewState": "AgIAADsAAAAAAAAAAAAIwFIAAAAxAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-11-18T19:53:45.328Z" + }, + { + "$type": "Document", + "DocumentIndex": 8, + "Title": "HttpService.cs", + "DocumentMoniker": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\Services\\HttpService.cs", + "RelativeDocumentMoniker": "Core\\Services\\HttpService.cs", + "ToolTip": "X:\\Back\\Carteira x.x\\Codigo\\PipefyAddCompanies\\Core\\Services\\HttpService.cs", + "RelativeToolTip": "Core\\Services\\HttpService.cs", + "ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2025-04-09T17:22:54.493Z" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/.vs/ProjectEvaluation/pipefyaddcompanies.metadata.v9.bin b/.vs/ProjectEvaluation/pipefyaddcompanies.metadata.v9.bin new file mode 100644 index 0000000..aaea863 Binary files /dev/null and b/.vs/ProjectEvaluation/pipefyaddcompanies.metadata.v9.bin differ diff --git a/.vs/ProjectEvaluation/pipefyaddcompanies.projects.v9.bin b/.vs/ProjectEvaluation/pipefyaddcompanies.projects.v9.bin new file mode 100644 index 0000000..d0ff07f Binary files /dev/null and b/.vs/ProjectEvaluation/pipefyaddcompanies.projects.v9.bin differ diff --git a/.vs/ProjectEvaluation/pipefyaddcompanies.strings.v9.bin b/.vs/ProjectEvaluation/pipefyaddcompanies.strings.v9.bin new file mode 100644 index 0000000..4cc8128 Binary files /dev/null and b/.vs/ProjectEvaluation/pipefyaddcompanies.strings.v9.bin differ diff --git a/App.xaml b/App.xaml new file mode 100644 index 0000000..251e214 --- /dev/null +++ b/App.xaml @@ -0,0 +1,5 @@ + + diff --git a/App.xaml.cs b/App.xaml.cs new file mode 100644 index 0000000..5ec5ef4 --- /dev/null +++ b/App.xaml.cs @@ -0,0 +1,8 @@ +using System.Windows; + +namespace PipefyAddCompanies.UI +{ + public partial class App : Application + { + } +} diff --git a/AssemblyInfo.cs b/AssemblyInfo.cs new file mode 100644 index 0000000..8b5504e --- /dev/null +++ b/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Core/Models/Empresa.cs b/Core/Models/Empresa.cs new file mode 100644 index 0000000..a2c5c66 --- /dev/null +++ b/Core/Models/Empresa.cs @@ -0,0 +1,87 @@ +using System.ComponentModel; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using PipefyAddCompanies.Core.Services; + +namespace PipefyAddCompanies.Core.Models +{ + public class Empresa: INotifyPropertyChanged + { + public string Nome { get; set; } // Nome da empresa em letras maiúsculas, sem caracteres especiais + public bool? ExisteNoPipefy { get; set; } // null = não verificado, true = existe, false = não existe + public string ProspectanteEmail { get; set; } // Email do prospectante cadastrado no Pipefy + public string Cidade { get; set; } // Cidade com acentos + public string Estado { get; set; } // Estado conforme lista + public string RamoAtividade { get; set; } // Ramo de atividade da empresa + + // Campos opcionais + public string? Comentarios { get; set; } // Comentários curtos + public string? TelefoneEmpresa { get; set; } // Telefone da empresa sem caracteres especiais + public string? ResponsavelEnergia { get; set; } // Nome do responsável pela energia + public string? AreaResponsavel { get; set; } // Área do responsável + public string? TelefoneResponsavel { get; set; } // Telefone do responsável (55 DDD XXXXXXXX) + public string? CelularResponsavel { get; set; } // Celular do responsável (55 DDD XXXXXXXXX) + public string? EmailResponsavel { get; set; } // Email do responsável + public string? Email2 { get; set; } // Email secundário do responsável + public string? Ambiente { get; set; } // Ambiente + public string? Distribuidora { get; set; } // Distribuidora + public decimal? ValorFatura { get; set; } // Valor da fatura, preenchido se a distribuidora estiver preenchida + public string? empresa_bd { get; set; } + public string? cidade_uf { get; set; } + public event PropertyChangedEventHandler? PropertyChanged; + protected virtual void OnPropertyChanged(string propertyName) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + // Método de validação para nome + public void ValidarNome() + { + Nome = Regex.Replace(Nome.ToUpper(), @"[^A-Z0-9\s]", ""); + } + + public Empresa( + string nome, + string prospectanteEmail, + string cidade, + string estado, + string ramoAtividade, + string comentarios, + string telefoneEmpresa, + string responsavelEnergia, + string areaResponsavel, + string telefoneResponsavel, + string celularResponsavel, + string emailResponsavel, + string email2, + string ambiente, + string distribuidora, + decimal? valorFatura = null) + { + Nome = nome.ToUpperInvariant(); + ProspectanteEmail = prospectanteEmail; + Cidade = cidade; + Estado = estado; + RamoAtividade = ramoAtividade; + Comentarios = comentarios; + TelefoneEmpresa = telefoneEmpresa; + ResponsavelEnergia = responsavelEnergia; + AreaResponsavel = areaResponsavel; + TelefoneResponsavel = telefoneResponsavel; + CelularResponsavel = celularResponsavel; + EmailResponsavel= emailResponsavel; + Email2 = email2; + Ambiente = ambiente; + Distribuidora = distribuidora; + ValorFatura = distribuidora != null ? valorFatura : null; + } + public async Task AtualizarExistenciaAsync(PipefyService pipefyService) + { + ExisteNoPipefy = await pipefyService.VerificarRegistroEmpresaExistente(Nome); + OnPropertyChanged(nameof(ExisteNoPipefy)); // Notifique a mudança para que a interface reflita a atualização + } + } +} diff --git a/Core/Services/HttpService.cs b/Core/Services/HttpService.cs new file mode 100644 index 0000000..506a35a --- /dev/null +++ b/Core/Services/HttpService.cs @@ -0,0 +1,37 @@ +using Newtonsoft.Json; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using System; +using Microsoft.Extensions.Configuration; +using System.IO; + +namespace PipefyAddCompanies.Core.Services +{ + public class HttpService + { + private readonly HttpClient _httpClient; + private readonly string _apiUrl = string.Empty; + private readonly string _token = string.Empty; + + public HttpService() + { + var config = new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) + .Build(); + + _apiUrl = config["Pipefy:ApiUrl"] ?? throw new ArgumentNullException(nameof(_apiUrl)); // Garantir que o endereço da API não seja nulo + _token = config["Pipefy:Token"] ?? throw new ArgumentNullException(nameof(_token)); // Garantir que a chave de API não seja nula + _httpClient = new HttpClient(); + _httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _token); + } + internal async Task FazerRequisicaoApiAsync(string strQuery) + { + var content = new StringContent(strQuery, Encoding.UTF8, "application/json"); + var response = await _httpClient.PostAsync(_apiUrl, content); + var jsonResponse = await response.Content.ReadAsStringAsync(); + return JsonConvert.DeserializeObject(jsonResponse); + } + } +} diff --git a/Core/Services/PipefyService.cs b/Core/Services/PipefyService.cs new file mode 100644 index 0000000..fe8e319 --- /dev/null +++ b/Core/Services/PipefyService.cs @@ -0,0 +1,205 @@ +using System.IO; +using System.Threading.Tasks; +using Microsoft.Extensions.Configuration; +using Newtonsoft.Json; +using PipefyAddCompanies.Core.Models; + +namespace PipefyAddCompanies.Core.Services +{ + public class PipefyService + { + private readonly HttpService _httpService; + private readonly string _pipeId; + private readonly string _table_id; + + public PipefyService() + { + var config = new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) + .Build(); + + _pipeId = config["Pipefy:PipeId"] ?? string.Empty; + _table_id = config["Pipefy:TableId"] ?? string.Empty; + + _httpService = new HttpService(); + } + + // Método para verificar se a empresa já existe no Pipefy + public async Task VerificarRegistroEmpresaExistente(string nomeEmpresa) + { + var query = new + { + query = @"query GetRecords($table_id: ID!, $title: String!) + { + table_records(table_id: $table_id, first:50, search: {title: $title}) + { + pageInfo{ + hasNextPage + endCursor + } + edges{ + node{ + record_fields{ + field { + id + } + value + array_value + } + } + } + } + }", + variables = new + { + table_id = _table_id, + title = nomeEmpresa + } + }; + + var response = await _httpService.FazerRequisicaoApiAsync(JsonConvert.SerializeObject(query)); + var test = response?.data?.table_records?.edges; + return test?.Count > 0; + } + // Método para criar um card no Pipefy + public async Task CriarRecordNoPipefy(string nomeEmpresa) + { + var mutation = new + { + query = $@" + mutation($table_id: ID!, $field_id: ID!, $field_value: [UndefinedInput!], $title: String!) + {{ + createTableRecord + ( + input: + {{ + table_id: $table_id + fields_attributes: + [ + {{ + field_id: $field_id, + field_value: $field_value + }} + ] + title: $title + }} + ) + {{ + table_record{{ + id + title + }} + }} + }}", + variables = new + { + table_id = _table_id, + field_id = "nome_da_empresa", + field_value = nomeEmpresa, + title = nomeEmpresa + } + }; + + var response = await _httpService.FazerRequisicaoApiAsync(JsonConvert.SerializeObject(mutation)); + return response?.data?.createTableRecord?.table_record?.id ?? ""; + } + // Método para criar um card no Pipefy + public async Task CriarCardNoPipefy(Empresa Empresa) + { + var mutation = $@" + mutation{{ + createCard( + input: + {{ + pipe_id: 303017662, + title: ""{Empresa.Nome}"", + fields_attributes: + [ + {{ + field_id: ""respons_vel"", + field_value: + [ + 302409638, + 99999999 + ] + }} + {{ + field_id: ""cidade_importa_o"", + field_value: {Empresa.Cidade} + }} + {{ + field_id: ""estado_importa_o"", + field_value: {Empresa.Estado} + }} + {{ + field_id: ""ramo_de_atividade"", + field_value: {Empresa.RamoAtividade} + }} + {{ + field_id: ""coment_rios"", + field_value: {Empresa.Comentarios} + }} + {{ + field_id: ""telefone_da_empresa_1"", + field_value: {Empresa.TelefoneEmpresa} + }} + {{ + field_id: ""nome_do_respons_vel_por_energia"", + field_value: {Empresa.ResponsavelEnergia} + }} + {{ + field_id: ""rea_do_respons_vel"", + field_value: {Empresa.AreaResponsavel} + }} + {{ + field_id: ""telefone_do_respons_vel"", + field_value: {Empresa.TelefoneResponsavel} + }} + {{ + field_id: ""celular_respons_vel"", + field_value: {Empresa.CelularResponsavel} + }} + {{ + field_id: ""email_do_respons_vel"", + field_value: {Empresa.EmailResponsavel} + }} + {{ + field_id: ""e_mail_2"", + field_value: {Empresa.Email2} + }} + {{ + field_id: ""ambiente_de_contrata_o"", + field_value: {Empresa.Ambiente} + }} + {{ + field_id: ""distribuidora"", + field_value: {Empresa.Distribuidora} + }} + {{ + field_id: ""valor_da_fatura_1"", + field_value: {Empresa.ValorFatura} + }} + {{ + field_id: ""empresa_bd"", + field_value: {Empresa.empresa_bd} + }} + {{ + field_id: ""cidade_uf"", + field_value: {Empresa.cidade_uf} + }} + ] + }} + ) + {{ + card + {{ + id + }} + }} + }}"; + + await _httpService.FazerRequisicaoApiAsync(mutation); + } + } +} diff --git a/Core/Services/PlanilhaService.cs b/Core/Services/PlanilhaService.cs new file mode 100644 index 0000000..a761633 --- /dev/null +++ b/Core/Services/PlanilhaService.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using OfficeOpenXml; +using PipefyAddCompanies.Core.Models; + +namespace PipefyAddCompanies.Core.Services +{ + public static class PlanilhaService + { + public static List LerPlanilha(string caminhoArquivo) + { + var empresas = new List(); + ExcelPackage.LicenseContext = LicenseContext.NonCommercial; + + using (var package = new ExcelPackage(new FileInfo(caminhoArquivo))) + { + // Verifique se há ao menos uma planilha + if (package.Workbook.Worksheets.Count == 0) + { + throw new InvalidOperationException("O arquivo Excel não contém nenhuma planilha."); + } + + var worksheet = package.Workbook.Worksheets[0]; // Acessa a primeira planilha + var totalRows = worksheet.Dimension?.Rows ?? 0; + + for (int row = 3; row <= totalRows; row++) // Começando de 2 para pular o cabeçalho + { + var empresa = new Empresa + ( + nome: worksheet.Cells[row, 2].Text, + prospectanteEmail: worksheet.Cells[row, 3].Text, + cidade: worksheet.Cells[row, 4].Text, + estado: worksheet.Cells[row, 5].Text, + ramoAtividade: worksheet.Cells[row, 6].Text, + comentarios: worksheet.Cells[row, 7].Text, + telefoneEmpresa: worksheet.Cells[row, 8].Text, + responsavelEnergia: worksheet.Cells[row, 9].Text, + areaResponsavel: worksheet.Cells[row, 10].Text, + telefoneResponsavel: worksheet.Cells[row, 11].Text, + celularResponsavel: worksheet.Cells[row, 12].Text, + emailResponsavel: worksheet.Cells[row, 13].Text, + email2: worksheet.Cells[row, 14].Text, + ambiente: worksheet.Cells[row, 15].Text, + distribuidora: worksheet.Cells[row, 16].Text + ); + + // Condicional para preencher o ValorFatura somente se Distribuidora estiver preenchida + var valorFatura = worksheet.Cells[row, 17].Text; + if (!string.IsNullOrEmpty(empresa.Distribuidora) && decimal.TryParse(valorFatura, out var fatura)) + { + empresa.ValorFatura = fatura; + } + + // Aplicar validação de nome para remover caracteres especiais + empresa.ValidarNome(); + + // Adicionar empresa à lista se as condições forem atendidas + empresas.Add(empresa); + } + } + + return empresas.Where(x => !string.IsNullOrEmpty(x.Nome) && x.Nome != "SMART ENERGIA").ToList(); + } + } +} diff --git a/Core/UseCases/ProcessadorDeEmpresas.cs b/Core/UseCases/ProcessadorDeEmpresas.cs new file mode 100644 index 0000000..ec54e12 --- /dev/null +++ b/Core/UseCases/ProcessadorDeEmpresas.cs @@ -0,0 +1,31 @@ +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Threading.Tasks; +using PipefyAddCompanies.Core.Models; +using PipefyAddCompanies.Core.Services; + +namespace PipefyAddCompanies.Core.UseCases +{ + public class ProcessadorDeEmpresas + { + private readonly PipefyService _pipefyService; + + public ProcessadorDeEmpresas(PipefyService pipefyService) + { + _pipefyService = pipefyService; + } + + // Método principal para processar as empresas + public async Task ProcessarAsync(IEnumerable Empresas) + { + foreach (Empresa empresa in Empresas) + { + if (!(empresa.ExisteNoPipefy ?? false)) + { + await _pipefyService.CriarCardNoPipefy(empresa); + } + } + } + } +} diff --git a/PipefyAddCompanies.csproj b/PipefyAddCompanies.csproj new file mode 100644 index 0000000..f0666c1 --- /dev/null +++ b/PipefyAddCompanies.csproj @@ -0,0 +1,32 @@ + + + + WinExe + net6.0-windows + enable + true + ab03497c-9000-4dce-83cd-241260db036e + + + + + + + + + + + + + + + + + + + + Always + + + + diff --git a/PipefyAddCompanies.csproj.user b/PipefyAddCompanies.csproj.user new file mode 100644 index 0000000..f1948f6 --- /dev/null +++ b/PipefyAddCompanies.csproj.user @@ -0,0 +1,15 @@ + + + + + + + Code + + + + + Designer + + + \ No newline at end of file diff --git a/PipefyAddCompanies.sln b/PipefyAddCompanies.sln new file mode 100644 index 0000000..0e6c4de --- /dev/null +++ b/PipefyAddCompanies.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34221.43 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PipefyAddCompanies", "PipefyAddCompanies.csproj", "{838A6A59-682B-4DF7-A258-C67E65072DEC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {838A6A59-682B-4DF7-A258-C67E65072DEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {838A6A59-682B-4DF7-A258-C67E65072DEC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {838A6A59-682B-4DF7-A258-C67E65072DEC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {838A6A59-682B-4DF7-A258-C67E65072DEC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {204ABC01-662A-4135-B771-E1C42AB6C8C7} + EndGlobalSection +EndGlobal diff --git a/UI/RelayCommand.cs b/UI/RelayCommand.cs new file mode 100644 index 0000000..6a4bbbe --- /dev/null +++ b/UI/RelayCommand.cs @@ -0,0 +1,27 @@ +using System; +using System.Windows.Input; + +namespace PipefyAddCompanies.UI +{ + public class RelayCommand : ICommand + { + private readonly Action _execute; + private readonly Func? _canExecute; + + public RelayCommand(Action execute, Func? canExecute = null) + { + _execute = execute ?? throw new ArgumentNullException(nameof(execute)); + _canExecute = canExecute; + } + + public event EventHandler? CanExecuteChanged + { + add => CommandManager.RequerySuggested += value; + remove => CommandManager.RequerySuggested -= value; + } + + public bool CanExecute(object? parameter) => _canExecute?.Invoke() ?? true; + + public void Execute(object? parameter) => _execute(); + } +} diff --git a/UI/ViewModels/MainWindowViewModel.cs b/UI/ViewModels/MainWindowViewModel.cs new file mode 100644 index 0000000..56d47d9 --- /dev/null +++ b/UI/ViewModels/MainWindowViewModel.cs @@ -0,0 +1,143 @@ +using System.Threading.Tasks; +using System.Windows.Input; +using PipefyAddCompanies.Core.UseCases; +using PipefyAddCompanies.UI.Views; +using System.ComponentModel; +using PipefyAddCompanies.Core.Models; +using System.Collections.ObjectModel; +using PipefyAddCompanies.Core.Services; +using System.Linq; +using System.Windows; +using System; +using System.IO; +using Microsoft.Extensions.Configuration; + +namespace PipefyAddCompanies.UI.ViewModels +{ + public class MainWindowViewModel : INotifyPropertyChanged + { + public event PropertyChangedEventHandler? PropertyChanged; + private readonly ProcessadorDeEmpresas _processadorDeEmpresas; + public ICommand SelecionarArquivoCommand { get; } + public ICommand ProcessarCommand { get; } + public ICommand LimparCommand { get; } + private string? _caminhoPlanilha; + private bool _isPlanilhaSelecionada; + private readonly string _templateName = string.Empty; + public ObservableCollection Empresas { get; } = new ObservableCollection(); + public ObservableCollection EmpresasExistentes { get; } = new ObservableCollection(); + + protected virtual void OnPropertyChanged(string propertyName) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + public MainWindowViewModel(ProcessadorDeEmpresas processadorDeEmpresas) + { + var config = new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) + .Build(); + + _templateName = config["FileTemplate:Name"] ?? string.Empty; + + _processadorDeEmpresas = processadorDeEmpresas; + + SelecionarArquivoCommand = new RelayCommand(SelecionarArquivoPlanilha); + ProcessarCommand = new RelayCommand(async () => await ProcessarEmpresasAsync()); + LimparCommand = new RelayCommand(LimparEmpresas); + } + public void OnWindowClosing() + { + // Limpa as listas de empresas ao fechar a janela + Empresas.Clear(); + EmpresasExistentes.Clear(); + } + + // Método para limpar empresas + private void LimparEmpresas() + { + Empresas.Clear(); + EmpresasExistentes.Clear(); + CaminhoPlanilha = null; // Opcional: Reseta o caminho da planilha + PodeProcessar = false; // Desabilita o botão de processamento + } + public void DefinirCaminhoPlanilha(string caminho) + { + if (Path.GetExtension(caminho).Equals(".xlsx", StringComparison.OrdinalIgnoreCase) && Path.GetFileNameWithoutExtension(caminho).Contains(_templateName, StringComparison.OrdinalIgnoreCase)) + { + CaminhoPlanilha = caminho; + CarregarEmpresas(); + PodeProcessar = true; // Habilita o botão de processamento + } + else + { + MessageBox.Show("Por favor, selecione um arquivo Excel válido."); + } + } + + public string? CaminhoPlanilha + { + get => _caminhoPlanilha; + set + { + _caminhoPlanilha = value; + OnPropertyChanged(nameof(CaminhoPlanilha)); + } + } + public bool PodeProcessar + { + get => _isPlanilhaSelecionada; + set + { + _isPlanilhaSelecionada = value; + OnPropertyChanged(nameof(PodeProcessar)); + } + } + private void SelecionarArquivoPlanilha() + { + _ = new MainWindow(); + _caminhoPlanilha = MainWindow.SelecionarArquivoPlanilha(); + + if (!string.IsNullOrEmpty(_caminhoPlanilha)) { DefinirCaminhoPlanilha(_caminhoPlanilha); } + } + + private void CarregarEmpresas() + { + Empresas.Clear(); + EmpresasExistentes.Clear(); + + if (string.IsNullOrEmpty(_caminhoPlanilha)) return; + + var empresasCarregadas = PlanilhaService.LerPlanilha(_caminhoPlanilha); + var pipefyService = new PipefyService(); + + foreach (var empresa in empresasCarregadas) + { + empresa.AtualizarExistenciaAsync(pipefyService).ContinueWith(task => + { + Application.Current.Dispatcher.Invoke(() => + { + if (empresa.ExisteNoPipefy == true) + { + EmpresasExistentes.Add(empresa); + } + else + { + Empresas.Add(empresa); + } + }); + }); + } + } + + + public async Task ProcessarEmpresasAsync() + { + if (!Empresas.Where(x => (x.ExisteNoPipefy == null)).Any()) + { + await _processadorDeEmpresas.ProcessarAsync(Empresas.Where(x => !(x.ExisteNoPipefy ?? false))); + } + } + } +} \ No newline at end of file diff --git a/UI/Views/MainWindow.xaml b/UI/Views/MainWindow.xaml new file mode 100644 index 0000000..c123a64 --- /dev/null +++ b/UI/Views/MainWindow.xaml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + +