Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .vs/DoNetAdvancedClassHomework/v16/.suo
Binary file not shown.
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
8 changes: 8 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ExpandedNodes": [
"",
"\\.gitignore"
],
"SelectedNode": "\\Src",
"PreviewInSolutionExplorer": false
}
Binary file added .vs/slnx.sqlite
Binary file not shown.
176 changes: 176 additions & 0 deletions Doc/高级班13期第一次homework.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@

.Net�߼����13�ڵ�һ����ҵ�����Ŀ��˷���+����

��ҵ��������һ������̨������ҵ�������£�

1 ����һ�����ݿ⣬Ȼ��ִ����������ݿ�ű������������ű� User Company����ҿ���ȥ�������Լ������һЩ����
(�ű����ڱ��ĵ�������)

2 �������ݿ��ӳ��Ļ���BaseModel������ Id����
������������Model����˾���û������ձ��ṹ��

3 �ṩ�������͵����ݿ���ʷ������� BaseModelԼ��
һ������idȥ��ѯ����ʵ�壬(ֻ����һ������)
һ���Dz�ѯ�����ݱ���ȫ�������б���ѯ(û�в���)

��ʾ����DataReaderȥ�������ݿ⣬���õ��Ľ��ͨ����������ʵ�����/���Ϸ��أ�


4 ��װһ���������ܿ���̨�������ʵ���ȫ�����Ժ�����ֵ��

5 ���������ṩ���͵����ݿ�ʵ����롢ʵ����¡�IDɾ�����ݵ����ݿ���ʷ�����

6 �������󣨿�ѡ������ӭС����д��ʵ���Զ���������

7 �������󣨿�ѡ���������ݷ��ʲ����ʹ�ü򵥹���+�����ļ�+����ķ�ʽ�����ṩ�����ݷ��ʲ��ʹ��

8 �������󣨿�ѡ����ÿ��ʵ����Ļ�����ɾ�IJ�SQL����Dz���ģ��÷��ͻ������ԣ�


ע�������淶���쳣��������������ӿڡ�������װ�� and so on

��ҵǰ��ð���������쳣������ר�⿴һ��
���ӣ�http://pan.baidu.com/s/1kVNorpd ���룺pyhv


��ҵҪ�󷢵����䣺2119142269@qq.com 57265177@qq.com


��ҵ��ѹ��������ʽ�����ң�ѹ��������������Ⱥ����dzƿ�ͷ��Ȼ���и��µĻ������dzƺ������_update1������

��һ���ύ�ǣ� 1258-Richard��ʦ-��-�人_homework_��һ��.rar
�ڶ����ύ�ǣ� 1258-Richard��ʦ-��-�人_homework_��һ��_Update1.rar
�������ύ�ǣ� 1258-Richard��ʦ-��-�人_homework_��һ��_Update2.rar

ѹ������ϣ��������ҵ˵���ĵ��������Լ�����˼�����
��������ɹ����е����⡢˼·�����������ѧϰ���򡢱ʼǶ������ˣ���
�����ҵ�и��£������Ѹ��µ�����д���ĵ�


Ȼ��Խ�罻��ҵ�� ��ʦ�ᵥ�����ģ�һ��һָ��������ʱ���ˡ�����





CREATE TABLE [dbo].[Company](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](500) NULL,
[CreateTime] [datetime] NOT NULL,
[CreatorId] [int] NOT NULL,
[LastModifierId] [int] NULL,
[LastModifyTime] [datetime] NULL,
CONSTRAINT [PK_Company] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO


INSERT INTO [dbo].[Company]
([Name]
,[CreateTime]
,[CreatorId]
,[LastModifierId]
,[LastModifyTime])
VALUES
('�ٽ�'
,'2015-12-10'
,1
,1
,'2015-12-10')


INSERT INTO [dbo].[Company]
([Name]
,[CreateTime]
,[CreatorId]
,[LastModifierId]
,[LastModifyTime])
VALUES
('��ݸ'
,'2015-12-10'
,1
,1
,'2015-12-10')


INSERT INTO [dbo].[Company]
([Name]
,[CreateTime]
,[CreatorId]
,[LastModifierId]
,[LastModifyTime])
VALUES
('�����ղ�'
,'2018-12-10'
,1
,1
,'2018-12-10')




