Example #1
0
        private void SaveSettings(CancelEventArgs e)
        {
            DialogResult dr = MessageBox.Show("确定提交修改?", "确定", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dr == DialogResult.Yes)
            {
                string ftpDesc     = txtFtpDesc.Text.Trim();
                string ftpServer   = txtFtpServer.Text.Trim();
                string userName    = txtUserName.Text.Trim();
                string password    = txtPassword.Text.Trim();
                string defaultPath = txtDefaultPath.Text.Trim();


                // 如果MailFtp为空,则是新增
                if (MailFtp == null)
                {
                    MailFtp mailFtp = new MailFtp(0, ftpDesc, ftpServer, userName, password, defaultPath);
                    MailFtpStorage.AddMailFtp(mailFtp);
                }
                else
                {
                    MailFtp.FtpDesc     = ftpDesc;
                    MailFtp.FtpServer   = ftpServer;
                    MailFtp.UserName    = userName;
                    MailFtp.Password    = password;
                    MailFtp.DefaultPath = defaultPath;

                    MailFtpStorage.UpdateMailFtp(MailFtp);
                }



                MessageBox.Show("保存完成!");
            }
            else
            {
                e.Cancel = true;
            }
        }