CNAS取数仪器端升级
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

98 wiersze
3.5KB

  1. using CNAS_DBSync;
  2. using CnasSynchronousCommon;
  3. using CnasSynchronusClient;
  4. using CnasSynchrousModel;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Configuration;
  8. using System.Linq;
  9. using System.Windows.Forms;
  10. namespace CNAS_RunSync
  11. {
  12. static class Program
  13. {
  14. /// <summary>
  15. /// 应用程序的主入口点。
  16. /// </summary>
  17. [STAThread]
  18. static void Main()
  19. {
  20. Application.EnableVisualStyles();
  21. Application.SetCompatibleTextRenderingDefault(false);
  22. string strMsg = "";
  23. // 检查是否已激活
  24. if (!(new ActivationForm()).CheckActivation())
  25. {
  26. MessageBox.Show("无法正常连接cnas库,请先配置数据库连接。");
  27. //// 未激活,显示激活窗口
  28. //using (var activationForm = new ActivationForm())
  29. //{
  30. // if (activationForm.ShowDialog() == DialogResult.OK)
  31. // {
  32. // // 激活成功,显示主窗口
  33. // if (new frmOperationPwd().ShowDialog() == DialogResult.OK)
  34. // Application.Run(new frmSynchrousMain());
  35. // }
  36. //}
  37. }
  38. else
  39. {
  40. CheckAvailability(ref strMsg);
  41. if (strMsg == "")
  42. {
  43. // 已激活,直接显示主窗口
  44. //if (new frmOperationPwd().ShowDialog() == DialogResult.OK)
  45. Application.Run(new frmSynchrousMain());
  46. }
  47. else
  48. MessageBox.Show(strMsg);
  49. }
  50. }
  51. //检查当前电脑是否可以启动程序
  52. public static void CheckAvailability(ref string strErrorMsg)
  53. {
  54. SystemFormatConfig systemFormat = FileOperation.GetSystemFormatConfigData();
  55. GlobalCommonOperation.strStartGeneralVersion = systemFormat.StartGeneralVersion;
  56. GlobalCommonOperation.strStartWebApi = systemFormat.StartWebApi;
  57. GlobalCommonOperation.strWebApiUrl = systemFormat.WebApiUrl;
  58. GlobalCommonOperation.strTargetDbType = systemFormat.TargetDBType;
  59. if (GlobalCommonOperation.strStartGeneralVersion == "1") //此时启动的时通用版本,不需检查Mac地址
  60. {
  61. return;
  62. }
  63. //1.读取本地CNAS数据库配置信息
  64. DataBaseInfo Cnasdb = null;
  65. if (GlobalCommonOperation.strStartWebApi != "1")
  66. Cnasdb = FileOperation.GetLocalCnasDB();
  67. else
  68. Cnasdb = new DataBaseInfo()
  69. {
  70. DataBaseCode = "cnas"
  71. };
  72. if (!CnasDataOperationFact.CnasDataOperation().TestConnect(Cnasdb))
  73. {
  74. strErrorMsg = "无法正常连接CNAS库,请先配置数据库连接。";
  75. return;
  76. }
  77. ////2.获取本机MAC地址
  78. //string strLocalMac = ComputeMessage.getLocalMac(ref strErrorMsg);
  79. //if (strErrorMsg != "")
  80. //{
  81. // return;
  82. //}
  83. ////3 验证是否存在于CNAS数据库相应表中
  84. //bool bIfChecked = CnasDataOperationFact.CnasDataOperation().CheckMacMessage(Cnasdb, strLocalMac);
  85. //if (!bIfChecked)
  86. //{
  87. // strErrorMsg = "当前电脑没有使用权限,请联系管理员。";
  88. // return;
  89. //}
  90. }
  91. }
  92. }