CREATE TABLE [dbo].[User](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](50) NULL,
[Account] [varchar](100) NOT NULL,
[Password] [varchar](100) NOT NULL,
[Email] [varchar](200) NULL,
[Mobile] [varchar](30) NULL,
[CompanyId] [int] NULL,
[CompanyName] [nvarchar](500) NULL,
[State] [int] NOT NULL,
[UserType] [int] NOT NULL,
[LastLoginTime] [datetime] NULL,
[CreateTime] [datetime] NOT NULL,
[CreatorId] [int] NOT NULL,
[LastModifierId] [int] NULL,
[LastModifyTime] [datetime] NULL,
CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'�û�״̬ 0���� 1���� 2ɾ��' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'User', @level2type=N'COLUMN',@level2name=N'State'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'�û����� 1 ��ͨ�û� 2����Ա 4��������Ա' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'User', @level2type=N'COLUMN',@level2name=N'UserType'
GO


INSERT INTO [dbo].[User]
([Name]
,[Account]
,[Password]
,[Email]
,[Mobile]
,[CompanyId]
,[CompanyName]
,[State]
,[UserType]
,[LastLoginTime]
,[CreateTime]
,[CreatorId]
,[LastModifierId]
,[LastModifyTime])
VALUES
('��'
,'admin'
,'e10adc3949ba59abbe56e057f20f883e'
,'12'
,'133'
,'1'
,'�ٽ�'
,0
,2
,'2018-12-12'
,'2018-12-12'
,1
,1
,'2018-12-12')
GO

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#region << 版 本 注 释 >>
/*----------------------------------------------------------------
* 作 者 :Nicholas Leo
* E-Mail : nicholasleo1030@163.com
* GitHub : https://github.com/nicholasleo
* 项目名称 :NicholasLeo.Homework.Commond
* 项目描述 :类-
* 类 名 称 :CustomerAttribute
* 类 描 述 :
* 所在的域 :NICHOLAS-LEO
* 命名空间 :NicholasLeo.Homework.Commond
* 机器名称 :NICHOLAS-LEO
* CLR 版本 :4.0.30319.42000
* 创建时间 :2019-10-25 0:27:36
* 修 改 人 : NicholasLeo
* 更新时间 :2019-10-25 0:27:36
* 版 本 号 :v1.0.0.0
*******************************************************************
* Copyright @ NicholasLeo 2019. All rights reserved.
*******************************************************************
//----------------------------------------------------------------*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NicholasLeo.Homework.Commond
{
public class CustomerAttribute : Attribute
{
private string _TableName;
public string TableName { get { return _TableName; } set { _TableName = value; } }
private string _ColumnName;
public string ColumnName { get { return _ColumnName; } set { _ColumnName = value; } }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#region << 版 本 注 释 >>
/*----------------------------------------------------------------
* 作 者 :Nicholas Leo
* E-Mail : nicholasleo1030@163.com
* GitHub : https://github.com/nicholasleo
* 项目名称 :NicholasLeo.Homework.Commond
* 项目描述 :类-
* 类 名 称 :CustomerAttributeHelper
* 类 描 述 :
* 所在的域 :NICHOLAS-LEO
* 命名空间 :NicholasLeo.Homework.Commond
* 机器名称 :NICHOLAS-LEO
* CLR 版本 :4.0.30319.42000
* 创建时间 :2019-10-25 0:37:25
* 修 改 人 : NicholasLeo
* 更新时间 :2019-10-25 0:37:25
* 版 本 号 :v1.0.0.0
*******************************************************************
* Copyright @ NicholasLeo 2019. All rights reserved.
*******************************************************************
//----------------------------------------------------------------*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace NicholasLeo.Homework.Commond
{
public static class CustomerAttributeHelper
{
public static string GetTableName(Type type)
{
string tableName = string.Empty;
object[] objAttrs = type.GetCustomAttributes(typeof(CustomerAttribute), true);
foreach (var item in objAttrs)
{
CustomerAttribute customerAttribute = item as CustomerAttribute;
if (customerAttribute != null)
{
tableName = customerAttribute.TableName;
break;
}
}
return tableName;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D0E5AF96-C2F0-4823-8E29-A39E7EF1BF68}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NicholasLeo.Homework.Commond</RootNamespace>
<AssemblyName>NicholasLeo.Homework.Commond</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CustomerAttribute.cs" />
<Compile Include="CustomerAttributeHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("NicholasLeo.Homework.Commond")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NicholasLeo.Homework.Commond")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]

// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("d0e5af96-c2f0-4823-8e29-a39e7ef1bf68")]

// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
<connectionStrings>
<!--数据库连接字符串-->
<add name="db" connectionString="Data Source=.; Database=HOMEWORK; User ID=sa; Password=Zzc1030@123456; MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
Loading