public override int GetHashCode()
 {
     return
         (Type.GetHashCode() +
          Name.GetHashCode() +
          IsPrimaryKey.GetHashCode() +
          Nullability.GetHashCode());
 }
Example #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Key != null ? Key.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FieldValue != null ? FieldValue.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IsPrimaryKey.GetHashCode();
         return(hashCode);
     }
 }
Example #3
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (ColumnName != null ? ColumnName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ColumnType != null ? ColumnType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IsNullable.GetHashCode();
         hashCode = (hashCode * 397) ^ HasDefaultValue.GetHashCode();
         hashCode = (hashCode * 397) ^ IsPrimaryKey.GetHashCode();
         return(hashCode);
     }
 }
Example #4
0
        public static string IsPrimaryKeyDescription(this IsPrimaryKey isPrimaryKey)
        {
            switch (isPrimaryKey)
            {
            case IsPrimaryKey.NotPrimaryKey:
                return("");

            case IsPrimaryKey.PrimaryKey:
                return("是");

            default:
                return("");
            }
        }
Example #5
0
        internal void ToSettings(string indexName, Dictionary <string, string> settings, bool isSubField)
        {
            var category = "Index-" + indexName.ToLower() + "-Fields-" + this.Name.ToLower();

            Lib.AddSettingAsNeeded(settings, category, "IsSubField", isSubField.ToString(), true);

            Lib.AddSettingAsNeeded(settings, category, "Name", this.Name, true);

            Lib.AddSettingAsNeeded(settings, category, "Ordinal", Ordinal.ToString(), true);


            Lib.AddSettingAsNeeded(settings, category, "Value", ("" + Value).ToString(), true);

            Lib.AddSettingAsNeeded(settings, category, "IsPrimaryKey", IsPrimaryKey.ToString(), true);

            Lib.AddSettingAsNeeded(settings, category, "StoredInIndex", StoredInIndex.ToString(), true);

            Lib.AddSettingAsNeeded(settings, category, "Searchable", Searchable.ToString(), true);

            Lib.AddSettingAsNeeded(settings, category, "Format", Format.ToString(), true);

            Lib.AddSettingAsNeeded(settings, category, "Type", DataType.ToString(), true);

            Lib.AddSettingAsNeeded(settings, category, "IsBoolean", IsBoolean.ToString(), true);

            Lib.AddSettingAsNeeded(settings, category, "TrueValue", TrueValue.ToString(), true);

            Lib.AddSettingAsNeeded(settings, category, "IsCreatedDate", IsCreatedDate.ToString(), true);

            Lib.AddSettingAsNeeded(settings, category, "IsModifiedDate", IsModifiedDate.ToString(), true);

            Lib.AddSettingAsNeeded(settings, category, "ForeignKeyTable", ForeignKeyTable.ToString(), true);

            Lib.AddSettingAsNeeded(settings, category, "ForeignKeyField", ForeignKeyField.ToString(), true);


            Lib.AddSettingAsNeeded(settings, category, "Calculation", Calculation.ToString(), true);
            foreach (Field sf in this.SubFields)
            {
                sf.ToSettings(indexName, settings, true);
            }
        }
Example #6
0
        internal void FillDataSet(DataSet ds, string indexName, bool isSubField)
        {
            var dtField = ds.Tables["index_field"];

            var drFields = dtField.Select("index_name = '" + indexName + "' and field_name = '" + Name + "'");
            var drField  = dtField.NewRow();

            if (drFields.Length == 0)
            {
                dtField.Rows.Add(drField);
            }
            else
            {
                drField = drFields[0];
            }


            drField["index_name"] = indexName;
            drField["field_name"] = Name.ToString();
            drField["ordinal"]    = Ordinal.ToString();
            //drField["value"] = ("" + Value).ToString();
            drField["is_primary_key"]     = IsPrimaryKey.ToString();
            drField["is_stored_in_index"] = StoredInIndex.ToString();
            drField["is_searchable"]      = Searchable.ToString();
            drField["format"]             = Format.ToString();
            drField["type"]              = DataType.ToString();
            drField["is_boolean"]        = IsBoolean.ToString();
            drField["true_value"]        = TrueValue.ToString();
            drField["foreign_key_table"] = ForeignKeyTable.ToString();
            drField["foreign_key_field"] = ForeignKeyField.ToString();
            drField["calculation"]       = Calculation.ToString();

            foreach (Field sf in this.SubFields)
            {
                sf.FillDataSet(ds, indexName, true);
            }
        }
