Przeglądaj źródła

修复超过授权次数不禁止功能的bug

-修复已生成次数超过授权次数时仍然允许使用报告生成功能的Bug
+新增在首页显示当前的授权次数和剩余次数的功能
-修复登录界面有默认账户密码的Bug
-修复系统的字体为黑体
-修复错别字“登陆”
ZhuYifan 5 lat temu
rodzic
commit
11cf7d4cd9

+ 3 - 2
WpfTest1/MainWindow.xaml

@@ -13,7 +13,7 @@
         ShowIconOnTitleBar="True"
         PreviewKeyDown="processGrid_KeyDown"
         WindowStartupLocation="CenterScreen"
-        WindowState = "Normal" FontFamily="Segoe UI Symbol"
+        WindowState = "Normal" FontFamily="SimHei"
         >
     <Controls:MetroWindow.Resources>
         <Style BasedOn="{StaticResource MetroTabItem}" TargetType="{x:Type TabItem}" x:Key="smallHeader" >
@@ -183,6 +183,7 @@
                         </Button>
                         <Label x:Name="labelSoftwareName" Content="欢迎使用劳拉" FontSize="32" HorizontalAlignment="Center" Margin="0,61,0,0" VerticalAlignment="Top" Foreground="White"/>
                         <Label x:Name="labelHomepageCversion" Content="编译版本:20200411" HorizontalAlignment="Center" Margin="0,109,0,0" VerticalAlignment="Top" Foreground="White"/>
+                        <Label x:Name="labelHomepageUSBDogStatus" Visibility="Hidden" Content="系统Key已授权,当前Key可使用XX次,已使用XX次" HorizontalAlignment="Center" Margin="0,550,0,0" VerticalAlignment="Top" Foreground="White"/>
                     </Grid>
                 </TabItem>
                 <TabItem Header="用户管理" Style="{StaticResource smallHeader}" >
@@ -346,7 +347,7 @@
                                 <Button x:Name="buttonDeleteDoctor" FontSize="18" Content="删除医师" HorizontalAlignment="Left" Margin="26,210,0,0" VerticalAlignment="Top" Width="236" Height="38" Click="buttonDeleteDoctor_Click"/>
                                 <Button x:Name="buttonFindDoctor" Content="查找" FontSize="18" HorizontalAlignment="Left" Margin="170,328,0,0" VerticalAlignment="Top" Width="92" Height="36" Click="buttonFindDoctor_Click"/>
                                 <TextBox x:Name="textBoxFindDoctor" HorizontalAlignment="Left"  FontSize="18" Height="36" Margin="126,287,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="136"/>
-                                <Label x:Name="label5" Content="登名:" HorizontalAlignment="Left" Margin="26,287,0,0" VerticalAlignment="Top" Height="36" Width="95" FontSize="20"/>
+                                <Label x:Name="label5" Content="登名:" HorizontalAlignment="Left" Margin="26,287,0,0" VerticalAlignment="Top" Height="36" Width="95" FontSize="20"/>
                                 <Button x:Name="buttonChangeDoctorPWD" FontSize="18" Content="修改医师密码" HorizontalAlignment="Left" Margin="26,154,0,0" VerticalAlignment="Top" Width="236" Height="38" Click="buttonChangeDoctorPWD_Click"/>
                             </Grid>
                         </TabItem>

+ 29 - 11
WpfTest1/MainWindow.xaml.cs

