武汉晴川学院
2021-2022-1
.NET综合应用开发
综合作品
专 业: | 计算机科学与技术 | ||
班 级: | 201903班 | ||
题 目: | BMS图书管理系统 | ||
指导老师: | |||
第2组 (组长:***) | 成员 | 分工 | 成绩 |
客户端代码、服务器代码丶答辩讲解 | |||
客户端代码丶文档整理 | |||
服务器代码丶数据库存储过程代码 | |||
服务器代码丶PPT制作 |
计算机学院
BMS图书管理系统的设计与实现
1需求分析
参与者:【一般用户】、【管理员用户】
用例:列出每一个参与者的操作
参与者 | 用例 | 说明 | 状态 |
【一般用户】 | 图书功能 | 能对图书进行查看操作 | 已完成 |
登录注册功能 | 能进行注册,登录等基本功能 | 已完成 | |
图书图片上传-共享功能 | 可以上传分享自己的书单 | 已完成 | |
【管理员用户】 | 图书管理功能 | 能对图书进行查看,添加,删除等操作 | 已完成 |
登录注册功能 | 能进行注册,登录等基本功能 | 已完成 | |
权限修改功能 | 能进行权限的增加,更新以及删除等操作 | 已完成 | |
(备注:管理员用户在拥有一般用户各种操作的情况下可以完成上述操作) |
2设计
采用C/S架构,系统包含数据库服务器、WEB服务器、和WPF客户端。
数据库服务器:
WEB服务器:采用三层结构:Model、DAL、BLL
WPF客户端:
2.1 数据库设计
数据库(image)包含哪张表(列出表名)
users表(用户表)
字段名 | 数据类型 | NULL | 说明 |
uName | varchar(32) | 主键,用户名 | |
poQu | varchar(128) | 用户权限 | |
image表(图书图片表)
字段名 | 数据类型 | NULL | 说明 |
ID | int | 自动增长列,主键,图片的 ID 号 | |
uName | varchar(32) | 用户名称,说明该图片归该用户所有 | |
iDate | datetime | 存储图片的日期时间 | |
iFile | varchar(256) | 图片的名称 | |
iShared | bit | Not | 图片是否共享,值为 1 时共享,为 0 时不共享 |
iData | image | 图片的二进制数据 |
book表(图书信息表)
字段名 | 数据类型 | NULL | 说明 |
bookID | varchar(128) | 主键,图书编号 | |
bookName | varchar(128) | 图书名字 | |
bookType | varchar(128) | 图书类型 | |
author | varchar(128) | 作者 |
popem表(用户权限表)
字段名 | 数据类型 | NULL | 说明 |
uName | varchar(32) | 与用户表的外键,主键,用户名 | |
uPass | varchar(512) | 密码 | |
BMS图书管理系统存储过程表
功能 | 存储过程名 | 参数 | 返回值 |
添加用户 | adduser | Uname,upass | 无 |
查找用户及密码 | selectuser | uname ,upass | 返回所查用户的密码 |
增加权限 | addpopem | Uname,poqu | 0 |
更新权限 | updatepopem | uName,poqu | 无 |
删除权限 | delbypopem | uname | 无 |
添加图书 | addbook | BookID,BookName,BookType Author | 0 |
查找图书 | selbookid | BookID | BookID,bookName, bookType, author |
更新图书 | updatebookid | BookName,BookID | 无 |
删除图书 | delbybookid | BookID | 无 |
2.2 WEB服务器
层次 | 类名 | 方法 | 说明 |
MODEL | MODEL | MODEL | 获得用户信息 |
DAL | DBHelper | DBHelper | 连接数据库 |
ImageService | uploadImage | 上传图片 | |
userService | userService | 登录 | |
Xmlprocess | Xmlsd | Xmlsd | 序列化和反序列化 |
2.3 WPF客户端
窗体名 | 控件 | 控件名称 | 说明 |
Zhuye.xaml | Button StatusBarItem | 图书图片,添加图书,修改图片, | 主页 |
Window1.xaml | MenuItem DataGridTextColumn TextBlock | 用户管理,图片管理,关于 | 查看图书 |
Window2.xaml | Button | 搜索,返回 | 查询图书 |
quanxian.xaml | TextBlock Label Button | 权限,用户名,确定 | 修改用户权限 |
MainWindow.xaml | Border TextBox CheckBox Button Canva | 安全登录,自动登录,记住密码,注册账号 | 登录界面 |
addBok.xaml | TextBlock GroupBox CheckBox Button Label | 添加图书,图书编号,书名,现存否,类型,邮箱,作者,添加者,添加,返回 | 添加图书信息 |
3实现代码
数据库
create database books --创建数据库books
go
use books --打开数据库
go
create table users --创建表
(
uName varchar(32) primary key,
uPass varchar(512)
)
go
-- 添加用户
create proc adduser
(
@uname varchar(32),
@upass varchar(512)
)
as
insert into users(uName,uPass)
values(@uname,@upass)
go
-- 查找用户及密码
create proc selectuser
(
@uname varchar(32),
@upass varchar(512)
)
as
select count(*) from users where uName=@uname and uPass=@upass
go
create table popem --//用户权限表(属性为 用户名:uName 用户权限:poqu)
(
uName varchar(32) primary key,
poQu varchar(128),
foreign key( uName) references users( uName)
)
go
--增加权限
create proc addpopem
(
@uname varchar(32),
@poqu varchar(128)
)
as
insert into popem(uname,poQu)
values(@uname,@poqu)
go
--更新权限
create proc updatepopem
(
@uName varchar(32),
@poqu varchar(128)
)
as
update popem set poQu=@poqu where uName=@uname
go
--删除权限
create proc delbypopem
(
@uname varchar(32)
)
as
delete from popem where uName=@uname
go
create table book --图书信息表(属性为图书编号:bookID 图书名字:bookName 图书类型:bookType 作者:author)
(
bookID varchar(128) primary key,
bookName varchar(128),
bookType varchar(128),
author varchar(128)
)
go
create proc addbook
(
@BookID varchar(128),
@BookName varchar(128),
@BookType varchar(128),
@Author varchar(128)
)
as
insert into book(bookID,bookName,bookType,author)
values(@BookID,@BookName,@BookType ,@Author)
go
--查找图书
create proc selbookid
(
@BookID varchar(128)
)
as
select bookID,bookName,bookType,author from book where bookID=@BookID
go
create proc selbybookid
(
@BookID varchar(128)
)
as
select count(*) from book where bookID=@BookID
go
--更新图书
create proc updatebookid
(
@BookName varchar(128),
@BookID varchar(128)
)
as
update book set bookName=@BookName where bookID=@BookID
go
--删除图书
create proc delbybookid
(
@BookID varchar(128)
)
as
delete from book where bookID=@BookID
go
WEB服务器
namespace DAL
{
public class DBHelper
{
//public static String conString = "Data Source=localhost\\sqlexpress;Initial Catalog=image;Integrated Security = SSPI; MultipleActiveResultSets=true";//windows 身份验证
public static String conString = "Server=127.0.0.1;initial catalog=books;user id=sa;password=123456;";
public SqlConnection con;
public SqlCommand cmd;
public DBHelper(SqlConnection con)
{
con.Open();
this.con = con;
cmd = new SqlCommand();
cmd.Connection = con;
}
public int executeCommand(string sql)
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = sql;
cmd.Parameters.Clear();
return cmd.ExecuteNonQuery();
}
public int executeCommand(string sql, params SqlParameter[] values)
{
cmd.CommandType=CommandType.StoredProcedure;
cmd.CommandText =sql ;
cmd.Parameters.Clear();
cmd.Parameters.AddRange(values);
return cmd.ExecuteNonQuery();
}
public int getScalar(string sql)
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = sql;
cmd.Parameters.Clear();
return (int)cmd.ExecuteScalar();
}
public int getScalar(string sql, params SqlParameter[] values)
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = sql;
cmd.Parameters.Clear();
cmd.Parameters.AddRange(values);
return (int)cmd.ExecuteScalar();
}
public SqlDataReader getReader(string sql)
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = sql;
cmd.Parameters.Clear();
SqlDataReader reader = cmd.ExecuteReader();
return reader;
}
public SqlDataReader getReader(string sql, params SqlParameter[] values)
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = sql;
cmd.Parameters.Clear();
cmd.Parameters.AddRange(values);
return cmd.ExecuteReader();
}
public SqlDataAdapter getAdapter(string sql)
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = sql;
cmd.Parameters.Clear();
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
return adapter;
}
public SqlDataAdapter getAdapter(string sql, params SqlParameter[] values)
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = sql;
cmd.Parameters.Clear();
cmd.Parameters.AddRange(values);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
return adapter;
}
}
客户端
Zhuye.xaml
<Style x:Key="CorrectSeparatorStyle" TargetType="{x:Type Separator}">
<Setter Property="Margin" Value="0,2,0,2"/>
<Setter Property="Focusable" Value="false"/>
<Setter Property="Height" Value="1"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Separator}">
<Border Background="{TemplateBinding Background}">
<Line Stretch="Fill" X2="1" Stroke="{TemplateBinding Background}" StrokeThickness="{TemplateBinding Height}"
StrokeStartLineCap="Square" StrokeEndLineCap="Square"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--Button控件模块样式-->
<Style x:Key="buttonStyle" TargetType="{x:Type Button}">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Height" Value="43"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<!--修改模板属性-->
<Setter Property="Template">
<Setter.Value>
<!--控件模板-->
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="fore" BorderThickness="0" CornerRadius="3" BorderBrush="#5555" Background="{TemplateBinding Background}">
<ContentPresenter x:Name="content" HorizontalAlignment="Center" VerticalAlignment="Center"
Content="{TemplateBinding Content}">
<ContentPresenter.BitmapEffect>
<DropShadowBitmapEffect Color="#000" Direction="-90" ShadowDepth="2" Softness="0.1" Opacity="0.3"/>
</Window.Resources>
<TextBlock Text="家里蹲大学图书管理系统" Grid.Row="1" Grid.ColumnSpan="3" TextAlignment="Center"
Foreground="#ffffff" Padding="0 8 0 0" FontSize="30" FontWeight="Bold" HorizontalAlignment="Stretch">
</TextBlock>
<StackPanel Grid.Row="2" Grid.ColumnSpan="3">
<Separator Style="{StaticResource ResourceKey=CorrectSeparatorStyle}" Height="5" Background="#c0c0c0">
</Separator>
</StackPanel>
<Grid Grid.Row="3" Grid.ColumnSpan="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="170"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Text="主菜单栏" Padding="0 7 0 0" TextAlignment="Center" FontSize="20" Foreground="#fafafa" FontWeight="Bold" Height="40">
<StatusBar Grid.Row="4" Grid.ColumnSpan="3" VerticalAlignment="Center" Background="Beige">
<StatusBarItem Content="数据库状态:已连接"/>
<StatusBarItem Content="岗位名称:图书管理员" Margin="25 0 0 0"/>
<StatusBarItem x:Name="G1" Content="登录用户名:系统管理员" Margin="25 0 0 0"/>
<StatusBarItem x:Name="time" Content="登录时间:2021年12月15日 13:54:08 星期三" Margin="25 0 0 0"/>
</StatusBar>
Zhuye.xaml.cs
public partial class zhuye : Window
{
User u;
WebClient client;
public zhuye(User u)
{
InitializeComponent();
client = new WebClient();
client.Encoding = Encoding.UTF8;
this.u = u;
G1.Content = u.uName + "管理员,您好!";
time.Content = "登录时间"+DateTime.Now.ToString("yyyy")+"年"+ DateTime.Now.ToString("MM")+"月"+ DateTime.Now.ToString("dd")+"日"+ DateTime.Now.ToString("HH")+"时";
}
private void btn_Repair_Click(object sender, RoutedEventArgs e)
{
Window1 w = new Window1(u);
this.Close();
w.ShowDialog();
} private void Button_Click(object sender, RoutedEventArgs e)
{
addBok m =new addBok(u);
this.Close();
m.Show(); }
private void Button_Click_1(object sender, RoutedEventArgs e)
{
Window2 m = new Window2();
this.Close();
m.Show();}
private void Button_Click_2(object sender, RoutedEventArgs e)
{quanxian m = new quanxian(u);
this.Close();
m.Show(); }
Window1.xaml
<DockPanel x:Name="img" LastChildFill="True" Background="AliceBlue">
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Background="WhiteSmoke" Margin="10,10">
<Menu HorizontalAlignment="Left" Margin="10,10">
<MenuItem Header="用户管理">
<MenuItem Header="注册"></MenuItem>
<MenuItem Header="注销"></MenuItem>
<MenuItem Header="退出" Command="ApplicationCommands.Close"></MenuItem>
</MenuItem>
<MenuItem Header="图书管理">
<MenuItem Header="图片上传" Name="upimage" Click="upimage_Click"></MenuItem>
<MenuItem Header="设置共享" Click="menuSetSharedList_Click"></MenuItem>
</MenuItem>
<MenuItem Header="返回" Click="MenuItem_Click">
</MenuItem>
</Menu>
<TextBlock x:Name="un" HorizontalAlignment="Right" Margin="500,10,0,10"/>
</StackPanel>
<TextBlock DockPanel.Dock="Bottom"></TextBlock>
<DataGrid x:Name="uGrid" AutoGenerateColumns="False" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserAddRows="False"
Grid.Column="0" Grid.Row="1" SelectionMode="Single"
SelectionChanged="uGrid_SelectionChanged" Background="AliceBlue">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding ID}" Header="ID" Width="50"/>
<DataGridTextColumn Binding="{Binding uName}" Header="用户" Width="50"/>
<DataGridTextColumn Binding="{Binding iDate}" Header="日期" Width="100"/>
<DataGridTextColumn Binding="{Binding iFile}" Header="书名" Width="150"/>
<DataGridCheckBoxColumn x:Name="colShared" Binding="{Binding iShared,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" IsThreeState="False" IsReadOnly="False" Header="共享" Width="50"/>
</DataGrid.Columns>
<DataGrid.ColumnHeaderStyle>
<Style TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
</Style>
</DataGrid.ColumnHeaderStyle>
<DataGrid.ContextMenu>
<ContextMenu>
<MenuItem x:Name="menuAddImage" Header="上传图片" Click="upimage_Click"/>
<MenuItem x:Name="menuGetImageList" Header="获取图片" Click="menuGetImageList_Click"/>
<MenuItem x:Name="menuSetSharedList" Header="设置共享" Click="menuSetSharedList_Click"/>
<MenuItem x:Name="menuDelImg" Header="删除图片" Click="menuDelImg_Click"/>
</ContextMenu>
</DataGrid.ContextMenu>
</DataGrid>
<Image x:Name="img1" Margin="81,78,119.6,66" Source="Img/456.jpg">
</Image>
</DockPanel>
Window1.xaml.cs
private void upimage_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Filter = "Images|*.jpg;*.png";
if ((bool)dlg.ShowDialog())
{
try
{
string fn = dlg.FileName;
int p = fn.LastIndexOf("\\");
if (p >= 0) fn = fn.Substring(p + 1);
FileStream fs = new FileStream(dlg.FileName, FileMode.Open);
byte[] data = new byte[fs.Length];
fs.Read(data, 0, data.Length);
fs.Close();
Uri uri = new Uri(url + "?opt=uploadImage&uName=" + Xmlsd.encode(u.uName)
+ "&uPass=" + Xmlsd.encode(Xmlsd.encryptString(u.uPass)) + "&iFile=" + Xmlsd.encode(fn), UriKind.Absolute);
client.UploadDataAsync(uri, "POST", data);
}
catch (Exception exp)
{
showMsg(exp.Message);
showMsg("上传失败");
}
}
Window2.xaml
<Button x:Name="stu" Content="搜索" HorizontalAlignment="Left" Margin="97,39,0,0" VerticalAlignment="Top" Width="130" Height="52" Click="stu_Click" FontSize="36"/>
<TextBox x:Name="t1" HorizontalAlignment="Left" Height="53" Margin="312,38,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="381" FontSize="36"/>
<TextBlock HorizontalAlignment="Left" Height="35" Margin="325,114,0,0" TextWrapping="Wrap" Text="书号" VerticalAlignment="Top" Width="90" FontSize="24"/>
<TextBlock HorizontalAlignment="Left" Height="32" Margin="439,114,0,0" TextWrapping="Wrap" Text="书名" VerticalAlignment="Top" Width="108" FontSize="24"/>
<TextBlock x:Name="s1" HorizontalAlignment="Left" Height="52" Margin="290,168,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Width="107" FontSize="20"/>
<TextBlock x:Name="n1" HorizontalAlignment="Left" Height="46" Margin="439,168,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Width="98"
Window2.xaml.cs
private void stu_Click(object sender, RoutedEventArgs e)
{
SqlConnection con = new SqlConnection(MyConStr);
con.Open();
MessageBox.Show("连接成功");
string str = t1.Text;
string sql = "SELECT bookID as '书号', booKName as '书名' FROM book WHERE bookID LIKE"+"'"+"%"+str+"%"+"' ;";
SqlCommand cmd = new SqlCommand(sql, con);
SqlDataReader abc = cmd.ExecuteReader();
quanxian.xaml
<Grid>
<Grid.Background>
<ImageBrush ImageSource="/Img/456.jpg"></ImageBrush>
</Grid.Background>
<TextBox x:Name="uname" HorizontalAlignment="Left" Height="34" Margin="297,205,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="287" FontSize="20"/>
<Label Content="用户名:" />
<Button Content="确定" HorizontalAlignment="Left" Margin="297,295,0,0" VerticalAlignment="Top" Width="107" Height="41" RenderTransformOrigin="1.221,0.297" Click="Button_Click" FontSize="20"/>
<ComboBox x:Name="quan" HorizontalAlignment="Left" Margin="297,102,0,0" VerticalAlignment="Top" Width="287" Height="39" SelectionChanged="ComboBox_SelectionChanged">
<TextBlock x:Name="q3" Text="学生" FontSize="20"/>
<TextBlock x:Name="q2" Text="教师" FontSize="20"/>
<TextBlock x:Name="q1" Text="管理员" FontSize="20"/>
</ComboBox>
<Label Content="权限:" HorizontalAlignment="Left" Margin="177,102,0,0" VerticalAlignment="Top" Width="63" Height="39" FontSize="20" Foreground="#FF1943A5"/>
<Button Content="返回" HorizontalAlignment="Left" Height="41" Margin="471,295,0,0" VerticalAlignment="Top" Width="101" Click="Button_Click_1" FontSize="20"/>
</Grid>
Quanxian.xaml.cs
private void Button_Click(object sender, RoutedEventArgs e)
{
SqlConnection con = new SqlConnection(MyConStr);
con.Open();
MessageBox.Show("连接成功");
string name = uname.Text;
string p1 = quan.Text;
string sql = "insert into popem values ("+"'"+name+"'"+","+"'"+p1+"'"+");";
SqlCommand cmd = new SqlCommand(sql, con);
int result = cmd.ExecuteNonQuery();
if (result > 0) MessageBox.Show("添加成功");
}
MainWindow.xaml
<TextBox x:Name="uname" Height="40" Grid.Row="1" FontSize="22" Style="{DynamicResource UserTextBoxStyle}" Text="sa" ></TextBox>
</Grid>
<PasswordBox x:Name="psd" Height="40" PasswordChar="*" Grid.Row="1" FontSize="20" Style="{DynamicResource PwdPasswordBoxStyle}" Password="123456"></PasswordBox>
<Grid Grid.Row="2">
<CheckBox VerticalAlignment="Center" Content="自动登录" Foreground="#A6A6A6" Grid.Column="0"/>
<CheckBox VerticalAlignment="Center" Content="记住密码" Foreground="#A6A6A6" Grid.Column="2"/>
<TextBlock VerticalAlignment="Center" Text="找回密码" Foreground="#A6A6A6" Grid.Column="4"/>
</Grid>
<Button x:Name="login" Template="{StaticResource LoginButtonTemplate}" Height="40" Background="#1FC8FD" Command="{Binding LoginCommand}" CommandParameter="{Binding ElementName=LoginWindow}" Foreground="White" FontSize="16" Grid.Row="3" Content="安全登录" Click="login_Click"></Button>
<TextBlock Grid.Row="4"></TextBlock>
</Grid>
<Button x:Name="zhuce" Grid.Column="0" HorizontalAlignment="Center" Foreground="#A6A6A6" VerticalAlignment="Bottom" FontSize="14" Margin="0 0 0 15" Content="注册账号" Click="zhuce_Click_1" />
<Border Grid.Column="2">
<Viewbox Width="35" Height="35" HorizontalAlignment="Right" Margin="0 0 10 10" VerticalAlignment="Bottom"
MainWindw.xaml.cs
private void zhuce_Click_1(object sender, RoutedEventArgs e)
{
SqlConnection con = new SqlConnection(MyConStr);
con.Open();
MessageBox.Show("连接成功");
string name = uname.Text;
string pass = psd.Password;
string sql = "INSERT INTO users(uName,uPass)VALUES("+"'"+name+"'"+","+"'"+pass+"'"+");";//INSERT INTO users(uName,uPass)VALUES('uname','pass');
SqlCommand cmd = new SqlCommand(sql, con);
int result = cmd.ExecuteNonQuery();
if(result>0) MessageBox.Show("注册成功");
addaBok.xaml
<Grid>
<Grid.Background>
<ImageBrush ImageSource="Img/2.jpg" TileMode="Tile"></ImageBrush>
</Grid.Background>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="14*"/>
<ColumnDefinition Width="103*"/>
</Grid.ColumnDefinitions>
<Label Content="图书编号" HorizontalAlignment="Left" Margin="18.2,68,0,0" VerticalAlignment="Top" Grid.Column="1"/>
<Label Content="书名" HorizontalAlignment="Left" Margin="18.2,111,0,0" VerticalAlignment="Top" Grid.Column="1"/>
<Label Content="现存否" HorizontalAlignment="Left" Margin="18.2,159,0,0" VerticalAlignment="Top" Grid.Column="1"/>
<Label Content="类型" HorizontalAlignment="Left" Margin="18.2,206,0,0" VerticalAlignment="Top" Grid.Column="1"/>
<Label Content="邮箱" HorizontalAlignment="Left" Margin="18.2,251,0,0" VerticalAlignment="Top" Grid.Column="1"/>
<Label Content="作者" HorizontalAlignment="Left" Margin="18.2,292,0,0" VerticalAlignment="Top" Grid.Column="1"/>
<Label Content="添加者" HorizontalAlignment="Left" Margin="18.2,333,0,0" VerticalAlignment="Top" Grid.Column="1"/
<Button x:Name="button1" Content="添加" HorizontalAlignment="Left" Margin="18.2,399,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click" Grid.Column="1" Background="#1FC8FD"/>
<Button Content="返回" HorizontalAlignment="Left" Margin="146.2,399,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_1" Grid.Column="1" Background="#1FC8FD"/>
<CheckBox x:Name="yes" Content="是" HorizontalAlignment="Left" Margin="110.2,165,0,0" VerticalAlignment="Top" Checked="CheckBox_Checked" Grid.Column="1"/>
<CheckBox x:Name="no" Content="否" HorizontalAlignment="Left" Margin="180.2,165,0,0" VerticalAlignment="Top" Checked="CheckBox_Checked_1" Grid.Column="1"/>
<GroupBox Header="图书信息" Height="335" Margin="40,48,0,0" VerticalAlignment="Top" Width="253" Grid.ColumnSpan="2" BorderBrush="#FFC915FC" MinWidth="1" HorizontalAlignment="Left"/>
<GroupBox Header="" HorizontalAlignment="Left" Height="45" Margin="101.2,144,0,0" VerticalAlignment="Top" Width="121" Grid.Column="1"/>
<TextBlock Grid.Column="1" HorizontalAlignment="Left" Height="33" Margin="76.4,15,0,0" TextWrapping="Wrap" Text="添加图书" VerticalAlignment="Top" Width="96" FontSize="22"/>
</Grid>
addBok.xaml.cs
public partial class addBok : Window
{
static string MyConStr = "Server=127.0.0.1;initial catalog = books; user id = sa; password=123456;";
User u;
WebClient client;
public addBok(User u)
{
InitializeComponent();
client = new WebClient();
client.Encoding = Encoding.UTF8;
this.u = u;
password1.Text = u.uName;
运行结果
4总结
#### 基本需求 ####
图书管理系统的管理层次可划分为了五个部分:图书信息管理,权限管理,信息查询,管理员信息管理。能够实现以下功能。
进行新书入库的信息录入及现有图书信息查询、增加、修改以及删除。
能够实现对用户基本信息的查询、注册、修改和删除管理。
能够实现对用户的权限进行增加、更新、删除等操作。
#### 系统功能 ####
系统的功能分析:
图书管理涉及图书信息、用户信息、管理员信息等多种数据管理。
从管理的角度可将图书管理系统分为三类:图书信息管理、系统用户管理、权限信息管理。
图书信息管理包括图书增加、查询信息等操作。
#### 具体功能如下 ####
对所有用户开放的图书查询。
查询及编辑用户或者管理者信息。
根据查询情况对数据库进行操作。
查询及统计各种信息。
维护图书信息。
维护用户和管理员信息。
#### 体会与收获 ####
经过接近一个月的项目设计和开发,图书馆管理系统基本开发完毕。其功能基符合需求。但是由于时间较短,所以该系统还有许多不尽如人意的地方,比如用户界面不够美观、不够完善等方面问题。这些都有待进一一步改善。
接近一个月的项目开发,使我们提高了实际操作能力,从以前的理论上升到实践从感性认识上升到理性认识,真正做到学有所用,虽然在设计过程中我也遇到些困难,但在老师的帮助和自己的努力下,我们都一一克服了,但由于时间关系我们并不能做到尽善尽美,应该说这是一大遗憾吧。