public override void Visit(FieldResult visitee)
        {
            if (!visitee.GuardResult.IsValid || visitee.ValidationResult.IsValid)
            {
                return;
            }

            if (!visitee.GuardResult.IsAny())
            {
                inguard = true;
                WriteLine("When");
                using (Indent())
                {
                    visitee.GuardResult.Accept(this);
                }
                inguard = false;
                WriteLine("Then");
                using (Indent())
                {
                    visitee.ValidationResult.Accept(this);
                }
            }
            else
            {
                WriteLine("Always");
                visitee.ValidationResult.Accept(this);
            }
            WriteLine("");
        }
示例#2
0
        public void SetupCustomField()
        {
            AdobeConnectProvider provider = GetProvider();
            var field = provider.GetCustomField("esync-mp4-result").Value;

            string recordingId = "44636"; //  User Meetings >  [email protected] >  isa test mp4 >  recUNO
            // User Content > [email protected] > MP4 Recordings > isa test mp4 > recUNO
            var info = new
            {
                mp4 = "85704",
                vtt = "85705",
            };
            string     fieldValue  = Newtonsoft.Json.JsonConvert.SerializeObject(info);
            StatusInfo setupResult = provider.UpdateAclField(new List <AclFieldUpdateTrio>
            {
                new AclFieldUpdateTrio
                {
                    AclId   = recordingId,
                    FieldId = field.FieldId,
                    Value   = fieldValue,
                },
            });

            FieldResult originalName = provider.GetAclField(recordingId, field.FieldId);
        }
 /// <summary>
 /// Converts the document field to field result.
 /// </summary>
 /// <param name="docField">The doc field.</param>
 /// <returns></returns>
 private static FieldResult ConvertDocumentFieldToFieldResult(DocumentField docField)
 {
     var newField = new FieldResult
     {
         Name = docField.FieldName,
         Value = docField.Value,
         ID = Convert.ToInt32(docField.Id),
         DataTypeId = Convert.ToInt32(docField.Type)
     };
     return newField;
 }
        internal virtual void Compile(FieldResult field, CompileState state)
        {
            string?functionText = field.FunctionText.Invoke(state.Translator);

            if (functionText is null)
            {
                if ((object?)field.Alias is not null)
                {
                    field.Alias.Compile(state);
                    if (!string.IsNullOrEmpty(field.FieldName))
                    {
                        state.Text.Append(".");
                        state.Text.Append(field.FieldName);
                    }
                }
                else if (!string.IsNullOrEmpty(field.FieldName))
                {
                    state.Text.Append(field.FieldName);
                }
            }
            else
            {
                string[] compiledArgs = field.FunctionArgs.Select(arg => state.Preview(GetCompile(arg), state)).ToArray();
                string   compiledText = string.Format(functionText.Replace("{base}", "{{base}}"), compiledArgs);

                if ((object?)field.Field is not null)
                {
                    string[] split = compiledText.Split(new string[] { "{base}" }, StringSplitOptions.None);
                    if (split.Length == 0)
                    {
                        throw new NotSupportedException("Functions have to include compilation of the base they are derived from.");
                    }

                    string baseText = state.Preview(field.Field.Compile, state);
                    state.Text.Append(string.Join(baseText, split));
                }
                else if ((object?)field.Alias is not null)
                {
                    string[] split = compiledText.Split(new string[] { "{base}" }, StringSplitOptions.None);
                    if (split.Length == 0)
                    {
                        throw new NotSupportedException("Functions have to include compilation of the base they are derived from.");
                    }

                    string baseText = state.Preview(field.Alias.Compile, state);
                    state.Text.Append(string.Join(baseText, split));
                }
                else
                {
                    state.Text.Append(compiledText);
                }
            }
        }