@@ -24,12 +24,12 @@ namespace WpfTest1
     {
         #region 系统基本参数
         System.Data.SQLite.SQLiteDataAdapter daHistoryRecord;   //选择记录页面查询记录条目的数据集容器
-        public doctor loginDoctor = null;                       //所登的医师
+        public doctor loginDoctor = null;                       //所登的医师
         DataSet ds;                                             //其他界面的DataSet
         System.Data.SQLite.SQLiteDataAdapter da;                //其他界面的DataAdapter
         //double highBp;                                        //BP界面高压
         //double lowBp;                                         //BP界面低压
-        DateTime lastSettingLogin;                              //上一次在系统设置界面登的时间
+        DateTime lastSettingLogin;                              //上一次在系统设置界面登的时间
         public Toolkits.Config cfg;                //从数据库取配置的类
         DogOperator dop = new DogOperator(Constants.registerPid, Constants.registerUid);
 
@@ -73,7 +73,7 @@ namespace WpfTest1
         {
             labelHomepageCversion.Content = "编译日期:" + Toolkits.Constants.compileDate;
             labelSoftwareName.Content = String.Format("欢迎使用{0}", Constants.softwareName);
-            //之后测试登
+            //之后测试登
             SmallDialogs.LoginWindow lw = new SmallDialogs.LoginWindow(this);
             lw.ShowDialog();
             if (loginDoctor == null)
@@ -87,6 +87,8 @@ namespace WpfTest1
                 MessageBox.Show("未找到硬件授权Key,请确认插入后重试", "错误");
                 this.Close();
             }
+            loadUSBDogStatus();
+
             string datestr = "2021-12-31 00:00:00";
             DateTime dtStandard = DateTime.Parse(datestr);
             DateTime now = DateTime.Now;
@@ -104,7 +106,20 @@ namespace WpfTest1
 
             loadQuestionaire(filterQuestionaire, "filter");
             loadQuestionaire(evaluationQuestionaire, "evaluation");
-            
+        }
+
+        private void loadUSBDogStatus()
+        {
+            int[] timesLimit = dop.getTimesCount();
+            if(timesLimit[0] != -1 && timesLimit[1]!= -1)
+            {
+                labelHomepageUSBDogStatus.Content = String.Format("系统Key已授权,当前Key可使用{0}次,已使用{1}次", timesLimit[0], timesLimit[1]);
+                labelHomepageUSBDogStatus.Visibility = Visibility.Visible;
+            }
+            else
+            {
+                labelHomepageUSBDogStatus.Visibility = Visibility.Hidden;
+            }
         }
 
         private void loadQuestionaire(List<QuestionAnswerPair> oneQuestionaire, string type = "filter")
@@ -260,10 +275,11 @@ namespace WpfTest1
         //首页--操作帮助
         private void buttonHomePageHelp_Click(object sender, RoutedEventArgs e)
         {
-            //System.Diagnostics.Process.Start("https://www.baidu.com");
-            Record one_record = SQLiteModel.getRecordByID(24);
-            Patient one_patient = SQLiteModel.getPatientById("5");
-            ReportGenerater.generateReport_constum(one_record, one_patient,cfg);
+            System.Diagnostics.Process.Start(Constants.template_custom + "\\" + "manual.pdf");
+            //manual.pdf
+            //Record one_record = SQLiteModel.getRecordByID(24);
+            //Patient one_patient = SQLiteModel.getPatientById("5");
+            //ReportGenerater.generateReport_constum(one_record, one_patient,cfg);
         }
 
 
