public List <HAQDetails> GetAll(string rowKey) { List <HAQDetails> dEntList = new List <HAQDetails>(); HAQDetails dEnt = null; TableQuery <HAQDetails> rangeQuery = new TableQuery <HAQDetails>().Where( TableQuery.CombineFilters( TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, _partKey), TableOperators.And, TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.Equal, rowKey) ) ); foreach (HAQDetails e in _table.ExecuteQuery(rangeQuery)) { char[] delim = { ',' }; dEnt = new HAQDetails(); dEnt.RowKey = (e.RowKey == null) ? DEFAULT_STR_VALUE : e.RowKey; //dEnt.Id = (e.RowKey == null) ? "EMPTY" : e.RowKey; dEnt.Name = (e.Name == null) ? DEFAULT_STR_VALUE : e.Name; dEnt.HATopic = (e.HATopic == null) ? DEFAULT_STR_VALUE : e.HATopic; if (dEnt.roles != null) { dEnt.AllowedRoles = dEnt.roles.Split(delim); } dEnt.roles = (e.roles == null) ? DEFAULT_STR_VALUE : e.roles; dEnt.Result = (e.Result == null) ? DEFAULT_STR_VALUE : e.Result; dEntList.Add(dEnt); } return(dEntList); }
public List <HAQDetails> GetAllForRole(string role) { List <HAQDetails> dEntList = new List <HAQDetails>(); HAQDetails dEnt; TableQuery <HAQDetails> rangeQuery = new TableQuery <HAQDetails>().Where( TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, _partKey) ); foreach (HAQDetails e in _table.ExecuteQuery(rangeQuery)) { char[] delim = { ',' }; dEnt = new HAQDetails(); dEnt.RowKey = (e.RowKey == null) ? DEFAULT_STR_VALUE : e.RowKey; //dEnt.Id = (e.RowKey == null) ? "EMPTY" : e.RowKey; dEnt.Name = (e.Name == null) ? DEFAULT_STR_VALUE : e.Name; dEnt.HATopic = (e.HATopic == null) ? DEFAULT_STR_VALUE : e.HATopic; if (e.roles != null) { e.roles = e.roles.Replace(" ", ""); dEnt.AllowedRoles = e.roles.Split(delim); } dEnt.roles = (e.roles == null) ? DEFAULT_STR_VALUE : e.roles; dEnt.Result = (e.Result == null) ? DEFAULT_STR_VALUE : e.Result; if (dEnt.roles.ToLower().IndexOf(role.ToLower()) >= 0) { dEntList.Add(dEnt); } } return(dEntList); }
public void InsertHAQDetails(HAQDetails device) { TableResult result; // Create the table if it doesn't exist. _table.CreateIfNotExists(); try { // Create the TableOperation object that inserts the customer entity. _insertOperation = TableOperation.Insert(device); // Execute the insert operation. result = _table.Execute(_insertOperation); } catch (Exception ex) { throw ex; } }