示例#5
0
        /// <summary>
        /// Converts the document field to field result.
        /// </summary>
        /// <param name="docField">The doc field.</param>
        /// <returns></returns>
        private static FieldResult ConvertDocumentFieldToFieldResult(DocumentField docField)
        {
            var newField = new FieldResult
            {
                Name       = docField.FieldName,
                Value      = docField.Value,
                ID         = Convert.ToInt32(docField.Id),
                DataTypeId = Convert.ToInt32(docField.Type)
            };

            return(newField);
        }
        public override List <Field> ParseContent(object Content, ReadoutType Types, DateTime From, DateTime To)
        {
            List <Field> Result = null;
            XmlDocument  Doc    = Content as XmlDocument;

            if (Doc != null)
            {
                if (Doc.DocumentElement.LocalName == "fields")
                {
                    Result = FieldResult.GetFieldsFromXmppXep0323Xml(Doc.DocumentElement, this);
                }
                else if (Doc.DocumentElement.LocalName == "failure")
                {
                    XmlElement ErrorElement;
                    DateTime   Timestamp;

                    foreach (XmlNode N in Doc.DocumentElement.ChildNodes)
                    {
                        ErrorElement = N as XmlElement;
                        if (ErrorElement == null || ErrorElement.LocalName != "error")
                        {
                            continue;
                        }

                        Timestamp = XmlUtilities.GetAttribute(ErrorElement, "timestamp", DateTime.MinValue);
                        if (Timestamp == DateTime.MinValue)
                        {
                            continue;
                        }

                        this.LogError(ErrorElement.InnerText);
                    }
                }
                else
                {
                    this.LogError(String(52, "Content not valid XMPP XEP-0323 XML."));
                }
            }
            else
            {
                this.LogError(String(49, "XML expected."));
            }

            if (Result == null)
            {
                Result = new List <Field>();
            }

            return(Result);
        }
示例#7
0
        private bool GetValue(InvoiceTemplate template, FieldResult result, out double parsed)
        {
            var separator = CultureInfo.CurrentCulture.NumberFormat.CurrencyDecimalSeparator;
            var text      = result.Value;

            if (!string.IsNullOrEmpty(template?.Options.DecimalSeparator) &&
                template.Options.DecimalSeparator != separator)
            {
                text = text.Replace(template.Options.DecimalSeparator, separator);
            }

            if (double.TryParse(text, NumberStyles.Any, CultureInfo.CurrentCulture, out parsed))
            {
                return(true);
            }

            logger.LogWarning("Failed parsing {0}", result.Value);
            return(false);
        }
示例#8
0
        public override List <Field> ParseContent(object Content, ReadoutType Types, DateTime From, DateTime To)
        {
            List <Field> Result = new List <Field>();
            XmlDocument  Doc    = Content as XmlDocument;

            if (Doc != null)
            {
                FieldResult[] FieldResults = FieldResult.FromXml(Doc, false, false);
                foreach (FieldResult Fields in FieldResults)
                {
                    Result.AddRange(Fields.Fields);
                }
            }
            else
            {
                this.LogError(String(49, "XML expected."));
            }

            return(Result);
        }
        public override void Visit(FieldResult visitee)
        {
            if (!visitee.GuardResult.IsValid || visitee.ValidationResult.IsValid)
            {
                return;
            }

            inguard = true;
            WriteLine($"When : (IsValid = {visitee.GuardResult.IsValid})");
            using (Indent())
            {
                visitee.GuardResult.Accept(this);
            }
            inguard = false;
            WriteLine($"Then : (IsValid = {visitee.ValidationResult.IsValid})");
            using (Indent())
            {
                visitee.ValidationResult.Accept(this);
            }
            WriteLine("");
        }
        private bool GetValue(InvoiceTemplate template, FieldResult result, out DateTime parsed)
        {
            parsed = DateTime.MinValue;
            if (template.Options.DateFormats == null)
            {
                if (DateTime.TryParse(result.Value, out parsed))
                {
                    return(true);
                }
            }
            else
            {
                foreach (var format in template.Options.DateFormats)
                {
                    if (DateTime.TryParseExact(result.Value, format, CultureInfo.InvariantCulture, DateTimeStyles.None, out parsed))
                    {
                        return(true);
                    }
                }
            }

            logger.LogWarning("Failed parsing {0}", result.Value);
            return(false);
        }
