Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add files

  • Loading branch information...
commit 62f3e6bb278d37d8b65dedd179e4407b3ae728c9 0 parents
tianyawang authored
Showing with 52,543 additions and 0 deletions.
  1. +22 −0 .gitattributes
  2. +163 −0 .gitignore
  3. +66 −0 GSReport/BLReport/BLReport.csproj
  4. +261 −0 GSReport/BLReport/BLReports.cs
  5. +68 −0 GSReport/BLReport/BLStation.cs
  6. +58 −0 GSReport/BLReport/BLUser.cs
  7. +36 −0 GSReport/BLReport/Properties/AssemblyInfo.cs
  8. +67 −0 GSReport/DAReport/DAReport.csproj
  9. +943 −0 GSReport/DAReport/DAReports.cs
  10. +292 −0 GSReport/DAReport/DAStation.cs
  11. +274 −0 GSReport/DAReport/DAUser.cs
  12. +38 −0 GSReport/DAReport/DAWorkLog.cs
  13. +1,476 −0 GSReport/DAReport/DBUtility/SQLHelper.cs
  14. +55 −0 GSReport/DAReport/DBUtility/SqlDataReaderExtensions.cs
  15. +30 −0 GSReport/DAReport/Encrypt.cs
  16. +36 −0 GSReport/DAReport/Properties/AssemblyInfo.cs
  17. +38 −0 GSReport/GSReport.sln
  18. +3 −0  GSReport/Report/Content/Data/Files/readme.txt
  19. +3 −0  GSReport/Report/Content/Data/MathImage/readme.txt
  20. BIN  GSReport/Report/Content/Data/MathImage/sqrt2
  21. +3 −0  GSReport/Report/Content/Data/ZipFile/readme.txt
  22. +345 −0 GSReport/Report/Content/Site.css
  23. BIN  GSReport/Report/Content/images/ui-bg_diagonals-thick_18_b81900_40x40.png
  24. BIN  GSReport/Report/Content/images/ui-bg_diagonals-thick_20_666666_40x40.png
  25. BIN  GSReport/Report/Content/images/ui-bg_flat_10_000000_40x100.png
  26. BIN  GSReport/Report/Content/images/ui-bg_glass_100_f6f6f6_1x400.png
  27. BIN  GSReport/Report/Content/images/ui-bg_glass_100_fdf5ce_1x400.png
  28. BIN  GSReport/Report/Content/images/ui-bg_glass_65_ffffff_1x400.png
  29. BIN  GSReport/Report/Content/images/ui-bg_gloss-wave_35_f6a828_500x100.png
  30. BIN  GSReport/Report/Content/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
  31. BIN  GSReport/Report/Content/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
  32. BIN  GSReport/Report/Content/images/ui-icons_222222_256x240.png
  33. BIN  GSReport/Report/Content/images/ui-icons_228ef1_256x240.png
  34. BIN  GSReport/Report/Content/images/ui-icons_ef8c08_256x240.png
  35. BIN  GSReport/Report/Content/images/ui-icons_ffd27a_256x240.png
  36. BIN  GSReport/Report/Content/images/ui-icons_ffffff_256x240.png
  37. +357 −0 GSReport/Report/Content/jquery-ui-1.8.16.custom.css
  38. BIN  GSReport/Report/Content/style/bar.gif
  39. BIN  GSReport/Report/Content/style/btn_40.gif
  40. BIN  GSReport/Report/Content/style/logo_big.gif
  41. BIN  GSReport/Report/Content/style/logo_small.gif
  42. BIN  GSReport/Report/Content/style/nav_right.gif
  43. BIN  GSReport/Report/Content/style/noimage.gif
  44. +105 −0 GSReport/Report/Content/style/style.css
  45. +226 −0 GSReport/Report/Content/style/syntaxhighlighter/shCore.css
  46. +330 −0 GSReport/Report/Content/style/syntaxhighlighter/shCoreDefault.css
  47. +331 −0 GSReport/Report/Content/style/syntaxhighlighter/shCoreDjango.css
  48. +339 −0 GSReport/Report/Content/style/syntaxhighlighter/shCoreEclipse.css
  49. +324 −0 GSReport/Report/Content/style/syntaxhighlighter/shCoreEmacs.css
  50. +328 −0 GSReport/Report/Content/style/syntaxhighlighter/shCoreFadeToGrey.css
  51. +324 −0 GSReport/Report/Content/style/syntaxhighlighter/shCoreMDUltra.css
  52. +324 −0 GSReport/Report/Content/style/syntaxhighlighter/shCoreMidnight.css
  53. +324 −0 GSReport/Report/Content/style/syntaxhighlighter/shCoreRDark.css
  54. +117 −0 GSReport/Report/Content/style/syntaxhighlighter/shThemeDefault.css
  55. +120 −0 GSReport/Report/Content/style/syntaxhighlighter/shThemeDjango.css
  56. +128 −0 GSReport/Report/Content/style/syntaxhighlighter/shThemeEclipse.css
  57. +113 −0 GSReport/Report/Content/style/syntaxhighlighter/shThemeEmacs.css
  58. +117 −0 GSReport/Report/Content/style/syntaxhighlighter/shThemeFadeToGrey.css
  59. +113 −0 GSReport/Report/Content/style/syntaxhighlighter/shThemeMDUltra.css
  60. +113 −0 GSReport/Report/Content/style/syntaxhighlighter/shThemeMidnight.css
  61. +113 −0 GSReport/Report/Content/style/syntaxhighlighter/shThemeRDark.css
  62. BIN  GSReport/Report/Content/themes/base/images/ui-bg_flat_0_aaaaaa_40x100.png
  63. BIN  GSReport/Report/Content/themes/base/images/ui-bg_flat_75_ffffff_40x100.png
  64. BIN  GSReport/Report/Content/themes/base/images/ui-bg_glass_55_fbf9ee_1x400.png
  65. BIN  GSReport/Report/Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png
  66. BIN  GSReport/Report/Content/themes/base/images/ui-bg_glass_75_dadada_1x400.png
  67. BIN  GSReport/Report/Content/themes/base/images/ui-bg_glass_75_e6e6e6_1x400.png
  68. BIN  GSReport/Report/Content/themes/base/images/ui-bg_glass_95_fef1ec_1x400.png
  69. BIN  GSReport/Report/Content/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png
  70. BIN  GSReport/Report/Content/themes/base/images/ui-icons_222222_256x240.png
  71. BIN  GSReport/Report/Content/themes/base/images/ui-icons_2e83ff_256x240.png
  72. BIN  GSReport/Report/Content/themes/base/images/ui-icons_454545_256x240.png
  73. BIN  GSReport/Report/Content/themes/base/images/ui-icons_888888_256x240.png
  74. BIN  GSReport/Report/Content/themes/base/images/ui-icons_cd0a0a_256x240.png
  75. +635 −0 GSReport/Report/Content/themes/base/jquery-ui.css
  76. +127 −0 GSReport/Report/Controllers/AccountController.cs
  77. +28 −0 GSReport/Report/Controllers/HomeController.cs
  78. +171 −0 GSReport/Report/Controllers/ReportController.cs
  79. +78 −0 GSReport/Report/Controllers/StationController.cs
  80. +66 −0 GSReport/Report/Controllers/UserController.cs
  81. +1 −0  GSReport/Report/Global.asax
  82. +40 −0 GSReport/Report/Global.asax.cs
  83. +280 −0 GSReport/Report/Models/AccountModels.cs
  84. +35 −0 GSReport/Report/Models/CurrentUserModel.cs
  85. +35 −0 GSReport/Report/Properties/AssemblyInfo.cs
  86. +234 −0 GSReport/Report/Report.csproj
  87. +7,117 −0 GSReport/Report/Scripts/MicrosoftAjax.debug.js
  88. +6 −0 GSReport/Report/Scripts/MicrosoftAjax.js
  89. +408 −0 GSReport/Report/Scripts/MicrosoftMvcAjax.debug.js
  90. +25 −0 GSReport/Report/Scripts/MicrosoftMvcAjax.js
  91. +883 −0 GSReport/Report/Scripts/MicrosoftMvcValidation.debug.js
  92. +55 −0 GSReport/Report/Scripts/MicrosoftMvcValidation.js
  93. +9,035 −0 GSReport/Report/Scripts/jquery-1.4.4-vsdoc.js
  94. +7,177 −0 GSReport/Report/Scripts/jquery-1.4.4.js
  95. +171 −0 GSReport/Report/Scripts/jquery-1.4.4.min.js
  96. +11,630 −0 GSReport/Report/Scripts/jquery-ui.js
  97. +409 −0 GSReport/Report/Scripts/jquery-ui.min.js
  98. +165 −0 GSReport/Report/Scripts/jquery.unobtrusive-ajax.js
  99. +5 −0 GSReport/Report/Scripts/jquery.unobtrusive-ajax.min.js
  100. +1,286 −0 GSReport/Report/Scripts/jquery.validate-vsdoc.js
  101. +1,150 −0 GSReport/Report/Scripts/jquery.validate.js
  102. +20 −0 GSReport/Report/Scripts/jquery.validate.min.js
  103. +319 −0 GSReport/Report/Scripts/jquery.validate.unobtrusive.js
  104. +5 −0 GSReport/Report/Scripts/jquery.validate.unobtrusive.min.js
  105. +55 −0 GSReport/Report/Views/Account/ChangePassword.aspx
  106. +12 −0 GSReport/Report/Views/Account/ChangePasswordSuccess.aspx
  107. +19 −0 GSReport/Report/Views/Account/LogOn.aspx
  108. +63 −0 GSReport/Report/Views/Account/Register.aspx
  109. +12 −0 GSReport/Report/Views/Home/About.aspx
  110. +5 −0 GSReport/Report/Views/Home/Index.aspx
  111. +54 −0 GSReport/Report/Views/Report/DailyAmountReport.aspx
  112. +86 −0 GSReport/Report/Views/Report/DailyCardReport.aspx
  113. +62 −0 GSReport/Report/Views/Report/ShortOver.aspx
  114. +43 −0 GSReport/Report/Views/Report/SpiltBill.aspx
  115. +89 −0 GSReport/Report/Views/Report/TrafficReport.aspx
  116. +79 −0 GSReport/Report/Views/Report/Truck5Report.aspx
  117. +79 −0 GSReport/Report/Views/Report/Truck6Report.aspx
  118. +213 −0 GSReport/Report/Views/Report/chargedepartmentReport.aspx
  119. +115 −0 GSReport/Report/Views/Report/stationReport.aspx
  120. +11 −0 GSReport/Report/Views/Shared/Error.aspx
  121. +14 −0 GSReport/Report/Views/Shared/LogOnUserControl.ascx
  122. +45 −0 GSReport/Report/Views/Shared/Reports.Master
  123. +66 −0 GSReport/Report/Views/Shared/Site.Master
  124. +25 −0 GSReport/Report/Views/Station/Add.aspx
  125. +26 −0 GSReport/Report/Views/Station/AddClass.aspx
  126. +32 −0 GSReport/Report/Views/Station/CollectionClasses.aspx
  127. +26 −0 GSReport/Report/Views/Station/Details.aspx
  128. +29 −0 GSReport/Report/Views/Station/Index.aspx
  129. +43 −0 GSReport/Report/Views/User/Add.aspx
  130. +46 −0 GSReport/Report/Views/User/Details.aspx
  131. +33 −0 GSReport/Report/Views/User/Index.aspx
  132. +58 −0 GSReport/Report/Views/Web.config
  133. +30 −0 GSReport/Report/Web.Debug.config
  134. +31 −0 GSReport/Report/Web.Release.config
  135. +91 −0 GSReport/Report/Web.config
  136. +19 −0 GSReport/ReportModel/CollectionClassModel.cs
  137. +55 −0 GSReport/ReportModel/Common/Encryptor.cs
  138. +66 −0 GSReport/ReportModel/Common/EntityInfo.cs
  139. +90 −0 GSReport/ReportModel/Common/UtilityHelper.cs
  140. +70 −0 GSReport/ReportModel/DailyAmountReport.cs
  141. +48 −0 GSReport/ReportModel/DailyCardReport.cs
  142. +18 −0 GSReport/ReportModel/MonthAmountReport.cs
  143. +36 −0 GSReport/ReportModel/Properties/AssemblyInfo.cs
  144. +69 −0 GSReport/ReportModel/ReportModel.csproj
  145. +28 −0 GSReport/ReportModel/ShortOverReport.cs
  146. +21 −0 GSReport/ReportModel/SplitBillReport.cs
  147. +14 −0 GSReport/ReportModel/StationModel.cs
  148. +121 −0 GSReport/ReportModel/TrafficeFlowReport.cs
  149. +58 −0 GSReport/ReportModel/Truck5ReportModel.cs
  150. +57 −0 GSReport/ReportModel/Truck6ReportModel.cs
  151. +37 −0 GSReport/ReportModel/UserModel.cs
  152. +25 −0 GSReport/ReportModel/WorkLog.cs
