Merge branch 'master' of git@github.com:Neo-Desktop/Coleman-Code.git
This commit is contained in:
commit
146fb788a6
9 files changed
+222
No files matched your search
Binary file not shown.
@@ -16,11 +16,14 @@
|
||||
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Configuration
|
||||
Imports System.Collections.Generic
|
||||
|
||||
|
||||
Namespace VBWinFormDataGridView.DataGridViewPaging
|
||||
|
||||
Public Class MainForm
|
||||
Implements IOrderInformationRetriever
|
||||
|
||||
Private PageSize As Integer = 30
|
||||
Private CurrentPageIndex As Integer = 1
|
||||
Private TotalPage As Integer
|
||||
@@ -28,6 +31,7 @@ Namespace VBWinFormDataGridView.DataGridViewPaging
|
||||
Private conn As SqlConnection
|
||||
Private adapter As SqlDataAdapter
|
||||
Private command As SqlCommand
|
||||
Private dtable As DataTable
|
||||
|
||||
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
||||
Me.conn = New SqlConnection(connstr)
|
||||
@@ -95,6 +99,7 @@ Namespace VBWinFormDataGridView.DataGridViewPaging
|
||||
Dim view As New DataView(dt)
|
||||
view.Sort = "CustomerID"
|
||||
Dim dtout As DataTable = view.ToTable()
|
||||
Me.dtable = dtout
|
||||
Return dtout
|
||||
End Function
|
||||
|
||||
@@ -131,6 +136,45 @@ Namespace VBWinFormDataGridView.DataGridViewPaging
|
||||
Me.GetTotalPageCount()
|
||||
Me.dataGridView1.DataSource = GetPageData(Me.CurrentPageIndex)
|
||||
End Sub
|
||||
|
||||
Public Function GetOrderInformationAmountTotal() As List(Of OrderInformation) Implements IOrderInformationRetriever.GetOrderInformationAmountTotal
|
||||
Dim dt As DataTable = New DataTable()
|
||||
command.Parameters.Clear()
|
||||
command.CommandType = CommandType.Text
|
||||
command.CommandText = _
|
||||
"SELECT Orders.OrderID, Customers.CompanyName, SUM([Order Details].UnitPrice * [Order Details].Quantity) as Aprice" _
|
||||
& "FROM [Orders]" _
|
||||
& "JOIN [Customers] ON Customers.CustomerID = Orders.CustomerID" _
|
||||
& "JOIN [Order Details] ON [Order Details].OrderID = Orders.OrderID" _
|
||||
& "WHERE Orders.CustomerID = (SELECT TOP 1 CustomerID" _
|
||||
& "FROM [Northwind].dbo.Orders" _
|
||||
& "GROUP BY CustomerID" _
|
||||
& "ORDER BY COUNT(*) DESC)" _
|
||||
& "GROUP BY Customers.CompanyName, Orders.OrderID" _
|
||||
& "ORDER BY Orders.OrderID DESC"
|
||||
|
||||
Try
|
||||
conn.Open()
|
||||
Me.adapter.SelectCommand = command
|
||||
Me.adapter.Fill(dt)
|
||||
Catch ex As Exception
|
||||
MessageBox.Show(ex.Message)
|
||||
Finally
|
||||
conn.Close()
|
||||
End Try
|
||||
|
||||
Dim drlist As New List(Of DataRow)
|
||||
For Each row As DataRow In dt.Rows
|
||||
drlist.Add(CType(row, DataRow))
|
||||
Next
|
||||
Return drlist.Select(Function(rowin As DataRow)
|
||||
Return New OrderInformation With {
|
||||
.CompanyName = rowin.Item("CompanyName"),
|
||||
.OrderId = rowin.Item("OrderID"),
|
||||
.OrderUnitPrice = rowin.Item("Aprice")
|
||||
}
|
||||
End Function)
|
||||
End Function
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@@ -0,0 +1,3 @@
|
||||
Public Interface IOrderInformationRetriever
|
||||
Function GetOrderInformationAmountTotal() As List(Of OrderInformation)
|
||||
End Interface
|
||||
@@ -0,0 +1,6 @@
|
||||
Public Class OrderInformation
|
||||
|
||||
Public Property CompanyName As String
|
||||
Public Property OrderId As String
|
||||
Public Property OrderUnitPrice As String
|
||||
End Class
|
||||
@@ -108,6 +108,7 @@
|
||||
<Compile Include="EditingControlHosting\MainForm.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="IOrderInformationRetriever.vb" />
|
||||
<Compile Include="JustInTimeDataLoading\Cache.vb" />
|
||||
<Compile Include="JustInTimeDataLoading\MainForm.Designer.vb">
|
||||
<DependentUpon>MainForm.vb</DependentUpon>
|
||||
@@ -136,6 +137,7 @@
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="OrderInformation.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="CustomDataGridViewColumn\MainForm.resx">
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.40629.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Project 1", "Project 1\Project 1.vcxproj", "{332CB208-C9B0-4066-BC48-62652C0A5ED5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{332CB208-C9B0-4066-BC48-62652C0A5ED5}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{332CB208-C9B0-4066-BC48-62652C0A5ED5}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{332CB208-C9B0-4066-BC48-62652C0A5ED5}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{332CB208-C9B0-4066-BC48-62652C0A5ED5}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{332CB208-C9B0-4066-BC48-62652C0A5ED5}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>Project1</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,39 @@
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
#include <string.h>
|
||||
|
||||
const char* HELLO ="I love Porgramming in C\n";
|
||||
const char* TOKENS = " ";
|
||||
const int TOKENINDEX = 1; // insert name after token 0
|
||||
|
||||
char name[256], out[256];
|
||||
char* token, nextToken = NULL;
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
printf("%s\n:", "Please enter your name");
|
||||
gets_s(name, sizeof(name));
|
||||
|
||||
strcpy(out, HELLO);
|
||||
|
||||
token = strtok_s(out, TOKENS, &nextToken);
|
||||
|
||||
for (int i = 0; token != NULL; i++) {
|
||||
if (i == TOKENINDEX) {
|
||||
printf(", %s,", name);
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
printf("%s", token);
|
||||
} else {
|
||||
printf(" %s", token);
|
||||
}
|
||||
|
||||
token = strtok_s(NULL, TOKENS, &nextToken);
|
||||
}
|
||||
|
||||
printf("\n%s\n", "Press any key to continue. . .");
|
||||
_getch();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user