Browse Source

添加登录页面工作日志

master
sc 2 years ago
parent
commit
efb99dcf3f
  1. 2
      EX/ExProgram.xaml
  2. 2
      Login.xaml
  3. 29
      Login.xaml.cs

2
EX/ExProgram.xaml

@ -13,7 +13,7 @@
<RichTextBox Margin="0,300,0,0" IsReadOnly="True">
<FlowDocument>
<Paragraph>
<Run Text="LOG"/>
<Run Text="TEXTLOG"/>
</Paragraph>
</FlowDocument>
</RichTextBox>

2
Login.xaml

@ -23,7 +23,7 @@
<TextBlock Height="30" Margin="15,115,15,0" TextWrapping="Wrap" Text="尚彩科技单据管理系统" VerticalAlignment="Top" FontSize="20"/>
<TextBox x:Name="DISPENLINK" HorizontalAlignment="Left" Height="15" Margin="0,0,0,0" TextWrapping="Wrap" Text="DISPEN" VerticalAlignment="Bottom" Width="50" Background="#FFF1F1F1" BorderBrush="#FF989898" Focusable="False" MaxLines="1" FontSize="11"/>
<TextBox x:Name="DBCLINK" HorizontalAlignment="Left" Height="15" Margin="50,0,0,0" TextWrapping="Wrap" Text="DBC" VerticalAlignment="Bottom" Width="50" Background="#FFF1F1F1" BorderBrush="#FF989898" FontSize="11" MaxLines="1"/>
<TextBox x:Name="EXLINK" HorizontalAlignment="Left" Height="15" Margin="100,0,0,0" TextWrapping="Wrap" Text="EX" VerticalAlignment="Bottom" Width="50" Background="#FFF1F1F1" BorderBrush="#FF989898" FontSize="11" MaxLines="1"/>
<TextBox x:Name="EXLINK" HorizontalAlignment="Left" Height="15" Margin="100,0,0,0" TextWrapping="Wrap" Text="EX" VerticalAlignment="Bottom" Width="50" Background="#FFF1F1F1" BorderBrush="#FF989898" FontSize="11" MaxLines="1" TextChanged="EXLINK_TextChanged"/>
<TextBox x:Name="USERLINK" HorizontalAlignment="Left" Height="15" Margin="150,0,0,0" TextWrapping="Wrap" Text="USER" VerticalAlignment="Bottom" Width="98" Background="#FFF1F1F1" BorderBrush="#FF989898" MaxLines="1" FontSize="11"/>
</Grid>
</Window>

29
Login.xaml.cs

@ -61,6 +61,10 @@ namespace formula_manage
private void Button_Click(object sender, RoutedEventArgs e) //退出按钮事件
{
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
StreamWriter wr = new StreamWriter(fs);//创建文件
wr.WriteLine(Log_time + "FORMULA_LogStop");
wr.Close();
this.Close();
}
@ -85,7 +89,7 @@ namespace formula_manage
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
StreamWriter wr = new StreamWriter(fs);//创建文件
wr.WriteLine(Log_time + "LOGon_ENGINEER");
wr.WriteLine(Log_time + "LOGon = ENGINEER");
wr.Close();
Main.ShowDialog();//实例化并置顶打开窗口
@ -109,7 +113,7 @@ namespace formula_manage
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
StreamWriter wr = new StreamWriter(fs);//创建文件
wr.WriteLine(Log_time + "LOGon_" + user);
wr.WriteLine(Log_time + "LOGon = " + user);
wr.Close();
Main.ShowDialog();//实例化并置顶打开窗口
@ -162,6 +166,10 @@ namespace formula_manage
{
EXLINK.Background = Brushes.Red;
System.Windows.MessageBox.Show("扩展程序未启动");
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
StreamWriter wr = new StreamWriter(fs);//创建文件
wr.WriteLine("[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:" + "EX = FALL_TO_START");
wr.Close();
}
}
try
@ -198,6 +206,12 @@ namespace formula_manage
System.Windows.MessageBox.Show("连接数据库失败");
//Windows.Sql sql = new Windows.Sql();
//sql.ShowDialog();//实例化并置顶打开数据库设置窗口
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
StreamWriter wr = new StreamWriter(fs);//创建文件
wr.WriteLine("[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:" + "DISPENLINK = ConnectFailed");
wr.Close();
return;
}
conn_SC.Close(); //关闭连接
@ -229,6 +243,12 @@ namespace formula_manage
System.Windows.MessageBox.Show("连接数据库失败");
//Windows.Sql sql = new Windows.Sql();
//sql.ShowDialog();//实例化并置顶打开数据库设置窗口
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
StreamWriter wr = new StreamWriter(fs);//创建文件
wr.WriteLine("[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:" + "DBCLINK = ConnectFailed");
wr.Close();
return;
}
DBCLINK.Background = Brushes.Green; //连接成功绿色
@ -255,11 +275,16 @@ namespace formula_manage
catch (Exception)
{
System.Windows.MessageBox.Show("请求信息失败,检查连接");
FileStream fs = new FileStream(logPath, FileMode.Append, FileAccess.Write);
StreamWriter wr = new StreamWriter(fs);//创建文件
wr.WriteLine("[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]:" + "USER = NoData");
wr.Close();
return;
}
}
}
}
}

Loading…
Cancel
Save