private void getProfile()
        {
            AdminRepository AdminRepo = new AdminRepository();
            RAdmin          Ra        = AdminRepo.Profile(id);

            this.idtbox.Text       = Ra.Id;
            this.Nametbox.Text     = Ra.Name;
            this.positiontbox.Text = Ra.Position;
            this.passtbox.Text     = Ra.Password;
            this.salarytbox.Text   = Ra.Salary.ToString();
            this.typetbox.Text     = Ra.Type.ToString();
        }
        private void ConfirmbtnClicked(object sender, EventArgs e)
        {
            RAdmin Ra = new RAdmin();

            Ra.Id       = this.idtbox.Text;
            Ra.Password = this.passtbox.Text;

            AdminRepository AdminRepo = new AdminRepository();

            if (AdminRepo.PasswordChange(Ra))
            {
                MessageBox.Show("Password Change Successfully", "Update");
                this.Confirmbtn.Enabled = false;
                this.button1.Enabled    = true;
                this.passtbox.Enabled   = false;
            }
            else
            {
                MessageBox.Show("Can Not Add Data", "Update Error");
            }
        }
示例#3
0
        private void AddClicked(object sender, EventArgs e)
        {
            RAdmin a = new RAdmin();

            a.Id       = this.idtbox.Text;
            a.Name     = this.nametbox.Text;
            a.Position = this.positionCbox.Text;
            a.Password = this.passtbox.Text;
            a.Salary   = Convert.ToDouble(this.salarytbox.Text);
            a.Type     = Convert.ToInt32(this.typetbox.Text);

            AdminRepository adminRepo = new AdminRepository();

            if (adminRepo.AdminAdd(a))
            {
                MessageBox.Show("Admin Information Added", "ADD");
            }
            else
            {
                MessageBox.Show("Can Not Add Data", "Insert Error");
            }
        }
