private bool mail_LoadInfo(int iid)
        {
            try
            {
                Settingsite.MailServer info = (new CMailServer()).Getinfo(iid);
                if (info == null || info.Id == 0)
                    info = new Settingsite.MailServer();

                mail_txtId.Value = info.Id.ToString();
                mail_txtSMTPServer.Text = info.SMTPServer;
                mail_txtSMTPPort.Text = info.SMTPPort.ToString();
                mail_chkUseSSL.Checked = info.UseSSL!=0;
                mail_txtReceiver.Text = info.Receiver;
                mail_txtUsername.Text = info.Username;
                mail_txtPassword.Text = CFunctions.MBDecrypt(info.Password);

                return true;
            }
            catch
            {
                return false;
            }
        }
Example #2
0
        private Settingsite.MailServer getDataReader(iSqlDataReader dar)
        {
            try
            {
                int i = -1;
                Settingsite.MailServer info = new Settingsite.MailServer();
                info.SMTPServer = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.SMTPPort = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.UseSSL = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);
                info.Receiver = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Username = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Password = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Timeupdate = dar.IsDBNull(++i) ? new DateTime(0) : dar.GetDateTime(i);
                info.Id = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);

                return info;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private Settingsite.MailServer mail_Take()
        {
            try
            {
                int iid = 0;
                int.TryParse(mail_txtId.Value, out iid);
                Settingsite.MailServer info = (new CMailServer()).Getinfo(iid);
                if (info == null)
                    info = new Settingsite.MailServer();
                info.Id = iid;
                info.SMTPServer = mail_txtSMTPServer.Text.Trim();
                info.SMTPPort = int.Parse(mail_txtSMTPPort.Text.Trim());
                info.UseSSL = mail_chkUseSSL.Checked ? 1 : 0;
                info.Receiver = mail_txtReceiver.Text.Trim();
                info.Username = mail_txtUsername.Text.Trim();
                info.Password = mail_chkChangepassword.Checked ? CFunctions.MBEncrypt(mail_txtPassword.Text) : info.Password;
                info.Timeupdate = DateTime.Now;

                return info;
            }
            catch
            {
                return null;
            }
        }