예제 #1
0
        public static AccrossStructInfo GetAccrossStructInfo(String strTableName, String strFieldString)
        {
            AccrossStructInfo result = new AccrossStructInfo();

            result.FieldName = strFieldString;
            result.TableName = strTableName;

            String[] strArr = strFieldString.Split(':');
            if (strArr.Length <= 1)
            {
                return(result);
            }

            result.FieldName = strArr[0];
            result.TableName = strTableName;

            for (int i = 1; i < strArr.Length; i++)
            {
                if (DataStructureProvider.IsForeignKey(result.TableName, result.FieldName) == false)
                {
                    break;
                }

                result.TableName = DataStructureProvider.GetTableNameOfForeignKey(result.TableName, result.FieldName);
                result.FieldName = strArr[i];
            }

            if (DataStructureProvider.IsForeignKey(result.TableName, result.FieldName))
            {
                result.TableName = DataStructureProvider.GetTableNameOfForeignKey(result.TableName, result.FieldName);
                result.FieldName = DataStructureProvider.GetDisplayColumn(result.TableName);
            }

            return(result);
        }
예제 #2
0
        public static ABCFormatInfo GetFormatInfo(String strTableName, String strFieldString)
        {
            if (String.IsNullOrWhiteSpace(strFieldString) || String.IsNullOrWhiteSpace(strTableName))
            {
                return(null);
            }

            String TableName = strTableName;
            String FieldName = strFieldString;

            if (strFieldString.Contains(":"))
            {
                DataCachingProvider.AccrossStructInfo structInfo = DataCachingProvider.GetAccrossStructInfo(strTableName, strFieldString);
                if (structInfo != null)
                {
                    TableName = structInfo.TableName;
                    FieldName = structInfo.FieldName;
                }
            }

            if (DataStructureProvider.IsTableColumn(TableName, FieldName) == false)
            {
                return(null);
            }

            if (DataStructureProvider.IsForeignKey(TableName, FieldName))
            {
                TableName = DataStructureProvider.GetTableNameOfForeignKey(TableName, FieldName);
                FieldName = DataStructureProvider.GetDisplayColumn(TableName);
            }
            if (DataConfigProvider.TableConfigList.ContainsKey(TableName) &&
                DataConfigProvider.TableConfigList[TableName].FieldConfigList.ContainsKey(FieldName))
            {
                return(GetFormatInfo(DataConfigProvider.TableConfigList[TableName].FieldConfigList[FieldName].Format));
            }

            return(null);
        }
