Esempio n. 1
0
 private void btnDel_Click(object sender, EventArgs e)
 {
     if (dgvCommands.CurrentRow != null)
     {
         DBManager db = new DBManager();
         Property command = (Property)dgvCommands.CurrentRow.DataBoundItem;
         db.deleteCommands(this.SelectedUser.phoneId, command.id, command.fId);
     }
     this.dgvCommands.DataSource = new DBObjectProvider().getCommands(this.SelectedUser.phoneId);
 }
Esempio n. 2
0
        public List<Property> getPropertyValues(int idProperty)
        {
            DBManager mdb = new DBManager();
            DataTable dt = mdb.getPropertyValues(idProperty);

            List<Property> list = new List<Property>();

            if (dt != null)
                foreach (DataRow r in dt.Rows)
                {
                    Property p = new Property();
                    p.id = (int)r["idPropertyValue"];
                    p.value = (string)r["value"];
                    list.Add(p);
                }
            return list;
        }
Esempio n. 3
0
        public List<Property> getProperties(int idType)
        {
            DBManager mdb = new DBManager();
            DataTable dt = mdb.getProperties(null,idType);

            List<Property> list = new List<Property>();

            if (dt != null)
                foreach (DataRow r in dt.Rows)
                {
                    Property p = new Property();
                    p.id = (int)r["idProperty"];
                    p.name = (string)r["name"];
                    p.type = (string)r["type"];
                    list.Add(p);
                }
            return list;
        }
Esempio n. 4
0
        public List<File> getFiles(User u)
        {
            DBManager mdb = new DBManager();
            DataTable dt = mdb.getFile(u.phoneId,false);

            List<File> list = new List<File>();

            if (dt != null)
                foreach (DataRow r in dt.Rows)
                {
                    File f = new File();
                    f.name = (string)r["name"];
                    f.process = (bool)r["process"];
                    f.isZip = (bool)r["isZip"];
                    list.Add(f);
                }
            return list;
        }
Esempio n. 5
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if ((dgvCommands.CurrentRow != null) &&
                (cbxType.SelectedItem != null) &&
                (cbxProperty.SelectedItem != null) &&
                (this.cbxValue.SelectedItem != null) &&
                !string.IsNullOrEmpty(cbxCommand.Text))
            {
                DBManager db = new DBManager();
                Property type = (Property)cbxType.SelectedItem;
                Property property = (Property)cbxProperty.SelectedItem;
                Property value = (Property)cbxValue.SelectedItem;
                Property command = (Property)dgvCommands.CurrentRow.DataBoundItem;
                db.InsertCommands(this.SelectedUser.phoneId, command.id, value.id, cbxCommand.Text);

            }
            this.dgvCommands.DataSource = new DBObjectProvider().getCommands(this.SelectedUser.phoneId);
        }
Esempio n. 6
0
        public List<Property> getCommands(string phoneId)
        {
            DBManager mdb = new DBManager();
            DataTable dt = mdb.getCommands(phoneId);

            List<Property> list = new List<Property>();

            if (dt != null)
                foreach (DataRow r in dt.Rows)
                {
                    Property p = new Property();
                    p.id = (int)r["idRule"];
                    p.fId = (int)r["idCondition"];
                    p.name = (string)r["CommandKey"];
                    p.value = (string)r["condition"];
                    list.Add(p);
                }
            return list;
        }
Esempio n. 7
0
        public List<User> getUsers()
        {
            DBManager mdb = new DBManager();
            DataTable dt = mdb.getUsers(null);

            List<User> list = new List<User>();
            if (dt != null)
                foreach (DataRow r in dt.Rows)
                {
                    User u = new User();
                    u.name = (string)r["Name"];
                    u.phoneId = (string)r["phoneId"];
                    u.phoneModel = (string)r["phoneModel"];
                    u.version = (string)r["version"];
                    u.maxLocation = (int)r["maxLocations"];
                    if (r["lastLocationProcess"] != DBNull.Value)
                        u.lastLocationProcess = (DateTime)r["lastLocationProcess"];
                    list.Add(u);
                }
            return list;
        }