示例#11
0
        public static List<FieldResult> GenerateInserts(string pTableName, List<ColumnData> pValidColumns,
            DatabaseManage origManager, DatabaseManage destManager, RadProgressBar progressBarResult)
        {
            List<FieldResult> results = new List<FieldResult>();
            List<RowModel> dataOrig;
            List<RowModel> dataDest;

            // Obtenemos todos los datos de origen de la tabla
            if (pValidColumns.Select(s => s.ColumnName).Contains("id"))
            {
                dataOrig = origManager.ExecuteQueryList(string.Format("SELECT \"{0}\" FROM {1} ORDER BY id ASC",
                    string.Join("\", \"", pValidColumns.Select(s => s.ColumnName).OrderBy(o => o)), pTableName), pValidColumns);

                // Obtenemos todos los datos de destino de la tabla
                dataDest = destManager.ExecuteQueryList(string.Format("SELECT \"{0}\" FROM {1} ORDER BY id ASC",
                    string.Join("\", \"", pValidColumns.Select(s => s.ColumnName).OrderBy(o => o)), pTableName), pValidColumns);
            }
            else
            {
                dataOrig = origManager.ExecuteQueryList(string.Format("SELECT \"{0}\" FROM {1}",
                    string.Join("\", \"", pValidColumns.Select(s => s.ColumnName).OrderBy(o => o)), pTableName), pValidColumns);

                // Obtenemos todos los datos de destino de la tabla
                dataDest = destManager.ExecuteQueryList(string.Format("SELECT \"{0}\" FROM {1}",
                    string.Join("\", \"", pValidColumns.Select(s => s.ColumnName).OrderBy(o => o)), pTableName), pValidColumns);
            }

            int rowCount = dataOrig.Count();
            int rowIndex = 0;

            foreach (RowModel row in dataOrig)
            {
                StringBuilder builderQuery = new StringBuilder();

                // Generamos la query
                builderQuery.Append(string.Format("INSERT INTO {0} (\"{1}\") VALUES (", pTableName,
                    string.Join("\", \"", pValidColumns.Select(s => s.ColumnName).OrderBy(o => o))));

                int fieldCount = row.Fields.Count;
                int idx = 1;
                foreach (var fieldValue in row.Fields)
                {
                    if ("null".Equals(fieldValue))
                    {
                        builderQuery.Append(idx < fieldCount ? "null, " : "null");
                    }
                    else
                    {
                        builderQuery.Append(idx < fieldCount ? string.Format("'{0}', ", fieldValue) : string.Format("'{0}'", fieldValue));
                    }
                    idx++;
                }
                builderQuery.AppendLine(")");

                // Generamos el identificador a devolver
                FieldResult rowResult = new FieldResult
                {
                    Id = row.Id,
                    Name = row.Name,
                    Query = builderQuery.ToString(),
                    Migrate = true
                };

                // Si ya existe un registro con el mismo identificador, automáticamente lo desmarcamos
                if (dataDest.Any(w => w.Id == row.Id) && row.Id > 0)
                {
                    rowResult.Migrate = false;
                }

                results.Add(rowResult);

                rowIndex++;
                progressBarResult.BeginInvoke(new Action(() =>
                {
                    int newValue = (int)(((float)rowIndex / rowCount) * 100);
                    if (newValue > 100)
                    {
                        newValue = 100;
                    }
                    progressBarResult.Value1 = newValue;
                }));
            }

            return results;
        }
        public override object GET(CoapRequest Request, object DecodedPayload)
        {
            CoapOptionUriPath[] Path = Request.SubPath;
            int  c = Path.Length;
            Node Node;

            if (c == 0)
            {
                Node = Topology.Root;
                if (!Node.IsVisible(this.user))
                {
                    Node = null;
                }
            }
            else
            {
                Node = Topology.GetNode(HttpUtilities.UrlDecode(Path[c - 1].Value), false, this.user);
            }

            if (Node == null)
            {
                throw new CoapException(CoapResponseCode.ClientError_NotFound);
            }

            if (!Node.IsReadable)
            {
                return(string.Empty);
            }

            ReadoutType        Types = (ReadoutType)0;
            DateTime           From  = DateTime.MinValue;
            DateTime           To    = DateTime.MaxValue;
            CoapOptionUriQuery Parameter;
            DateTime           TP;
            string             s, Name, Value;
            int  i;
            bool b;

            foreach (CoapOption Option in Request.Options)
            {
                if ((Parameter = Option as CoapOptionUriQuery) != null)
                {
                    s = Parameter.Value;
                    i = s.IndexOf('=');
                    if (i < 0)
                    {
                        continue;
                    }

                    Name  = s.Substring(0, i);
                    Value = s.Substring(i + 1);
                    switch (Name.ToLower())
                    {
                    case "all":
                        if (XmlUtilities.TryParseBoolean(Value, out b))
                        {
                            if (b)
                            {
                                Types |= ReadoutType.All;
                            }
                            else
                            {
                                throw new CoapException(CoapResponseCode.ClientError_BadRequest);
                            }
                        }
                        break;

                    case "historical":
                        if (XmlUtilities.TryParseBoolean(Value, out b))
                        {
                            if (b)
                            {
                                Types |= ReadoutType.HistoricalValues;
                            }
                            else
                            {
                                throw new CoapException(CoapResponseCode.ClientError_BadRequest);
                            }
                        }
                        break;

                    case "momentary":
                        if (XmlUtilities.TryParseBoolean(Value, out b))
                        {
                            if (b)
                            {
                                Types |= ReadoutType.MomentaryValues;
                            }
                            else
                            {
                                throw new CoapException(CoapResponseCode.ClientError_BadRequest);
                            }
                        }
                        break;

                    case "peak":
                        if (XmlUtilities.TryParseBoolean(Value, out b))
                        {
                            if (b)
                            {
                                Types |= ReadoutType.PeakValues;
                            }
                            else
                            {
                                throw new CoapException(CoapResponseCode.ClientError_BadRequest);
                            }
                        }
                        break;

                    case "status":
                        if (XmlUtilities.TryParseBoolean(Value, out b))
                        {
                            if (b)
                            {
                                Types |= ReadoutType.StatusValues;
                            }
                            else
                            {
                                throw new CoapException(CoapResponseCode.ClientError_BadRequest);
                            }
                        }
                        break;

                    case "computed":
                        if (XmlUtilities.TryParseBoolean(Value, out b))
                        {
                            if (b)
                            {
                                Types |= ReadoutType.Computed;
                            }
                            else
                            {
                                throw new CoapException(CoapResponseCode.ClientError_BadRequest);
                            }
                        }
                        break;

                    case "identity":
                        if (XmlUtilities.TryParseBoolean(Value, out b))
                        {
                            if (b)
                            {
                                Types |= ReadoutType.Identity;
                            }
                            else
                            {
                                throw new CoapException(CoapResponseCode.ClientError_BadRequest);
                            }
                        }
                        break;

                    case "historicalSecond":
                        if (XmlUtilities.TryParseBoolean(Value, out b))
                        {
                            if (b)
                            {
                                Types |= ReadoutType.HistoricalValuesSecond;
                            }
                            else
                            {
                                throw new CoapException(CoapResponseCode.ClientError_BadRequest);
                            }
                        }
                        break;

                    case "historicalMinute":
                        if (XmlUtilities.TryParseBoolean(Value, out b))
                        {
                            if (b)
                            {
                                Types |= ReadoutType.HistoricalValuesMinute;
                            }
                            else
                            {
                                throw new CoapException(CoapResponseCode.ClientError_BadRequest);
                            }
                        }
                        break;

                    case "historicalHour":
                        if (XmlUtilities.TryParseBoolean(Value, out b))
                        {
                            if (b)
                            {
                                Types |= ReadoutType.HistoricalValuesHour;
                            }
                            else
                            {
                                throw new CoapException(CoapResponseCode.ClientError_BadRequest);
                            }
                        }
                        break;

                    case "historicalDay":
                        if (XmlUtilities.TryParseBoolean(Value, out b))
                        {
                            if (b)
                            {
                                Types |= ReadoutType.HistoricalValuesDay;
                            }
                            else
                            {
                                throw new CoapException(CoapResponseCode.ClientError_BadRequest);
                            }
                        }
                        break;

                    case "historicalWeek":
                        if (XmlUtilities.TryParseBoolean(Value, out b))
                        {
                            if (b)
                            {
                                Types |= ReadoutType.HistoricalValuesWeek;
                            }
                            else
                            {
                                throw new CoapException(CoapResponseCode.ClientError_BadRequest);
                            }
                        }
                        break;

                    case "historicalMonth":
                        if (XmlUtilities.TryParseBoolean(Value, out b))
                        {
                            if (b)
                            {
                                Types |= ReadoutType.HistoricalValuesMonth;
                            }
                            else
                            {
                                throw new CoapException(CoapResponseCode.ClientError_BadRequest);
                            }
                        }
                        break;

                    case "historicalQuarter":
                        if (XmlUtilities.TryParseBoolean(Value, out b))
                        {
                            if (b)
                            {
                                Types |= ReadoutType.HistoricalValuesQuarter;
                            }
                            else
                            {
                                throw new CoapException(CoapResponseCode.ClientError_BadRequest);
                            }
                        }
                        break;

                    case "historicalYear":
                        if (XmlUtilities.TryParseBoolean(Value, out b))
                        {
                            if (b)
                            {
                                Types |= ReadoutType.HistoricalValuesYear;
                            }
                            else
                            {
                                throw new CoapException(CoapResponseCode.ClientError_BadRequest);
                            }
                        }
                        break;

                    case "historicalOther":
                        if (XmlUtilities.TryParseBoolean(Value, out b))
                        {
                            if (b)
                            {
                                Types |= ReadoutType.HistoricalValuesOther;
                            }
                            else
                            {
                                throw new CoapException(CoapResponseCode.ClientError_BadRequest);
                            }
                        }
                        break;

                    case "from":
                        if (XmlUtilities.TryParseDateTimeXml(Value, out TP))
                        {
                            From = TP;
                        }
                        break;

                    case "to":
                        if (XmlUtilities.TryParseDateTimeXml(Value, out TP))
                        {
                            To = TP;
                        }
                        break;
                    }
                }
            }

            if ((int)Types == 0)
            {
                Types = ReadoutType.All;
            }

            try
            {
                Field[]     Fields = Node.SynchronousReadout(Types, From, To, 10000);
                FieldResult Result = new FieldResult(Node, true, null, Fields);
                string      Xml    = Result.ExportXmppXep0323XmlString(0);

                XmlDocument Doc = new XmlDocument();
                Doc.LoadXml(Xml);

                return(Doc);
            }
            catch (Exception)
            {
                throw new CoapException(CoapResponseCode.ServerError_ServiceUnavailable);
            }
        }
