Пример #1
0
        internal void ResetCurrentRecord(string tableName)
        {
            TableManager mgr = Tables[tableName];

            mgr.CurrentRecord = 0;
        }
Пример #2
0
        /// <summary>
        /// Returns the value for a field from the current row
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        internal object GetCurrentValueForPlaceHolderObject(string field, bool quotesIfString)
        {
            if (field == Parser._pgbrk)
            {
                return(@"\page");
            }

            object theValue = field;

            //It's a field from a table / list
            if (field.Contains("."))
            {
                string[]     parts      = field.Trim().Split('.');
                string       fieldname  = parts[1].Replace(Parser._d, "");
                TableManager tbmgr      = Tables[parts[0].Replace(Parser._d, "")];
                DataRow      currentRow = tbmgr.Table.Rows[tbmgr.CurrentRecord];
                if (currentRow.Table.Columns[fieldname].DataType == typeof(string))
                {
                    if (quotesIfString)
                    {
                        theValue = "\"" + currentRow[fieldname] + "\"";
                    }
                    else
                    {
                        theValue = currentRow[fieldname];
                    }
                }
                else
                {
                    theValue = currentRow[fieldname];
                }
            }
            else
            {
                //It's a variable
                string variableName = field.Replace(Parser._d, "");
                if (variableMap.ContainsKey(variableName))
                {
                    switch (variableMap[variableName])
                    {
                    case "System.Int32":
                        theValue = int32Variables[variableName];
                        break;

                    case "System.Double":
                        theValue = doubleVariables[variableName];
                        break;

                    case "System.DateTime":
                        theValue = dateTimeVariables[variableName];
                        break;

                    case "System.String":
                        if (quotesIfString)
                        {
                            theValue = "\"" + stringVariables[variableName] + "\"";
                        }
                        else
                        {
                            theValue = stringVariables[variableName];
                        }
                        break;

                    case "System.Boolean":
                        theValue = booleanVariables[variableName];
                        break;

                    case "System.Drawing.Image":
                    case "System.Drawing.Bitmap":
                        theValue = imageVariables[variableName];
                        break;
                    }
                }
            }

            return(theValue);
        }