示例#1
0
文件: objData.cs 项目: emm274/fcObj
        // синхронизация родительских бланков
        int syncParentDT(xobj.Iblank blank, FC.FeatureType dt)
        {
            var rc =0;
            var parents = dt.InheritsFrom;
            if (parents != null)
            foreach (var parent in parents) {
                FC.FeatureType up=parent.Supertype;
                if (up != null) {
                    string s=up.Code;
                    if (convert.IsString(s))
                    if (syncDT(up) > 0) {
                        int rc1;
                        if (!up.IsDataType()) s="$"+s;
                        blank.attr("$inherited","",s,0,out rc1);
                        if (rc1 < 0) __err(); else rc++;
                    }
                }
            }

            return rc;
        }
示例#2
0
文件: objData.cs 项目: emm274/fcObj
        // синхронизация атрибута
        bool syncAttr(xobj.Iblank blank, FC.Binding binding)
        {
            var attr = binding.PropertyType as FC.FeatureAttribute;

            if (attr != null) {

                string key=attr.Code;	// акроним
                if (convert.IsString(key)) {

                    int rc;

                    string typ=attr.ValueType;

                    FC.FeatureType dt=null;
                    string dt1="";

                    if (typ == "Класс") {
                        dt=binding.GetDataType();
                        if (dt != null) dt1=dt.Code;
                    }

               					string Nset=binding.Cardinality;

                    int flags=0;

                    if (!binding.Voidable) flags+=1;

                    if (typ == "Домен") {
                        var vt = binding.ConstrainedBy.GetConstraint( typeof(ValueTypeConstraint) ) as
                            FC.ValueTypeConstraint.DomainValueType;
                        if (vt != null) if (vt.IsMultiValue) flags+=8;
                    } else

                    if (typ == "Дробное интервальное") flags+=8;

                    if (!fattrList.Contains(key)) {

                        fattrList.Add(key);

              					if (dt != null) syncDT(dt);
              					if (typ == "Домен") {
              						rc=syncEnum(attr);
              						if (rc == 0) typ="dbase";
              					}

                        string capt=attr.ToString();
                        fidx.sync(key,typ,capt,out rc);

                        if (rc == 1) fattrUpdCount++; else
                        if (rc == 2) fattrNewCount++; else
                        if (rc != 0) __err();
                    }

                    blank.attr(key,Nset,dt1,flags,out rc);

                    if (rc < 0) __err();

                    return true;
                }
            }

            return false;
        }