示例#13
0
        // Update the dialog as fields are updated - gives us a highly interactive GUI. Not terribly efficient, but it works...
        private FieldResult updateDialog()
        {
            if (skipUpdate)
            {
                return(FieldResult.Success);
            }

            // We do a lot of GUI manipulations (sometimes just temporarily) - turn off updates
            SuspendLayout();

            // We assume everything is perfect and sadly discover the truth.
            FieldResult result = FieldResult.Success;

            // Reset the various statuses and colors to "no error"
            toolStripStatusLabel.Text   = String.Empty;
            BaseFolderTextBox.BackColor = SystemColors.Window;
            SeriesTextBox.BackColor     = SystemColors.Window;
            SeasonUpDown.BackColor      = SystemColors.Window;
            ExtrasTextBox.BackColor     = SystemColors.Window;

            // Assume we have no folders to create (right now, everything is "perfect", remember?)
            NewSeriesFolderButton.Visible = false;
            NewSeasonFolderButton.Visible = false;
            NewExtrasFolderButton.Visible = false;

            // If this is the "Specials" season, we can't have Extras
            if (Season.Equals(SpecialsSeason))
            {
                ExtrasTextBox.Text    = String.Empty;
                ExtrasTextBox.Visible = false;
            }
            else
            {
                ExtrasTextBox.Visible = true;
            }

            // See if the base folder exists
            if (!folderExists(BaseFolderTextBox.Text))
            {
                // Nope - highlight that fact
                BaseFolderTextBox.BackColor = Color.Red;
                toolStripStatusLabel.Text   = "Base folder does not exist.";
                result = FieldResult.BadBase;
            }
            // See if the series folder exists
            else if (!folderExists(BaseFolderTextBox.Text, SeriesTextBox.Text))
            {
                // Nope - but that might be because the user is modifying the base folder and isn't done yet
                if (!BaseFolderTextBox.Focused)
                {
                    // Nope - it's because the folder as typed so far doesn't exist
                    SeriesTextBox.BackColor = Color.Red;
                    if (SeriesTextBox.Text.Length > 0)
                    {
                        NewSeriesFolderButton.Visible = true;
                    }
                }
                result = FieldResult.BadSeries;
            }
            // See if the season folder exists
            else if (!folderExists(BaseFolderTextBox.Text, SeriesTextBox.Text, Season))
            {
                // Nope - the folder as typed (so far) does not exist
                SeasonUpDown.BackColor        = Color.Red;
                NewSeasonFolderButton.Visible = true;
                result = FieldResult.BadSeason;
            }
            // See if the (optional) extras folder exists
            else if (!folderExists(BaseFolderTextBox.Text, SeriesTextBox.Text, Season, ExtrasTextBox.Text))
            {
                // Nope - the folder as typed (so far) does not exist
                ExtrasTextBox.BackColor = Color.Red;
                if (ExtrasTextBox.Text.Length > 0)
                {
                    NewExtrasFolderButton.Visible = true;
                }
                result = FieldResult.BadExtras;
            }

            // If everything passed, we have a valid folder
            if (result == FieldResult.Success)
            {
                // If we have a valid folder, we can create a file
                SaveButton.Enabled = true;

                // If we have a media extension, we have enough info to create its name
                if (MediaExtensionTextBox.Text.Length > 0)
                {
                    MediaFilenameCopyButton.Enabled = true;
                }

                string seasonEpisode = String.Format("S{0:00}E{1:00}", SeasonUpDown.Value, EpisodeUpDown.Value);
                string newFolder     = buildFolderName(BaseFolderTextBox.Text, SeriesTextBox.Text, Season, ExtrasTextBox.Text);

                // If we've changed folders, we need to reload the folder and regenerate the NFO/Media filenames
                if (!newFolder.Equals(watcher.Path))
                {
                    watcher.Path = newFolder;
                    loadList();
                }

                // We need to update the filenames
                NFOFilename.Text   = newFolder + "\\" + FilenameCleaner.cleanFilename(seasonEpisode + " - " + trimmed(TitleTextBox.Text) + ".nfo");
                MediaFilename.Text = newFolder + "\\" + FilenameCleaner.cleanFilename(seasonEpisode + " - " + trimmed(TitleTextBox.Text) + "." + MediaExtensionTextBox.Text.ToLower());
            }
            else
            {
                // We don't have a valid folder, so we can't save anything
                SaveButton.Enabled = false;
                MediaFilenameCopyButton.Enabled = false;

                // So, don't display any filenames
                NFOFilename.Text   = String.Empty;
                MediaFilename.Text = String.Empty;

                // And there's no folder items to display either
                clearList();
            }

            ResumeLayout();
            return(result);
        }
