Exemple #1
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (SQ == null)
     {
         var clsSql = new Server();
         clsSql.ServerId    = Convert.ToInt32(txtServerId.Value);
         clsSql.ServerName  = txtServerName.Text;
         clsSql.UserName    = txtUserName.Text;
         clsSql.Passwerd    = Convert.ToInt32(txtPasswerd.Text);
         clsSql.Description = txtDescription.Text;
         objServerManager.Add(clsSql);
         if (eventSQLServerChanged != null)
         {
             eventSQLServerChanged(clsSql);
         }
         DialogResult = DialogResult.OK;
     }
     else
     {
         SQ.ServerId    = Convert.ToInt32(txtServerId.Value);
         SQ.ServerName  = txtServerName.Text;
         SQ.UserName    = txtUserName.Text;
         SQ.Passwerd    = Convert.ToInt32(txtPasswerd.Text);
         SQ.Description = txtDescription.Text;
         objServerManager.Update(SQ);
         if (eventSQLServerChanged != null)
         {
             eventSQLServerChanged(SQ);
         }
         DialogResult = DialogResult.OK;
     }
 }
Exemple #2
0
        private void butNew_Click(object sender, EventArgs e)
        {
            try
            {
                if (Verify() == false)
                {
                    return;
                }

                ServerInfo si = new ServerInfo();

                CopyCfgElement(ref si);

                _sm.Add(si);

                _isModify = true;

                ReindData();

                _sm.SaveToFile();

                LocateRow(si);
            }
            catch (Exception ex)
            {
                MsgBox.ShowException(ex, this);
            }
        }
Exemple #3
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     try
     {
         if (SQ == null)
         {
             Server clsSql = new Server
             {
                 ServerId    = Convert.ToInt32(txtServerId.Text),
                 ServerName  = txtServerName.Text,
                 UserName    = txtUserName.Text,
                 Passwerd    = Convert.ToInt32(txtPasswerd.Text),
                 Description = txtDesc.Text
             };
             objServerManager.Add(clsSql);
             eventSQLServerChanged?.Invoke(clsSql);
             System.Windows.Forms.DialogResult dialogResult = DialogResult;
         }
         else
         {
             SQ.ServerId    = Convert.ToInt32(txtServerId.Text);
             SQ.ServerName  = txtServerName.Text;
             SQ.UserName    = txtUserName.Text;
             SQ.Passwerd    = Convert.ToInt32(txtPasswerd.Text);
             SQ.Description = txtDesc.Text;
             objServerManager.Update(SQ);
             eventSQLServerChanged?.Invoke(SQ);
         }
     }
     catch (Exception ex)
     {
         EventscadaException?.Invoke(GetType().Name, ex.Message);
     }
 }
        private void LogServerStarted()
        {
            var serverItem = new ServerLogItem
            {
                ServerId  = this.Id,
                Date      = this.StartTime,
                EventType = EventTypeEnum.Started
            };

            ServerManager.Add(serverItem, _cs);
        }
        public void LogServerStopped()
        {
            var serverItem = new ServerLogItem
            {
                AvailableClientsCount = GetAvailableClientsCount(),
                ServerId  = this.Id,
                Date      = this.StartTime,
                EventType = EventTypeEnum.Stopped
            };

            ServerManager.Add(serverItem, _cs);
        }
        public void LogServerRunning()
        {
            while (!_stop)
            {
                Thread.Sleep(5000);

                var serverItem = new ServerLogItem
                {
                    AvailableClientsCount = GetAvailableClientsCount(),
                    ServerId  = this.Id,
                    Date      = DateTime.Now,
                    EventType = EventTypeEnum.Running
                };
                ServerManager.Add(serverItem, _cs);
            }
        }