python contact search

pull/1/head
DJh2o2 2022-11-09 18:13:35 +07:00
parent efb5af848f
commit 80376ea6d2
7 changed files with 88 additions and 6 deletions

@ -11,7 +11,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig.inferred = .editorconfig.inferred
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gremlin_Blazor", "Gremlin_Blazor\Gremlin_Blazor.csproj", "{FA6FA9E2-6874-4CE1-A7B9-D6B627E133AC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Gremlin_Blazor", "Gremlin_Blazor\Gremlin_Blazor.csproj", "{FA6FA9E2-6874-4CE1-A7B9-D6B627E133AC}"
EndProject
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "Gremlin_Python", "Gremlin_Python\Gremlin_Python.pyproj", "{9E0CF057-C3D7-4F60-A4EC-93E712610B53}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -27,6 +29,8 @@ Global
{FA6FA9E2-6874-4CE1-A7B9-D6B627E133AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA6FA9E2-6874-4CE1-A7B9-D6B627E133AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA6FA9E2-6874-4CE1-A7B9-D6B627E133AC}.Release|Any CPU.Build.0 = Release|Any CPU
{9E0CF057-C3D7-4F60-A4EC-93E712610B53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9E0CF057-C3D7-4F60-A4EC-93E712610B53}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

@ -1,3 +1,3 @@
@page "/"
<h1>Hello, world!</h1>
<h1>Willkommen zu Gremlin Blazor!</h1>

@ -1,11 +1,11 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
var builder = WebApplication.CreateBuilder(args);
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
var app = builder.Build();
WebApplication app = builder.Build();
if (!app.Environment.IsDevelopment())
{

@ -1,9 +1,9 @@
{
"AllowedHosts": "*",
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
}

@ -0,0 +1,5 @@
{
"objectscript.conn": {
"active": true
}
}

@ -0,0 +1,38 @@
import mysql.connector as database
connection = database.connect(
host="woitschetzki.de",
port="3306",
user="sascha",
password="mgltoJtmmDnKJ86LltsGdw",
database="regulus")
cursor = connection.cursor()
def getContact(lastName):
try:
statement = "SELECT ContactId, AccountId, FirstName, LastName, Gender, Email FROM Contacts WHERE LastName LIKE %s"
data = (lastName,)
cursor.execute(statement, data)
rows = list(cursor)
print(f"Found {len(rows)} contacts with {lastName} in LastName:")
print("ContactId | AccountID | FirstName | LastName | Gender | Email")
for (contactId, AccountId, firstName, lastName, gender, email) in rows:
print(
f"{contactId} | {AccountId} | {firstName} | {lastName} | {gender} | {email}")
except database.Error as error:
print(f"Error retrieving entry from database: {error}")
print("Willkommen bei Gremlin_Python!")
while 2 > 1:
print("Nach welchem Kunden suchen Sie?: ")
contactSearch = input()
getContact(f"%{contactSearch}%")
connection.close()

@ -0,0 +1,35 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>9e0cf057-c3d7-4f60-a4ec-93e712610b53</ProjectGuid>
<ProjectHome>.</ProjectHome>
<StartupFile>Gremlin_Python.py</StartupFile>
<SearchPath>
</SearchPath>
<WorkingDirectory>.</WorkingDirectory>
<OutputPath>.</OutputPath>
<Name>Gremlin_Python</Name>
<RootNamespace>Gremlin_Python</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>true</DebugSymbols>
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
</PropertyGroup>
<ItemGroup>
<Compile Include="Gremlin_Python.py" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
<!-- Uncomment the CoreCompile target to enable the Build command in
Visual Studio and specify your pre- and post-build commands in
the BeforeBuild and AfterBuild targets below. -->
<!--<Target Name="CoreCompile" />-->
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
</Project>