public int GetColumnOrdinal(ColumnName columnName) { if (columnNameList == null) throw new InvalidOperationException (string.Format ("Column name {0} not found", columnName)); return Array.FindIndex (columnNameList, a => a.CompareTo (columnName) == 0); }
public int GetColumnOrdinal(ColumnName columnName) { if (columnName.CompareTo (new ColumnName (0)) == 0) return 0; else return -1; }
public int GetColumnOrdinal(ColumnName columnName) { if (columnName.Alias != null) { if (StringComparer.InvariantCultureIgnoreCase.Compare (columnName.Alias, this.Alias) != 0) //throw new InvalidOperationException (string.Format ("Unexpected provider alias {0} when expecting {1}", columnName.Alias, this.Alias)); return -1; else columnName = new ColumnName (null, columnName.Name); } return provider.GetColumnOrdinal (columnName); }
public static int GetColumnIndex(ColumnName columnName) { switch (columnName) { case ColumnName.TESTID: return 1; case ColumnName.DESCRIPTION: return 2; case ColumnName.IN_ID: return 3; case ColumnName.CLIENT_NAME: return 4; default: throw new ArgumentException("Invalid Column Heading in Data Source Schema "); } }
private bool FindValue(Annotation a, ColumnName key, out string value) { if (nameKeyMap.ContainsKey(key)) { HashSet<string> keys = nameKeyMap[key]; foreach (var ck in keys) { if (a.Annotations.ContainsKey(ck)) { value = (a.Annotations[ck] as string).Trim(); return true; } } } value = StatusValue.NA; return false; }
public virtual void Initialize(GqlQueryState gqlQueryState) { provider.Initialize (gqlQueryState); firstLine = ReadLine (); int columns = columnCount; if (columns == -1) columns = firstLine != null ? firstLine.Length : 0; if (columns == -1) throw new Exception ("No columns found in delimited file"); columnNameList = new ColumnName[columns]; for (int i = 0; i < columnNameList.Length; i++) columnNameList [i] = new ColumnName (i); dataString = new DataString[columns]; record = new ProviderRecord (this, false); }
public override int GetHashCode() { return(Schema.GetHashCode() + TableName.GetHashCode() + ColumnName.GetHashCode()); }
public override string ToString() { return($"SqlExpression.Parameter({ColumnName.Quoted()})"); }
private void _getSqlCommandForPostgres(Column column) { OverrideValueType("like", "text"); string like = _ignoreCase ? "ILIKE" : "LIKE"; var props = ColumnName.Split(".".ToCharArray()); var collName = $"\"{props[0]}\""; var propertiesList = new List <string>(); string searchstr = string.Empty; string comm = String.Empty; var jTokenType = column.DotNetType.GetJTokenType(); switch (jTokenType) { case JTokenType.Array when jTokenType == JTokenType.Object: for (int i = 1; i < props.Length - 1; i++) { propertiesList.Add(props[i]); } if (propertiesList.Any()) { searchstr = $"->{String.Join("->", propertiesList.Select(s => $"'{s}'"))}"; } searchstr = $"{searchstr}->>'{props.Last()}'::text"; comm = $"exists (Select 1 from unnest({collName}) as objects where objects{searchstr} {like} @{GetId("like")})"; SetCommand(comm); return; case JTokenType.Object: if (props.Length == 1) { break; } for (int i = 1; i < props.Length - 1; i++) { propertiesList.Add(props[i]); } if (propertiesList.Any()) { searchstr = $"->{String.Join("->", propertiesList.Select(s => $"'{s}'"))}"; } searchstr = $"{searchstr}->>'{props.Last()}'::text"; comm = $"{collName}{searchstr} {like} @{GetId("like")}"; SetCommand(comm); return; } SetCommand($"{collName}::text {like} @{GetId("like")}"); }
public bool Matches(Prop otherProp) { return(ColumnName.Equals(otherProp.ColumnName, StringComparison.InvariantCultureIgnoreCase) && SqlDbType == otherProp.SqlDbType); }
public override int GetHashCode() { return(ColumnName != null?ColumnName.GetHashCode() : 0); }
public SingleColumn(ColumnName columnName, IExpression expr) : base(columnName) { Expression = expr; }
public void Initialize(GqlQueryState gqlQueryState) { regex = new Regex (regexDefinition, caseInsensitive ? RegexOptions.IgnoreCase : RegexOptions.None); string[] groups = regex.GetGroupNames (); columnNameList = groups.Skip (1).Select (p => new ColumnName (p)).ToArray (); for (int i = 0; i < columnNameList.Length; i++) if (groups [i + 1] == (i + 1).ToString ()) columnNameList [i] = new ColumnName (i); else columnNameList [i] = new ColumnName (groups [i + 1]); provider.Initialize (gqlQueryState); record = new ProviderRecord (this, true); dataStrings = new DataString[columnNameList.Length]; for (int i = 0; i < dataStrings.Length; i++) { dataStrings [i] = new DataString (); record.Columns [i] = dataStrings [i]; } }
/// <summary> /// Metoda InitCommand /// Zawiera inicjalizacje koimend występujacych w połączeniu widoku i modelu /// Są to komendy dodawania kolumn do zmiennej,sprawdzania poprawnosci wypełnienia pól w widoku /// oraz komenda przejścia do następnego okna w aplikacji i dodanie kolumn do pliku /// </summary> private void InitCommand() { AddColumnCommand = new RelayCommand(() => { if (ColumnName == null || ColumnName.FirstOrDefault() >= '0' && ColumnName.FirstOrDefault() <= '9' || ColumnName == "") { MessageBoxResult result = MessageBox.Show("Podaj prawidłową nazwę", "Confirmation", MessageBoxButton.OK); AddOrNot = ""; } else if (ColumnType == null) { MessageBox.Show("Wybierz typ kolumny", "Confirmation", MessageBoxButton.OK); } else { for (int indexName = 0; indexName < Dt.Columns.Count; indexName++) { if (ColumnName == Dt.Columns[indexName].ToString()) { add = 0; break; } else { add = 1; } } if (add == 0) { MessageBoxResult result = MessageBox.Show("Taka kolumna juz istnieje", "Confirmation", MessageBoxButton.OK); ColumnName = ""; AddOrNot = ""; } else if (add == 1) { Dt.Columns.Add(ColumnName); CellType cellType; if (ColumnType == "String") { cellType = CellType.String; } else if (ColumnType == "Numeryczny") { cellType = CellType.Numeric; } else { cellType = CellType.Boolean; } ViewModelLocator.ColumnType.Add(cellType); ColumnName = ""; AddOrNot = "Dodano"; ColumnType = null; } } }); GoNextCommand = new RelayCommand(() => { string path = navigationService.Parameter.ToString(); FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read); IWorkbook woorkbook = new XSSFWorkbook(stream); stream.Close(); string SheetName = woorkbook.GetSheetName(0); ISheet sheet = woorkbook.GetSheet(SheetName); IRow row = sheet.CreateRow(0); for (int j = 0; j < Dt.Columns.Count; j++) { var cell = row.CreateCell(j); cell.SetCellValue(Dt.Columns[j].ToString()); } stream = new FileStream(path, FileMode.Create, FileAccess.Write); woorkbook.Write(stream); stream.Close(); AddOrNot = ""; Dt.Clear(); App.Current.MainWindow.Hide(); ViewModelLocator.Param = path; ActionLoadedBase ActionWindow = new ActionLoadedBase(); ActionWindow.ShowDialog(); App.Current.MainWindow.Show(); }); }
public override int GetHashCode() { return(Tools.Object.CombineHashCodes(ColumnName.GetHashCode(), Value != null ? Value.GetHashCode() : 0)); }
public override int GetHashCode() { return(ColumnName.GetHashCode()); }
public ColumnNameShould() { _name = "Number"; _columnName = new ColumnName(_name); }
public static SheetPage DeconstructDatasheetCode(DatasheetType datasheetType) { SheetPage sheetPage = new SheetPage(); sheetPage.sheetName = datasheetType.GetIdentifier(); sheetPage.index = (int)datasheetType; Type recordType = Type.GetType(SheetStringDefinitions.NAMESPACE + "." + sheetPage.sheetRecordName + SheetStringDefinitions.ASSEMBLY_LOCATION); FieldInfo[] fieldInfos = recordType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance); fieldInfos = fieldInfos.Where(i => i.IsPublic || i.GetCustomAttribute <SerializeField>() != null).ToArray(); sheetPage.columns = new List <SheetColumn>(fieldInfos.Length); for (int i = 0; i < fieldInfos.Length; i++) { FieldInfo fieldInfo = fieldInfos[i]; SheetColumn column = new SheetColumn(); sheetPage.columns.Add(column); ColumnName columnNameAttribute = fieldInfo.GetCustomAttribute <ColumnName>(); column.serializationName = columnNameAttribute.columnName; column.propertyName = fieldInfo.Name.Remove(0, 1).FirstLetterToUpper(); column.isCollection = fieldInfo.FieldType.IsArray; column.dataType = GetDataType(fieldInfo.FieldType); if (column.dataType == SheetDataType.Reference) { string typeName = fieldInfo.FieldType.Name; string datasheetName; if (column.isCollection) { datasheetName = typeName.Remove(typeName.Length - SheetStringDefinitions.IDENTIFIER_SUFFIX.Length - SheetStringDefinitions.ARRAY_VARIABLE_SUFFIX.Length); } else { datasheetName = typeName.Remove(typeName.Length - SheetStringDefinitions.IDENTIFIER_SUFFIX.Length); } column.referenceSheet = Enum.Parse(typeof(DatasheetType), datasheetName).GetIdentifier(); } } Type modelType = Type.GetType(SheetStringDefinitions.NAMESPACE + "." + sheetPage.sheetModelNameUpperCase + SheetStringDefinitions.ASSEMBLY_LOCATION); object modelObject = AssetDatabase.LoadAssetAtPath(sheetPage.scriptableObjectFileLocation, modelType); FieldInfo recordsFieldInfo = modelType.GetField(SheetStringDefinitions.RECORDS_PROPERTY_NAME, BindingFlags.NonPublic | BindingFlags.Instance); Array modelRecords = (Array)recordsFieldInfo.GetValue(modelObject); Type recordBaseType = recordType.BaseType; FieldInfo recordIdentifierFieldInfo = recordBaseType.GetField(SheetStringDefinitions.RECORD_IDENTIFIER_VARIABLE, BindingFlags.NonPublic | BindingFlags.Instance); Type identifierType = Type.GetType(sheetPage.sheetIdentifierName + SheetStringDefinitions.ASSEMBLY_LOCATION); sheetPage.rows = new List <SheetRow>(modelRecords.Length); for (int i = 0; i < modelRecords.Length; i++) { object record = modelRecords.GetValue(i); SheetRow sheetRow = new SheetRow(); sheetPage.rows.Add(sheetRow); object identifierEnumValue = recordIdentifierFieldInfo.GetValue(record); sheetRow.index = (int)identifierEnumValue; sheetRow.identifier = identifierEnumValue.GetIdentifier(); sheetRow.enumValue = identifierEnumValue.ToString(); sheetRow.cells = new List <SheetCell>(fieldInfos.Length); for (int j = 0; j < fieldInfos.Length; j++) { FieldInfo fieldInfo = fieldInfos[j]; SheetColumn column = sheetPage.columns[j]; object data = fieldInfo.GetValue(record); if (data == null) { data = column.GetDefaultCellValue(); } if (column.dataType == SheetDataType.Reference) { if (column.isCollection) { Array arrayData = ((Array)data); string[] stringData = new string[arrayData.Length]; for (int h = 0; h < arrayData.Length; h++) { stringData[h] = arrayData.GetValue(h).GetIdentifier(); } data = stringData; } else { data = data.GetIdentifier(); } } SheetCell cell = new SheetCell(data); sheetRow.cells.Add(cell); } } return(sheetPage); }
public int GetColumnOrdinal(ColumnName columnName) { return -1; }
/// <summary> /// Gets the name of the column. /// </summary> /// <param name="dbName">Name of the db.</param> /// <param name="extraction">The extraction.</param> /// <param name="nameFormat">The name format.</param> /// <returns></returns> public ColumnName GetColumnName(string dbName, WordsExtraction extraction, NameFormat nameFormat) { var words = GetLanguageWords(nameFormat.Culture); var columnName = new ColumnName { DbName = dbName }; columnName.NameWords = ExtractWords(words, dbName, extraction); // if no extraction (preset name, just copy it) if (extraction == WordsExtraction.None) columnName.PropertyName = dbName; else columnName.PropertyName = Format(words, columnName.NameWords, nameFormat.Case, Singularization.DontChange); return columnName; }
protected override void Execute(CodeActivityContext context) { DataTable dataTable = DataTable.Get(context); string lookupValue = LookupValue.Get(context); DataColumn dataColumn = DataColumn.Get(context); DataColumn targetDataColumn = TargetDataColumn.Get(context); Int32 columnIndex = ColumnIndex.Get(context); Int32 targetColumnIndex = ColumnIndex.Get(context); string columnName = ColumnName.Get(context); string targetColumnName = TargetColumnName.Get(context); object cellValue = null; Int32 rowIndex = 0; try { int beginIndex = 0, endInex = 0; DataColumn beginColumn = new DataColumn(); if (dataColumn != null) { beginIndex = dataTable.Columns.IndexOf(dataColumn); } else if (columnName != null && columnName != "") { beginIndex = dataTable.Columns.IndexOf(columnName); } else { beginIndex = columnIndex; } if (targetDataColumn != null) { endInex = dataTable.Columns.IndexOf(targetDataColumn); } else if (targetColumnName != null && targetColumnName != "") { endInex = dataTable.Columns.IndexOf(targetColumnName); } else { endInex = targetColumnIndex; } if (beginIndex < 0 || endInex < 0 || beginIndex > endInex) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "数据表列索引有误,请检查开始列与结束列"); return; } DataRowCollection dataRows = dataTable.Rows; for (int index = beginIndex; index < endInex; index++) { foreach (DataRow datarow in dataRows) { object data = datarow[index]; string dataStr = data as string; if (dataStr.Equals(lookupValue)) { rowIndex = dataRows.IndexOf(datarow); cellValue = data; break; } } } if (CellValue != null) { CellValue.Set(context, cellValue); } if (RowIndex != null) { RowIndex.Set(context, rowIndex); } } catch (Exception e) { SharedObject.Instance.Output(SharedObject.enOutputType.Error, "查找数据表失败", e.Message); } }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns> public override int GetHashCode() { return((ColumnName?.GetHashCode(StringComparison.OrdinalIgnoreCase) ?? 0) + (int)Direction); }
private string FindValue(Annotation a, ColumnName key) { string result; FindValue(a, key, out result); return result; }
/// <summary> ///Validate Fields and create LookupInfo if required /// </summary> public void InitFinish() { // Not null fields if (DisplayLogic == null) { DisplayLogic = ""; } if (DefaultValue == null) { DefaultValue = ""; } if (FieldGroup == null) { FieldGroup = ""; } if (Description == null) { Description = ""; } if (Help == null) { Help = ""; } if (Callout == null) { Callout = ""; } if (ReadOnlyLogic == null) { ReadOnlyLogic = ""; } // Create Lookup, if not ID if (ctx.SkipLookup) //No need if call from Visual editor { return; } if (DisplayType.IsLookup(displayType)) { if (IsDisplayedf || IsDisplayedMR || ColumnName.ToLower().Equals("createdby") || ColumnName.ToLower().Equals("updatedby")) { try { lookupInfo = VLookUpFactory.GetLookUpInfo(ctx, windowNo, displayType, AD_Column_ID, Env.GetLanguage(ctx), ColumnName, AD_Reference_Value_ID, IsParent, ValidationCode); } catch (Exception e) // Cannot create Lookup { VLogger.Get().Log(Level.SEVERE, "No LookupInfo for " + ColumnName, e); displayType = DisplayType.ID; } } else { displayType = DisplayType.ID; } } }
public List <CCBTransaction> ParseCSV(string fileLocation, bool useImportFormat) { List <CCBTransaction> TransactionSet = new List <CCBTransaction>(); Dictionary <string, int> ColumnMapping = new Dictionary <string, int>(); if (!File.Exists(fileLocation)) { throw new IOException(string.Format("CSV file does not exist: {0}", fileLocation)); } TransactionSet.Clear(); string FullFile = File.ReadAllText(fileLocation); bool HaveHeaders = false; string AccountID = string.Empty; int LineIndex = 0; bool UseLFonly = FullFile.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).Length < FullFile.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries).Length; foreach (string RawLine in FullFile.Split( UseLFonly ? new string[] { "\n" } : new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries)) { LineIndex++; if (RawLine.Length == 0) { continue; } if (!HaveHeaders) { string[] ColumnNames = ParseLine(RawLine); int Offset = 0; foreach (string ColumnName in ColumnNames) { ColumnMapping.Add(ColumnName.Trim(), Offset++); } HaveHeaders = true; } else { try { string[] ColumnValues = ParseLine(RawLine); if (useImportFormat) { TransactionSet.Add( new CCBTransaction( IDcounter++, DateTime.Parse(ColumnValues[ColumnMapping["Date"]]), DoubleOrNothing(ColumnValues[ColumnMapping["Amount"]]), ColumnValues[ColumnMapping["Description"]], ColumnValues[ColumnMapping["Category"]], ColumnValues[ColumnMapping["Account"]], ColumnValues[ColumnMapping["Jive"]] == "yes" ? true : false, ColumnValues[ColumnMapping["Check"]], ColumnValues[ColumnMapping["Payee"]], ColumnValues[ColumnMapping["Memo"]], string.Empty )); } else { TransactionSet.Add( new CCBTransaction( IDcounter++, DateTime.Parse(ColumnValues[ColumnMapping["Date(MM/DD/YYYY)"]]), DoubleOrNothing(ColumnValues[ColumnMapping["Amount"]]), ColumnValues[ColumnMapping["Description"]], ColumnValues[ColumnMapping["Category"]], ColumnValues[ColumnMapping["Account"]], ColumnValues[ColumnMapping["Jived"]] == "yes" ? true : false, ColumnValues[ColumnMapping["Check Number"]], ColumnValues[ColumnMapping["Payee"]], ColumnValues[ColumnMapping["Memo"]], ColumnValues[ColumnMapping["User"]] )); } } catch (Exception e1) { Console.WriteLine("Error parsing line #{0}:\r\n{1}\r\n\r\n{2}", LineIndex, RawLine, DetailedException.WithEnteriseContent(ref e1)); throw; } } } return(TransactionSet); }
public wnd_RenameColumn() { InitializeComponent(); ColumnName.SelectAll(); }
public bool NameNotIn(string[] excludedNames) { return(!excludedNames.Contains(ColumnName.ToLower())); }
protected override MergeResult DoMerge(Operation operation) { if (base.DoMerge(operation) == MergeResult.Stop) { return(MergeResult.Stop); } switch (operation) { case RemoveExtendedPropertyOperation otherAsRemovePropertyOp: { var thisPropertyName = GetPropertyName(this); var otherPropertyName = GetPropertyName(otherAsRemovePropertyOp); if (thisPropertyName.Equals(otherPropertyName, StringComparison.InvariantCultureIgnoreCase)) { Disabled = operation.Disabled = true; return(MergeResult.Stop); } break; } case RemoveSchemaOperation otherAsRemoveSchemaOp when ForSchema && SchemaName.Equals(otherAsRemoveSchemaOp.Name, StringComparison.InvariantCultureIgnoreCase): Disabled = true; break; case RemoveTableOperation otherAsRemoveTableOp when ForTable && TableViewObjectName.Equals(otherAsRemoveTableOp.ObjectName, StringComparison.InvariantCultureIgnoreCase): Disabled = true; break; case RemoveViewOperation otherAsRemoveViewOp when ForView && TableViewObjectName.Equals(otherAsRemoveViewOp.ObjectName, StringComparison.InvariantCultureIgnoreCase): Disabled = true; break; case RenameColumnOperation otherAsRenameColumnOp when TableViewObjectName.Equals(otherAsRenameColumnOp.TableObjectName, StringComparison.InvariantCultureIgnoreCase) && ForColumn && ColumnName.Equals(otherAsRenameColumnOp.Name, StringComparison.InvariantCultureIgnoreCase): ColumnName = otherAsRenameColumnOp.NewName; break; case RenameObjectOperation otherAsRenameOp when TableViewObjectName.Equals(otherAsRenameOp.ObjectName, StringComparison.InvariantCultureIgnoreCase): TableViewName = otherAsRenameOp.NewName; break; case UpdateExtendedPropertyOperation updateExtendedPropOp when !(this is RemoveExtendedPropertyOperation): { var thisPropertyName = GetPropertyName(this); var otherPropertyName = GetPropertyName(updateExtendedPropOp); if (thisPropertyName.Equals(otherPropertyName, StringComparison.InvariantCultureIgnoreCase)) { Value = updateExtendedPropOp.Value; updateExtendedPropOp.Disabled = true; return(MergeResult.Continue); } break; } case UpdateTableOperation otherAsUpdateTableOp when ForTable && ForColumn && TableViewObjectName.Equals(otherAsUpdateTableOp.ObjectName, StringComparison.InvariantCultureIgnoreCase): { foreach (var deletedColumnName in otherAsUpdateTableOp.RemoveColumns) { if (ColumnName.Equals(deletedColumnName, StringComparison.InvariantCultureIgnoreCase)) { Disabled = true; return(MergeResult.Stop); } } break; } } return(MergeResult.Continue); }
public Column(ColumnName columnName) : base(columnName) { }
public static IWebElement getRowFromTableByColumnName(String nameItem, String waitElementByClassName, ColumnName tableValue) { waitForClassName(waitElementByClassName); var table = Driver.Instance.FindElement(By.XPath("//div[@class='ag-body-container']")); var rows = table.FindElements(By.ClassName("ag-row")); IWebElement rowMatch = null; foreach (var row in rows) { if (!row.Text.Equals(String.Empty)) { var rowName = row.FindElements(By.ClassName("ag-cell-not-inline-editing"))[1].Text; if (rowName.Equals(nameItem)) { switch (tableValue) { case ColumnName.Check: rowMatch = row.FindElements(By.ClassName("ag-cell-not-inline-editing"))[0]; break; case ColumnName.Name: rowMatch = row.FindElements(By.ClassName("ag-cell-not-inline-editing"))[1]; break; case ColumnName.Delete: rowMatch = row.FindElements(By.ClassName("ag-cell-not-inline-editing"))[5]; break; } break; } } } return(rowMatch); }
public int GetColumnOrdinal(ColumnName columnName) { return Array.FindIndex (columnNames, a => a.CompareTo (columnName) == 0); }
/// <summary> /// LUA结构支持 /// </summary> /// <returns></returns> public override void GetLuaStruct(StringBuilder code) { base.GetLuaStruct(code); int idx; if (!string.IsNullOrWhiteSpace(PropertyName)) { code.AppendLine($@"['PropertyName'] = '{PropertyName.ToLuaString()}',"); } else { code.AppendLine($@"['PropertyName'] = nil,"); } code.AppendLine($@"['IsCaption'] ={(IsCaption.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(Alias)) { code.AppendLine($@"['Alias'] = '{Alias.ToLuaString()}',"); } else { code.AppendLine($@"['Alias'] = nil,"); } if (!string.IsNullOrWhiteSpace(Group)) { code.AppendLine($@"['Group'] = '{Group.ToLuaString()}',"); } else { code.AppendLine($@"['Group'] = nil,"); } code.AppendLine($@"['CreateIndex'] ={(CreateIndex.ToString().ToLower())},"); code.AppendLine($@"['IsPrimaryKey'] ={(IsPrimaryKey.ToString().ToLower())},"); code.AppendLine($@"['IsExtendKey'] ={(IsExtendKey.ToString().ToLower())},"); code.AppendLine($@"['IsIdentity'] ={(IsIdentity.ToString().ToLower())},"); code.AppendLine($@"['IsGlobalKey'] ={(IsGlobalKey.ToString().ToLower())},"); code.AppendLine($@"['UniqueIndex'] ={UniqueIndex},"); code.AppendLine($@"['IsRequired'] ={(IsRequired.ToString().ToLower())},"); code.AppendLine($@"['IsUserReadOnly'] ={(IsUserReadOnly.ToString().ToLower())},"); code.AppendLine($@"['IsMemo'] ={(IsMemo.ToString().ToLower())},"); code.AppendLine($@"['DenyClient'] ={(DenyClient.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(Prefix)) { code.AppendLine($@"['Prefix'] = '{Prefix.ToLuaString()}',"); } else { code.AppendLine($@"['Prefix'] = nil,"); } if (!string.IsNullOrWhiteSpace(Suffix)) { code.AppendLine($@"['Suffix'] = '{Suffix.ToLuaString()}',"); } else { code.AppendLine($@"['Suffix'] = nil,"); } if (!string.IsNullOrWhiteSpace(InputType)) { code.AppendLine($@"['InputType'] = '{InputType.ToLuaString()}',"); } else { code.AppendLine($@"['InputType'] = nil,"); } if (!string.IsNullOrWhiteSpace(ComboBoxUrl)) { code.AppendLine($@"['ComboBoxUrl'] = '{ComboBoxUrl.ToLuaString()}',"); } else { code.AppendLine($@"['ComboBoxUrl'] = nil,"); } code.AppendLine($@"['IsMoney'] ={(IsMoney.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(GridAlign)) { code.AppendLine($@"['GridAlign'] = '{GridAlign.ToLuaString()}',"); } else { code.AppendLine($@"['GridAlign'] = nil,"); } if (!string.IsNullOrWhiteSpace(DataFormater)) { code.AppendLine($@"['DataFormater'] = '{DataFormater.ToLuaString()}',"); } else { code.AppendLine($@"['DataFormater'] = nil,"); } code.AppendLine($@"['DenyClient'] ={(DenyClient.ToString().ToLower())},"); code.AppendLine($@"['GridDetails'] ={(GridDetails.ToString().ToLower())},"); code.AppendLine($@"['NoneGrid'] ={(NoneGrid.ToString().ToLower())},"); code.AppendLine($@"['NoneDetails'] ={(NoneDetails.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(GridDetailsCode)) { code.AppendLine($@"['GridDetailsCode'] = '{GridDetailsCode.ToLuaString()}',"); } else { code.AppendLine($@"['GridDetailsCode'] = nil,"); } if (!string.IsNullOrWhiteSpace(CppType)) { code.AppendLine($@"['CppType'] = '{CppType.ToLuaString()}',"); } else { code.AppendLine($@"['CppType'] = nil,"); } if (CppTypeObject != null) { code.AppendLine($@"['CppTypeObject'] ='{CppTypeObject}',"); } if (!string.IsNullOrWhiteSpace(CppName)) { code.AppendLine($@"['CppName'] = '{CppName.ToLuaString()}',"); } else { code.AppendLine($@"['CppName'] = nil,"); } if (!string.IsNullOrWhiteSpace(CppLastType)) { code.AppendLine($@"['CppLastType'] = '{CppLastType.ToLuaString()}',"); } else { code.AppendLine($@"['CppLastType'] = nil,"); } code.AppendLine($@"['IsIntDecimal'] ={(IsIntDecimal.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(CsType)) { code.AppendLine($@"['CsType'] = '{CsType.ToLuaString()}',"); } else { code.AppendLine($@"['CsType'] = nil,"); } if (!string.IsNullOrWhiteSpace(CustomType)) { code.AppendLine($@"['CustomType'] = '{CustomType.ToLuaString()}',"); } else { code.AppendLine($@"['CustomType'] = nil,"); } if (!string.IsNullOrWhiteSpace(LastCsType)) { code.AppendLine($@"['LastCsType'] = '{LastCsType.ToLuaString()}',"); } else { code.AppendLine($@"['LastCsType'] = nil,"); } if (EnumConfig != null) { code.AppendLine($@"['EnumConfig'] = {EnumConfig.GetLuaStruct()},"); } code.AppendLine($@"['IsCompute'] ={(IsCompute.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(ComputeGetCode)) { code.AppendLine($@"['ComputeGetCode'] = '{ComputeGetCode.ToLuaString()}',"); } else { code.AppendLine($@"['ComputeGetCode'] = nil,"); } if (!string.IsNullOrWhiteSpace(ComputeSetCode)) { code.AppendLine($@"['ComputeSetCode'] = '{ComputeSetCode.ToLuaString()}',"); } else { code.AppendLine($@"['ComputeSetCode'] = nil,"); } code.AppendLine($@"['IsMiddleField'] ={(IsMiddleField.ToString().ToLower())},"); code.AppendLine($@"['InnerField'] ={(InnerField.ToString().ToLower())},"); code.AppendLine($@"['IsSystemField'] ={(IsSystemField.ToString().ToLower())},"); code.AppendLine($@"['IsInterfaceField'] ={(IsInterfaceField.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(Initialization)) { code.AppendLine($@"['Initialization'] = '{Initialization.ToLuaString()}',"); } else { code.AppendLine($@"['Initialization'] = nil,"); } if (!string.IsNullOrWhiteSpace(EmptyValue)) { code.AppendLine($@"['EmptyValue'] = '{EmptyValue.ToLuaString()}',"); } else { code.AppendLine($@"['EmptyValue'] = nil,"); } code.AppendLine($@"['DenyScope'] ='{DenyScope}',"); code.AppendLine($@"['Nullable'] ={(Nullable.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(Max)) { code.AppendLine($@"['Max'] = '{Max.ToLuaString()}',"); } else { code.AppendLine($@"['Max'] = nil,"); } if (!string.IsNullOrWhiteSpace(Min)) { code.AppendLine($@"['Min'] = '{Min.ToLuaString()}',"); } else { code.AppendLine($@"['Min'] = nil,"); } code.AppendLine($@"['UniqueString'] ={(UniqueString.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(ColumnName)) { code.AppendLine($@"['ColumnName'] = '{ColumnName.ToLuaString()}',"); } else { code.AppendLine($@"['ColumnName'] = nil,"); } code.AppendLine($@"['DbNullable'] ={(DbNullable.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(DbType)) { code.AppendLine($@"['DbType'] = '{DbType.ToLuaString()}',"); } else { code.AppendLine($@"['DbType'] = nil,"); } code.AppendLine($@"['Precision'] ={Datalen},"); if (!string.IsNullOrWhiteSpace(ArrayLen)) { code.AppendLine($@"['ArrayLen'] = '{ArrayLen.ToLuaString()}',"); } else { code.AppendLine($@"['ArrayLen'] = nil,"); } code.AppendLine($@"['Scale'] ={Scale},"); code.AppendLine($@"['DbIndex'] ={DbIndex},"); code.AppendLine($@"['Unicode'] ={(Unicode.ToString().ToLower())},"); code.AppendLine($@"['FixedLength'] ={(FixedLength.ToString().ToLower())},"); code.AppendLine($@"['IsBlob'] ={(IsBlob.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(StorageProperty)) { code.AppendLine($@"['StorageProperty'] = '{StorageProperty.ToLuaString()}',"); } else { code.AppendLine($@"['StorageProperty'] = nil,"); } code.AppendLine($@"['DbInnerField'] ={(DbInnerField.ToString().ToLower())},"); code.AppendLine($@"['NoStorage'] ={(NoStorage.ToString().ToLower())},"); code.AppendLine($@"['KeepStorageScreen'] ='{KeepStorageScreen}',"); code.AppendLine($@"['CustomWrite'] ={(CustomWrite.ToString().ToLower())},"); code.AppendLine($@"['IsLinkField'] ={(IsLinkField.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(LinkTable)) { code.AppendLine($@"['LinkTable'] = '{LinkTable.ToLuaString()}',"); } else { code.AppendLine($@"['LinkTable'] = nil,"); } code.AppendLine($@"['IsLinkKey'] ={(IsLinkKey.ToString().ToLower())},"); code.AppendLine($@"['IsLinkCaption'] ={(IsLinkCaption.ToString().ToLower())},"); code.AppendLine($@"['IsUserId'] ={(IsUserId.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(LinkField)) { code.AppendLine($@"['LinkField'] = '{LinkField.ToLuaString()}',"); } else { code.AppendLine($@"['LinkField'] = nil,"); } code.AppendLine($@"['IsCustomCompute'] ={(IsCustomCompute.ToString().ToLower())},"); code.AppendLine($@"['CanGet'] ={(CanGet.ToString().ToLower())},"); code.AppendLine($@"['CanSet'] ={(CanSet.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(AccessType)) { code.AppendLine($@"['AccessType'] = '{AccessType.ToLuaString()}',"); } else { code.AppendLine($@"['AccessType'] = nil,"); } code.AppendLine($@"['ReadOnly'] ={(ReadOnly.ToString().ToLower())},"); code.AppendLine($@"['CanInput'] ={(CanUserInput.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(ExtendRole)) { code.AppendLine($@"['ExtendRole'] = '{ExtendRole.ToLuaString()}',"); } else { code.AppendLine($@"['ExtendRole'] = nil,"); } if (!string.IsNullOrWhiteSpace(ValueSeparate)) { code.AppendLine($@"['ValueSeparate'] = '{ValueSeparate.ToLuaString()}',"); } else { code.AppendLine($@"['ValueSeparate'] = nil,"); } if (!string.IsNullOrWhiteSpace(ArraySeparate)) { code.AppendLine($@"['ArraySeparate'] = '{ArraySeparate.ToLuaString()}',"); } else { code.AppendLine($@"['ArraySeparate'] = nil,"); } code.AppendLine($@"['ExtendArray'] ={(ExtendArray.ToString().ToLower())},"); code.AppendLine($@"['IsKeyValueArray'] ={(IsKeyValueArray.ToString().ToLower())},"); code.AppendLine($@"['IsRelation'] ={(IsRelation.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(ExtendPropertyName)) { code.AppendLine($@"['ExtendPropertyName'] = '{ExtendPropertyName.ToLuaString()}',"); } else { code.AppendLine($@"['ExtendPropertyName'] = nil,"); } if (!string.IsNullOrWhiteSpace(ExtendClassName)) { code.AppendLine($@"['ExtendClassName'] = '{ExtendClassName.ToLuaString()}',"); } else { code.AppendLine($@"['ExtendClassName'] = nil,"); } code.AppendLine($@"['ExtendClassIsPredestinate'] ={(ExtendClassIsPredestinate.ToString().ToLower())},"); code.AppendLine($@"['IsRelationField'] ={(IsRelationField.ToString().ToLower())},"); code.AppendLine($@"['IsRelationValue'] ={(IsRelationValue.ToString().ToLower())},"); code.AppendLine($@"['IsRelationArray'] ={(IsRelationArray.ToString().ToLower())},"); code.AppendLine($@"['IsExtendArray'] ={(IsExtendArray.ToString().ToLower())},"); code.AppendLine($@"['IsExtendValue'] ={(IsExtendValue.ToString().ToLower())},"); }
public override int GetHashCode() { unchecked { return(((TableName != null ? TableName.GetHashCode() : 0) * 397) ^ (ColumnName != null ? ColumnName.GetHashCode() : 0)); } }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (ColumnName.ToLower() == "publisheruri" || ColumnName.ToLower() == "publisherlabel" || ColumnName.ToLower() == "publisher uri" || ColumnName.ToLower() == "publisher label") { yield return(new ValidationResult("This column name is reserved.", new[] { "ColumnName" })); } }
public override int GetHashCode() => HashCode.Combine(Table.GetHashCode(), ColumnName.GetHashCode());
public int GetColumnOrdinal(ColumnName columnName) { return Array.FindIndex (columnNameList, a => (columnName.Alias != null && a.Alias != null || columnName.Alias == null) && a.CompareTo (columnName) == 0); }
public override bool UseWhen() { return(ColumnName.StartsWith("!")); }
protected bool Equals(ColumnName other) { return string.Equals(m_Name.ToLowerInvariant(), other.m_Name.ToLowerInvariant()); }
public bool IsSorted(DataTablesGridModel <T> model) { return(ColumnName.Equals(model.SortColumnName, StringComparison.OrdinalIgnoreCase)); }
public static string Column(ColumnName columnName, string value, ColumnOperator op = ColumnOperator.Equal) => Column(ToColumnName(columnName), value, op);
protected override void BuildSelectStatement(SelectStatement select, bool appendSeparator = true) { if (select.TableName == null && select.Columns.Count == 1 && select.Columns[0].Symbol.Contains("=")) { ColumnName columnName = select.Columns.First(); this.AppendLine($"SET {columnName}"); } else { this.AppendLine($"SELECT {string.Join("," + Environment.NewLine + indent, select.Columns.Select(item => item.ToString()))}"); } if (select.IntoTableName != null) { this.AppendLine($"INTO {select.IntoTableName.ToString()}"); } if (select.FromItems != null && select.FromItems.Count > 0) { this.BuildSelectStatementFromItems(select); } else if (select.TableName != null) { if (select.WithStatements == null || select.WithStatements.Count == 0) { this.AppendLine($"FROM {select.TableName}"); } else { string tableName = select.TableName.ToString(); this.AppendLine("FROM"); int i = 0; foreach (WithStatement withStatement in select.WithStatements) { this.AppendLine("("); this.AppendChildStatements(withStatement.SelectStatements, false); this.AppendLine($") AS {(tableName.StartsWith(withStatement.Name.ToString()) ? "" : withStatement.Name.ToString())}{(i < select.WithStatements.Count - 1 ? "," : "")}"); i++; } this.AppendLine(select.TableName.ToString()); } } if (select.Where != null) { this.AppendLine($"WHERE {select.Where}"); } if (select.GroupBy != null && select.GroupBy.Count > 0) { this.AppendLine($"GROUP BY {string.Join(",", select.GroupBy)}"); } if (select.Having != null) { this.AppendLine($"HAVING {select.Having}"); } if (select.OrderBy != null && select.OrderBy.Count > 0) { this.AppendLine($"ORDER BY {string.Join(",", select.OrderBy)}"); } if (select.TopInfo != null) { this.AppendLine($"LIMIT 0,{select.TopInfo.TopCount}"); } if (select.LimitInfo != null) { this.AppendLine($"LIMIT {select.LimitInfo.StartRowIndex},{select.LimitInfo.RowCount}"); } if (select.UnionStatements != null) { foreach (var union in select.UnionStatements) { this.Build(union, false).TrimSeparator(); } } if (appendSeparator) { this.AppendLine(";", false); } }
public int GetColumnOrdinal(ColumnName columnName) { return providers [0].GetColumnOrdinal (columnName); }
static void ConstructColumns(IList<Column> outputColumns, out IExpression[] outputList2, out ColumnName[] columnNameList2) { List<IExpression> outputList = new List<IExpression> (); List<ColumnName> columnNameList = new List<ColumnName> (); for (int i = 0; i < outputColumns.Count; i++) { Column column = outputColumns [i]; if (column is AllColums) { AllColums allColums = (AllColums)column; var columnNameList3 = allColums.Provider.GetColumnNames (); for (int j = 0; j < columnNameList3.Length; j++) { if (allColums.ProviderAlias == null || StringComparer.InvariantCultureIgnoreCase.Compare (allColums.ProviderAlias, columnNameList3 [j].Alias) == 0) { outputList.Add (GqlParser.ConstructColumnExpression (allColums.Provider, j)); columnNameList.Add (columnNameList3 [j]); } } if (columnNameList.Count == 0) throw new InvalidOperationException (string.Format ("No columns found for provider alias {0}", allColums.ProviderAlias)); } else if (column is SingleColumn) { SingleColumn singleColumn = (SingleColumn)column; outputList.Add (singleColumn.Expression); columnNameList.Add (singleColumn); } else { throw new InvalidOperationException (string.Format ("Unknown column type {0}", column.GetType ())); } } outputList2 = outputList.ToArray (); columnNameList2 = columnNameList.ToArray (); for (int i = 0; i < columnNameList2.Length; i++) if (columnNameList2 [i] == null || string.IsNullOrEmpty (columnNameList2 [i].Name)) columnNameList2 [i] = new ColumnName (i); }