Example #7
0
        internal Node ToXmlNode()
        {
            Node nd = new Node("Field");

            nd.Attributes.SetValue("Ordinal", Ordinal.ToString());
            nd.Attributes.SetValue("Name", Name);
            if (Value != null)
            {
                nd.Attributes.SetValue("Value", Value.ToString());
            }
            nd.Attributes.SetValue("IsPrimaryKey", IsPrimaryKey.ToString());
            nd.Attributes.SetValue("StoredInIndex", StoredInIndex.ToString());
            nd.Attributes.SetValue("Searchable", Searchable.ToString());
            nd.Attributes.SetValue("Format", Format);
            if (DataType != null)
            {
                nd.Attributes.SetValue("Type", DataType.ToString());
            }

            nd.Attributes.SetValue("IsBoolean", IsBoolean.ToString());
            nd.Attributes.SetValue("TrueValue", TrueValue);

            nd.Attributes.SetValue("IsCreatedDate", IsCreatedDate.ToString());
            nd.Attributes.SetValue("IsModifedDate", IsModifiedDate.ToString());

            nd.Attributes.SetValue("ForeignKeyTable", ForeignKeyTable);
            nd.Attributes.SetValue("ForeignKeyField", ForeignKeyField);


            nd.Attributes.SetValue("Calculation", Calculation);
            foreach (Field sf in this.SubFields)
            {
                nd.Nodes.Add(sf.ToXmlNode());
            }

            return(nd);
        }
