Skip to content

Commit

Permalink
AddAboutLibrary
Browse files Browse the repository at this point in the history
添加“帮助/关于“
  • Loading branch information
jquery2005 committed Jan 2, 2014
0 parents commit cc2506e
Show file tree
Hide file tree
Showing 9 changed files with 901 additions and 0 deletions.
153 changes: 153 additions & 0 deletions About/About.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using Microsoft.Win32;

namespace About
{
public partial class About : Form
{
public About()
{
InitializeComponent();
}

private void btnOk_Click(object sender, EventArgs e)
{
this.Close();
}

private void About_Load(object sender, EventArgs e)
{
System.Collections.IDictionary ii;
ii = Environment.GetEnvironmentVariables();
string[] ss;
ss = Environment.GetLogicalDrives();

label4.Text = ReadRememberUser();
label5.Text = ReadRememberField();

GMIS.CommonRightBusinessRule.CCommonInfo gCCommonInfo = new GMIS.CommonRightBusinessRule.CCommonInfo();
string ss1, struser = ".", strserver = "gmisinfo";
try
{
ss1 = gCCommonInfo.gsGetConfigPropertyValue("发布日期", "日期");
}
catch
{
ss1 = "";
}
label8.Text = ss1;

try
{
if (System.IO.File.Exists(Application.StartupPath + @"\gmisinfo.txt"))
{
System.IO.StreamReader sr = System.IO.File.OpenText(Application.StartupPath + @"\gmisinfo.txt");
string str = sr.ReadLine();
if (str == null) str = "";
if (str.Trim() != "" && str.Split(',').Length == 3)
{
struser = str.Split(',')[0];
strserver = str.Split(',')[1];
}
else
{
struser = ".";
strserver = "gmisinfo";
}
sr.Close();
}
else //不存在文件
{
struser = ".";
strserver = "gmisinfo";
}
}
catch
{
struser = ".";
strserver = "gmisinfo";
}
try
{
DataTable dt = new DataTable();
string dbConnectStr = "server=" + struser + ";uid=gmis2002"
+ ";pwd=gs2002;database=" + strserver + ";Connection Lifetime = 180";
SqlConnection conn = new SqlConnection(dbConnectStr);
SqlDataAdapter dsCommand = new SqlDataAdapter("select convert(varchar(10),verDate,21) from gs_ver ", conn);
dsCommand.Fill(dt);
ss1 = dt.Rows[0][0].ToString();
}
catch
{
ss1 = "";
}

label10.Text = ss1;

this.TopMost = true;
}

/// <summary>
/// 从注册表中读字符记忆型数据
/// </summary>
private string ReadRememberField()
{
object strRemember;
try
{
RegistryKey LMRK = Registry.LocalMachine;
RegistryKey SoftRK = LMRK.OpenSubKey("software", true);
RegistryKey GmisRK = SoftRK.OpenSubKey("Microsoft").OpenSubKey("Windows NT").OpenSubKey("CurrentVersion");

strRemember = GmisRK.GetValue("RegisteredOrganization");
if (strRemember == null || strRemember.ToString() == "")
{
GmisRK = SoftRK.OpenSubKey("Microsoft").OpenSubKey("Windows").OpenSubKey("CurrentVersion");

strRemember = GmisRK.GetValue("RegisteredOrganization");
}

return strRemember.ToString();
}//try
catch
{
return "";
}
}

/// <summary>
/// 从注册表中读字符记忆型数据
/// </summary>
private string ReadRememberUser()
{
object strRemember;
try
{
RegistryKey LMRK = Registry.LocalMachine;
RegistryKey SoftRK = LMRK.OpenSubKey("software", true);
RegistryKey GmisRK = SoftRK.OpenSubKey("Microsoft").OpenSubKey("Windows NT").OpenSubKey("CurrentVersion");

strRemember = GmisRK.GetValue("RegisteredOwner");
if (strRemember == null || strRemember.ToString() == "")
{
GmisRK = SoftRK.OpenSubKey("Microsoft").OpenSubKey("Windows").OpenSubKey("CurrentVersion");

strRemember = GmisRK.GetValue("RegisteredOwner");
}
return strRemember.ToString();
}//try
catch
{
return "";
}
}
}
}
64 changes: 64 additions & 0 deletions About/About.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?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>{00048928-5BF8-45BA-B895-AD0221F8EA5C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>About</RootNamespace>
<AssemblyName>About</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.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="About.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="About.designer.cs">
<DependentUpon>About.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="About.resx">
<DependentUpon>About.cs</DependentUpon>
</EmbeddedResource>
</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>
Loading

0 comments on commit cc2506e

Please sign in to comment.