Пример #1
0
        private string ConstructLineEntryForTextFile(BaseClasses.Utils.SkippedLine skippedLine, int maximumChar)
        {
            string result = "";

            try
            {
                result += this.GetResourceValue("Import:LineNumber", this.AppName).Replace("{Number}", skippedLine.LineNumber.ToString());
                string truncatedContent = skippedLine.LineContent.Replace("'", "\\'");
                if (truncatedContent.Length > maximumChar)
                {
                    truncatedContent = truncatedContent.Substring(0, maximumChar - 3) + ENDING;
                }
                result += " " + truncatedContent + "\r\n";
                if (!string.IsNullOrEmpty(skippedLine.ErrorMessage.Trim()))
                {
                    result += "     " + this.GetResourceValue("Import:ErrorMessage", this.AppName) + " " + skippedLine.ErrorMessage + "\r\n";
                }
            }
            catch
            {
                return("");
            }

            return(result);
        }
Пример #2
0
        private void AddSkippedRecordToList(System.Collections.Generic.List <BaseClasses.Utils.SkippedLine> recordsList, long RowCount, string[] rowValues, string exMsg)
        {
            if (!string.IsNullOrEmpty(exMsg))
            {
                exMsg = exMsg.Replace("'", "\\'");
            }
            BaseClasses.Utils.SkippedLine skippedRecord = new BaseClasses.Utils.SkippedLine("", exMsg, RowCount);
            foreach (string rv in rowValues)
            {
                if (!string.IsNullOrEmpty(rv))
                {
                    skippedRecord.LineContent += rv + SEPARATOR;
                }
            }
            if (skippedRecord.LineContent.EndsWith(", "))
            {
                skippedRecord.LineContent = skippedRecord.LineContent.Substring(0, skippedRecord.LineContent.Length - 2);
            }

            recordsList.Add(skippedRecord);
        }
Пример #3
0
        private void AddSkippedRecordToList(System.Collections.Generic.List<BaseClasses.Utils.SkippedLine> recordsList, long RowCount, string[] rowValues, string exMsg)
        {
            if (!string.IsNullOrEmpty(exMsg)) exMsg = exMsg.Replace("'", "\\'");
            BaseClasses.Utils.SkippedLine skippedRecord = new BaseClasses.Utils.SkippedLine("", exMsg, RowCount);
            foreach (string rv in rowValues)
            {
                if (!string.IsNullOrEmpty(rv)) skippedRecord.LineContent += rv + SEPARATOR;
            }
            if (skippedRecord.LineContent.EndsWith(", "))
            {
                skippedRecord.LineContent = skippedRecord.LineContent.Substring(0, skippedRecord.LineContent.Length - 2);
            }

            recordsList.Add(skippedRecord);
        }