Ejemplo n.º 1
0
        public void UpdateMail(string name)
        {
            MailServer mailServer = new MailServer();
            var        current    = mailServer.GetBy(name);

            if (current != null)
            {
                int  Num;
                bool isNum = int.TryParse(tbxPort.Text, out Num);

                if (isNum)
                {
                    current.Name     = tbxName.Text;
                    current.Server   = tbxServer.Text;
                    current.Username = tbxUsername.Text;
                    current.Password = tbxPassword.Text;
                    current.Port     = Num;

                    int result = current.Update();
                    if (result == 1)
                    {
                        frmManager manager = (frmManager)Application.OpenForms["frmManager"];
                        manager.SelectTab("tabMails");
                        this.Close();
                    }
                }
            }
        }
        private void AddNew()
        {
            Connection conn     = new Connection();
            string     message  = Language.Resource.Message;
            Security   security = new Security();


            bool check = conn.CheckExists(tbxName.Text);

            if (check)
            {
                MessageBox.Show(Language.Resource.NameExists, message);
            }
            else
            {
                conn.Name     = tbxName.Text;
                conn.Server   = tbxServer.Text;
                conn.Database = tbxDatabase.Text;
                conn.Username = tbxUser.Text;
                conn.Password = tbxPassword.Text;
                conn.Provider = tbxProvider.Text;

                int result = conn.Add();
                if (result == 1)
                {
                    frmManager manager = (frmManager)Application.OpenForms["frmManager"];
                    manager.SelectTab("tabConnections");
                    this.Close();
                }
            }
        }
Ejemplo n.º 3
0
        private void AddNew()
        {
            if (User.Current != null)
            {
                Account account = new Account();

                bool check = account.CheckExists(tbxName.Text);

                string message = Language.Resource.Message;

                if (check)
                {
                    MessageBox.Show(Language.Resource.NameExists, message);
                }
                else
                {
                    account.Name        = tbxName.Text;
                    account.Username    = tbxUsername.Text;
                    account.Password    = tbxPassword.Text;
                    account.Description = tbxDescription.Text;
                    int result = account.Add();

                    if (result == 1)
                    {
                        frmManager manager = (frmManager)Application.OpenForms["frmManager"];
                        manager.SelectTab("tabAccounts");
                        this.Close();
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void UpdateUser()
        {
            if (User.Current != null)
            {
                User   user    = new User();
                string message = Language.Resource.Message;

                if (!string.IsNullOrEmpty(tbxUserName.Text))
                {
                    if (_oldPassword == tbxOldPassword.Text)
                    {
                        if (!string.IsNullOrEmpty(tbxNewPassword.Text))
                        {
                            if (tbxNewPassword.Text == tbxConfirm.Text)
                            {
                                user.UserName = tbxUserName.Text;
                                user.Password = tbxNewPassword.Text;
                                user.Email    = tbxEmail.Text;

                                int result = user.Update();

                                if (result == 1)
                                {
                                    frmManager manager = (frmManager)Application.OpenForms["frmManager"];
                                    manager.SelectTab("tabUsers");
                                    this.Close();
                                }
                            }
                            else
                            {
                                MessageBox.Show(Language.Resource.NewPasswordAndConfirmNotTheSame, message);
                            }
                        }
                        else
                        {
                            MessageBox.Show(Language.Resource.NewPasswordRequire, message);
                        }
                    }
                    else
                    {
                        MessageBox.Show(Language.Resource.OldPasswordIncorrect, message);
                    }
                }
                else
                {
                    MessageBox.Show(Language.Resource.UsernameRequired, message);
                }
            }
        }
        public void UpdateConnection(string name)
        {
            Connection conn = new Connection();

            conn.Name     = tbxName.Text;
            conn.Server   = tbxServer.Text;
            conn.Database = tbxDatabase.Text;
            conn.Username = tbxUser.Text;
            conn.Password = tbxPassword.Text;
            conn.Provider = tbxProvider.Text;
            int result = conn.Update();

            if (result == 1)
            {
                frmManager manager = (frmManager)Application.OpenForms["frmManager"];
                manager.SelectTab("tabConnections");
                this.Close();
            }
        }
Ejemplo n.º 6
0
        private void AddNew()
        {
            MailServer mailServer = new MailServer();
            string     message    = Language.Resource.Message;
            Security   security   = new Security();


            bool check = mailServer.CheckExists(tbxName.Text);

            if (check)
            {
                MessageBox.Show(Language.Resource.NameExists, message);
            }
            else
            {
                int  Num;
                bool isNum = int.TryParse(tbxPort.Text, out Num);

                if (isNum)
                {
                    mailServer.Name     = tbxName.Text;
                    mailServer.Server   = tbxServer.Text;
                    mailServer.Username = tbxUsername.Text;
                    mailServer.Password = tbxPassword.Text;
                    mailServer.Port     = Num;

                    int result = mailServer.Add();
                    if (result == 1)
                    {
                        frmManager manager = (frmManager)Application.OpenForms["frmManager"];
                        manager.SelectTab("tabMails");
                        this.Close();
                    }
                }
                else
                {
                    tbxPort.Focus();
                    MessageBox.Show(Language.Resource.NotNumber, message);
                }
            }
        }
Ejemplo n.º 7
0
        public void UpdateAccount(string name)
        {
            if (User.Current != null)
            {
                Account account        = new Account();
                var     currentAccount = account.GetBy(name);

                if (currentAccount != null)
                {
                    account.Name        = tbxName.Text;
                    account.Username    = tbxUsername.Text;
                    account.Password    = tbxPassword.Text;
                    account.Description = tbxDescription.Text;
                    int result = account.Update();

                    if (result == 1)
                    {
                        frmManager manager = (frmManager)Application.OpenForms["frmManager"];
                        manager.SelectTab("tabAccounts");
                        this.Close();
                    }
                }
            }
        }
Ejemplo n.º 8
0
 public void ManagerClick()
 {
     frmManager manager = new frmManager();
     manager.Show();
 }