Example #8
0
        /// <summary>
        /// LUA结构支持
        /// </summary>
        /// <returns></returns>
        public override void GetLuaStruct(StringBuilder code)
        {
            base.GetLuaStruct(code);
            int idx;

            if (!string.IsNullOrWhiteSpace(PropertyName))
            {
                code.AppendLine($@"['PropertyName'] = '{PropertyName.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['PropertyName'] = nil,");
            }

            code.AppendLine($@"['IsCaption'] ={(IsCaption.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(Alias))
            {
                code.AppendLine($@"['Alias'] = '{Alias.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['Alias'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(Group))
            {
                code.AppendLine($@"['Group'] = '{Group.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['Group'] = nil,");
            }

            code.AppendLine($@"['CreateIndex'] ={(CreateIndex.ToString().ToLower())},");

            code.AppendLine($@"['IsPrimaryKey'] ={(IsPrimaryKey.ToString().ToLower())},");

            code.AppendLine($@"['IsExtendKey'] ={(IsExtendKey.ToString().ToLower())},");

            code.AppendLine($@"['IsIdentity'] ={(IsIdentity.ToString().ToLower())},");

            code.AppendLine($@"['IsGlobalKey'] ={(IsGlobalKey.ToString().ToLower())},");

            code.AppendLine($@"['UniqueIndex'] ={UniqueIndex},");

            code.AppendLine($@"['IsRequired'] ={(IsRequired.ToString().ToLower())},");

            code.AppendLine($@"['IsUserReadOnly'] ={(IsUserReadOnly.ToString().ToLower())},");

            code.AppendLine($@"['IsMemo'] ={(IsMemo.ToString().ToLower())},");


            code.AppendLine($@"['DenyClient'] ={(DenyClient.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(Prefix))
            {
                code.AppendLine($@"['Prefix'] = '{Prefix.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['Prefix'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(Suffix))
            {
                code.AppendLine($@"['Suffix'] = '{Suffix.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['Suffix'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(InputType))
            {
                code.AppendLine($@"['InputType'] = '{InputType.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['InputType'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(ComboBoxUrl))
            {
                code.AppendLine($@"['ComboBoxUrl'] = '{ComboBoxUrl.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ComboBoxUrl'] = nil,");
            }

            code.AppendLine($@"['IsMoney'] ={(IsMoney.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(GridAlign))
            {
                code.AppendLine($@"['GridAlign'] = '{GridAlign.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['GridAlign'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(DataFormater))
            {
                code.AppendLine($@"['DataFormater'] = '{DataFormater.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['DataFormater'] = nil,");
            }

            code.AppendLine($@"['DenyClient'] ={(DenyClient.ToString().ToLower())},");

            code.AppendLine($@"['GridDetails'] ={(GridDetails.ToString().ToLower())},");

            code.AppendLine($@"['NoneGrid'] ={(NoneGrid.ToString().ToLower())},");

            code.AppendLine($@"['NoneDetails'] ={(NoneDetails.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(GridDetailsCode))
            {
                code.AppendLine($@"['GridDetailsCode'] = '{GridDetailsCode.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['GridDetailsCode'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(CppType))
            {
                code.AppendLine($@"['CppType'] = '{CppType.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['CppType'] = nil,");
            }

            if (CppTypeObject != null)
            {
                code.AppendLine($@"['CppTypeObject'] ='{CppTypeObject}',");
            }

            if (!string.IsNullOrWhiteSpace(CppName))
            {
                code.AppendLine($@"['CppName'] = '{CppName.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['CppName'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(CppLastType))
            {
                code.AppendLine($@"['CppLastType'] = '{CppLastType.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['CppLastType'] = nil,");
            }

            code.AppendLine($@"['IsIntDecimal'] ={(IsIntDecimal.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(CsType))
            {
                code.AppendLine($@"['CsType'] = '{CsType.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['CsType'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(CustomType))
            {
                code.AppendLine($@"['CustomType'] = '{CustomType.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['CustomType'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(LastCsType))
            {
                code.AppendLine($@"['LastCsType'] = '{LastCsType.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['LastCsType'] = nil,");
            }

            if (EnumConfig != null)
            {
                code.AppendLine($@"['EnumConfig'] = {EnumConfig.GetLuaStruct()},");
            }

            code.AppendLine($@"['IsCompute'] ={(IsCompute.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(ComputeGetCode))
            {
                code.AppendLine($@"['ComputeGetCode'] = '{ComputeGetCode.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ComputeGetCode'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(ComputeSetCode))
            {
                code.AppendLine($@"['ComputeSetCode'] = '{ComputeSetCode.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ComputeSetCode'] = nil,");
            }

            code.AppendLine($@"['IsMiddleField'] ={(IsMiddleField.ToString().ToLower())},");

            code.AppendLine($@"['InnerField'] ={(InnerField.ToString().ToLower())},");

            code.AppendLine($@"['IsSystemField'] ={(IsSystemField.ToString().ToLower())},");

            code.AppendLine($@"['IsInterfaceField'] ={(IsInterfaceField.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(Initialization))
            {
                code.AppendLine($@"['Initialization'] = '{Initialization.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['Initialization'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(EmptyValue))
            {
                code.AppendLine($@"['EmptyValue'] = '{EmptyValue.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['EmptyValue'] = nil,");
            }

            code.AppendLine($@"['DenyScope'] ='{DenyScope}',");

            code.AppendLine($@"['Nullable'] ={(Nullable.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(Max))
            {
                code.AppendLine($@"['Max'] = '{Max.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['Max'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(Min))
            {
                code.AppendLine($@"['Min'] = '{Min.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['Min'] = nil,");
            }

            code.AppendLine($@"['UniqueString'] ={(UniqueString.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(ColumnName))
            {
                code.AppendLine($@"['ColumnName'] = '{ColumnName.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ColumnName'] = nil,");
            }

            code.AppendLine($@"['DbNullable'] ={(DbNullable.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(DbType))
            {
                code.AppendLine($@"['DbType'] = '{DbType.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['DbType'] = nil,");
            }

            code.AppendLine($@"['Precision'] ={Datalen},");

            if (!string.IsNullOrWhiteSpace(ArrayLen))
            {
                code.AppendLine($@"['ArrayLen'] = '{ArrayLen.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ArrayLen'] = nil,");
            }

            code.AppendLine($@"['Scale'] ={Scale},");

            code.AppendLine($@"['DbIndex'] ={DbIndex},");

            code.AppendLine($@"['Unicode'] ={(Unicode.ToString().ToLower())},");

            code.AppendLine($@"['FixedLength'] ={(FixedLength.ToString().ToLower())},");

            code.AppendLine($@"['IsBlob'] ={(IsBlob.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(StorageProperty))
            {
                code.AppendLine($@"['StorageProperty'] = '{StorageProperty.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['StorageProperty'] = nil,");
            }

            code.AppendLine($@"['DbInnerField'] ={(DbInnerField.ToString().ToLower())},");

            code.AppendLine($@"['NoStorage'] ={(NoStorage.ToString().ToLower())},");

            code.AppendLine($@"['KeepStorageScreen'] ='{KeepStorageScreen}',");

            code.AppendLine($@"['CustomWrite'] ={(CustomWrite.ToString().ToLower())},");

            code.AppendLine($@"['IsLinkField'] ={(IsLinkField.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(LinkTable))
            {
                code.AppendLine($@"['LinkTable'] = '{LinkTable.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['LinkTable'] = nil,");
            }

            code.AppendLine($@"['IsLinkKey'] ={(IsLinkKey.ToString().ToLower())},");

            code.AppendLine($@"['IsLinkCaption'] ={(IsLinkCaption.ToString().ToLower())},");

            code.AppendLine($@"['IsUserId'] ={(IsUserId.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(LinkField))
            {
                code.AppendLine($@"['LinkField'] = '{LinkField.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['LinkField'] = nil,");
            }

            code.AppendLine($@"['IsCustomCompute'] ={(IsCustomCompute.ToString().ToLower())},");

            code.AppendLine($@"['CanGet'] ={(CanGet.ToString().ToLower())},");

            code.AppendLine($@"['CanSet'] ={(CanSet.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(AccessType))
            {
                code.AppendLine($@"['AccessType'] = '{AccessType.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['AccessType'] = nil,");
            }

            code.AppendLine($@"['ReadOnly'] ={(ReadOnly.ToString().ToLower())},");

            code.AppendLine($@"['CanInput'] ={(CanUserInput.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(ExtendRole))
            {
                code.AppendLine($@"['ExtendRole'] = '{ExtendRole.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ExtendRole'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(ValueSeparate))
            {
                code.AppendLine($@"['ValueSeparate'] = '{ValueSeparate.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ValueSeparate'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(ArraySeparate))
            {
                code.AppendLine($@"['ArraySeparate'] = '{ArraySeparate.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ArraySeparate'] = nil,");
            }

            code.AppendLine($@"['ExtendArray'] ={(ExtendArray.ToString().ToLower())},");

            code.AppendLine($@"['IsKeyValueArray'] ={(IsKeyValueArray.ToString().ToLower())},");

            code.AppendLine($@"['IsRelation'] ={(IsRelation.ToString().ToLower())},");

            if (!string.IsNullOrWhiteSpace(ExtendPropertyName))
            {
                code.AppendLine($@"['ExtendPropertyName'] = '{ExtendPropertyName.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ExtendPropertyName'] = nil,");
            }

            if (!string.IsNullOrWhiteSpace(ExtendClassName))
            {
                code.AppendLine($@"['ExtendClassName'] = '{ExtendClassName.ToLuaString()}',");
            }
            else
            {
                code.AppendLine($@"['ExtendClassName'] = nil,");
            }

            code.AppendLine($@"['ExtendClassIsPredestinate'] ={(ExtendClassIsPredestinate.ToString().ToLower())},");

            code.AppendLine($@"['IsRelationField'] ={(IsRelationField.ToString().ToLower())},");

            code.AppendLine($@"['IsRelationValue'] ={(IsRelationValue.ToString().ToLower())},");

            code.AppendLine($@"['IsRelationArray'] ={(IsRelationArray.ToString().ToLower())},");

            code.AppendLine($@"['IsExtendArray'] ={(IsExtendArray.ToString().ToLower())},");

            code.AppendLine($@"['IsExtendValue'] ={(IsExtendValue.ToString().ToLower())},");
        }