22 .gitattributes
@@ -0,0 +1,22 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# Custom for Visual Studio
+*.cs diff=csharp
+*.sln merge=union
+*.csproj merge=union
+*.vbproj merge=union
+*.fsproj merge=union
+*.dbproj merge=union
+
+# Standard to msysgit
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
163 .gitignore
@@ -0,0 +1,163 @@
+#################
+## Eclipse
+#################
+
+*.pydevproject
+.project
+.metadata
+bin/
+tmp/
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.classpath
+.settings/
+.loadpath
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# CDT-specific
+.cproject
+
+# PDT-specific
+.buildpath
+
+
+#################
+## Visual Studio
+#################
+
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+[Dd]ebug/
+[Rr]elease/
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.vspscc
+.builds
+*.dotCover
+
+## TODO: If you have NuGet Package Restore enabled, uncomment this
+#packages/
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+
+# Visual Studio profiler
+*.psess
+*.vsp
+
+# ReSharper is a .NET coding add-in
+_ReSharper*
+
+# Installshield output folder
+[Ee]xpress
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish
+
+# Others
+[Bb]in
+[Oo]bj
+sql
+TestResults
+*.Cache
+ClientBin
+stylecop.*
+~$*
+*.dbmdl
+Generated_Code #added for RIA/Silverlight projects
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+
+
+
+############
+## Windows
+############
+
+# Windows image file caches
+Thumbs.db
+
+# Folder config file
+Desktop.ini
+
+
+#############
+## Python
+#############
+
+*.py[co]
+
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+parts
+bin
+var
+sdist
+develop-eggs
+.installed.cfg
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+
+#Translations
+*.mo
+
+#Mr Developer
+.mr.developer.cfg
+
+# Mac crap
+.DS_Store
66 GSReport/BLReport/BLReport.csproj
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{61BDE7DA-F37C-413B-BF81-E14137815DE0}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>BLReport</RootNamespace>
+ <AssemblyName>BLReport</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </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.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="BLReports.cs" />
+ <Compile Include="BLStation.cs" />
+ <Compile Include="BLUser.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\DAReport\DAReport.csproj">
+ <Project>{DE6D324E-8F2C-4DA4-9F85-ECCFD9E7EF58}</Project>
+ <Name>DAReport</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\ReportModel\ReportModel.csproj">
+ <Project>{7FDDC80A-F428-4322-885C-6DBB435C0CE2}</Project>
+ <Name>ReportModel</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
261 GSReport/BLReport/BLReports.cs
@@ -0,0 +1,261 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using DAReport;
+using ReportModel;
+
+namespace BLReport
+{
+ public class BLReports
+ {
+ private DAReports dareport = new DAReports();
+
+ public void AddDailyAmountReport(DailyAmountReport model)
+ {
+ dareport.AddDailyAmountReport(model);
+ }
+
+ public void AddDailyCardReport(DailyCardReport model)
+ {
+ dareport.AddDailyCardReport(model);
+ }
+
+ public void AddTrafficReport(TrafficeFlowReport model)
+ {
+ dareport.AddTrafficReport(model);
+ }
+
+ public void AddTruck5Report(Truck5ReportModel model)
+ {
+ dareport.AddTruck5Report(model);
+ }
+
+ public void AddTruck6Report(Truck6ReportModel model)
+ {
+ dareport.AddTruck6Report(model);
+ }
+
+ public void SpiltBill(SplitBillReport model)
+ {
+ dareport.SpiltBill(model);
+ }
+
+ public void AddShortOver(ShortOverReport model)
+ {
+ dareport.AddShortOver(model);
+ }
+
+ #region 收费科报表
+
+ public IList<DailyAmountReport> ListDailyReports()
+ {
+ return dareport.ListDayDailyReports();
+ }
+
+ public IList<MonthCardReport> ListMonthCardReports()
+ {
+ IList<MonthCardReport> reports = new List<MonthCardReport>();
+
+ BLStation blstation = new BLStation();
+ var stations = blstation.GetStations();
+
+ var cardreport = dareport.ListMonthCardReports(DateTime.Now.Year, DateTime.Now.Month);
+
+ foreach (var item in stations)
+ {
+ var report = cardreport.FirstOrDefault(t => t.StationID == item.StationID);
+ if (report == null)
+ {
+ reports.Add(new MonthCardReport()
+ {
+ StationID = item.StationID,
+ StationName = item.StationName,
+ BrokenCards = 0,
+ ReceivedCards = 0,
+ SentCards = 0,
+ WrongCards = 0
+ });
+ }
+ else
+ {
+ report.StationName = item.StationName;
+ reports.Add(report);
+ }
+ }
+
+ return reports;
+ }
+
+ public IList<MonthEasyAccessReport> ListMonthEasyAccessReports()
+ {
+ var eareports = dareport.ListMonthEasyAccessReports(DateTime.Now.Year, DateTime.Now.Month);
+ var amountreports = dareport.ListMonthDailyAmountReport(DateTime.Now.Year, DateTime.Now.Month);
+
+ IList<MonthEasyAccessReport> reports = new List<MonthEasyAccessReport>();
+
+ BLStation blstation = new BLStation();
+ var stations = blstation.GetStations();
+
+ foreach (var item in stations)
+ {
+ var eareport = eareports.FirstOrDefault(t => t.StationID == item.StationID);
+ var amountreport = amountreports.FirstOrDefault(t => t.StationID == item.StationID);
+
+ reports.Add(new MonthEasyAccessReport()
+ {
+ StationID = item.StationID,
+ StationName = item.StationName,
+ Amount = amountreport == null ? 0 : amountreport.Amount,
+ EasyAccessAmount = amountreport == null ? 0 : amountreport.EasyAccessAmount,
+ DownAmount = eareport == null ? 0 : eareport.DownAmount,
+ EasyAccess = eareport == null ? 0 : eareport.EasyAccess
+ });
+
+ }
+
+ return reports;
+
+
+ }
+
+ public IList<MonthAmountReport> ListMonthAmountReport()
+ {
+ var now = DateTime.Now;
+
+ var amountreports = dareport.ListMonthDailyAmountReport(now.Year, now.Month);
+ var splitamount = dareport.ListMonthSplitBillReports(now.Year, now.Month);
+
+ IList<MonthAmountReport> reports = new List<MonthAmountReport>();
+
+ BLStation blstation = new BLStation();
+ var stations = blstation.GetStations();
+
+
+ foreach (var item in stations)
+ {
+ var splitreport = splitamount.FirstOrDefault(t => t.StationID == item.StationID);
+ var amountreport = amountreports.FirstOrDefault(t => t.StationID == item.StationID);
+
+ reports.Add(new MonthAmountReport()
+ {
+ StationID = item.StationID,
+ StationName = item.StationName,
+ Amount = amountreport == null ? 0 : amountreport.Amount,
+ SplitAmount = splitreport == null ? 0 : splitreport.Amount
+ });
+
+ }
+
+ return reports;
+
+ }
+
+ public IList<TrafficeFlowReport> ListDailyTrafficReports()
+ {
+ return dareport.ListDailyTrafficReports();
+ }
+
+ public IList<Truck5ReportModel> ListMonthTruck5Reports()
+ {
+ IList<Truck5ReportModel> reports = new List<Truck5ReportModel>();
+
+ BLStation blstation = new BLStation();
+ var stations = blstation.GetStations();
+
+ var cardreport = dareport.ListMonthTruck5Reports(DateTime.Now.Year, DateTime.Now.Month);
+
+ foreach (var item in stations)
+ {
+ var report = cardreport.FirstOrDefault(t => t.StationID == item.StationID);
+ if (report == null)
+ {
+ reports.Add(new Truck5ReportModel()
+ {
+ StationID = item.StationID,
+ StationName = item.StationName,
+ DownAmount = 0,
+ MoreThan0 = 0,
+ MoreThan100 = 0,
+ MoreThan30 = 0,
+ TruckAmount = 0
+ });
+ }
+ else
+ {
+ reports.Add(report);
+ }
+ }
+
+ return reports;
+ }
+
+ public IList<Truck6ReportModel> ListMonthTruck6Reports()
+ {
+ IList<Truck6ReportModel> reports = new List<Truck6ReportModel>();
+
+ BLStation blstation = new BLStation();
+ var stations = blstation.GetStations();
+
+ var cardreport = dareport.ListMonthTruck6Reports(DateTime.Now.Year, DateTime.Now.Month);
+
+ foreach (var item in stations)
+ {
+ var report = cardreport.FirstOrDefault(t => t.StationID == item.StationID);
+ if (report == null)
+ {
+ reports.Add(new Truck6ReportModel()
+ {
+ StationID = item.StationID,
+ StationName = item.StationName,
+ DownAmount = 0,
+ MoreThan0 = 0,
+ MoreThan100 = 0,
+ MoreThan30 = 0,
+ TruckAmount = 0
+ });
+ }
+ else
+ {
+ reports.Add(report);
+ }
+ }
+
+ return reports;
+ }
+
+ #endregion
+
+ #region 收费站报表
+
+ public IList<DailyAmountReport> ListStationDailyAmountReport(int stationid,DateTime date)
+ {
+ return dareport.ListStationDailyAmountReport(stationid,date);
+ }
+
+ public StationMonthAmountReport GetDailyAmountMonthReport(int stationid, DateTime date)
+ {
+ return dareport.GetDailyAmountMonthReport(stationid, date);
+
+ }
+
+ public IList<DailyCardReport> ListStationDailyCardReports(int stationid, DateTime date)
+ {
+ return dareport.ListStationDailyCardReports(stationid, date);
+ }
+
+ public MonthCardReport GetDailyCardMonthReport(int stationid, DateTime date)
+ {
+ return dareport.GetDailyCardMonthReport(stationid, date);
+ }
+
+ public IList<TrafficeFlowReport> ListStationDailyTrafficReports(int stationid)
+ {
+ return dareport.ListStationDailyTrafficReports(stationid );
+ }
+
+
+ #endregion
+
+ }
+}
68 GSReport/BLReport/BLStation.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using DAReport;
+using ReportModel;
+
+namespace BLReport
+{
+ public class BLStation
+ {
+ private DAStation dastation = new DAStation();
+
+ #region Station
+
+ public StationModel GetStation(int id)
+ {
+ return dastation.GetStation(id);
+ }
+
+ public IList<StationModel> GetStations()
+ {
+ return dastation.GetStations();
+ }
+
+ public int AddStation(string stationname)
+ {
+ return dastation.AddStation(stationname);
+ }
+
+ public void DeleteStation(int id)
+ {
+ dastation.DeleteStation(id);
+ }
+
+
+ public void UpdateStation(int id, string stationname)
+ {
+ dastation.UpdateStation(id, stationname);
+ }
+
+ #endregion
+
+ #region class
+
+ public IList<CollectionClassModel> GetCollectionClasses(int stationid)
+ {
+ return dastation.GetCollectionClasses(stationid);
+ }
+
+ public CollectionClassModel GetCollection(int id)
+ {
+ return dastation.GetCollectionClass(id);
+ }
+
+ public int AddCollectionClass(int stationid, string classname)
+ {
+ return dastation.AddCollectionClass(stationid, classname);
+ }
+
+ public void DeleteClass(int classid)
+ {
+ dastation.DeleteCollectionClass(classid);
+ }
+
+ #endregion
+ }
+}
58 GSReport/BLReport/BLUser.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using DAReport;
+using ReportModel;
+using ReportModel.Common;
+
+namespace BLReport
+{
+ public class BLUser
+ {
+ private DAUser daUser = new DAUser();
+
+ public int CreateUser(NewUserModel user)
+ {
+ return daUser.CreateUser(user);
+ }
+
+ public UserModel GetUser(int userid)
+ {
+ return daUser.GetUser(userid);
+ }
+
+ public IList<UserModel> GetUsers()
+ {
+ return daUser.GetUsers();
+ }
+
+
+ public void DeleteUser(int id)
+ {
+ daUser.DeleteUser(id);
+ }
+
+ public void ResetPassword(int id)
+ {
+ string newpassword = Guid.NewGuid().ToString().Substring(0, 6);
+ daUser.ResetPassword(id, newpassword);
+ }
+
+ public int ValidateUser(string username, string password)
+ {
+ return daUser.ValidateUser(username, password);
+ }
+
+ public bool ChangePassword(int userid, string oldpassword, string newpassword)
+ {
+ return daUser.ChangePassword(userid, oldpassword, newpassword);
+
+ }
+
+ public void UpdateUser(UserModel user)
+ {
+ daUser.UpdateUser(user);
+ }
+ }
+}
36 GSReport/BLReport/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("BLReport")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("BLReport")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("735c239a-34e4-499d-b61b-467c53781056")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
67 GSReport/DAReport/DAReport.csproj
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{DE6D324E-8F2C-4DA4-9F85-ECCFD9E7EF58}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>DAReport</RootNamespace>
+ <AssemblyName>DAReport</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </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.configuration" />
+ <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.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="DAReports.cs" />
+ <Compile Include="DAStation.cs" />
+ <Compile Include="DAUser.cs" />
+ <Compile Include="DAWorkLog.cs" />
+ <Compile Include="DBUtility\SqlDataReaderExtensions.cs" />
+ <Compile Include="DBUtility\SQLHelper.cs" />
+ <Compile Include="Encrypt.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\ReportModel\ReportModel.csproj">
+ <Project>{7FDDC80A-F428-4322-885C-6DBB435C0CE2}</Project>
+ <Name>ReportModel</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
943 GSReport/DAReport/DAReports.cs
@@ -0,0 +1,943 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using ReportModel;
+using System.Data.SqlClient;
+using System.Data;
+using DAReport.DBUtility;
+
+namespace DAReport
+{
+ public class DAReports
+ {
+ public void AddDailyAmountReport(DailyAmountReport model)
+ {
+ try
+ {
+ string strSQL = @"
+ if exists (select id from dailyamountreport
+ where stationid=@stationid
+ and reportdate=@reportdate and schedue=@schedue)
+ begin
+ update dailyamountreport set
+ amount=@amount,
+ easyaccessamount=@easyaccessamount,
+ cruser=@cruser,
+ crtime=getdate()
+ where stationid=@stationid
+ and reportdate=@reportdate and schedue=@schedue
+ end
+ else
+ begin
+ insert into dailyamountreport(schedue,reportdate,amount,easyaccessamount,cruser,stationid)
+ values(@schedue,@reportdate,@amount,@easyaccessamount,@cruser,@stationid)
+ end ";
+
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@schedue",SqlDbType.Int),
+ new SqlParameter("@reportdate",SqlDbType.DateTime),
+ new SqlParameter("@amount",SqlDbType.Decimal),
+ new SqlParameter("@easyaccessamount",SqlDbType.Decimal),
+ new SqlParameter("@cruser",SqlDbType.Int),
+ new SqlParameter("@stationid",SqlDbType.Int),
+ };
+
+ parms[0].Value = model.Schedue;
+ parms[1].Value = model.ReportDate;
+ parms[2].Value = model.Amount;
+ parms[3].Value = model.EasyAccessAmount;
+ parms[4].Value = model.CrUser;
+ parms[5].Value = model.StationID;
+ SqlHelper.ExecuteNonQuery(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms);
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+ }
+
+ public void AddDailyCardReport(DailyCardReport model)
+ {
+ try
+ {
+ string strSQL = @"
+ if exists (select id from dailycardreport
+ where stationid=@stationid
+ and reportdate=@reportdate and collectionclassid=@collectionclassid)
+ begin
+ update dailycardreport set
+ SentCards=@SentCards,
+ WrongCards=@WrongCards,
+ ReceivedCards=@ReceivedCards,
+ BrokenCards=@BrokenCards,
+ cruser=@cruser,
+ crtime=getdate()
+ where stationid=@stationid
+ and reportdate=@reportdate and collectionclassid=@collectionclassid
+ end
+ else
+ begin
+ insert into dailycardreport(ReportDate,StationID,CollectionClassID,sentcards,wrongcards,receivedcards,brokencards,cruser)
+ values(@ReportDate,@StationID,@CollectionClassID,@sentcards,@wrongcards,@receivedcards,@brokencards,@cruser)
+ end ";
+
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@CollectionClassID",SqlDbType.Int),
+ new SqlParameter("@reportdate",SqlDbType.DateTime),
+ new SqlParameter("@sentcards",SqlDbType.Int),
+ new SqlParameter("@wrongcards",SqlDbType.Int),
+ new SqlParameter("@receivedcards",SqlDbType.Int),
+ new SqlParameter("@brokencards",SqlDbType.Int),
+ new SqlParameter("@cruser",SqlDbType.Int),
+ new SqlParameter("@stationid",SqlDbType.Int),
+ };
+
+ parms[0].Value = model.CollectionClassID;
+ parms[1].Value = model.ReportDate;
+ parms[2].Value = model.SentCards;
+ parms[3].Value = model.WrongCards;
+ parms[4].Value = model.ReceivedCards;
+ parms[5].Value = model.BrokenCards;
+ parms[6].Value = model.CrUser;
+ parms[7].Value = model.StationID;
+ SqlHelper.ExecuteNonQuery(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms);
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+ }
+
+ public void AddTrafficReport(TrafficeFlowReport model)
+ {
+ try
+ {
+ string strSQL = @"
+ if exists (select id from TrafficFlowReport
+ where stationid=@stationid
+ and reportdate=@reportdate)
+ begin
+ update TrafficFlowReport set
+ DownAmount=@DownAmount,
+ TruckAmount=@TruckAmount,
+ MoreThan30=@MoreThan30,
+ MoreThan100=@MoreThan100,
+ EngineeringVehicles=@EngineeringVehicles,
+ EasyAccess=@EasyAccess,
+ CrUser=@CrUser,
+ crtime=getdate()
+ where stationid=@stationid
+ and reportdate=@reportdate
+ end
+ else
+ begin
+ insert into TrafficFlowReport(ReportDate,StationID,DownAmount,TruckAmount,MoreThan30,MoreThan100,EngineeringVehicles,EasyAccess,CrUser)
+ values(@ReportDate,@StationID,@DownAmount,@TruckAmount,@MoreThan30,@MoreThan100,@EngineeringVehicles,@EasyAccess,@CrUser)
+ end ";
+
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@reportdate",SqlDbType.DateTime),
+ new SqlParameter("@DownAmount",SqlDbType.Int),
+ new SqlParameter("@TruckAmount",SqlDbType.Int),
+ new SqlParameter("@MoreThan30",SqlDbType.Int),
+ new SqlParameter("@MoreThan100",SqlDbType.Int),
+ new SqlParameter("@EngineeringVehicles",SqlDbType.Int),
+ new SqlParameter("@EasyAccess",SqlDbType.Int),
+ new SqlParameter("@cruser",SqlDbType.Int),
+ new SqlParameter("@stationid",SqlDbType.Int),
+ };
+
+ parms[0].Value = model.ReportDate;
+ parms[1].Value = model.DownAmount;
+ parms[2].Value = model.TruckAmount;
+ parms[3].Value = model.MoreThan30;
+ parms[4].Value = model.MoreThan100;
+ parms[5].Value = model.EngineeringVehicles;
+ parms[6].Value = model.EasyAccess;
+ parms[7].Value = model.CrUser;
+ parms[8].Value = model.StationID;
+ SqlHelper.ExecuteNonQuery(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms);
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+ }
+
+ public void AddTruck5Report(Truck5ReportModel model)
+ {
+ try
+ {
+ string strSQL = @"
+ if exists (select id from Truck5Report
+ where stationid=@stationid
+ and Year=@year and Month=@Month)
+ begin
+ update Truck5Report set
+ DownAmount=@DownAmount,
+ TruckAmount=@TruckAmount,
+ MoreThan30=@MoreThan30,
+ MoreThan100=@MoreThan100,
+ MoreThan0=@MoreThan0,
+ CrUser=@CrUser,
+ crtime=getdate()
+ where stationid=@stationid
+ and Year=@year and Month=@Month
+ end
+ else
+ begin
+ insert into Truck5Report(year,Month,StationID,DownAmount,TruckAmount,MoreThan30,MoreThan100,MoreThan0,CrUser)
+ values(@year,@Month,@stationid,@DownAmount,@TruckAmount,@MoreThan30,@MoreThan100,@MoreThan0,@CrUser)
+ end ";
+
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@Year",SqlDbType.Int),
+ new SqlParameter("@Month",SqlDbType.Int),
+ new SqlParameter("@DownAmount",SqlDbType.Int),
+ new SqlParameter("@TruckAmount",SqlDbType.Int),
+ new SqlParameter("@MoreThan30",SqlDbType.Int),
+ new SqlParameter("@MoreThan100",SqlDbType.Int),
+ new SqlParameter("@MoreThan0",SqlDbType.Int),
+ new SqlParameter("@cruser",SqlDbType.Int),
+ new SqlParameter("@stationid",SqlDbType.Int),
+ };
+
+ parms[0].Value = model.Year;
+ parms[1].Value = model.Month;
+ parms[2].Value = model.DownAmount;
+ parms[3].Value = model.TruckAmount;
+ parms[4].Value = model.MoreThan30;
+ parms[5].Value = model.MoreThan100;
+ parms[6].Value = model.MoreThan0;
+ parms[7].Value = model.CrUser;
+ parms[8].Value = model.StationID;
+ SqlHelper.ExecuteNonQuery(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms);
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+ }
+
+ public void AddTruck6Report(Truck6ReportModel model)
+ {
+ try
+ {
+ string strSQL = @"
+ if exists (select id from Truck6Report
+ where stationid=@stationid
+ and Year=@year and Month=@Month)
+ begin
+ update Truck5Report set
+ DownAmount=@DownAmount,
+ TruckAmount=@TruckAmount,
+ MoreThan30=@MoreThan30,
+ MoreThan100=@MoreThan100,
+ MoreThan0=@MoreThan0,
+ CrUser=@CrUser,
+ crtime=getdate()
+ where stationid=@stationid
+ and Year=@year and Month=@Month
+ end
+ else
+ begin
+ insert into Truck6Report(year,Month,StationID,DownAmount,TruckAmount,MoreThan30,MoreThan100,MoreThan0,CrUser)
+ values(@year,@Month,@stationid,@DownAmount,@TruckAmount,@MoreThan30,@MoreThan100,@MoreThan0,@CrUser)
+ end ";
+
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@Year",SqlDbType.Int),
+ new SqlParameter("@Month",SqlDbType.Int),
+ new SqlParameter("@DownAmount",SqlDbType.Int),
+ new SqlParameter("@TruckAmount",SqlDbType.Int),
+ new SqlParameter("@MoreThan30",SqlDbType.Int),
+ new SqlParameter("@MoreThan100",SqlDbType.Int),
+ new SqlParameter("@MoreThan0",SqlDbType.Int),
+ new SqlParameter("@cruser",SqlDbType.Int),
+ new SqlParameter("@stationid",SqlDbType.Int),
+ };
+
+ parms[0].Value = model.Year;
+ parms[1].Value = model.Month;
+ parms[2].Value = model.DownAmount;
+ parms[3].Value = model.TruckAmount;
+ parms[4].Value = model.MoreThan30;
+ parms[5].Value = model.MoreThan100;
+ parms[6].Value = model.MoreThan0;
+ parms[7].Value = model.CrUser;
+ parms[8].Value = model.StationID;
+ SqlHelper.ExecuteNonQuery(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms);
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+ }
+
+ public void SpiltBill(SplitBillReport model)
+ {
+ try
+ {
+ string strSQL = @"
+ if exists (select id from SplitBillReport
+ where stationid=@stationid
+ and Year=@year and Month=@Month)
+ begin
+ update SplitBillReport set
+ Amount=@Amount,
+ CrUser=@CrUser,
+ crtime=getdate()
+ where stationid=@stationid
+ and Year=@year and Month=@Month
+ end
+ else
+ begin
+ insert into SplitBillReport(year,Month,StationID,Amount,CrUser)
+ values(@year,@Month,@StationID,@Amount,@CrUser)
+ end ";
+
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@Year",SqlDbType.Int),
+ new SqlParameter("@Month",SqlDbType.Int),
+ new SqlParameter("@Amount",SqlDbType.Int),
+ new SqlParameter("@cruser",SqlDbType.Int),
+ new SqlParameter("@stationid",SqlDbType.Int),
+ };
+
+ parms[0].Value = model.Year;
+ parms[1].Value = model.Month;
+ parms[2].Value = model.Amount;
+ parms[3].Value = model.CrUser;
+ parms[4].Value = model.StationID;
+ SqlHelper.ExecuteNonQuery(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms);
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+ }
+
+ public void AddShortOver(ShortOverReport model)
+ {
+ try
+ {
+ string strSQL = @"
+ if exists (select id from shortoverreport
+ where stationid=@stationid
+ and reportdate=@reportdate)
+ begin
+ update shortoverreport set
+ amount=@amount,
+ shortovertimes=@shortovertimes,
+ chargeTimes=@chargeTimes,
+ cruser=@cruser,
+ crtime=getdate()
+ where stationid=@stationid
+ and reportdate=@reportdate
+ end
+ else
+ begin
+ insert into shortoverreport(reportdate,amount,shortovertimes,chargeTimes,cruser,stationid)
+ values(@reportdate,@amount,@shortovertimes,@chargeTimes,@cruser,@stationid)
+ end ";
+
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@reportdate",SqlDbType.DateTime),
+ new SqlParameter("@amount",SqlDbType.Decimal),
+ new SqlParameter("@shortovertimes",SqlDbType.Decimal),
+ new SqlParameter("@chargeTimes",SqlDbType.Decimal),
+ new SqlParameter("@cruser",SqlDbType.Int),
+ new SqlParameter("@stationid",SqlDbType.Int),
+ };
+
+ parms[0].Value = model.ReportDate;
+ parms[1].Value = model.ShortOverAmount;
+ parms[2].Value = model.ShortOverTimes;
+ parms[3].Value = model.ChargeTimes;
+ parms[4].Value = model.CrUser;
+ parms[5].Value = model.StationID;
+ SqlHelper.ExecuteNonQuery(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms);
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+ }
+
+ #region 收费科报表
+
+ public IList<SplitBillReport> ListMonthSplitBillReports(int year, int month)
+ {
+ IList<SplitBillReport> reports = new List<SplitBillReport>();
+ try
+ {
+ string strSQL = @"
+ select *
+ from SplitBillReport
+ where month=@month and year=@year
+ ";
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@year",SqlDbType.Int),
+ new SqlParameter("@month",SqlDbType.Int),
+ };
+
+ parms[0].Value = year;
+ parms[1].Value = month;
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms))
+ {
+ while (rdr.Read())
+ {
+ reports.Add(new SplitBillReport()
+ {
+ Amount = Convert.ToDecimal(rdr["totalamount"]),
+ StationID = Convert.ToInt32(rdr["StationID"]),
+ });
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+
+ return reports;
+
+ }
+
+ public IList<DailyAmountReport> ListDayDailyReports()
+ {
+ IList<DailyAmountReport> reports = new List<DailyAmountReport>();
+ try
+ {
+ string strSQL = @"
+ select top 10 stationid,station.stationname,sum(amount) as totalamount,sum(easyaccessamount) totaleasyaccessamount,reportdate from dailyamountreport
+ inner join station on station.id=dailyamountreport.stationid
+ group by stationid,reportdate,stationname
+ order by reportdate
+ ";
+
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, null))
+ {
+ while (rdr.Read())
+ {
+ reports.Add(new DailyAmountReport()
+ {
+ Amount = Convert.ToDecimal(rdr["totalamount"]),
+ StationName = Convert.ToString(rdr["StationName"]),
+ StationID = Convert.ToInt32(rdr["StationID"]),
+ ReportDate = Convert.ToDateTime(rdr["reportdate"]).ToString("yyyy-MM-dd"),
+ EasyAccessAmount = Convert.ToDecimal(rdr["totaleasyaccessamount"]),
+ });
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+
+ return reports;
+ }
+
+ public IList<DailyAmountReport> ListMonthDailyAmountReport(int year, int month)
+ {
+ IList<DailyAmountReport> reports = new List<DailyAmountReport>();
+ try
+ {
+ string strSQL = @"
+ select stationid,station.stationname,sum(amount) as totalamount,sum(easyaccessamount) totaleasyaccessamount
+ from DailyAmountReport
+ inner join station on station.id=dailyamountreport.stationid
+ where datepart(m,reportdate)=@month and datepart(yyyy,reportdate)=@year
+ group by stationid,stationname
+ ";
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@year",SqlDbType.Int),
+ new SqlParameter("@month",SqlDbType.Int),
+ };
+
+ parms[0].Value = year;
+ parms[1].Value = month;
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms))
+ {
+ while (rdr.Read())
+ {
+ reports.Add(new DailyAmountReport()
+ {
+ Amount = Convert.ToDecimal(rdr["totalamount"]),
+ StationName = Convert.ToString(rdr["StationName"]),
+ StationID = Convert.ToInt32(rdr["StationID"]),
+ ReportDate = Convert.ToDateTime(rdr["reportdate"]).ToString("yyyy-MM-dd"),
+ EasyAccessAmount = Convert.ToDecimal(rdr["totaleasyaccessamount"]),
+ });
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+
+ return reports;
+
+ }
+
+ public IList<MonthCardReport> ListMonthCardReports(int year, int month)
+ {
+ IList<MonthCardReport> reports = new List<MonthCardReport>();
+ try
+ {
+ string strSQL = @"
+ select stationid,sum(SentCards) as totalsentcards,sum(wrongcards)as totalwrongcards,
+ sum(receivedcards) as totalreceivedcards,sum(brokencards) as totalbrokencards
+ from dailycardreport
+ inner join station on station.id=dailycardreport.stationid
+ where datepart(m,reportdate)=@month and datepart(yyyy,reportdate)=@year
+ group by stationid
+ ";
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@year",SqlDbType.Int),
+ new SqlParameter("@month",SqlDbType.Int),
+ };
+
+ parms[0].Value = year;
+ parms[1].Value = month;
+
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms))
+ {
+ while (rdr.Read())
+ {
+ reports.Add(new MonthCardReport()
+ {
+ StationID = Convert.ToInt32(rdr["StationID"]),
+ BrokenCards = Convert.ToInt32(rdr["totalbrokencards"]),
+ ReceivedCards = Convert.ToInt32(rdr["totalreceivedcards"]),
+ WrongCards = Convert.ToInt32(rdr["totalwrongcards"]),
+ SentCards = Convert.ToInt32(rdr["totalsentcards"])
+ });
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+
+ return reports;
+ }
+
+ public IList<MonthEasyAccessReport> ListMonthEasyAccessReports(int year, int month)
+ {
+ IList<MonthEasyAccessReport> reports = new List<MonthEasyAccessReport>();
+ try
+ {
+ string strSQL = @"
+ select stationid,stationname,sum(downamount) as totaldownamount,sum(easyaccess)as totaleasyaccess
+ from trafficflowreport
+ inner join station on station.id=trafficflowreport.stationid
+ where datepart(m,reportdate)=@month and datepart(yyyy,reportdate)=@year
+ group by stationid,stationname
+ ";
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@year",SqlDbType.Int),
+ new SqlParameter("@month",SqlDbType.Int),
+ };
+
+ parms[0].Value = year;
+ parms[1].Value = month;
+
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms))
+ {
+ while (rdr.Read())
+ {
+ reports.Add(new MonthEasyAccessReport()
+ {
+ StationID = Convert.ToInt32(rdr["StationID"]),
+ StationName = Convert.ToString(rdr["StationName"]),
+ DownAmount = Convert.ToInt32(rdr["totaldownamount"]),
+ EasyAccess = Convert.ToInt32(rdr["totaleasyaccess"]),
+ });
+ }
+ }
+
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+
+ return reports;
+
+ }
+
+ public IList<TrafficeFlowReport> ListDailyTrafficReports()
+ {
+ IList<TrafficeFlowReport> reports = new List<TrafficeFlowReport>();
+ try
+ {
+ string strSQL = @"
+ select top 10 TrafficFlowReport.*,station.stationname
+ from TrafficFlowReport
+ inner join station on station.id=TrafficFlowReport.stationid
+ order by reportdate
+ ";
+
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, null))
+ {
+ while (rdr.Read())
+ {
+ reports.Add(new TrafficeFlowReport()
+ {
+ ReportDate = Convert.ToDateTime(rdr["ReportDate"]).ToString("yyyy-MM-dd"),
+ DownAmount = Convert.ToInt32(rdr["DownAmount"]),
+ EasyAccess = Convert.ToInt32(rdr["EasyAccess"]),
+ EngineeringVehicles = Convert.ToInt32(rdr["EngineeringVehicles"]),
+ MoreThan100 = Convert.ToInt32(rdr["MoreThan100"]),
+ MoreThan30 = Convert.ToInt32(rdr["MoreThan30"]),
+ TruckAmount = Convert.ToInt32(rdr["TruckAmount"]),
+ StationName = Convert.ToString(rdr["StationName"])
+ });
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+
+ return reports;
+ }
+
+ public IList<Truck5ReportModel> ListMonthTruck5Reports(int year, int month)
+ {
+ IList<Truck5ReportModel> reports = new List<Truck5ReportModel>();
+ try
+ {
+ string strSQL = @"
+ select Truck5Report.*,stationname
+ from Truck5Report
+ inner join station on station.id=Truck5Report.stationid
+ where month=@month and year=@year
+ ";
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@year",SqlDbType.Int),
+ new SqlParameter("@month",SqlDbType.Int),
+ };
+
+ parms[0].Value = year;
+ parms[1].Value = month;
+
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms))
+ {
+ while (rdr.Read())
+ {
+ reports.Add(new Truck5ReportModel()
+ {
+ StationID = Convert.ToInt32(rdr["StationID"]),
+ StationName = Convert.ToString(rdr["StationName"]),
+ DownAmount = Convert.ToInt32(rdr["totaldownamount"]),
+ MoreThan0 = Convert.ToInt32(rdr["MoreThan0"]),
+ MoreThan30 = Convert.ToInt32(rdr["MoreThan30"]),
+ MoreThan100 = Convert.ToInt32(rdr["MoreThan100"]),
+ TruckAmount = Convert.ToInt32(rdr["TruckAmount"]),
+ });
+ }
+ }
+
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+
+ return reports;
+ }
+
+ public IList<Truck6ReportModel> ListMonthTruck6Reports(int year, int month)
+ {
+ IList<Truck6ReportModel> reports = new List<Truck6ReportModel>();
+ try
+ {
+ string strSQL = @"
+ select Truck6Report.*,stationname
+ from Truck6Report
+ inner join station on station.id=Truck6Report.stationid
+ where month=@month and year=@year
+ ";
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@year",SqlDbType.Int),
+ new SqlParameter("@month",SqlDbType.Int),
+ };
+
+ parms[0].Value = year;
+ parms[1].Value = month;
+
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms))
+ {
+ while (rdr.Read())
+ {
+ reports.Add(new Truck6ReportModel()
+ {
+ StationID = Convert.ToInt32(rdr["StationID"]),
+ StationName = Convert.ToString(rdr["StationName"]),
+ DownAmount = Convert.ToInt32(rdr["totaldownamount"]),
+ MoreThan0 = Convert.ToInt32(rdr["MoreThan0"]),
+ MoreThan30 = Convert.ToInt32(rdr["MoreThan30"]),
+ MoreThan100 = Convert.ToInt32(rdr["MoreThan100"]),
+ TruckAmount = Convert.ToInt32(rdr["TruckAmount"]),
+ });
+ }
+ }
+
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+
+ return reports;
+ }
+
+ #endregion
+
+ #region 收费站报表
+
+ public IList<DailyAmountReport> ListStationDailyAmountReport(int stationid, DateTime date)
+ {
+ IList<DailyAmountReport> reports = new List<DailyAmountReport>();
+ try
+ {
+ string strSQL = @"
+ select * from dailyamountreport
+ where datepart(m,reportdate)=@month and datepart(yyyy,reportdate)=@year and datepart(dd,reportdate)=@day
+ and stationid=@stationid
+ ";
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@year",SqlDbType.Int),
+ new SqlParameter("@month",SqlDbType.Int),
+ new SqlParameter("@day",SqlDbType.Int),
+ new SqlParameter("@stationid",SqlDbType.Int),
+ };
+
+ parms[0].Value = date.Year;
+ parms[1].Value = date.Month;
+ parms[2].Value = date.Day;
+ parms[3].Value = stationid;
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms))
+ {
+ while (rdr.Read())
+ {
+ reports.Add(new DailyAmountReport()
+ {
+ Amount = Convert.ToDecimal(rdr["Amount"]),
+ Schedue = Convert.ToInt32(rdr["Schedue"])
+ });
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+
+ return reports;
+ }
+
+ public StationMonthAmountReport GetDailyAmountMonthReport(int stationid, DateTime date)
+ {
+ StationMonthAmountReport report = new StationMonthAmountReport();
+ try
+ {
+ string strSQL = @" select
+ ( select sum(amount) from dailyamountreport
+ where datepart(m,reportdate)=@month and datepart(yyyy,reportdate)=@year
+ and stationid=@stationid ) as currentamount,
+ ( select sum(amount) from dailyamountreport
+ where stationid=@stationid ) as total
+ ";
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@year",SqlDbType.Int),
+ new SqlParameter("@month",SqlDbType.Int),
+ new SqlParameter("@stationid",SqlDbType.Int),
+ };
+
+ parms[0].Value = date.Year;
+ parms[1].Value = date.Month;
+ parms[2].Value = stationid;
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms))
+ {
+ if (rdr.Read())
+ {
+ report.CurrentAmount = Convert.ToDecimal(rdr["currentamount"]);
+ report.TotalAmount = Convert.ToDecimal(rdr["total"]);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+
+ return report;
+ }
+
+ public IList<DailyCardReport> ListStationDailyCardReports(int stationid, DateTime date)
+ {
+ IList<DailyCardReport> reports = new List<DailyCardReport>();
+ try
+ {
+ string strSQL = @"
+ select dailycardreport.*,collectionclass.classname
+ from dailycardreport
+ inner join collectionclass on collectionclass.id=dailycardreport.collectionclassid
+ where datepart(m,reportdate)=@month and datepart(yyyy,reportdate)=@year and datepart(dd,reportdate)=@day
+ and dailycardreport.stationid=@stationid
+ ";
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@year",SqlDbType.Int),
+ new SqlParameter("@month",SqlDbType.Int),
+ new SqlParameter("@day",SqlDbType.Int),
+ new SqlParameter("@stationid",SqlDbType.Int),
+ };
+
+ parms[0].Value = date.Year;
+ parms[1].Value = date.Month;
+ parms[2].Value = date.Day;
+ parms[3].Value = stationid;
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms))
+ {
+ while (rdr.Read())
+ {
+ reports.Add(new DailyCardReport()
+ {
+ CollectionClassName = Convert.ToString(rdr["classname"]),
+ BrokenCards = Convert.ToInt32(rdr["BrokenCards"]),
+ ReceivedCards = Convert.ToInt32(rdr["ReceivedCards"]),
+ WrongCards = Convert.ToInt32(rdr["WrongCards"]),
+ SentCards = Convert.ToInt32(rdr["SentCards"])
+ });
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+
+ return reports;
+ }
+
+ public MonthCardReport GetDailyCardMonthReport(int stationid, DateTime date)
+ {
+ MonthCardReport report = new MonthCardReport();
+ try
+ {
+ string strSQL = @"
+ select sum(SentCards) as totalsentcards,sum(wrongcards)as totalwrongcards,
+ sum(receivedcards) as totalreceivedcards,sum(brokencards) as totalbrokencards
+ from dailycardreport
+ where datepart(m,reportdate)=@month and datepart(yyyy,reportdate)=@year
+ and stationid=@stationid
+ ";
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@year",SqlDbType.Int),
+ new SqlParameter("@month",SqlDbType.Int),
+ new SqlParameter("@stationid",SqlDbType.Int),
+ };
+
+ parms[0].Value = date.Year;
+ parms[1].Value = date.Month;
+ parms[2].Value = stationid;
+
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms))
+ {
+ if (rdr.Read())
+ {
+
+ report.BrokenCards = Convert.ToInt32(rdr["totalbrokencards"]);
+ report.ReceivedCards = Convert.ToInt32(rdr["totalreceivedcards"]);
+ report.WrongCards = Convert.ToInt32(rdr["totalwrongcards"]);
+ report.SentCards = Convert.ToInt32(rdr["totalsentcards"]);
+
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+
+ return report;
+
+ }
+
+ public IList<TrafficeFlowReport> ListStationDailyTrafficReports(int stationid)
+ {
+ IList<TrafficeFlowReport> reports = new List<TrafficeFlowReport>();
+ try
+ {
+ string strSQL = @"
+ select top 10 TrafficFlowReport.*
+ from TrafficFlowReport
+ where stationid=@stationid
+ order by reportdate
+ ";
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@stationid",SqlDbType.Int),
+ };
+
+ parms[0].Value = stationid;
+
+
+
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms))
+ {
+ while (rdr.Read())
+ {
+ reports.Add(new TrafficeFlowReport()
+ {
+ ReportDate = Convert.ToDateTime(rdr["ReportDate"]).ToString("yyyy-MM-dd"),
+ DownAmount = Convert.ToInt32(rdr["DownAmount"]),
+ EasyAccess = Convert.ToInt32(rdr["EasyAccess"]),
+ EngineeringVehicles = Convert.ToInt32(rdr["EngineeringVehicles"]),
+ MoreThan100 = Convert.ToInt32(rdr["MoreThan100"]),
+ MoreThan30 = Convert.ToInt32(rdr["MoreThan30"]),
+ TruckAmount = Convert.ToInt32(rdr["TruckAmount"]),
+ });
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+
+ return reports;
+ }
+
+ #endregion
+ }
+}
292 GSReport/DAReport/DAStation.cs
@@ -0,0 +1,292 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using ReportModel;
+using DAReport.DBUtility;
+using System.Data;
+using System.Data.SqlClient;
+
+namespace DAReport
+{
+ public class DAStation
+ {
+
+ #region Station
+
+ public IList<StationModel> GetStations()
+ {
+ IList<StationModel> stations = new List<StationModel>();
+
+ try
+ {
+ string strSQL = @" select * from station where isdeleted=0 ";
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL))
+ {
+ while (rdr.Read())
+ {
+ stations.Add(new StationModel()
+ {
+ StationID = Convert.ToInt32(rdr["id"]),
+ StationName = Convert.ToString(rdr["stationname"])
+ });
+ }
+ }
+ }
+ catch
+ {
+ throw;
+ }
+ return stations;
+ }
+
+ public StationModel GetStation(int stationid)
+ {
+ StationModel station = null;
+
+ try
+ {
+ string strSQL = @" select * from station where id=@stationid ";
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@stationid",SqlDbType.Int),
+ };
+
+ parms[0].Value = stationid;
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms))
+ {
+ if (rdr.Read())
+ {
+ station = new StationModel()
+ {
+ StationID = Convert.ToInt32(rdr["id"]),
+ StationName = Convert.ToString(rdr["stationname"])
+ };
+ }
+ }
+ }
+ catch
+ {
+ throw;
+ }
+ return station;
+ }
+
+ public void DeleteStation(int stationid)
+ {
+ try
+ {
+ string strSQL = @" update station set isdeleted=1 where id=@stationid ";
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@stationid",SqlDbType.Int),
+ };
+
+ parms[0].Value = stationid;
+
+ SqlHelper.ExecuteNonQuery(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms);
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+
+ }
+
+ public int AddStation(string stationame)
+ {
+ int id = 0;
+
+ try
+ {
+ string strSQL = @" insert into station(stationname)
+ values(@stationname)
+ SELECT SCOPE_IDENTITY() ";
+
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@stationname",SqlDbType.NVarChar,50),
+ };
+
+ parms[0].Value = stationame;
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms))
+ {
+ if (rdr.Read())
+ {
+ id = Convert.ToInt32(rdr[0]);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+ return id;
+
+ }
+
+ public void UpdateStation(int stationid, string stationname)
+ {
+ try
+ {
+ string strSQL = @" update station set
+ stationname=@stationname
+ where id=@stationid ";
+
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@stationname",SqlDbType.NVarChar,50),
+ new SqlParameter("@stationid",SqlDbType.Int)
+ };
+
+ parms[0].Value = stationname;
+ parms[1].Value = stationid;
+
+ SqlHelper.ExecuteNonQuery(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms);
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+
+ }
+
+ #endregion
+
+ #region class
+
+ public IList<CollectionClassModel> GetCollectionClasses(int stationid)
+ {
+ IList<CollectionClassModel> stations = new List<CollectionClassModel>();
+ StringBuilder strSQL = new StringBuilder();
+ try
+ {
+ strSQL.Append(@" select collectionclass.*,stationname from collectionclass
+ inner join station on station.id=collectionclass.stationid
+ where collectionclass.isdeleted=0 ");
+
+ if (stationid > 0)
+ {
+ strSQL.AppendFormat(" and stationid={0}", stationid);
+ }
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL.ToString()))
+ {
+ while (rdr.Read())
+ {
+ stations.Add(new CollectionClassModel()
+ {
+ StationID = Convert.ToInt32(rdr["stationid"]),
+ StationName = Convert.ToString(rdr["stationname"]),
+ ClassID = Convert.ToInt32(rdr["ID"]),
+ ClassName = Convert.ToString(rdr["ClassName"])
+ });
+ }
+ }
+ }
+ catch
+ {
+ throw;
+ }
+ return stations;
+ }
+
+ public CollectionClassModel GetCollectionClass(int classid)
+ {
+ CollectionClassModel station = null;
+ StringBuilder strSQL = new StringBuilder();
+ try
+ {
+ strSQL.Append(@" select collectionclass.*,stationname from collectionclass
+ inner join station on station.id=collectionclass.stationid
+ where collectionclass.id=@classid");
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@classid",SqlDbType.Int),
+ };
+
+ parms[0].Value = classid;
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL.ToString(), parms))
+ {
+ if (rdr.Read())
+ {
+ station = new CollectionClassModel()
+ {
+ StationID = Convert.ToInt32(rdr["stationid"]),
+ StationName = Convert.ToString(rdr["stationname"]),
+ ClassID = Convert.ToInt32(rdr["ID"]),
+ ClassName = Convert.ToString(rdr["ClassName"])
+ };
+ }
+ }
+ }
+ catch
+ {
+ throw;
+ }
+ return station;
+ }
+
+ public void DeleteCollectionClass(int classid)
+ {
+ try
+ {
+ string strSQL = @" update collectionclass set isdeleted=1 where id=@classid ";
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@classid",SqlDbType.Int),
+ };
+
+ parms[0].Value = classid;
+
+ SqlHelper.ExecuteNonQuery(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms);
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+
+ }
+
+ public int AddCollectionClass(int stationid,string classname)
+ {
+ int id = 0;
+
+ try
+ {
+ string strSQL = @" insert into collectionclass(stationid,classname)
+ values(@stationid,@classname)
+ SELECT SCOPE_IDENTITY() ";
+
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@stationid",SqlDbType.Int),
+ new SqlParameter("@classname",SqlDbType.NVarChar,50),
+ };
+
+ parms[0].Value = stationid;
+ parms[1].Value = classname;
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms))
+ {
+ if (rdr.Read())
+ {
+ id = Convert.ToInt32(rdr[0]);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+ return id;
+
+ }
+
+
+ #endregion
+ }
+}
274 GSReport/DAReport/DAUser.cs
@@ -0,0 +1,274 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Security.Cryptography;
+using System.Data;
+using ReportModel.Common;
+using ReportModel;
+using System.Data.SqlClient;
+using DAReport.DBUtility;
+namespace DAReport
+{
+ public class DAUser
+ {
+
+ public int CreateUser(NewUserModel model)
+ {
+ int userid = 0;
+
+ try
+ {
+ string strSQL = @" insert into useraccount(username,password,stationid)
+ values(@username,@password,@stationid)
+ SELECT SCOPE_IDENTITY() ";
+
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@username",SqlDbType.NVarChar,50),
+ new SqlParameter("@password",SqlDbType.NVarChar,1024),
+ new SqlParameter("@stationid",SqlDbType.Int),
+ };
+
+ parms[0].Value = model.UserName;
+ parms[1].Value = model.Password;
+ parms[2].Value = model.StationID;
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms))
+ {
+ if (rdr.Read())
+ {
+ userid = Convert.ToInt32(rdr[0]);
+ }
+ }
+ }
+ catch(Exception ex)
+ {
+ throw;
+ }
+ return userid;
+ }
+
+ public UserModel GetUser(int userid)
+ {
+
+ UserModel user = null;
+
+ try
+ {
+ string strSQL = @" select useraccount.*,station.stationname
+ from useraccount
+ left join station on station.id=useraccount.stationid
+ where useraccount.id=@userid";
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@userid",SqlDbType.Int),
+ };
+
+ parms[0].Value = userid;
+
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms))
+ {
+ if (rdr.Read())
+ {
+ user=new UserModel()
+ {
+ StationID = Convert.ToInt32(rdr["StationID"]),
+ StationName = rdr.IsDBNull("StationName") ? "收费科" : Convert.ToString(rdr["StationName"]),
+ UserID = Convert.ToInt32(rdr["ID"]),
+ UserName = Convert.ToString(rdr["UserName"]),
+ Role=Convert.ToInt32(rdr["Role"]),
+ Password=Convert.ToString(rdr["password"])
+ };
+ }
+ }
+ }
+ catch
+ {
+ throw;
+ }
+ return user;
+
+ }
+
+
+ public IList<UserModel> GetUsers()
+ {
+
+ IList<UserModel> users = new List<UserModel>();
+
+ try
+ {
+ string strSQL = @" select useraccount.*,station.stationname
+ from useraccount
+ left join station on station.id=useraccount.stationid
+ where useraccount.IsDeleted=0 and username<>'sa' ";
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL))
+ {
+ while (rdr.Read())
+ {
+ users.Add(new UserModel()
+ {
+ StationID = Convert.ToInt32(rdr["StationID"]),
+ StationName = rdr.IsDBNull("StationName") ? "收费科" : Convert.ToString(rdr["StationName"]),
+ UserID = Convert.ToInt32(rdr["ID"]),
+ UserName = Convert.ToString(rdr["UserName"]),
+ Role=Convert.ToInt32(rdr["Role"]),
+ Password=Convert.ToString(rdr["password"])
+ });
+ }
+ }
+ }
+ catch
+ {
+ throw;
+ }
+ return users;
+
+ }
+
+ public void DeleteUser(int userid)
+ {
+ try
+ {
+ string strSQL = @" update useraccount set isdeleted=1 where id=@userid ";
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@userid",SqlDbType.Int),
+ };
+
+ parms[0].Value = userid;
+
+ SqlHelper.ExecuteNonQuery(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms);
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+ }
+
+ public void ResetPassword(int userid,string password)
+ {
+ try
+ {
+ string strSQL = @" update useraccount set password=@password where id=@userid ";
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@userid",SqlDbType.Int),
+ new SqlParameter("@password",SqlDbType.NVarChar,1024),
+ };
+
+ parms[0].Value = userid;
+ parms[1].Value = password;
+ SqlHelper.ExecuteNonQuery(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms);
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+ }
+
+ public int ValidateUser(string username, string password)
+ {
+ int userid = 0;
+ try
+ {
+ string strSQL = @" select id from useraccount where username=@username and password=@password and Isdeleted=0 ";
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@username",SqlDbType.NVarChar,50),
+ new SqlParameter("@password",SqlDbType.NVarChar,1024),
+ };
+
+ parms[0].Value = username;
+ parms[1].Value = password;
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms))
+ {
+ if (rdr.Read())
+ {
+ userid = Convert.ToInt32(rdr[0]);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+
+ return userid;
+ }
+
+ public bool ChangePassword(int userid, string password,string newpassword)
+ {
+ bool result = false;
+ try
+ {
+ string strSQL = @" if exists(Select id from useraccount where id=@userid and password=@password )
+ begin
+ update useraccount set password=@newpassword where id=@userid
+ select 1
+ return
+ end
+ select 0 ";
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@userid",SqlDbType.Int),
+ new SqlParameter("@password",SqlDbType.NVarChar,1024),
+ new SqlParameter("@newpassword",SqlDbType.NVarChar,1024),
+ };
+
+ parms[0].Value = userid;
+ parms[1].Value = password;
+ parms[2].Value = newpassword;
+
+ using (var rdr = SqlHelper.ExecuteReader(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms))
+ {
+ if (rdr.Read())
+ {
+ result = Convert.ToBoolean(Convert.ToInt32(rdr[0]));
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+
+ return result;
+
+ }
+
+ public void UpdateUser(UserModel user)
+ {
+ try
+ {
+ string strSQL = @" update useraccount set
+ password=@password,
+ username=@username,
+ stationid=@stationid
+ where id=@userid ";
+
+ SqlParameter[] parms = new SqlParameter[]{
+ new SqlParameter("@userid",SqlDbType.Int),
+ new SqlParameter("@password",SqlDbType.NVarChar,1024),
+ new SqlParameter("@username",SqlDbType.NVarChar,1024),
+ new SqlParameter("@stationid",SqlDbType.Int)
+ };
+
+ parms[0].Value = user.UserID;
+ parms[1].Value = user.Password;
+ parms[2].Value = user.UserName;
+ parms[3].Value = user.StationID;
+
+ SqlHelper.ExecuteNonQuery(SqlHelper.SQLConnectString, CommandType.Text, strSQL, parms);
+ }
+ catch (Exception ex)
+ {
+ throw;
+ }
+ }
+
+ }
+}
38 GSReport/DAReport/DAWorkLog.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Data.SqlClient;
+using System.Data;
+using ReportModel;
+namespace DAReport
+{
+ public class DAWorkLog
+ {
+ public static void AddWorkLog(WorkLog workLog)
+ {
+// string strSQL = @" Insert into workLog(Action,CrUser,CrTime,RelatedData,Loginfo,OriginalData,ModifiedData)
+// values(@Action,@CrUser,@CrTime,@RelatedData,@Loginfo,@OriginalData,@ModifiedData)";
+// SqlParameter[] parms = new SqlParameter[]
+// {
+// new SqlParameter("@Action",SqlDbType.NVarChar ,45),
+// new SqlParameter("@CrUser",SqlDbType.NVarChar ,45),
+// new SqlParameter("@CrTime",SqlDbType.DateTime),
+// new SqlParameter("@RelatedData",SqlDbType.VarChar ,45),
+// new SqlParameter("@Loginfo",SqlDbType.Text),
+// new SqlParameter("@OriginalData",SqlDbType.Text),
+// new SqlParameter("@ModifiedData",SqlDbType.Text),
+// };
+// parms[0].Value = workLog.Action;
+// parms[1].Value = workLog.EntityInfo.CrUser;
+// parms[2].Value = workLog.EntityInfo.CrTime;
+// parms[3].Value = workLog.RelatedData;
+// parms[4].Value = workLog.LogInfo;
+// parms[5].Value = workLog.OriginalData;
+// parms[6].Value = workLog.ModifiedData;
+
+// MySqlHelper.ExecuteNonQuery(MySqlDBHelper.ConnectionString, strSQL, parms);
+ }
+
+ }
+}
1,476 GSReport/DAReport/DBUtility/SQLHelper.cs
@@ -0,0 +1,1476 @@
+//===============================================================================
+// Microsoft Data Access Application Block for .NET
+// http://msdn.microsoft.com/library/en-us/dnbda/html/daab-rm.asp
+//
+// SQLHelper.cs
+//
+// This file contains the implementations of the SqlHelper and SqlHelperParameterCache
+// classes.
+//
+// For more information see the Data Access Application Block Implementation Overview.
+//
+//===============================================================================
+// Copyright (C) 2000-2001 Microsoft Corporation
+// All rights reserved.
+// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
+// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR
+// FITNESS FOR A PARTICULAR PURPOSE.
+//==============================================================================
+
+using System;
+using System.Data;
+using System.Xml;
+using System.Data.SqlClient;
+using System.Collections;
+using System.Configuration;
+
+namespace DAReport.DBUtility
+{
+ /// <summary>
+ /// The SqlHelper class is intended to encapsulate high performance, scalable best practices for
+ /// common uses of SqlClient.
+ /// </summary>
+ public sealed class SqlHelper
+ {
+ public static string SQLConnectString = ConfigurationManager.ConnectionStrings["ReportConnectionString"].ConnectionString;
+ #region private utility methods & constructors
+
+ //Since this class provides only static methods, make the default constructor private to prevent
+ //instances from being created with "new SqlHelper()".
+ private SqlHelper() {}
+
+
+
+ /// <summary>
+ /// This method is used to attach array of SqlParameters to a SqlCommand.
+ ///
+ /// This method will assign a value of DbNull to any parameter with a direction of
+ /// InputOutput and a value of null.
+ ///
+ /// This behavior will prevent default values from being used, but
+ /// this will be the less common case than an intended pure output parameter (derived as InputOutput)
+ /// where the user provided no input value.
+ /// </summary>
+ /// <param name="command">The command to which the parameters will be added</param>
+ /// <param name="commandParameters">an array of SqlParameters tho be added to command</param>
+ private static void AttachParameters(SqlCommand command, SqlParameter[] commandParameters)
+ {
+ foreach (SqlParameter p in commandParameters)
+ {
+ //check for derived output value with no value assigned
+ if ((p.Direction == ParameterDirection.InputOutput) && (p.Value == null))
+ {
+ p.Value = DBNull.Value;
+ }
+
+ command.Parameters.Add(p);
+ }
+ }
+
+ /// <summary>
+ /// This method assigns an array of values to an array of SqlParameters.
+ /// </summary>
+ /// <param name="commandParameters">array of SqlParameters to be assigned values</param>
+ /// <param name="parameterValues">array of objects holding the values to be assigned</param>
+ private static void AssignParameterValues(SqlParameter[] commandParameters, object[] parameterValues)
+ {
+ if ((commandParameters == null) || (parameterValues == null))
+ {
+ //do nothing if we get no data
+ return;
+ }
+
+ // we must have the same number of values as we pave parameters to put them in
+ if (commandParameters.Length != parameterValues.Length)
+ {
+ throw new ArgumentException("Parameter count does not match Parameter Value count.");
+ }
+
+ //iterate through the SqlParameters, assigning the values from the corresponding position in the
+ //value array
+ for (int i = 0, j = commandParameters.Length; i < j; i++)
+ {
+ commandParameters[i].Value = parameterValues[i];
+ }
+ }
+
+ /// <summary>
+ /// This method opens (if necessary) and assigns a connection, transaction, command type and parameters
+ /// to the provided command.
+ /// </summary>
+ /// <param name="command">the SqlCommand to be prepared</param>
+ /// <param name="connection">a valid SqlConnection, on which to execute this command</param>
+ /// <param name="transaction">a valid SqlTransaction, or 'null'</param>
+ /// <param name="commandType">the CommandType (stored procedure, text, etc.)</param>
+ /// <param name="commandText">the stored procedure name or T-SQL command</param>
+ /// <param name="commandParameters">an array of SqlParameters to be associated with the command or 'null' if no parameters are required</param>
+ private static void PrepareCommand(SqlCommand command, SqlConnection connection, SqlTransaction transaction, CommandType commandType, string commandText, SqlParameter[] commandParameters)
+ {
+ //if the provided connection is not open, we will open it
+ if (connection.State != ConnectionState.Open)
+ {
+ connection.Open();
+ }
+
+ //associate the connection with the command
+ command.Connection = connection;
+
+ //set the command text (stored procedure name or SQL statement)
+ command.CommandText = commandText;
+
+ //if we were provided a transaction, assign it.
+ if (transaction != null)
+ {
+ command.Transaction = transaction;
+ }
+
+ //set the command type
+ command.CommandType = commandType;
+
+ //attach the command parameters if they are provided
+ if (commandParameters != null)
+ {
+ AttachParameters(command, commandParameters);
+ }
+
+ return;
+ }
+
+
+ #endregion private utility methods & constructors
+
+ #region ExecuteNonQuery
+
+ /// <summary>
+ /// Execute a SqlCommand (that returns no resultset and takes no parameters) against the database specified in
+ /// the connection string.
+ /// </summary>
+ /// <remarks>
+ /// e.g.:
+ /// int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders");
+ /// </remarks>
+ /// <param name="connectionString">a valid connection string for a SqlConnection</param>
+ /// <