c++课程设计..终于完成
下载地址::
WEGmanager.zip
这ftp貌似有点点问题…
就这几个..,,,图标还没换…改天多…
readfile.dll那个动态连接库是自己写的..
以前一直觉得写那个很麻烦..
….其实也不麻烦嘛….呵呵
启动截图
密码的加密是md6(原创哦~~~…其实就是3次md5加乱序….)
主界面
下面可以直接查询(ps: access 的sql太麻烦咯….)
随便点个
网络查询主界面(相当陋….能用则行)(用浏览器打开)
结果的显示(更陋……)
第二次用c#写程序……也感觉学到了很多很多
终于觉得为什么vb简单了….是因为我熟练了….
等哪天有空再考虑转行c++咯…..
ps:网络模块被提出来,重新改了个,原程序内的也可继续使用,新的用于系统服务\
附录:源代码(部分)
主界面源码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography;
using Readfile;
namespace My_project
{
public partial class MainForm : Form
{
Readfile.Readfile rf = new Readfile.Readfile();
public MainForm()
{
InitializeComponent();
}
public struct cell
{
public static int ColumnIndex;
public static int RowIndex;
public static string usertype;
}
private void userBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
//保存并重置数据单元
this.Validate();
this.userBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.dataDataSet);
this.LoadData();
}
//数据加密
public static string GetMd6Str(string ConvertString)
{
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
string t2 = BitConverter.ToString(md5.ComputeHash(UTF8Encoding.Default.GetBytes(ConvertString)), 4, 8).Replace("-", "B");
t2 += BitConverter.ToString(md5.ComputeHash(UTF8Encoding.Default.GetBytes(ConvertString)), 4, 8).Replace("-", "Z");
t2 += BitConverter.ToString(md5.ComputeHash(UTF8Encoding.Default.GetBytes(ConvertString)), 4, 8).Replace("-", "W");
return t2;
}
//填充数据库
public void LoadData()
{
this.userTableAdapter.Fill (this.dataDataSet.user);
}
private void 删除ToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (DataGridViewCell c in userDataGridView.SelectedCells)
{
if (c.RowIndex>=0) { this.userDataGridView.Rows.RemoveAt(c.RowIndex); }
}
}
//设定当前单元格
private void userDataGridView_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
if (userDataGridView.SelectedCells.Count == 1 & e.ColumnIndex >= 0 & e.RowIndex >= 0 & e.Button==MouseButtons .Right)
{
userDataGridView.CurrentCell = userDataGridView[e.ColumnIndex, e.RowIndex];
}
}
private void 关于本程序ToolStripMenuItem_Click(object sender, EventArgs e)
{
AboutBox newabout= new AboutBox ();
newabout.Show();
}
private void fwToolStripMenuItem_Click(object sender, EventArgs e)
{
groupBox3.Visible = true;
}
private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
{
//终止所有线程并结束程序
Application.Exit();
}
private void hideall()
{
//隐藏所有可能出现的窗体
groupBox2.Visible = false;
button1.Visible = false;
groupBox1.Visible = false;
}
private void userDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
string[] data=new string[0];
hideall();
switch (e.ColumnIndex)
{
//配额
case 5:
groupBox1.Text = "用户配额";
//读取数据
data = userDataGridView.CurrentCell.Value.ToString().Split(‘|’);
if (data[0] != "")
{
water.Text = data[0];
elec.Text = data[1];
gas.Text = data[2];
}
else
{
water.Text = "0";
elec.Text = "0";
gas.Text = "0";
}
cell.ColumnIndex = e.ColumnIndex;
cell.RowIndex = e.RowIndex;
groupBox1.Visible = true;
button1.Visible=true;
//用户类型
cell.usertype = userDataGridView[e.ColumnIndex – 1, e.RowIndex].Value.ToString();
break;
//单价
case 6:
groupBox1.Text = "单价";
//读取数据
data = userDataGridView.CurrentCell.Value.ToString().Split(‘|’);
if (data[0] != "")
{
water.Text = data[0];
elec.Text = data[1];
gas.Text = data[2];
}
else
{
water.Text = "0";
elec.Text = "0";
gas.Text = "0";
}
cell.ColumnIndex = e.ColumnIndex;
cell.RowIndex = e.RowIndex;
groupBox1.Visible = true;
button1.Visible = true;
//用户类型
cell.usertype = userDataGridView[e.ColumnIndex – 2, e.RowIndex].Value.ToString();
break;
//使用
case 7:
groupBox1.Text = "已经使用";
//读取数据
data = userDataGridView.CurrentCell.Value.ToString().Split(‘|’);
if (data[0] != "")
{
water.Text = data[0];
elec.Text = data[1];
gas.Text = data[2];
}
else
{
water.Text = "0";
elec.Text = "0";
啊……..文章过长……..