public async void MapReduceStreamingJobTest() { MapReduceStreamingJob job = await hManager.MapReduceStreamingJob( "/tmp/test", "/tmp/output/1", "/bin/cat", "/usr/bin/wc -w", string.Empty, string.Empty, string.Empty, string.Empty, "/tmp/status", string.Empty, string.Empty ); Console.WriteLine(job.ToString()); TableProperty createProperty = await hManager.CreateTableProperty("testing", "table1", "animal", new PropertyValue() { value = "cat" }); if (string.IsNullOrEmpty(createProperty.error)) { Console.WriteLine(string.Format("Column {0}.{1}.{2} has been created", createProperty.database, createProperty.table, "animal")); } else { Console.WriteLine(((Error)createProperty).ToString()); } }
public TableViewModel(string title, TableProperty <double> table) { Title = title; TableRows = table.Rows; TableColumns = table.Columns; for (int r = 0; r < table.Rows; r++) { for (int c = 0; c < table.Columns; c++) { var valueModel = new TableValueModel() { Row = r, Column = c, Value = table[r, c] }; valueModel.OnChange += (int row, int column, double value) => { if (OnChange != null) { OnChange(row, column, value, bInvalidateAll); } }; TextBoxTable.Add(valueModel); } } FloatSlider = new SliderPlusViewModel <double>("SetAll", -10, 10, 0.1); FloatSlider.OnChange += FloatSlider_OnChange; }
public IHttpActionResult GetUsers(string search = null, int page = 1, int pageSize = 10) { var property = new TableProperty { Page = page, Search = search, PageSize = pageSize }; var users = _userService.GetUsers(property); var viewUsers = users.Select(a => new UserViewModel(a)); return(Ok(new { paging = property, users = viewUsers })); }
public async Task <TableProperty> CreateTableProperty(string database, string tableName, string propertyName, PropertyValue propertyValue) { if (string.IsNullOrEmpty(database) || string.IsNullOrEmpty(tableName) || string.IsNullOrEmpty(propertyName)) { throw new Exception("database, table and property are required."); } TableProperty createProperty = await Put <TableProperty>(_webHcatBaseUrl, _webHCatVersion, _webHCatUserName, requestURL.CreateTableProperty(database, tableName, propertyName), propertyValue); return(createProperty); }
/// <summary> /// Returns the properties (columns) in the given table of the given connection's database. /// </summary> /// <param name="tableName"></param> /// <param name="connection"></param> /// <returns>The list of TableProperty objects describing each individual field.</returns> public static List <TableProperty> GetFieldsForTable(string tableName, DbConnection connection) { List <TableProperty> properties = new List <TableProperty>(); string previousPropertyName = null; using (IDataReader reader = connection.RunQuery("SHOW COLUMNS IN " + tableName)) { while (reader.Read()) { TableProperty tableProp = new TableProperty(reader.GetValue(SHOWCOL_FIELD).ToString()); tableProp.Type = reader.GetValue(SHOWCOL_TYPE).ToString(); if (reader.GetValue(SHOWCOL_NULL).ToString() == "YES") { tableProp.IsNullable = true; } else { tableProp.IsNullable = false; } tableProp.Key = reader.GetValue(SHOWCOL_KEY).ToString(); if (reader.GetValue(SHOWCOL_DEFAULT) is System.DBNull) { tableProp.Default = null; } else { // System.Diagnostics.Debug.WriteLine("Type of default for " + tableName + "." + reader.GetValue(SHOWCOL_FIELD).ToString() + ":"); // System.Diagnostics.Debug.WriteLine(reader.GetValue(SHOWCOL_DEFAULT).GetType()); tableProp.Default = reader.GetValue(SHOWCOL_DEFAULT).ToString(); } tableProp.Extra = reader.GetValue(SHOWCOL_EXTRA).ToString(); if (previousPropertyName != null) { tableProp.AfterProperty = previousPropertyName; } previousPropertyName = tableProp.Name; properties.Add(tableProp); } } return(properties); }
public async Task <IActionResult> GetTableSchema([FromBody] string schemaDef) { try { await _loggingFacade.LogAsync(new LogEntry(LogLevels.Info, "Starting GetTableSchema ", "XmlController.cs", "GetTableSchema"), CancellationToken.None); TableProperty result = await Task.Run(() => _xmlApi.GetTableProperty(schemaDef)); return(Ok(result)); } catch (System.Exception ex) { await _loggingFacade.LogExceptionAsync(ex, this.HttpContext?.Request?.Headers["UserName"], LogLevels.Error, "Error in XmlController GetTableSchema() ", CancellationToken.None); return(BadRequest(ex)); } }
private static void SetPaging(TableProperty property, int count) { if (property.PageSize < 1) { property.PageSize = 10; } if (property.Page < 1) { property.Page = 1; } property.Total = count; var pageCount = property.Total / property.PageSize + 1; property.Page = pageCount < property.Page ? pageCount : property.Page; }
public List <User> GetUsers(TableProperty property) { var set = _userRepository.GetSet(); var query = string.IsNullOrWhiteSpace(property.Search) ? set : set.Where(a => a.Name.Contains(property.Search)); var count = query.Count(); SetPaging(property, count); var users = query .OrderBy(a => a.Id) .Skip((property.Page - 1) * property.PageSize) .Take(property.PageSize) .ToList(); return(users); }
public PropertyCtrlViewModel(string name, TableProperty <double> table) { Name = name; IntSliderShow = Visibility.Collapsed; FloatSliderShow = Visibility.Collapsed; ComboBoxShow = Visibility.Collapsed; FileManagerShow = Visibility.Collapsed; TableViewShow = Visibility.Visible; TableViewCtrl = new TableViewModel(Name, table); TableViewCtrl.OnChange += (int row, int column, double value, bool bInvalidateAll) => { table[row, column] = value; if (bInvalidateAll && (OnUpdateImg != null)) { OnUpdateImg(this); } }; }