예제 #3
0
        public static AccrossStructInfo GetAccrossStructInfo(String strTableName, Guid iFieldValue, String strFieldString, String strIDTableName)
        {
            if (String.IsNullOrWhiteSpace(strFieldString))
            {
                return(null);
            }

            String[] strArr = strFieldString.Split(':');

            if (DataStructureProvider.IsForeignKey(strTableName, strArr[0]) == false && strArr[0] != "ID")
            {
                return(null);
            }

            AccrossStructInfo result = new AccrossStructInfo();

            if (strArr[0] == "ID" && !String.IsNullOrWhiteSpace(strIDTableName))
            {
                result.TableName = strIDTableName;
            }
            else
            {
                result.TableName = DataStructureProvider.GetTableNameOfForeignKey(strTableName, strArr[0]);
            }

            result.TableID   = iFieldValue;
            result.FieldName = String.Empty;

            if (!DataStructureProvider.IsExistedTable(result.TableName))
            {
                return(null);
            }

            BusinessObject objTable = GetCachedBusinessObject(result.TableName, result.TableID);

            if (objTable == null)
            {
                return(null);
            }

            for (int i = 1; i < strArr.Length; i++)
            {
                result.FieldName = strArr[i];
                if (result.FieldName == "ID" && DataStructureProvider.IsTableColumn(result.TableName, "TableName"))
                {
                    object objTemp = ABCBusinessEntities.ABCDynamicInvoker.GetValue(objTable, "TableName");
                    if (objTemp == null)
                    {
                        break;
                    }
                    result.TableName = objTemp.ToString();

                    objTemp = ABCBusinessEntities.ABCDynamicInvoker.GetValue(objTable, result.FieldName);
                    if (objTemp == null)
                    {
                        break;
                    }
                    result.TableID = ABCHelper.DataConverter.ConvertToGuid(objTemp);
                }
                else
                {
                    if (DataStructureProvider.IsForeignKey(result.TableName, result.FieldName) == false)
                    {
                        break;
                    }

                    result.TableName = DataStructureProvider.GetTableNameOfForeignKey(result.TableName, result.FieldName);
                    object objValue = ABCBusinessEntities.ABCDynamicInvoker.GetValue(objTable, result.FieldName);
                    if (objValue == null)
                    {
                        break;
                    }

                    result.TableID = ABCHelper.DataConverter.ConvertToGuid(objValue);
                    objTable       = GetCachedBusinessObject(result.TableName, result.TableID);
                    if (objTable == null)
                    {
                        break;
                    }
                }
                result.FieldName = String.Empty;
            }

            if (DataStructureProvider.IsForeignKey(result.TableName, result.FieldName) || result.FieldName == String.Empty)
            {
                if (DataStructureProvider.IsForeignKey(result.TableName, result.FieldName))
                {
                    result.TableName = DataStructureProvider.GetTableNameOfForeignKey(result.TableName, result.FieldName);
                }

                result.FieldName = DataStructureProvider.GetDisplayColumn(result.TableName);
            }

            if (String.IsNullOrWhiteSpace(result.FieldName))
            {
                result.FieldName = DataStructureProvider.GetDisplayColumn(result.TableName);
            }
            if (String.IsNullOrWhiteSpace(result.FieldName))
            {
                result.FieldName = DataStructureProvider.GetPrimaryKeyColumn(result.TableName);
            }

            return(result);
        }
