コード例 #1
0
ファイル: MpImportSQLite.cs プロジェクト: c1982/mpimport
        //Domain, MsFTP modülü ile.
        public override List<Domain> GetDomains()
        {
            var _tmp = new List<Domain>();

            using (SQLiteConnection _conn = new SQLiteConnection(Settings.Default.connectionString))
            {
                _conn.Open();

                using (SQLiteCommand _cmd = new SQLiteCommand(@"SELECT Domain.DomainId,
                                                                        Domain.Name, Domain.ExpirationDate, Domain.Status,
                                                                    DomainMsFTPUser.Username as ftpUserName, DomainMsFTPUser.Password as FtpPassword,
                                                                    LoginAccount.UserName as DomainUser, LoginAccount.Password as DomainPassword
                                                                FROM Domain
                                                                    LEFT JOIN DomainMsFtp ON DomainMsFtp.DomainId = Domain.DomainId
                                                                    LEFT JOIN DomainMsFTPUser ON DomainMsFTPUser.FtpId = DomainMsFtp.Id
                                                                    LEFT JOIN LoginAccount ON LoginAccount.LoginId = Domain.OwnerLoginId AND LoginAccount.UserName <> 'admin'", _conn))
                {
                    using (SQLiteDataReader _read = _cmd.ExecuteReader())
                    {
                        while (_read.Read())
                        {
                            var _d = new Domain();
                            _d.Id = Convert.ToInt32(_read["DomainId"]);
                            _d.Name = _read["Name"].ToString();
                            _d.Username = _read["ftpUserName"].ToString();
                            _d.Password = _read["FtpPassword"].ToString();

                            _d.Status = Convert.ToInt32(_read["Status"]);

                            if (!_read.IsDBNull(6))
                                _d.ClientName = _read["DomainUser"].ToString();

                            if (!_read.IsDBNull(7))
                                _d.DomainPassword = _read["DomainPassword"].ToString();

                            if (!_read.IsDBNull(2))
                                _d.Expiration = DateTime.Parse(_read["ExpirationDate"].ToString());

                            _tmp.Add(_d);
                        }
                    }
                }
                _conn.Close();
            }

            return _tmp;
        }
コード例 #2
0
ファイル: ImportAccess.cs プロジェクト: c1982/mpimport
        public override List<Domain> GetDomains()
        {
            var _tmp = new List<Domain>();

            using (OleDbConnection _conn = new OleDbConnection(Settings.Default.connectionString))
            {
                _conn.Open();
                using (OleDbCommand _cmd = new OleDbCommand(@"SELECT
                                                                    domains.id,
                                                                    domains.name,
                                                                    hosting.fp_adm,
                                                                    accounts.[password],
                                                                    clients.login,
                                                                    clients.passwd,
                                                                    dom_level_usrs.passwd AS DomainPass,
                                                                    domains.status AS Status,
                                                                    NULL AS expiration
                                                        FROM (((((domains LEFT OUTER JOIN
                                                                    hosting ON hosting.dom_id = domains.id)

                            LEFT OUTER JOIN
                                                                    sys_users ON hosting.sys_user_id = sys_users.id) LEFT OUTER JOIN
                                                                    accounts ON accounts.id = sys_users.account_id) LEFT OUTER JOIN
                                                                    clients ON clients.id = domains.cl_id) LEFT OUTER JOIN
                                                                    dom_level_usrs ON dom_level_usrs.dom_id = domains.id)
                                                            WHERE
                                                                (domains.htype = 'vrt_hst')
                                                        ORDER BY domains.id", _conn))
                {
                    using (OleDbDataReader _read = _cmd.ExecuteReader())
                    {
                        while (_read.Read())
                        {
                            var _d = new Domain();
                            _d.Id = (int)_read["Id"];
                            _d.Name = _read["name"].ToString();
                            _d.Username = _read["fp_adm"].ToString();
                            _d.Password = _read["password"].ToString();
                            _d.ClientName = _read["login"].ToString();
                            _d.Status = Convert.ToInt32(_read["Status"]);

                            if (!_read.IsDBNull(6))
                                _d.DomainPassword = _read["DomainPass"].ToString();

                            if (!_read.IsDBNull(8))
                                _d.Expiration = _d.FromUnixTime(_read["expiration"].ToString());

                            _tmp.Add(_d);
                        }
                    }
                }
                _conn.Close();
            }

            return _tmp;
        }
コード例 #3
0
ファイル: ImportMsSQL.cs プロジェクト: c1982/mpimport
        public override List<Domain> GetDomains()
        {
            var _tmp = new List<Domain>();

            using (SqlConnection _conn = new SqlConnection(Settings.Default.connectionString))
            {
                _conn.Open();
                using (SqlCommand _cmd = new SqlCommand(@"SELECT domains.id, domains.name, hosting.fp_adm, accounts.password, clients.login, clients.passwd,
                                                            dom_level_usrs.passwd As DomainPass, domains.status As Status, limits.value as expiration
                                                        FROM domains
                                                LEFT JOIN hosting ON hosting.dom_id = domains.id
                                                LEFT JOIN sys_users ON hosting.sys_user_id = sys_users.id
                                                LEFT JOIN accounts ON accounts.id = sys_users.account_id
                                                LEFT JOIN clients ON clients.id = domains.cl_id
                                                LEFT JOIN dom_level_usrs ON dom_level_usrs.dom_id = domains.id
                                                LEFT JOIN limits ON limits.id = domains.limits_id AND limits.limit_name = 'expiration'
                                            WHERE
                                                domains.htype = 'vrt_hst'", _conn))
                {
                    using (SqlDataReader _read = _cmd.ExecuteReader())
                    {
                        while (_read.Read())
                        {
                            var _d = new Domain();
                            _d.Id = (int)_read["id"];
                            _d.Name = _read["name"].ToString();
                            _d.Username = _read["fp_adm"].ToString();
                            _d.Password = _read["password"].ToString();
                            _d.ClientName = _read["login"].ToString();
                            _d.Status = (long)_read["Status"];

                            System.Console.WriteLine("Check 1");
                            if (!_read.IsDBNull(6))
                                _d.DomainPassword = _read["DomainPass"].ToString();

                            if (!_read.IsDBNull(8))
                                _d.Expiration = _d.FromUnixTime(_read["expiration"].ToString());

                            _tmp.Add(_d);
                        }
                    }
                }
                _conn.Close();
            }

            return _tmp;
        }