예제 #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 object GetCachingObjectAccrossTable(String strTableName, Guid iFieldValue, String strFieldString, String strIDTableName)
        {
            AccrossStructInfo info = GetAccrossStructInfo(strTableName, iFieldValue, strFieldString, strIDTableName);

            if (info != null && DataStructureProvider.IsTableColumn(info.TableName, info.FieldName))
            {
                BusinessObject objResult = GetCachedBusinessObject(info.TableName, info.TableID);
                return(ABCBusinessEntities.ABCDynamicInvoker.GetValue(objResult, info.FieldName));
            }

            return(null);
        }
예제 #3
0
        public static object GetCachingObjectDisplayAccrossTable(String strTableName, Guid iFieldValue, String strFieldString, String strIDTableName)
        {
            AccrossStructInfo info = GetAccrossStructInfo(strTableName, iFieldValue, strFieldString, strIDTableName);

            if (info != null && DataStructureProvider.IsTableColumn(info.TableName, info.FieldName))
            {
                BusinessObject objResult = GetCachedBusinessObject(info.TableName, info.TableID);
                object         obj       = ABCBusinessEntities.ABCDynamicInvoker.GetValue(objResult, info.FieldName);

                String strEnum = DataConfigProvider.TableConfigList[info.TableName].FieldConfigList[info.FieldName].AssignedEnum;
                if (EnumProvider.EnumList.ContainsKey(strEnum) &&
                    EnumProvider.EnumList[strEnum].Items.ContainsKey(obj.ToString()))
                {
                    return(EnumProvider.EnumList[strEnum].Items[obj.ToString()].CaptionVN);
                }

                return(obj);
            }
            return(null);
        }
예제 #4
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);
        }