Esempio n. 1
0
 private void barLargeButtonItem3_ItemClick(object sender, ItemClickEventArgs e)
 {
     if (((this.SwitchModuleSM == null) && (ServerSystemInfo.SerialComInfoList != null)) && (ServerSystemInfo.SerialComInfoList.Count != 0))
     {
         SerialComConfig config = (from t in ServerSystemInfo.SerialComInfoList
                                   where t.SerialComType == 1
                                   select t).FirstOrDefault <SerialComConfig>();
         if (config != null)
         {
             this.SwitchModuleSM = new SysManager(config.SerialComInfo.Key, config.SerialComInfo.Value);
         }
     }
     if (ServerSystemInfo.ModuleId == ServerSystemInfo.SoftModuleId)
     {
         CMessageInfo.ShowMessage("该模块已连接!", "模块切换", 1);
         if ((this.client != null) && (this.buffer != null))
         {
             PaidComm.SendBack(this.client, this.buffer, 0);
         }
     }
     else if (CheckInfo.PcCheckState)
     {
         CMessageInfo.ShowMessage("学生机考核进行中,无法操作!", "模块切换", 1);
     }
     else if (CheckInfo.PaidCheckState)
     {
         CMessageInfo.ShowMessage("平板用户考核进行中,无法操作!", "模块切换", 1);
     }
     else
     {
         string msg = string.Empty;
         if (this.SwitchModuleSM.ConnectModule(int.Parse(this._dr["Id"].ToString())))
         {
             ServerSystemInfo.ModuleName   = this._dr["ModuleName"].ToString();
             ServerSystemInfo.ModuleIdBuff = int.Parse(this._dr["Id"].ToString());
             CMessageInfo.ShowMessage("模块切换成功!", "模块切换", 1);
             if ((this.client != null) && (this.buffer != null))
             {
                 PaidComm.SendBack(this.client, this.buffer, 0);
             }
             SysManager.ModuleId = ServerSystemInfo.ModuleId;
             SysManager.ResetFaultPoint();
             msg = string.Format("切换模块[{0}]成功", ServerSystemInfo.ModuleName);
         }
         else
         {
             CMessageInfo.ShowMessage("模块连接失败,请重试!", "模块切换", 1);
             msg = string.Format("切换模块[{0}]失败", this._dr["ModuleName"].ToString());
             if ((this.client != null) && (this.buffer != null))
             {
                 PaidComm.SendBack(this.client, this.buffer, 1);
             }
         }
         this.da.WriteLog(LoginInfo.UserName, msg);
     }
 }