예제 #4
0
        public static bool CalculateMainOnly(BaseVoucher voucher, BusinessObject obj, Dictionary <String, IEnumerable <BusinessObject> > lstObjecItems, String strAferValidateFieldName, bool isSave)
        {
            if (FormulasList == null)
            {
                InitFormulas();
            }

            if (!FormulasList.ContainsKey(obj.AATableName))
            {
                return(false);
            }

            bool isCalculated = false;

            Dictionary <String, double> lstVariables = new Dictionary <string, double>();
            bool isContinue = false;

            foreach (GEFormulaItemsInfo formula in FormulasList[obj.AATableName].Values)
            {
                if (String.IsNullOrWhiteSpace(formula.FormulaName))
                {
                    continue;
                }

                #region isNeedCalc
                bool isNeedCalc = isContinue;
                if (!isNeedCalc)
                {
                    if (formula.IsVariable)
                    {
                        isNeedCalc = true;
                    }
                    else
                    {
                        if (String.IsNullOrWhiteSpace(strAferValidateFieldName))
                        {
                            isNeedCalc = true;
                        }
                        else
                        {
                            if (FormulasList[obj.AATableName].Values.Count(t => t.FormulaName == strAferValidateFieldName) > 0)
                            {
                                if (formula.FormulaName == strAferValidateFieldName)
                                {
                                    isContinue = true;
                                    continue;
                                }
                            }
                            else
                            {
                                if (DataConfigProvider.GetFieldSortOrder(obj.AATableName, strAferValidateFieldName) <= DataConfigProvider.GetFieldSortOrder(obj.AATableName, formula.FormulaName))
                                {
                                    isContinue = true;
                                    isNeedCalc = true;
                                }
                            }
                        }
                    }
                }

                if (!isNeedCalc)
                {
                    continue;
                }
                #endregion

                object objAmt = null;
                if (formula.IsUseQuery && !String.IsNullOrWhiteSpace(formula.QueryString))
                {
                    #region Query
                    String strQuery = formula.QueryString.Replace("{TableName}", obj.AATableName);
                    if (obj.GetID() != Guid.Empty)
                    {
                        strQuery = strQuery.Replace("{ID}", obj.GetID().ToString());
                    }

                    foreach (String strProperty in DataStructureProvider.DataTablesList[obj.AATableName].ColumnsList.Keys)
                    {
                        if (strQuery.Contains("{" + strProperty + "}"))
                        {
                            object objValue = ABCDynamicInvoker.GetValue(obj, strProperty);
                            if (objValue == null || objValue == DBNull.Value)
                            {
                                strQuery = strQuery.Replace("{" + strProperty + "}", "NULL");
                            }
                            else
                            {
                                strQuery = strQuery.Replace("{" + strProperty + "}", objValue.ToString());
                            }
                        }
                    }

                    foreach (String strVariableName in lstVariables.Keys)
                    {
                        if (strQuery.Contains("{" + strVariableName + "}"))
                        {
                            strQuery = strQuery.Replace("{" + strVariableName + "}", lstVariables[strVariableName].ToString());
                        }
                    }
                    #endregion

                    objAmt = BusinessObjectController.GetData(strQuery);
                }
                else if (formula.IsUseFormula && !String.IsNullOrWhiteSpace(formula.Formula))
                {
                    String strExpression = formula.Formula;

                    #region Formula
                    foreach (String strProperty in DataStructureProvider.DataTablesList[obj.AATableName].ColumnsList.Keys)
                    {
                        strExpression = strExpression.Replace("{" + strProperty + "}", "[" + strProperty + "]");
                    }

                    foreach (String strVariableName in lstVariables.Keys)
                    {
                        strExpression = strExpression.Replace("{" + strVariableName + "}", "[" + strVariableName + "]");
                    }


                    Expression e = new Expression(strExpression);
                    foreach (String strProperty in DataStructureProvider.DataTablesList[obj.AATableName].ColumnsList.Keys)
                    {
                        if (strExpression.Contains("[" + strProperty + "]"))
                        {
                            object objValue = ABCDynamicInvoker.GetValue(obj, strProperty);
                            if (objValue == null)
                            {
                                continue;
                            }

                            double dbValue = 0;
                            Double.TryParse(objValue.ToString(), out dbValue);
                            e.Parameters[strProperty] = dbValue;
                        }
                    }

                    foreach (String strVariableName in lstVariables.Keys)
                    {
                        if (strExpression.Contains("[" + strVariableName + "]"))
                        {
                            e.Parameters[strVariableName] = lstVariables[strVariableName];
                        }
                    }

                    #endregion

                    objAmt = e.Evaluate();
                }
                else if (formula.IsUseSumFromChild)
                {
                    objAmt = 0;
                    if (lstObjecItems.ContainsKey(formula.SumChildTableName) && DataStructureProvider.IsTableColumn(formula.SumChildTableName, formula.SumChildFieldName))
                    {
                        objAmt = lstObjecItems[formula.SumChildTableName].Sum(t => Convert.ToDouble(ABCDynamicInvoker.GetValue((BusinessObject)t, formula.SumChildFieldName)));
                    }
                }

                if (formula.IsVariable && lstVariables.ContainsKey(formula.FormulaName) == false)
                {
                    lstVariables.Add(formula.FormulaName, Math.Round(Convert.ToDouble(objAmt), 3));
                }

                bool isCalculatedWithCurrentFormula = false;
                if (!formula.IsVariable && DataStructureProvider.IsTableColumn(obj.AATableName, formula.FormulaName))
                {
                    if (objAmt != null)
                    {
                        if (objAmt is double)
                        {
                            objAmt = Math.Round(Convert.ToDouble(objAmt), 3);
                        }

                        if (ABCDynamicInvoker.GetValue(obj, formula.FormulaName).ToString() != objAmt.ToString())
                        {
                            ABCDynamicInvoker.SetValue(obj, formula.FormulaName, objAmt);
                            isCalculatedWithCurrentFormula = true;
                        }
                    }
                }


                if (voucher != null && formula.IsCustomByCode)
                {
                    isCalculatedWithCurrentFormula = voucher.CustomFormulaCalc(obj, lstObjecItems, formula);
                }

                isCalculated = isCalculated | isCalculatedWithCurrentFormula;

                if (isCalculatedWithCurrentFormula && !string.IsNullOrWhiteSpace(formula.FieldRelations))
                {
                    foreach (String strRelation in formula.FieldRelations.Split(';').ToList())
                    {
                        if (FormulasList[obj.AATableName].Values.Count(t => t.FormulaName == strRelation) > 0)
                        {
                            int?iIndex = FormulasList[obj.AATableName].Values.Where(t => t.FormulaName == strRelation).Select(t => t.CalcIndex).First();
                            if (!iIndex.HasValue)
                            {
                                continue;
                            }

                            if (FormulasList[obj.AATableName].Values.Count(t => t.CalcIndex == iIndex.Value - 1) > 0)
                            {
                                iIndex = FormulasList[obj.AATableName].Values.Where(t => t.CalcIndex == iIndex.Value - 1).Select(t => t.CalcIndex).First();
                                if (!iIndex.HasValue)
                                {
                                    continue;
                                }

                                CalculateMainOnly(voucher, obj, lstObjecItems, strRelation, isSave);
                            }
                        }
                    }
                }
            }

            if (isCalculated && obj.GetID() != null && isSave)
            {
                BusinessControllerFactory.GetBusinessController(obj.AATableName).UpdateObject(obj);

                if (!CalculateQueue.ContainsKey(obj.AATableName))
                {
                    CalculateQueue.Add(obj.AATableName, new List <Guid>());
                }

                if (!CalculateQueue[obj.AATableName].Contains(obj.GetID()))
                {
                    CalculateQueue[obj.AATableName].Add(obj.GetID());

                    if (DataStructureProvider.DataTablesList.ContainsKey(obj.AATableName))
                    {
                        foreach (String strFkCol in DataStructureProvider.DataTablesList[obj.AATableName].ForeignColumnsList.Keys)
                        {
                            Guid fkID = ABCHelper.DataConverter.ConvertToGuid(ABCDynamicInvoker.GetValue(obj, strFkCol));
                            if (fkID == Guid.Empty)
                            {
                                continue;
                            }

                            BusinessObjectController FKCtrl = BusinessControllerFactory.GetBusinessController(DataStructureProvider.GetTableNameOfForeignKey(obj.AATableName, strFkCol));
                            if (FKCtrl != null)
                            {
                                BusinessObject fkObj = FKCtrl.GetObjectByID(fkID);
                                if (fkObj != null)
                                {
                                    Calculate(fkObj, true);
                                }
                            }
                        }
                    }

                    if (!CalculateQueue.ContainsKey(obj.AATableName))
                    {
                        CalculateQueue.Add(obj.AATableName, new List <Guid>());
                    }

                    if (!CalculateQueue[obj.AATableName].Contains(obj.GetID()))
                    {
                        CalculateQueue[obj.AATableName].Remove(obj.GetID());
                    }
                }
            }

            return(isCalculated);
        }
