Skip to content

Commit

Permalink
homework6
Browse files Browse the repository at this point in the history
  • Loading branch information
RiverUp committed Mar 25, 2022
1 parent 47181c3 commit cf8da0b
Show file tree
Hide file tree
Showing 7 changed files with 605 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Homework5/ConsoleApp1/ConsoleApp1.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{680FCF7A-06BC-430B-8007-C2555CC8533E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{680FCF7A-06BC-430B-8007-C2555CC8533E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
25 changes: 23 additions & 2 deletions Homework5/ConsoleApp1/ConsoleApp1/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace ConsoleApp1
{
Expand Down Expand Up @@ -40,6 +42,7 @@ public override string ToString()
return s;
}
}
[Serializable]
class Client
{
string name;
Expand All @@ -55,6 +58,7 @@ public override string ToString()
return $"client name : {name}; client address : {adderss}";
}
}
[Serializable]
class Goods
{
string name;
Expand All @@ -71,6 +75,7 @@ public override string ToString()
return $"name : {name}; price : {price}";
}
}
[Serializable]
class Order_Details
{
int OrdDetnum;//明细编号
Expand Down Expand Up @@ -98,6 +103,7 @@ public override string ToString()
return $"Order Detail No : {OrdDetNum} " + G.ToString() + $" Quantity : {ItemNums}";
}
}
[Serializable]
class Order : IComparable
{
int Ordnum;//订单编号
Expand Down Expand Up @@ -266,8 +272,23 @@ public void CorrectOrder(int a,int b,string type,string value)//按照订单号
oD1.G = g.ToList<Goods>()[0];break;
}
}


public void Export()
{
XmlSerializer xml = new XmlSerializer(typeof(List<Order>));
using (FileStream fs=new FileStream("orders.xml", FileMode.Create))
{
xml.Serialize(fs, orders);
}
}
public List<Order> Import()
{
XmlSerializer xml = new XmlSerializer(typeof(List<Order>));
using (FileStream fs = new FileStream("orders.xml", FileMode.Open))
{
List<Order> orders1 = (List<Order>)xml.Deserialize(fs);
return orders1;
}
}
}

class Program
Expand Down
31 changes: 31 additions & 0 deletions Homework6/ConsoleApp1/ConsoleApp1.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{680FCF7A-06BC-430B-8007-C2555CC8533E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestProject1", "UnitTestProject1\UnitTestProject1.csproj", "{5D74A284-C392-488E-A237-812A18E9B261}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{680FCF7A-06BC-430B-8007-C2555CC8533E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{680FCF7A-06BC-430B-8007-C2555CC8533E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{680FCF7A-06BC-430B-8007-C2555CC8533E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{680FCF7A-06BC-430B-8007-C2555CC8533E}.Release|Any CPU.Build.0 = Release|Any CPU
{5D74A284-C392-488E-A237-812A18E9B261}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5D74A284-C392-488E-A237-812A18E9B261}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5D74A284-C392-488E-A237-812A18E9B261}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5D74A284-C392-488E-A237-812A18E9B261}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E0DF70E0-D3FA-4B6D-AB3E-1AFD10A387A5}
EndGlobalSection
EndGlobal
8 changes: 8 additions & 0 deletions Homework6/ConsoleApp1/ConsoleApp1/ConsoleApp1.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

</Project>
Loading

0 comments on commit cf8da0b

Please sign in to comment.