Exemplo n.º 1
0
 internal dloUserGroup(dloUserGroups groups)
 {
     Id      = Guid.NewGuid().ToString();
     _groups = groups;
     _app    = _groups.Application;
     _rights = new dloUserRights(this);
 }
Exemplo n.º 2
0
 internal dloUserRight(dloUserRights rights)
 {
     Id           = Guid.NewGuid().ToString();
     _rights      = rights;
     _application = _rights.Application;
     EditMode     = ObjectStates.Added;
 }
Exemplo n.º 3
0
 internal dloApplicationLog(dloDataApplication application)
 {
     _application = application;
     Id           = Guid.NewGuid().ToString();
     Severity     = 1;
     CreatedOn    = DateTime.Now;
     // CreatedBy = _application.CurrentUser.FullName;
 }
Exemplo n.º 4
0
        internal dloUser(dloUsers users)
        {
            Id      = Guid.NewGuid().ToString();
            _users  = users;
            _app    = _users.Application;
            _rights = new dloUserRights(this);

            EditMode = ObjectStates.None;
        }
Exemplo n.º 5
0
        public bool CheckDeviceState(dloDataApplication application)
        {
            _application = application;
            bool result = false;

            try
            {
                DbCommand cmd = null;
                cmd = _application.DbInfo.Connection.CreateCommand();
                var provider = _application.Provider;
                int count    = 0;
                switch (_application.Provider)
                {
                case DataProviders.SQL:
                case DataProviders.SQLite:
                    cmd.CommandText = string.Format("SELECT COUNT(*) FROM dsto_devices WHERE IMEI ='{0}' AND Status = 1", Imei);
                    if (_application.DbInfo.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        _application.DbInfo.Connection.Open();
                    }
                    count  = (int)_application.DbInfo.ExecuteScalar(cmd);
                    result = count > 0;
                    break;

                case DataProviders.MYSQL:
                    cmd.CommandText = string.Format("SELECT COUNT(*) FROM dsto_devices WHERE IMEI ='{0}' AND Status = 1", Imei);
                    if (_application.DbInfo.Connection.State == System.Data.ConnectionState.Closed)
                    {
                        _application.DbInfo.Connection.Open();
                    }
                    count  = (int)_application.DbInfo.ExecuteScalar(cmd);
                    result = count > 0;
                    break;
                }
            }
            catch (Exception ex)
            {
                result = false;
            }
            finally
            {
                _application.DbInfo.Connection.Close();
            }
            return(result);
        }
Exemplo n.º 6
0
        internal static bool Exists(this dsoDataRow row, dloDataApplication app)
        {
            bool exists = false;

            DataTable     dt = null;
            DbDataAdapter da = null;
            DataRow       dr = null;

            string tableName = row.Table.TableName;
            string guid      = (string)row["Guid"];

            DbCommand cmd = app.DbInfo.CreateSqlCommand();

            switch (app.DbInfo.Provider)
            {
            case DataProviders.SQL:
                da = new SqlDataAdapter();
                break;

            case DataProviders.MYSQL:
                da = new MySqlDataAdapter();
                break;

            case DataProviders.SQLCE:
                // da = new SqlCeDataAdapter();
                break;
            }

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = string.Format("SELECT * FROM {0} WHERE Guid = '{1}'", tableName, guid);

            dt = new DataTable(tableName);

            da.SelectCommand = cmd;
            da.Fill(dt);

            if (dt != null && dt.Rows.Count > 0)
            {
                dr = dt.Rows[0];
            }


            return(exists);
        }
Exemplo n.º 7
0
        public bool ActivateDevice(dloDataApplication application)
        {
            //_application = application;
            //DbCommand cmd = null;
            //bool result = false;
            //try
            //{
            //    cmd = _application.DbInfo.Connection.CreateCommand();
            //    var provider = _application.Configuration.DataStores.Default.Settings.Provider;

            //    switch (provider)
            //    {
            //        case DataProviders.SQL:
            //        case DataProviders.SQLite:
            //            cmd.CommandText = string.Format("UPDATE dsto_devices SET Status = 1 WHERE IMEI ='{0}' ", Imei);
            //            break;
            //        case DataProviders.MYSQL:
            //             cmd.CommandText = string.Format("UPDATE dsto_devices SET Status = 1 WHERE IMEI ='{0}' ", Imei);
            //            break;
            //    }
            //    if (_application.DbInfo.Connection.State == System.Data.ConnectionState.Closed)
            //        _application.DbInfo.Connection.Open();
            //    var res = _application.DbInfo.ExecuteNonQuery(cmd.CommandText);
            //    if (res > -1)
            //    {
            //        result = true;
            //    }
            //    else
            //    {
            //        result = false;
            //    }
            //}
            //catch(Exception ex)
            //{
            //    result = false;

            //}
            //finally
            //{
            //    _application.DbInfo.Connection.Close();
            //}
            return(false);
        }
Exemplo n.º 8
0
 internal dloDevice(dloDataApplication application) : base(null)
 {
     _application = application;
 }
Exemplo n.º 9
0
 internal dloUserRights(dloUserGroup group)
 {
     _group         = group;
     _app           = _group.Application;
     UserRightsType = UserRightsTypes.Group;
 }
Exemplo n.º 10
0
 internal dloUserRights(dloUser user)
 {
     _user          = user;
     _app           = _user.Application;
     UserRightsType = UserRightsTypes.User;
 }
Exemplo n.º 11
0
 internal dloClosedQueston(dloDataApplication application) : base(null)
 {
     _application = application;
 }
Exemplo n.º 12
0
 internal dloDevices(dloDataApplication application)
 {
     _app = application;
 }
Exemplo n.º 13
0
 internal dloUsers(dloDataApplication app)
 {
     _app = app;
 }
Exemplo n.º 14
0
 internal dloApplicationLogs(dloDataApplication application)
 {
     _application = application;
 }
Exemplo n.º 15
0
        // public TableStatisticsCollection TableStatistics { get; private set; }
        #endregion

        internal DatabaseAnalysis(dloDataApplication application)
        {
            _application = application;
            ///TableStatistics = new TableStatisticsCollection();
        }
Exemplo n.º 16
0
 public dloDbInfo(dloDataApplication app)
 {
     //Application = app;
 }