예제 #5
0
        public static void GenerateDefaultTableConfig( )
        {
            String strCheckCondition = String.Empty;

            if (DataQueryProvider.IsSQLConnection("STTableConfigs"))
            {
                strCheckCondition = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='STTableConfigs'";
            }
            else
            {
                strCheckCondition = "SELECT tbl_name FROM sqlite_master WHERE type='table' AND tbl_name='STTableConfigs'";
            }

            DataSet dsTemp = DataQueryProvider.RunQuery(strCheckCondition);

            if (dsTemp == null || dsTemp.Tables.Count <= 0 || dsTemp.Tables[0].Rows.Count <= 0)
            {
                return;
            }

            #region Clean First
            DataSet ds2 = DataQueryProvider.SystemDatabaseHelper.RunQuery("SELECT STTableConfigID,TableName FROM  STTableConfigs ");
            if (ds2 != null && ds2.Tables.Count > 0)
            {
                foreach (DataRow dr in ds2.Tables[0].Rows)
                {
                    if (String.IsNullOrWhiteSpace(dr[0].ToString()) == false)
                    {
                        Guid iID = Guid.Empty;
                        Guid.TryParse(dr[0].ToString(), out iID);

                        String strTableName = dr[1].ToString();
                        if (DataStructureProvider.DataTablesList.ContainsKey(strTableName) == false)
                        {
                            DataQueryProvider.SystemDatabaseHelper.RunQuery(String.Format("DELETE FROM STTableConfigs WHERE STTableConfigID='{0}'", iID.ToString()));
                        }
                    }
                }
            }

            ds2 = DataQueryProvider.SystemDatabaseHelper.RunQuery("SELECT STFieldConfigID,TableName,FieldName FROM  STFieldConfigs ");
            if (ds2 != null && ds2.Tables.Count > 0)
            {
                foreach (DataRow dr in ds2.Tables[0].Rows)
                {
                    if (String.IsNullOrWhiteSpace(dr[0].ToString()) == false)
                    {
                        Guid iID = Guid.Empty;
                        Guid.TryParse(dr[0].ToString(), out iID);
                        String strTableName = dr[1].ToString();
                        String strFieldName = dr[2].ToString();
                        if (DataStructureProvider.DataTablesList.ContainsKey(strTableName) == false ||
                            DataStructureProvider.DataTablesList[strTableName].ColumnsList.ContainsKey(strFieldName) == false)
                        {
                            DataQueryProvider.SystemDatabaseHelper.RunQuery(String.Format("DELETE FROM STFieldConfigs WHERE STFieldConfigID='{0}'", iID.ToString()));
                        }
                    }
                }
            }
            #endregion

            foreach (String strTableName in DataStructureProvider.DataTablesList.Keys)
            {
                #region Table Config
                DataSet ds = DataQueryProvider.SystemDatabaseHelper.RunQuery(String.Format("SELECT COUNT(*) FROM  STTableConfigs WHERE TableName='{0}'", strTableName));
                if (ds == null || ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0 || Convert.ToInt32(ds.Tables[0].Rows[0][0]) <= 0)
                {
                    String strQuery = QueryTemplateGenerator.GenInsert("STTableConfigs");
                    strQuery = strQuery.Replace("@STTableConfigID", "'" + Guid.Empty.ToString() + "'");
                    strQuery = strQuery.Replace("@TableName", "'" + strTableName + "'");

                    String s = strTableName.Substring(2, strTableName.Length - 2);
                    //var r=new System.Text.RegularExpressions.Regex( @"(?<=[A-Z])(?=[A-Z][a-z]) |(?<=[^A-Z])(?=[A-Z]) |(?<=[A-Za-z])(?=[^A-Za-z])" , System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace );
                    //s=r.Replace( s , " " );


                    strQuery = strQuery.Replace("@CaptionVN", "'" + s + "'");
                    strQuery = strQuery.Replace("@CaptionEN", "'" + s + "'");
                    strQuery = strQuery.Replace("@DescriptionVN", "''");
                    strQuery = strQuery.Replace("@DescriptionEN", "''");
                    strQuery = strQuery.Replace("@IsCaching", "0");
                    strQuery = strQuery.Replace("@CalcOnClient", "1");
                    strQuery = strQuery.Replace("@DeleteByOwnerOnly", "0");
                    strQuery = strQuery.Replace("@EditByOwnerOnly", "0");
                    DataQueryProvider.SystemDatabaseHelper.RunScript(strQuery);
                }
                #endregion

                #region Field Config
                List <String> lstConfig = new List <String>();

                ds = DataQueryProvider.SystemDatabaseHelper.RunQuery(String.Format("SELECT STFieldConfigID,FieldName FROM  STFieldConfigs WHERE TableName='{0}'", strTableName));
                if (ds != null && ds.Tables.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        if (String.IsNullOrWhiteSpace(dr[1].ToString()) == false)
                        {
                            if (lstConfig.Contains(dr[1].ToString()) == false)
                            {
                                lstConfig.Add(dr[1].ToString());
                            }
                            else
                            {
                                Guid iID = Guid.Empty;
                                Guid.TryParse(dr[0].ToString(), out iID);
                                DataQueryProvider.SystemDatabaseHelper.RunQuery(String.Format("DELETE FROM STFieldConfigs WHERE STFieldConfigID='{0}'", strTableName));
                            }
                        }
                    }
                }

                int iCount = -1;
                foreach (String strColName in DataStructureProvider.DataTablesList[strTableName].ColumnsList.Keys)
                {
                    if (DataStructureProvider.IsPrimaryKey(strTableName, strColName))
                    {
                        continue;
                    }

                    iCount++;
                    if (lstConfig.Contains(strColName) == false)
                    {
                        String strQuery = QueryTemplateGenerator.GenInsert("STFieldConfigs");
                        Guid   iID      = Guid.NewGuid();
                        strQuery = strQuery.Replace("@STFieldConfigID", "'" + iID.ToString() + "'");
                        strQuery = strQuery.Replace("@TableName", "'" + strTableName + "'");
                        strQuery = strQuery.Replace("@FieldName", "'" + strColName + "'");
                        if (DataStructureProvider.IsForeignKey(strTableName, strColName))
                        {
                            String strFKTableName = DataStructureProvider.GetTableNameOfForeignKey(strTableName, strColName);
                            String strCaptionVN   = GetTableCaption(strFKTableName);
                            if (String.IsNullOrWhiteSpace(strCaptionVN))
                            {
                                strCaptionVN = strFKTableName.Substring(2, strFKTableName.Length - 3);
                            }
                            //var r=new System.Text.RegularExpressions.Regex( @"(?<=[A-Z])(?=[A-Z][a-z]) |(?<=[^A-Z])(?=[A-Z]) |(?<=[A-Za-z])(?=[^A-Za-z])" , System.Text.RegularExpressions.RegexOptions.IgnorePatternWhitespace );
                            //strCaptionVN=r.Replace( strCaptionVN , " " );

                            strQuery = strQuery.Replace("@CaptionVN", String.Format("N'{0}'", strCaptionVN));
                            strQuery = strQuery.Replace("@CaptionEN", "'" + strFKTableName.Substring(2, strFKTableName.Length - 3) + "'");
                        }
                        else
                        {
                            strQuery = strQuery.Replace("@CaptionVN", String.Format("N'{0}'", GetFieldCaptionFromDictionary(strColName)));
                            strQuery = strQuery.Replace("@CaptionEN", "'" + strColName + "'");
                            if (DataStructureProvider.IsNOColumn(strTableName, strColName))
                            {
                                String strTableCap = GetTableCaption(strTableName);
                                if (!String.IsNullOrWhiteSpace(strTableCap))
                                {
                                    strQuery = strQuery.Replace("@CaptionVN", String.Format("N'{0}'", strTableCap));
                                }
                            }
                        }
                        strQuery = strQuery.Replace("@DescriptionVN", "''");
                        strQuery = strQuery.Replace("@DescriptionEN", "''");
                        if (strColName.Equals("ABCStatus") || strColName.Equals("EditCount") ||
                            strColName.Equals("CreateTime") || strColName.Equals("CreateUser") ||
                            strColName.Equals("UpdateTime") || strColName.Equals("UpdateUser") ||
                            strColName.Equals("NoIndex") || strColName.Equals("LastCalcDate"))
                        {
                            strQuery = strQuery.Replace("@InUse", "0");
                        }
                        else
                        {
                            strQuery = strQuery.Replace("@InUse", "1");
                        }

                        if (DataStructureProvider.IsNOColumn(strTableName, strColName) ||
                            DataStructureProvider.IsNAMEColumn(strTableName, strColName) ||
                            DataStructureProvider.IsDisplayColumn(strTableName, strColName))
                        {
                            strQuery = strQuery.Replace("@IsDefault", "1");
                        }
                        else
                        {
                            strQuery = strQuery.Replace("@IsDefault", "0");
                        }

                        strQuery = strQuery.Replace("@AssignedEnum", "''");
                        strQuery = strQuery.Replace("@FilterString", "''");
                        strQuery = strQuery.Replace("@SortOrder", String.Format("{0}", iCount));

                        if (DataStructureProvider.IsNOColumn(strTableName, strColName) ||
                            DataStructureProvider.IsNAMEColumn(strTableName, strColName))
                        {
                            strQuery = strQuery.Replace("@IsDisplayField", "1");
                        }
                        else
                        {
                            strQuery = strQuery.Replace("@IsDisplayField", "0");
                        }

                        strQuery = strQuery.Replace("@IsDisplayField", "0");
                        strQuery = strQuery.Replace("@IsGrouping", "0");

                        #region DataFormatProvider.FieldFormat
                        String strTypeName = DataStructureProvider.GetCodingType(strTableName, strColName);
                        DataFormatProvider.FieldFormat format = DataFormatProvider.FieldFormat.None;

                        if (strTypeName == "DateTime" || strTypeName == "Nullable<DateTime>")
                        {
                            format = DataFormatProvider.FieldFormat.Date;
                        }

                        if ((strTypeName == "int" || strTypeName == "Nullable<int>" || strTypeName == "Guid" || strTypeName == "Nullable<Guid>") && strColName.ToUpper().Contains("FK_") == false &&
                            DataStructureProvider.IsForeignKey(strTableName, strColName) == false &&
                            DataStructureProvider.IsPrimaryKey(strTableName, strColName) == false)
                        {
                            format = DataFormatProvider.FieldFormat.Quantity;
                        }

                        if (strTypeName == "double" || strTypeName == "decimal")
                        {
                            if (strColName.ToLower().Contains("amt") || strColName.ToLower().Contains("fee") || strColName.ToLower().Contains("cost") ||
                                strColName.ToLower().Contains("expense") || strColName.ToLower().Contains("pay") || strColName.ToLower().Contains("tax") ||
                                strColName.ToLower().Contains("gross") || strColName.ToLower().Contains("net") ||
                                strColName.ToLower().Contains("amount") || strColName.ToLower().Contains("exchange"))
                            {
                                format = DataFormatProvider.FieldFormat.Currency;
                            }
                            else
                            {
                                format = DataFormatProvider.FieldFormat.Amount;
                            }
                        }

                        if (format != DataFormatProvider.FieldFormat.None)
                        {
                            strQuery = strQuery.Replace("@Format", String.Format("'{0}'", format.ToString()));
                        }
                        else
                        {
                            strQuery = strQuery.Replace("@Format", "''");
                        }

                        #endregion

                        DataQueryProvider.SystemDatabaseHelper.RunScript(strQuery);
                    }
                }

                foreach (String strColName in lstConfig)
                {
                    if (DataStructureProvider.DataTablesList[strTableName].ColumnsList.ContainsKey(strColName) == false)
                    {
                        DataQueryProvider.SystemDatabaseHelper.RunQuery(String.Format("DELETE  FROM  STFieldConfigs WHERE TableName='{0}' AND FieldName='{1}'", strTableName, strColName));
                    }
                }
                #endregion
            }
        }