Ejemplo n.º 1
0
        /// <summary>
        /// 系统注销
        /// </summary>
        private void LoginOutSystem()
        {
            SocketCls.Emit(ClientSendCmdEnum.logout, "");//退出
            SocketCls.DisConnectServer();
            SocketCls.s.Dispose();
            SocketCls.s = null;
            #region 写日志
            LogModel log = new LogModel()
            {
                CreateTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                Direction       = LogConstParam.Directions_In,
                FunctionName    = "坐席主窗体_系统注销",
                Level           = LogConstParam.LogLevel_Info,
                Msg             = "注销系统",
                Origin          = "汽车衡_" + LoginUser.Role.Name,
                OperateUserName = LoginUser.Name
            };
            Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
            #endregion

            System.Windows.Forms.Application.Restart();
            System.Threading.Thread.Sleep(500);
            Application.Current.Shutdown(0);

            //Login loginWindow = new Login();
            //loginWindow.Show();
            //isAllowClose = true;
            //this.Close();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 关闭系统
 /// </summary>
 private void CloseSystem()
 {
     SocketCls.Emit(ClientSendCmdEnum.logout, "");//退出
     SocketCls.DisConnectServer();
     SocketCls.s.Dispose();
     #region 写日志
     LogModel log = new LogModel()
     {
         Origin       = "汽车衡_" + LoginUser.Role.Name,
         FunctionName = "坐席主窗体_关闭系统",
         Level        = LogConstParam.LogLevel_Info,
         Direction    = LogConstParam.Directions_In,
         Msg          = "发送Socket退出命令【" + ClientSendCmdEnum.logout + "】给任务服务器",
         ParamList    = new List <DataParam>()
         {
             new DataParam()
             {
                 ParamName = "cmd", ParamValue = ClientSendCmdEnum.logout
             }
         },
         CreateTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
         OperateUserName = LoginUser.Name
     };
     Talent.ClinetLog.SysLog.Log(JsonConvert.SerializeObject(log));
     #endregion
     Application.Current.Shutdown();
 }