public async Task EndNewAsync(Authentication authentication) { try { this.ValidateExpired(); var tuple = await this.domain.Dispatcher.InvokeAsync(() => { if (this.Row != null) { throw new InvalidOperationException(); } var fields = this.fields.Values.ToArray(); var name = this.table.TableName; return(fields, name); }); var row = new DomainRowInfo() { TableName = tuple.name, Fields = tuple.fields, }; var info = await this.domain.NewRowAsync(authentication, new DomainRowInfo[] { row }); await this.domain.Dispatcher.InvokeAsync(() => { this.Row = this.table.Rows.Find(info.Value.First().Keys); this.fields = null; }); } catch (Exception e) { this.CremaHost.Error(e); throw; } }
public void Parse(string[][] rows) { if (this.gridContext.HasRectangularSelection() == false) { throw new Exception("여러 범위"); } var targetColumns = this.InitializeTargetColumns(rows.First()); var targetItems = this.InitializeTargetItems(rows); var itemCount = this.items.Length % rows.Length == 0 ? this.items.Length : rows.Length; var columnCount = this.columns.Length % rows.First().Length == 0 ? this.columns.Length : rows.First().Length; var rowInfos = new List <DomainRowInfo>(itemCount); for (var i = 0; i < targetItems.Length; i++) { var item = targetItems[i]; var textFields = rows[i % rows.Length]; var rowInfo = new DomainRowInfo { Fields = this.Fill(targetColumns, textFields), TableName = this.tableName, Keys = CremaDataRowUtility.GetKeys(item) }; rowInfos.Add(rowInfo); } this.domainRows = rowInfos.ToArray(); this.selectedItems = targetItems; this.selectedColumns = targetColumns; }
public void Parse(string[][] rows) { if (this.gridContext.HasRectangularSelection() == false) { throw new Exception("여러 범위"); } var hasHeader = this.ExistsHeader(rows.First()); var targetColumns = this.InitializeTargetColumns(rows.First()); var rowInfos = new List <DomainRowInfo>(); for (var i = hasHeader ? 1 : 0; i < rows.Length; i++) { var textFields = rows[i]; var rowInfo = new DomainRowInfo { Fields = this.Fill(targetColumns, textFields), TableName = CremaDataTable.GetTableName(this.tableName), }; rowInfos.Add(rowInfo); } this.DomainRows = rowInfos.ToArray(); }
public static void RemoveRow(this IDomain domain, Authentication authentication, object item) { var row = new DomainRowInfo() { TableName = CremaDataRowUtility.GetTableName(item), Keys = CremaDataRowUtility.GetKeys(item), }; domain.RemoveRow(authentication, new DomainRowInfo[] { row }); }
public static void RemoveRow(this IDomain domain, Authentication authentication, string tableName, object[] keys) { var row = new DomainRowInfo() { TableName = tableName, Keys = keys, }; domain.RemoveRow(authentication, new DomainRowInfo[] { row }); }
public static object[] NewRow(this IDomain domain, Authentication authentication, string tableName, object[] fields) { var row = new DomainRowInfo() { TableName = tableName, Fields = fields, }; return(domain.NewRow(authentication, new DomainRowInfo[] { row }).First().Keys); }
public static Task RemoveRowAsync(this IDomain domain, Authentication authentication, object item) { var row = new DomainRowInfo() { TableName = CremaDataRowUtility.GetTableName(item), Keys = CremaDataRowUtility.GetKeys(item), }; return(domain.RemoveRowAsync(authentication, new DomainRowInfo[] { row })); }
public static Task RemoveRowAsync(this IDomain domain, Authentication authentication, string tableName, object[] keys) { var row = new DomainRowInfo() { TableName = tableName, Keys = keys, }; return(domain.RemoveRowAsync(authentication, new DomainRowInfo[] { row })); }
public static Task NewRowAsync(this IDomain domain, Authentication authentication, string tableName, object[] fields) { var row = new DomainRowInfo() { TableName = tableName, Fields = fields, }; return(domain.NewRowAsync(authentication, new DomainRowInfo[] { row })); }
public static void SetRow(this IDomain domain, Authentication authentication, object item, string fieldName, object value) { var rowValue = new DomainRowInfo() { TableName = CremaDataRowUtility.GetTableName(item), Keys = CremaDataRowUtility.GetKeys(item), Fields = CremaDataRowUtility.GetFields(item, fieldName, value), }; domain.SetRow(authentication, new DomainRowInfo[] { rowValue }); }
public static void SetRow(this IDomain domain, Authentication authentication, string tableName, object[] keys, object[] fields) { var rowValue = new DomainRowInfo() { TableName = tableName, Keys = keys, Fields = fields, }; domain.SetRow(authentication, new DomainRowInfo[] { rowValue }); }
public static Task SetRowAsync(this IDomain domain, Authentication authentication, string tableName, object[] keys, object[] fields) { var rowValue = new DomainRowInfo() { TableName = tableName, Keys = keys, Fields = fields, }; return(domain.SetRowAsync(authentication, new DomainRowInfo[] { rowValue })); }
public void Clear(Authentication authentication) { this.DataBase.ValidateBeginInDataBase(authentication); this.CremaHost.DebugMethod(authentication, this, nameof(Clear), this.table); var rowInfo = new DomainRowInfo() { TableName = this.table.Name, Keys = DomainRowInfo.ClearKey, }; this.domain.Dispatcher.Invoke(() => this.domain.RemoveRow(authentication, new DomainRowInfo[] { rowInfo, })); }
public async Task ClearAsync(Authentication authentication) { try { this.ValidateExpired(); var name = await this.Dispatcher.InvokeAsync(() => { this.CremaHost.DebugMethod(authentication, this, nameof(ClearAsync), this.Table); return(this.Table.Name); }); var rowInfo = new DomainRowInfo() { TableName = name, Keys = DomainRowInfo.ClearKey, }; await this.Domain.RemoveRowAsync(authentication, new DomainRowInfo[] { rowInfo }); } catch (Exception e) { this.CremaHost.Error(e); throw; } }
public DomainRowEventArgs(Authentication authentication, IDomain domain, DomainRowInfo row) : base(authentication, domain) { this.rows = new DomainRowInfo[] { row }; }