示例#4
0
            private static void OpenConnectionFinal(Connection.Info newConnectionInfo, Connection.Info.Force Force,
                                                    Form ConForm)
            {
                try
                {
                    if (newConnectionInfo.Hostname == "" &&
                        newConnectionInfo.Protocol != Protocols.IntApp)
                    {
                        MessageCollector.AddMessage(MessageClass.WarningMsg,
                                                    Language.strConnectionOpenFailedNoHostname);
                        return;
                    }

                    if (newConnectionInfo.PreExtApp != "")
                    {
                        ExternalTool extA = GetExtAppByName(newConnectionInfo.PreExtApp);
                        if (extA != null)
                        {
                            extA.Start(newConnectionInfo);
                        }
                    }

                    //TODO
                    if (!(((Force & Connection.Info.Force.DoNotJump) == Connection.Info.Force.DoNotJump) || !SwitchToOpenConnection(newConnectionInfo)))
                    {
                        return;
                    }
                    Base newProtocol = new Base();
                        // Create connection based on protocol type
                        switch (newConnectionInfo.Protocol)
                        {
                            case Protocols.RDP:
                                newProtocol = new RDP();
                                break;
                            case Protocols.VNC:
                                newProtocol = new VNC();
                                break;
                            case Protocols.SSH1:
                                newProtocol = new SSH1();
                                break;
                            case Protocols.SSH2:
                                newProtocol = new SSH2();
                                break;
                            case Protocols.Telnet:
                                newProtocol = new Telnet();
                                break;
                            case Protocols.Rlogin:
                                newProtocol = new Rlogin();
                                break;
                            case Protocols.Serial:
                                newProtocol = new Serial();
                                break;
                            case Protocols.RAW:
                                newProtocol = new RAW();
                                break;
                            case Protocols.HTTP:
                                newProtocol = new HTTP(newConnectionInfo.RenderingEngine);
                                break;
                            case Protocols.HTTPS:
                                newProtocol = new HTTPS(newConnectionInfo.RenderingEngine);
                                break;
                            case Protocols.TeamViewer:
                                newProtocol = new TeamViewer();
                                break;
                            case Protocols.RAdmin:
                                newProtocol = new RAdmin();
                                break;
                            case Protocols.ICA:
                                newProtocol = new ICA();
                                break;
                            case Protocols.IntApp:
                                newProtocol = new IntApp();
                                if (newConnectionInfo.ExtApp == "")
                                {
                                    throw (new Exception(Language.strNoExtAppDefined));
                                }
                                break;
                            default:
                                return;
                        }

                    string cPnl;
                    if (((newConnectionInfo.Panel == "") | ((Force & Connection.Info.Force.OverridePanel) == Connection.Info.Force.OverridePanel)) | Settings.Default.AlwaysShowPanelSelectionDlg)
                    {
                        var frmPnl = new frmChoosePanel();
                        if (frmPnl.ShowDialog() == DialogResult.OK)
                        {
                            cPnl = frmPnl.Panel;
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        cPnl = newConnectionInfo.Panel;
                    }

                    Form cForm = ConForm ?? WindowList.FromString(cPnl);

                    if (cForm == null)
                    {
                        cForm = AddPanel(cPnl);
                        cForm.Focus();
                    }
                    else
                    {
                        (cForm as UI.Window.Connection).Show(frmMain.Default.pnlDock);
                        (cForm as UI.Window.Connection).Focus();
                    }

                    Control cContainer = (cForm as UI.Window.Connection).AddConnectionTab(newConnectionInfo);

                    if (newConnectionInfo.Protocol == Protocols.IntApp)
                    {
                        if (GetExtAppByName(newConnectionInfo.ExtApp).Icon != null)
                        {
                            (cContainer as TabPage).Icon =
                                GetExtAppByName(newConnectionInfo.ExtApp).Icon;
                        }
                    }

                    newProtocol.Closed +=  (cForm as UI.Window.Connection).Prot_Event_Closed;
                    newProtocol.Connected += (cForm as UI.Window.Connection).Prot_Event_Connected;
                    newProtocol.Disconnected += Prot_Event_Disconnected;
                    newProtocol.Connected += Prot_Event_Connected;
                    newProtocol.Closed += Prot_Event_Closed;
                    newProtocol.ErrorOccured += Prot_Event_ErrorOccured;
                    (cForm as UI.Window.Connection).ResizeBegin += newProtocol.ResizeBegin;
                    (cForm as UI.Window.Connection).ResizeEnd += newProtocol.ResizeEnd;
                    (cForm as UI.Window.Connection).Resize += newProtocol.Resize;

                    newProtocol.InterfaceControl = new InterfaceControl(cContainer, newProtocol, newConnectionInfo);

                    newProtocol.Force = Force;

                    if (newProtocol.SetProps() == false)
                    {
                        newProtocol.Close();
                        return;
                    }

                    if (newProtocol.Connect() == false)
                    {
                        newProtocol.Close();
                        return;
                    }

                    newConnectionInfo.OpenConnections.Add(newProtocol);

                    if (newConnectionInfo.IsQuicky == false)
                    {
                        if (newConnectionInfo.Protocol != Protocols.IntApp)
                        {
                            Node.SetNodeImage(newConnectionInfo.TreeNode, Enums.TreeImage.ConnectionOpen);
                        }
                        else
                        {
                            ExternalTool extApp = GetExtAppByName((string)newConnectionInfo.ExtApp);
                            if (extApp != null)
                            {
                                if (extApp.TryIntegrate)
                                {
                                    if (newConnectionInfo.TreeNode != null)
                                    {
                                        Node.SetNodeImage(newConnectionInfo.TreeNode,
                                                          Enums.TreeImage.ConnectionOpen);
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageCollector.AddMessage(MessageClass.ErrorMsg,
                                                Language.strConnectionOpenFailed + Constants.vbNewLine +
                                                ex.Message);
                }
            }