private void CreateNewField(int index, string value) { if (Columns[index].ColumnType == FieldType.file && !IsOnServer) { var field = new QField(Columns[index].ColumnId, Path.GetFileName(value), Columns[index].ColumnType, this) { FullName = value }; _fields.Add(field); } else { var field = new QField(Columns[index].ColumnId, value, Columns[index].ColumnType, this); _fields.Add(field); } }
//value 'QBInternal' is passed into the QField, and specifies if the column exists inside QB's internal dataformat, or is .Net datatype private void CreateNewField(int index, object value, bool QBInternal) { if (Columns[index].ColumnType == FieldType.file && !IsOnServer) { string fileName = (string)value; var field = new QField(Columns[index].ColumnId, Path.GetFileName(fileName), Columns[index].ColumnType, this, Columns[index], QBInternal) { FullName = fileName }; _fields.Add(field); } else { var field = new QField(Columns[index].ColumnId, value, Columns[index].ColumnType, this, Columns[index], QBInternal); _fields.Add(field); } UncleanState = _fields.Any(f => f.UncleanText); }
public string GetAsCSV(string clist) { List <string> csvList = new List <string>(); List <int> cols = clist.Split('.').Select(Int32.Parse).ToList(); foreach (int col in cols) { QField field = _fields.FirstOrDefault(fld => fld.FieldId == col); if (field == null) { csvList.Add(String.Empty); } else { if (field.Type == FieldType.file) { throw new InvalidChoiceException(); //Can't upload a file via CSV upload } csvList.Add(CSVQuoter(field.QBValue)); } } return(String.Join(",", csvList)); }
public bool Equals(QField other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return other.FieldId == FieldId; }
//value 'QBInternal' is passed into the QField, and specifies if the column exists inside QB's internal dataformat, or is .Net datatype private void CreateNewField(int index, object value, bool QBInternal) { if (Columns[index].ColumnType == FieldType.file && !IsOnServer) { string fileName = (string)value; var field = new QField(Columns[index].ColumnId, Path.GetFileName(fileName), Columns[index].ColumnType, this, Columns[index], QBInternal) { FullName = fileName }; _fields.Add(field); } else { var field = new QField(Columns[index].ColumnId, value, Columns[index].ColumnType, this, Columns[index], QBInternal); _fields.Add(field); } }