@@ -562,7 +578,7 @@ namespace WpfTest1
         private void buttonSubmitFilter_Click(object sender, RoutedEventArgs e)
         {
             int[] timesLimit =  dop.getTimesCount();
-            if(Constants.productionEnvironment && timesLimit[1] > timesLimit[0])
+            if (Constants.productionEnvironment && (timesLimit[1] >= timesLimit[0]))
             {
                 MessageBox.Show("此功能已超过Key授权次数,请使用一个新的Key进行操作。", "提示");
                 return;
@@ -998,7 +1014,8 @@ namespace WpfTest1
         private void buttonSubmitEvaluation_Click(object sender, RoutedEventArgs e)
         {
             int[] timesLimit = dop.getTimesCount();
-            if (Constants.productionEnvironment && timesLimit[1] > timesLimit[0])
+            //MessageBox.Show(String.Format("生产环境状态标识:{0}, 授权阈值: {1}, 已使用次数:{2}", Constants.productionEnvironment, timesLimit[0], timesLimit[1]));
+            if (Constants.productionEnvironment && (timesLimit[1] >= timesLimit[0]))
             {
                 MessageBox.Show("此功能已超过Key授权次数,请使用一个新的Key进行操作。", "提示");
                 return;
@@ -1028,6 +1045,7 @@ namespace WpfTest1
                 return;
             }
             dop.addOneCount();
+            loadUSBDogStatus();
             MessageBoxResult dr = MessageBox.Show("保存成功,是否生成报告?", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Question);
             if (dr == MessageBoxResult.OK)
             {
@@ -1238,7 +1256,7 @@ namespace WpfTest1
                     DateTime now = DateTime.Now;
                     if (lastSettingLogin != null && (now - lastSettingLogin).Minutes <= 10)
                     {
-                        //如果上次有登陆而且登陆时间在10分钟以内,则免登陆
+                        //如果上次有登录而且登录时间在10分钟以内,则免登录
                         return;
                     }
 

+ 6 - 6
WpfTest1/SmallDialogs/LoginWindow.xaml

@@ -6,7 +6,7 @@
         xmlns:local="clr-namespace:WpfTest1.SmallDialogs"
         xmlns:Custom="http://metro.mahapps.com/winfx/xaml/controls" x:Class="WpfTest1.SmallDialogs.LoginWindow"
         mc:Ignorable="d"
-        Title="登" Height="725" Width="1366"
+        Title="登" Height="725" Width="1366"
         WindowStartupLocation="CenterScreen"
         >
            
@@ -15,11 +15,11 @@
         <Grid.Background>
             <ImageBrush ImageSource="/WpfTest1;component/Resources/loginpage.jpg" />
         </Grid.Background>
-        <Label x:Name="labelSoftwareName" Content="欢迎使用劳拉" FontSize="32" HorizontalAlignment="Center" Margin="0,61,0,0" VerticalAlignment="Top" Foreground="White"/>
+        <Label x:Name="labelSoftwareName" Content="欢迎使用劳拉" FontSize="32" HorizontalAlignment="Center" Margin="0,61,0,0" VerticalAlignment="Top" Foreground="White" FontFamily="SimHei"/>
         <Label x:Name="labelHomepageCversion" Content="当前版本:V1.2.3.4" HorizontalAlignment="Center" Margin="0,550,0,0" VerticalAlignment="Top" Foreground="White"/>
-        <TextBox x:Name="textBoxUsername" HorizontalAlignment="Left" Height="29" Margin="850,313,0,0" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="220" Background="#BDC7D3"/>
-        <PasswordBox x:Name="textBoxPassword" Password="123" HorizontalAlignment="Left" Height="29" Margin="851,364,0,0" VerticalAlignment="Top" Width="220" Background="#BDC7D3"  KeyDown="textBoxPassword_KeyDown"/>
-        <Button x:Name="buttonLogin" Content="登" HorizontalAlignment="Left" Margin="813,420,0,0" VerticalAlignment="Top" Width="261" Height="33" BorderBrush="Black" FontFamily="Segoe UI Symbol" Click="buttonLogin_Click" Foreground="White" Custom:ButtonHelper.CornerRadius="-2" >
+        <TextBox x:Name="textBoxUsername" HorizontalAlignment="Left" Height="29" Margin="850,313,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="220" Background="#BDC7D3" FontFamily="SimHei"/>
+        <PasswordBox x:Name="textBoxPassword" Password="" HorizontalAlignment="Left" Height="29" Margin="851,364,0,0" VerticalAlignment="Top" Width="220" Background="#BDC7D3"  KeyDown="textBoxPassword_KeyDown"/>
+        <Button x:Name="buttonLogin" Content="登" HorizontalAlignment="Left" Margin="813,420,0,0" VerticalAlignment="Top" Width="261" Height="33" BorderBrush="Black" FontFamily="SimHei" Click="buttonLogin_Click" Foreground="White" Custom:ButtonHelper.CornerRadius="-2" >
             <Button.Background x:Uid="loginButtonColor">
                 <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                     <GradientStop Color="Black" Offset="1"/>
@@ -28,6 +28,6 @@
             </Button.Background>
         </Button>
         
-        <Label x:Name="labelWrongPw" Content="用户名或密码不正确!" HorizontalAlignment="Left" Margin="881,278,0,0" VerticalAlignment="Top" Foreground="Red" Visibility="Hidden"/>
+        <Label x:Name="labelWrongPw" Content="用户名或密码不正确!" HorizontalAlignment="Left" Margin="881,278,0,0" VerticalAlignment="Top" Foreground="Red" Visibility="Hidden" FontFamily="SimHei"/>
     </Grid>
 </Window>

+ 3 - 3
WpfTest1/Toolkits/Constants.cs

@@ -12,15 +12,15 @@ namespace WpfTest1.Toolkits
         //软件名称
         public static string softwareName = "劳拉核心体姿评测系统";
         //编译版本
-        public static string version = "0.4.0.0";
+        public static string version = "0.4.1.0";
         //编译日期
-        public static string compileDate = "20200803";
+        public static string compileDate = "20200806";
         //加密狗验证所使用的pid
         public static string registerPid = "3DE6BA91";
         //加密狗验证所使用的uid
         public static string registerUid = "587E770BB077E785";
         //是否是生产环境
-        public static bool productionEnvironment = false;
+        public static bool productionEnvironment = true;
         //数据库物理地址
         public static string dbPath = System.Environment.CurrentDirectory + "\\Junde.db3";
         //数据库连接直接实用的连接字符串