Exemplo n.º 1
0
 //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
         };
         this._fields.Add(field);
     }
     else
     {
         var field = new QField(Columns[index].ColumnId, value, Columns[index].ColumnType, this, Columns[index], QBInternal);
         this._fields.Add(field);
     }
     UncleanState = this._fields.Any(f => f.UncleanText == true);
 }
Exemplo n.º 2
0
        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 = this._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));
        }