//MailEnabel Modülü için public override List<Email> GetEmails(string domainName) { var _tmp = new List<Email>(); using (SQLiteConnection _conn = new SQLiteConnection(Settings.Default.connectionString)) { _conn.Open(); using (SQLiteCommand _cmd = new SQLiteCommand(@"SELECT Domain.Name as name, Pu.Username as mail_name, Pu.Password as password,Pu.Quota as mbox_quota FROM Domain LEFT JOIN DomainPostOffice AS Po ON Po.DomainId = Domain.DomainId LEFT JOIN DomainPostOfficeUser As Pu ON Pu.PostOfficeId = Po.Id WHERE Domain.Name = $NAME", _conn)) { _cmd.CommandType = CommandType.Text; _cmd.Parameters.AddWithValue("$NAME", domainName); using (SQLiteDataReader _read = _cmd.ExecuteReader()) { while (_read.Read()) { var _d = new Email(); _d.Name = _read["mail_name"].ToString(); _d.DomainName = _read["name"].ToString(); _d.Password = _read["password"].ToString(); _d.Redirect = ""; _d.RedirectedEmail = ""; _d.Quota = _read.IsDBNull(3) ? -1d : Convert.ToDouble(_read["mbox_quota"]); _tmp.Add(_d); } } } _conn.Close(); } return _tmp; }
public override List<Email> GetEmails(string domainName) { var _tmp = new List<Email>(); using (OleDbConnection _conn = new OleDbConnection(Settings.Default.connectionString)) { _conn.Open(); using (OleDbCommand _cmd = new OleDbCommand(@"SELECT mail.mail_name, domains.name, accounts.[password], domains.status, mail.redirect, mail.redir_addr, mail.mbox_quota FROM ((domains LEFT OUTER JOIN mail ON mail.dom_id = domains.id) LEFT OUTER JOIN accounts ON accounts.id = mail.account_id) WHERE (domains.name = ?) AND (mail.mail_name <> '')", _conn)) { _cmd.CommandType = CommandType.Text; _cmd.Parameters.AddWithValue("NAME", domainName); using (OleDbDataReader _read = _cmd.ExecuteReader()) { while (_read.Read()) { var _d = new Email(); _d.Name = _read["mail_name"].ToString(); _d.DomainName = _read["name"].ToString(); _d.Password = _read["password"].ToString(); _d.Redirect = _read["redirect"].ToString(); _d.RedirectedEmail = _read["redir_addr"].ToString(); _d.Quota = _read.IsDBNull(6) ? -1d : Convert.ToDouble(_read["mbox_quota"]); _tmp.Add(_d); } } } _conn.Close(); } return _tmp; }
public override List<Email> GetEmails(string domainName) { var _tmp = new List<Email>(); using (SqlConnection _conn = new SqlConnection(Settings.Default.connectionString)) { _conn.Open(); using (SqlCommand _cmd = new SqlCommand(@"SELECT mail.mail_name, domains.name, accounts.password, domains.status, mail.redirect, mail.redir_addr, mail.mbox_quota FROM domains LEFT OUTER JOIN mail ON mail.dom_id = domains.id LEFT OUTER JOIN accounts ON accounts.id = mail.account_id WHERE (mail.mail_name <> '') AND (domains.name = @NAME)", _conn)) { _cmd.Parameters.AddWithValue("@NAME", domainName); using (SqlDataReader _read = _cmd.ExecuteReader()) { while (_read.Read()) { var _d = new Email(); _d.Name = _read["mail_name"].ToString(); _d.DomainName = _read["name"].ToString(); _d.Password = _read["password"].ToString(); _d.Redirect = _read["redirect"].ToString(); _d.RedirectedEmail = _read["redir_addr"].ToString(); _d.Quota = (double)_read["mbox_quota"]; _tmp.Add(_d); } } } _conn.Close(); } return _tmp; }