示例#14
0
 public virtual void Visit(FieldResult visitee)
 {
     visitee.GuardResult.Accept(this);
     visitee.ValidationResult.Accept(this);
 }
        public static List <FieldResult> GenerateInserts(string pTableName, List <ColumnData> pValidColumns,
                                                         DatabaseManage origManager, DatabaseManage destManager, RadProgressBar progressBarResult)
        {
            List <FieldResult> results = new List <FieldResult>();
            List <RowModel>    dataOrig;
            List <RowModel>    dataDest;

            // Obtenemos todos los datos de origen de la tabla
            if (pValidColumns.Select(s => s.ColumnName).Contains("id"))
            {
                dataOrig = origManager.ExecuteQueryList(string.Format("SELECT \"{0}\" FROM {1} ORDER BY id ASC",
                                                                      string.Join("\", \"", pValidColumns.Select(s => s.ColumnName).OrderBy(o => o)), pTableName), pValidColumns);

                // Obtenemos todos los datos de destino de la tabla
                dataDest = destManager.ExecuteQueryList(string.Format("SELECT \"{0}\" FROM {1} ORDER BY id ASC",
                                                                      string.Join("\", \"", pValidColumns.Select(s => s.ColumnName).OrderBy(o => o)), pTableName), pValidColumns);
            }
            else
            {
                dataOrig = origManager.ExecuteQueryList(string.Format("SELECT \"{0}\" FROM {1}",
                                                                      string.Join("\", \"", pValidColumns.Select(s => s.ColumnName).OrderBy(o => o)), pTableName), pValidColumns);

                // Obtenemos todos los datos de destino de la tabla
                dataDest = destManager.ExecuteQueryList(string.Format("SELECT \"{0}\" FROM {1}",
                                                                      string.Join("\", \"", pValidColumns.Select(s => s.ColumnName).OrderBy(o => o)), pTableName), pValidColumns);
            }

            int rowCount = dataOrig.Count();
            int rowIndex = 0;

            foreach (RowModel row in dataOrig)
            {
                StringBuilder builderQuery = new StringBuilder();

                // Generamos la query
                builderQuery.Append(string.Format("INSERT INTO {0} (\"{1}\") VALUES (", pTableName,
                                                  string.Join("\", \"", pValidColumns.Select(s => s.ColumnName).OrderBy(o => o))));

                int fieldCount = row.Fields.Count;
                int idx        = 1;
                foreach (var fieldValue in row.Fields)
                {
                    if ("null".Equals(fieldValue))
                    {
                        builderQuery.Append(idx < fieldCount ? "null, " : "null");
                    }
                    else
                    {
                        builderQuery.Append(idx < fieldCount ? string.Format("'{0}', ", fieldValue) : string.Format("'{0}'", fieldValue));
                    }
                    idx++;
                }
                builderQuery.AppendLine(")");

                // Generamos el identificador a devolver
                FieldResult rowResult = new FieldResult
                {
                    Id      = row.Id,
                    Name    = row.Name,
                    Query   = builderQuery.ToString(),
                    Migrate = true
                };

                // Si ya existe un registro con el mismo identificador, automáticamente lo desmarcamos
                if (dataDest.Any(w => w.Id == row.Id) && row.Id > 0)
                {
                    rowResult.Migrate = false;
                }

                results.Add(rowResult);

                rowIndex++;
                progressBarResult.BeginInvoke(new Action(() =>
                {
                    int newValue = (int)(((float)rowIndex / rowCount) * 100);
                    if (newValue > 100)
                    {
                        newValue = 100;
                    }
                    progressBarResult.Value1 = newValue;
                }));
            }

            return(results);
        }