Beispiel #1
0
	private GameObject CreateNode(GroupType gtype, Transform parent, Vector3 scale, Vector3 pos, float angle)
	{
		DynamicObjectType otype = DynamicObjectType.circle;
		switch (gtype)
		{
			case GroupType.Box:
				otype = DynamicObjectType.box;
				break;
			case GroupType.Ball:
				otype = DynamicObjectType.circle;
				break;
			case GroupType.Triangle:
				otype = DynamicObjectType.triangle;
				break;
			case GroupType.Hexagon:
				otype = DynamicObjectType.hexagon;
				break;
			case GroupType.Star:
				otype = DynamicObjectType.star;
				break;
		}

		var ball = CreateDynamicPrefabs.CreateNode(otype, parent);
		if (ball)
		{
			var tran = ball.transform;
			tran.localScale = scale;
			tran.localPosition = pos;
			if (Math.Abs(angle) >= Mathf.Epsilon)
				tran.localEulerAngles = new Vector3(0, 0, angle);
		}
		else
			Debug.LogError($"Create {otype} Failed");
		return ball;
	}
Beispiel #2
0
        public Dictionary <DynamicObject, object> ChangedRoles <TRole>(string name)
        {
            DynamicObjectType objectType = this.Meta.ObjectTypeByType[typeof(TRole)];
            IDynamicRoleType  roleType   = objectType.RoleTypeByName[name];

            return(this.ChangedRoles(roleType));
        }
        /// <summary>
        /// Returns the difference between the target and source using the property "DATETIME"
        /// Returns null if both target and source do not have a "DATETIME" property
        /// </summary>
        private static TimeSpan?CalculateDateTimeDifference(DynamicObjectType targetProperty, DynamicObjectType sourceProperty)
        {
            if (targetProperty == null)
            {
                return(null);
            }

            var firstOrDefault = sourceProperty.Properties.FirstOrDefault(prop => prop.Name == Keywords.DATETIME);

            if (firstOrDefault != null)
            {
                var sourceDateTimeString =
                    firstOrDefault.Value.ToString();
                DateTime sourceDateTime;
                if (!DateTimeExt.TryParseWithTimeZoneRemoval(sourceDateTimeString, out sourceDateTime))
                {
                    return(null);
                }

                var dynamicProperty = targetProperty.Properties.FirstOrDefault(prop => prop.Name == Keywords.DATETIME);
                if (dynamicProperty != null)
                {
                    var targetDateTimeString =
                        dynamicProperty.Value.ToString();
                    DateTime targetDateTime;
                    if (!DateTimeExt.TryParseWithTimeZoneRemoval(targetDateTimeString, out targetDateTime))
                    {
                        return(null);
                    }

                    return(sourceDateTime - targetDateTime);
                }
            }
            return(null);
        }
Beispiel #4
0
 public DynamicOneToOneAssociationType(DynamicObjectType objectType, DynamicOneToOneRoleType roleType)
 {
     this.ObjectType          = objectType;
     roleType.AssociationType = this;
     this.RoleType            = roleType;
     this.SingularName        = roleType.SingularNameForAssociation(objectType);
     this.PluralName          = roleType.PluralNameForAssociation(objectType);
 }
Beispiel #5
0
        private void ClearEntity(string entityKey)
        {
            Entity            entryEntity       = this.View.BusinessInfo.GetEntryEntity(entityKey);
            DynamicObjectType dynamicObjectType = entryEntity.DynamicObjectType;

            this.Model.GetEntityDataObject(entryEntity).Clear();
            this.View.UpdateView(entityKey);
        }
Beispiel #6
0
        public DynamicOneToOneRoleType(DynamicObjectType objectType, string singularName)
        {
            var pluralizer = objectType.Meta.Pluralizer;

            this.ObjectType   = objectType;
            this.SingularName = singularName ?? objectType.Type.Name;
            this.PluralName   = pluralizer.Pluralize(this.SingularName);
        }
        /// <summary>
        /// 为打印动态属性修改数据源,使用套打动态属性赋值
        /// </summary>
        /// <param name="e"></param>
        public override void OnPrepareNotePrintData(PreparePrintDataEventArgs e)
        {
            base.OnPrepareNotePrintData(e);
            string dataSourceId = e.DataSourceId;

            List <Field>      fields = GetFieldByEntity(dataSourceId);
            DynamicObjectType dt     = e.DynamicObjectType;

            e.DataObjects = presenter.PrintExtensionData(dataSourceId, fields, ref dt, e.DataObjects);
        }
        /// <summary>
        /// 加载引用属性
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="dt"></param>
        /// <param name="pkValue"></param>
        /// <returns></returns>
        private DynamicObject LoadReferenceData(Context ctx, DynamicObjectType dt, object pkValue)
        {
            if (pkValue.IsEmptyPrimaryKey())
            {
                return(null);
            }
            OperateOption option = OperateOption.Create();

            option.SetThrowExceptionWhenNotFind(false);
            return(Kingdee.BOS.ServiceHelper.BusinessDataServiceHelper.LoadSingle(ctx, pkValue, dt, option));
        }
Beispiel #9
0
    public static GameObject CreateNode(DynamicObjectType type, Transform t = null)
    {
        GameObject ret = null;

        t = t ?? Selection.activeTransform;
        if (prefabs.TryGetValue(type.ToString(), out ret))
        {
            ret = Object.Instantiate(ret, t);
        }
        return(ret);
    }
Beispiel #10
0
        private void RegisterSimpleProperty(ref DynamicObjectType dt, string fieldKey)
        {
            string jsonValue = GetJsonValueByKey(fieldKey, 0);


            Dictionary <string, string> extensionValueDictionary = JsonConvert.DeserializeObject <Dictionary <string, string> >(jsonValue);

            foreach (string key in extensionValueDictionary.Keys)
            {
                dt.RegisterSimpleProperty(key, typeof(string));
            }
        }
Beispiel #11
0
        private void RefreshErrEntity(StockOrgOperateResult opResult, ErrType errType)
        {
            Entity                  entryEntity       = this.View.BusinessInfo.GetEntryEntity("FEntityErrInfo");
            DynamicObjectType       dynamicObjectType = entryEntity.DynamicObjectType;
            DynamicObjectCollection entityDataObject  = this.Model.GetEntityDataObject(entryEntity);

            entityDataObject.Clear();
            if (((errType == ErrType.Minus) || (errType == ErrType.None)) || ((errType == ErrType.UnAuditStkCountBill) || (errType == ErrType.StkDraftBill)))
            {
                this.View.UpdateView("FEntityErrInfo");
            }
            else if (((opResult == null) || (opResult.ErrInfo == null)) || (opResult.ErrInfo.Count < 1))
            {
                this.View.UpdateView("FEntityErrInfo");
            }
            else
            {
                IEnumerable <OperateErrorInfo> enumerable;
                if (errType == ErrType.UnAuditBill)
                {
                    enumerable = from p in opResult.ErrInfo
                                 where p.ErrType == Convert.ToInt32(ErrType.UnAuditBill)
                                 select p;
                }
                else
                {
                    enumerable = from p in opResult.ErrInfo
                                 where p.ErrType < Convert.ToInt32(ErrType.OrgStatusErr)
                                 select p;
                }
                foreach (OperateErrorInfo info in enumerable)
                {
                    DynamicObject item = new DynamicObject(dynamicObjectType)
                    {
                        ["ErrType"]        = info.ErrType,
                        ["ErrObjType"]     = info.ErrObjType,
                        ["ErrObjKeyField"] = info.ErrObjKeyField,
                        ["ErrObjKeyID"]    = info.ErrObjKeyID,
                        ["ErrMsg"]         = info.ErrMsg
                    };
                    entityDataObject.Add(item);
                }
                this.View.UpdateView("FEntityErrInfo");
            }
        }
Beispiel #12
0
        public static DynamicObject[] GetDynamicObjects(Context ctx, string formId, string filterClauseWihtKey)
        {
            if (!string.IsNullOrEmpty(formId))
            {
                FormMetadata          metaData       = MetaDataServiceHelper.Load(ctx, formId) as FormMetadata;
                DynamicObjectType     type           = metaData.BusinessInfo.GetDynamicObjectType();
                QueryBuilderParemeter queryParemeter = new QueryBuilderParemeter();
                queryParemeter.FormId = formId;

                if (!string.IsNullOrEmpty(filterClauseWihtKey))
                {
                    queryParemeter.FilterClauseWihtKey = filterClauseWihtKey;
                }

                DynamicObject[] objects = BusinessDataServiceHelper.Load(ctx, type, queryParemeter);
                return(objects);
            }

            return(null);
        }
Beispiel #13
0
        private void RefreshMinusEntry(StockOrgOperateResult opResult, ErrType errType)
        {
            Entity                  entryEntity       = this.View.BusinessInfo.GetEntryEntity("FMinusEntry");
            DynamicObjectType       dynamicObjectType = entryEntity.DynamicObjectType;
            DynamicObjectCollection entityDataObject  = this.Model.GetEntityDataObject(entryEntity);

            entityDataObject.Clear();
            if (((opResult != null) && (opResult.MinusErrObject != null)) && (((DynamicObjectCollection)opResult.MinusErrObject["Entry"]).Count > 0))
            {
                foreach (DynamicObject obj2 in (DynamicObjectCollection)opResult.MinusErrObject["Entry"])
                {
                    DynamicObject item = new DynamicObject(dynamicObjectType)
                    {
                        ["ErrMessage"]      = obj2["ErrMessage"],
                        ["MaterialNumber"]  = obj2["MaterialNumber"],
                        ["MaterialName"]    = obj2["MaterialName"],
                        ["Specification"]   = obj2["Specification"],
                        ["StockName"]       = obj2["StockName"],
                        ["StockLocName"]    = obj2["StockLocName"],
                        ["UnitName"]        = obj2["UnitName"],
                        ["Qty"]             = obj2["Qty"],
                        ["SecUnitName"]     = obj2["SecUnitName"],
                        ["SecQty"]          = obj2["SecQty"],
                        ["LotText"]         = obj2["LotText"],
                        ["AuxPropName"]     = obj2["AuxPropName"],
                        ["BOMNumber"]       = obj2["BOMNumber"],
                        ["MtoNo"]           = obj2["MtoNo"],
                        ["ProjectNo"]       = obj2["ProjectNo"],
                        ["ProduceDate"]     = obj2["ProduceDate"],
                        ["ExpiryDate"]      = obj2["ExpiryDate"],
                        ["StockStatusName"] = obj2["StockStatusName"],
                        ["OwnerTypeName"]   = obj2["OwnerTypeName"],
                        ["OwnerName"]       = obj2["OwnerName"],
                        ["KeeperTypeName"]  = obj2["KeeperTypeName"],
                        ["KeeperName"]      = obj2["KeeperName"]
                    };
                    entityDataObject.Add(item);
                }
            }
            this.View.UpdateView("FMinusEntry");
        }
Beispiel #14
0
        public override void CreateNewData(BizDataEventArgs e)
        {
            base.CreateNewData(e);

            DynamicObjectCollection logs      = GetObjects(this.Context, initSql);
            DynamicObjectType       dtType    = this.View.BusinessInfo.GetDynamicObjectType();
            EntryEntity             entity    = (EntryEntity)this.View.BusinessInfo.GetEntity("F_HS_Entity");
            DynamicObject           objData   = new DynamicObject(dtType);
            DynamicObject           entityObj = null;

            if (logs != null && logs.Count > 0)
            {
                int seq = 1;
                foreach (var log in logs)
                {
                    if (log != null)
                    {
                        entityObj = new DynamicObject(entity.DynamicObjectType);
                        entity.DynamicProperty.GetValue <DynamicObjectCollection>(objData).Add(entityObj);

                        entityObj["seq"] = seq;
                        entityObj["F_HS_DataSourceType"] = log["FDataSourceType"];
                        entityObj["F_HS_DataSourceId"]   = log["FDataSourceId"];
                        entityObj["F_HS_BILLNO"]         = log["FBILLNO"];
                        entityObj["F_HS_SynchroTime"]    = log["FSynchroTime"];
                        entityObj["F_HS_IsSuccess"]      = log["FIsSuccess"];
                        entityObj["F_HS_ErrInfor"]       = log["FErrInfor"];

                        entityObj["F_HS_DataSourceTypeDesc"] = log["FDataSourceTypeDesc"];
                        entityObj["F_HS_OperateId"]          = log["FHSOperateId"];
                        seq++;
                    }
                }

                e.BizDataObject = objData;
            }
        }
Beispiel #15
0
        private void RefreshStkCntBillAuditEntry(StockOrgOperateResult opResult, ErrType errtype)
        {
            Entity                  entryEntity       = this.View.BusinessInfo.GetEntryEntity("FStkCountBillAuditEntry");
            DynamicObjectType       dynamicObjectType = entryEntity.DynamicObjectType;
            DynamicObjectCollection entityDataObject  = this.Model.GetEntityDataObject(entryEntity);

            entityDataObject.Clear();
            if (((opResult != null) && (opResult.StkCountBillAuditErrInfo != null)) && (opResult.StkCountBillAuditErrInfo.Count > 0))
            {
                foreach (OperateErrorInfo info in opResult.StkCountBillAuditErrInfo)
                {
                    DynamicObject item = new DynamicObject(dynamicObjectType)
                    {
                        ["CtbaErrType"]        = info.ErrType,
                        ["CtbaErrObjType"]     = info.ErrObjType,
                        ["CtbaErrObjKeyField"] = info.ErrObjKeyField,
                        ["CtbaErrObjKeyID"]    = info.ErrObjKeyID,
                        ["CtbaErrMsg"]         = info.ErrMsg
                    };
                    entityDataObject.Add(item);
                }
            }
            this.View.UpdateView("FStkCountBillAuditEntry");
        }
Beispiel #16
0
        public bool CreateDynamicObject(ulong guidlow, Unit caster, SpellInfo spell, Position pos, float radius, DynamicObjectType type, SpellCastVisualField spellVisual)
        {
            SetMap(caster.GetMap());
            Relocate(pos);
            if (!IsPositionValid())
            {
                Log.outError(LogFilter.Server, "DynamicObject (spell {0}) not created. Suggested coordinates isn't valid (X: {1} Y: {2})", spell.Id, GetPositionX(), GetPositionY());
                return(false);
            }

            _Create(ObjectGuid.Create(HighGuid.DynamicObject, GetMapId(), spell.Id, guidlow));
            PhasingHandler.InheritPhaseShift(this, caster);

            SetEntry(spell.Id);
            SetObjectScale(1f);

            SetUpdateFieldValue(m_values.ModifyValue(m_dynamicObjectData).ModifyValue(m_dynamicObjectData.Caster), caster.GetGUID());
            SetUpdateFieldValue(m_values.ModifyValue(m_dynamicObjectData).ModifyValue(m_dynamicObjectData.Type), (byte)type);

            SpellCastVisualField spellCastVisual = m_values.ModifyValue(m_dynamicObjectData).ModifyValue(m_dynamicObjectData.SpellVisual);

            SetUpdateFieldValue(ref spellCastVisual.SpellXSpellVisualID, spellVisual.SpellXSpellVisualID);
            SetUpdateFieldValue(ref spellCastVisual.ScriptVisualID, spellVisual.ScriptVisualID);

            SetUpdateFieldValue(m_values.ModifyValue(m_dynamicObjectData).ModifyValue(m_dynamicObjectData.SpellID), spell.Id);
            SetUpdateFieldValue(m_values.ModifyValue(m_dynamicObjectData).ModifyValue(m_dynamicObjectData.Radius), radius);
            SetUpdateFieldValue(m_values.ModifyValue(m_dynamicObjectData).ModifyValue(m_dynamicObjectData.CastTime), GameTime.GetGameTimeMS());

            if (IsWorldObject())
            {
                SetActive(true);    //must before add to map to be put in world container
            }
            Transport transport = caster.GetTransport();

            if (transport)
            {
                float x, y, z, o;
                pos.GetPosition(out x, out y, out z, out o);
                transport.CalculatePassengerOffset(ref x, ref y, ref z, ref o);
                m_movementInfo.transport.pos.Relocate(x, y, z, o);

                // This object must be added to transport before adding to map for the client to properly display it
                transport.AddPassenger(this);
            }

            if (!GetMap().AddToMap(this))
            {
                // Returning false will cause the object to be deleted - remove from transport
                if (transport)
                {
                    transport.RemovePassenger(this);
                }
                return(false);
            }

            return(true);
        }
Beispiel #17
0
 public C1(IDynamicPopulation population, DynamicObjectType objectType)
     : base(population, objectType)
 {
 }
Beispiel #18
0
        public bool CreateDynamicObject(ulong guidlow, Unit caster, SpellInfo spell, Position pos, float radius, DynamicObjectType type, uint spellXSpellVisualId)
        {
            _spellXSpellVisualId = spellXSpellVisualId;
            SetMap(caster.GetMap());
            Relocate(pos);
            if (!IsPositionValid())
            {
                Log.outError(LogFilter.Server, "DynamicObject (spell {0}) not created. Suggested coordinates isn't valid (X: {1} Y: {2})", spell.Id, GetPositionX(), GetPositionY());
                return(false);
            }

            _Create(ObjectGuid.Create(HighGuid.DynamicObject, GetMapId(), spell.Id, guidlow));
            SetPhaseMask(caster.GetPhaseMask(), false);

            SetEntry(spell.Id);
            SetObjectScale(1f);
            SetGuidValue(DynamicObjectFields.Caster, caster.GetGUID());

            SetUInt32Value(DynamicObjectFields.Type, (uint)type);
            SetUInt32Value(DynamicObjectFields.SpellXSpellVisualId, spellXSpellVisualId);
            SetUInt32Value(DynamicObjectFields.SpellId, spell.Id);
            SetFloatValue(DynamicObjectFields.Radius, radius);
            SetUInt32Value(DynamicObjectFields.CastTime, Time.GetMSTime());

            if (IsWorldObject())
            {
                setActive(true);    //must before add to map to be put in world container
            }
            Transport transport = caster.GetTransport();

            if (transport)
            {
                float x, y, z, o;
                pos.GetPosition(out x, out y, out z, out o);
                transport.CalculatePassengerOffset(ref x, ref y, ref z, ref o);
                m_movementInfo.transport.pos.Relocate(x, y, z, o);

                // This object must be added to transport before adding to map for the client to properly display it
                transport.AddPassenger(this);
            }

            if (!GetMap().AddToMap(this))
            {
                // Returning false will cause the object to be deleted - remove from transport
                if (transport)
                {
                    transport.RemovePassenger(this);
                }
                return(false);
            }

            return(true);
        }
Beispiel #19
0
        public override void CreateNewData(BizDataEventArgs e)
        {
            DynamicObjectType dynamicObjectType = this.Model.BillBusinessInfo.GetDynamicObjectType();
            Entity            entity            = this.View.BusinessInfo.Entrys[1];
            DynamicObjectType dt         = entity.DynamicObjectType;
            DynamicObject     dataEntity = new DynamicObject(dynamicObjectType)
            {
                ["CloseDate"] = DateTime.Now.Date
            };
            DynamicObjectCollection objects   = entity.DynamicProperty.GetValue <DynamicObjectCollection>(dataEntity);
            BusinessObject          bizObject = new BusinessObject
            {
                Id = "STK_Account",
                PermissionControl = 1,
                SubSystemId       = "STK"
            };
            List <long> valList = PermissionServiceHelper.GetPermissionOrg(base.Context, bizObject, this.isOpenAccount ? "4cc4dea42de6441ebeb21c509358d73d" : "1046d14017fd45dbaff9b1fe4affe0c6");

            if ((valList == null) || (valList.Count < 1))
            {
                e.BizDataObject = dataEntity;
            }
            else
            {
                Dictionary <string, object> batchStockDate = StockServiceHelper.GetBatchStockDate(base.Context, valList);
                if ((batchStockDate == null) || (batchStockDate.Keys.Count < 1))
                {
                    e.BizDataObject = dataEntity;
                }
                else
                {
                    valList.Clear();
                    foreach (string str in batchStockDate.Keys)
                    {
                        valList.Add(Convert.ToInt64(str));
                    }
                    List <SelectorItemInfo> list2 = new List <SelectorItemInfo> {
                        new SelectorItemInfo("FORGID"),
                        new SelectorItemInfo("FName"),
                        new SelectorItemInfo("FNumber"),
                        new SelectorItemInfo("FDescription")
                    };
                    string str2 = this.GetInFilter(" FORGID", valList) + $" AND FDOCUMENTSTATUS = 'C' AND FFORBIDSTATUS = 'A' AND (FORGFUNCTIONS like'%103%') AND EXISTS(SELECT 1 FROM T_BAS_SYSTEMPROFILE BSP WHERE BSP.FCATEGORY = 'STK' AND BSP.FORGID = FORGID AND BSP.FACCOUNTBOOKID = 0 AND BSP.FKEY = 'IsInvEndInitial' AND BSP.FVALUE = '1') {(this.isOpenAccount ? "AND EXISTS(SELECT 1 FROM T_STK_CLOSEPROFILE SCP WHERE SCP.FCATEGORY = 'STK' AND SCP.FORGID = FORGID )" : "")} ";
                    QueryBuilderParemeter para = new QueryBuilderParemeter
                    {
                        FormId                 = "ORG_Organizations",
                        SelectItems            = list2,
                        FilterClauseWihtKey    = str2,
                        OrderByClauseWihtKey   = "",
                        IsolationOrgList       = null,
                        RequiresDataPermission = true
                    };
                    DynamicObjectCollection source          = QueryServiceHelper.GetDynamicObjectCollection(base.Context, para, null);
                    DataTable stockOrgAcctLastCloseDate     = CommonServiceHelper.GetStockOrgAcctLastCloseDate(base.Context, "");
                    Dictionary <long, DateTime> dictionary2 = new Dictionary <long, DateTime>();
                    foreach (DataRow row in stockOrgAcctLastCloseDate.Rows)
                    {
                        if (!(row["FCLOSEDATE"] is DBNull) && !string.IsNullOrWhiteSpace(row["FCLOSEDATE"].ToString()))
                        {
                            dictionary2[Convert.ToInt64(row["FORGID"])] = Convert.ToDateTime(row["FCLOSEDATE"]);
                        }
                    }
                    int num = 0;
                    if ((source != null) && (source.Count <DynamicObject>() > 0))
                    {
                        foreach (DynamicObject obj4 in source)
                        {
                            long          key  = Convert.ToInt64(obj4["FORGID"]);
                            DynamicObject item = new DynamicObject(dt)
                            {
                                ["Check"]        = true,
                                ["StockOrgNo"]   = obj4["FNumber"].ToString(),
                                ["StockOrgName"] = ((obj4["FName"] == null) || string.IsNullOrEmpty(obj4["FName"].ToString())) ? "" : obj4["FName"].ToString(),
                                ["StockOrgDesc"] = ((obj4["FDescription"] == null) || string.IsNullOrEmpty(obj4["FDescription"].ToString())) ? "" : obj4["FDescription"].ToString(),
                                ["StockOrgID"]   = obj4["FORGID"].ToString(),
                                ["Result"]       = "",
                                ["RetFlag"]      = false,
                                ["Seq"]          = num++
                            };
                            if (dictionary2.ContainsKey(key))
                            {
                                item["LastCloseDate"] = dictionary2[key];
                            }
                            objects.Add(item);
                        }
                    }
                    e.BizDataObject = dataEntity;
                }
            }
        }
Beispiel #20
0
 protected DynamicObject(IDynamicPopulation population, DynamicObjectType objectType)
 {
     this.Population = population;
     this.ObjectType = objectType;
 }
Beispiel #21
0
 public static DynamicObject LoadFromCache(this DynamicObject dataObject, Context ctx, DynamicObjectType type, Func <DynamicObject, object> selector = null)
 {
     return(new DynamicObject[] { dataObject }.LoadFromCache(ctx, type, selector).FirstOrDefault());
 }//end method
Beispiel #22
0
        /// <summary>
        /// 打印时将扩展属性加入到打印数据源中,在套打中使用动态字段
        /// </summary>
        /// <param name="dataSourceId"></param>
        /// <param name="fields"></param>
        /// <param name="dt"></param>
        /// <returns></returns>
        public DynamicObject[] PrintExtensionData(string dataSourceId, List <Field> fields, ref DynamicObjectType dt, DynamicObject[] oldObjs)
        {
            DynamicObject[] newObjs = new DynamicObject[oldObjs.Length];

            bool isEmpty = true;

            foreach (Field field in fields)
            {
                string entryKey = field.Entity.Key;
                string fieldKey = field.Key;
                if (!(dataSourceId.Equals(entryKey) && fieldKey.StartsWith(Constant.FExtension)))
                {
                    continue;
                }

                RegisterSimpleProperty(ref dt, fieldKey);

                for (int i = 0; i < oldObjs.Length; i++)
                {
                    // 使用新的模型,创建新的数据包
                    DynamicObject newObj = new DynamicObject(dt);
                    foreach (var prop in dt.Properties)
                    {
                        prop.SetValue(newObj, prop.GetValue(oldObjs[i]));
                    }
                    string jsonValue = GetJsonValueByKey(fieldKey, i);

                    Dictionary <string, string> jsonValueDictionary = JsonConvert.DeserializeObject <Dictionary <string, string> >(jsonValue);

                    foreach (var item in jsonValueDictionary)
                    {
                        newObj[item.Key] = item.Value;
                    }

                    newObjs[i] = newObj;
                }
                isEmpty = false;
            }
            if (isEmpty)
            {
                return(oldObjs);
            }
            return(newObjs);
        }
Beispiel #23
0
        static BudgetCalendar()
        {
            object[] attributes = new object[1];
            DataEntityTypeAttribute attribute = new DataEntityTypeAttribute {
                Alias = "T_BM_BUDGETCALENDAR"
            };

            attributes[0]         = attribute;
            BM_BUDGETCALENDARType = new DynamicObjectType("BM_BUDGETCALENDAR", NameNumberView.NameNumberViewType, null, DataEntityTypeFlag.Class, attributes);
            object[] objArray2 = new object[1];
            DataEntityTypeAttribute attribute2 = new DataEntityTypeAttribute {
                Alias = "T_BD_ACCOUNTPERIOD"
            };

            objArray2[0]         = attribute2;
            BD_ACCOUNTPERIODType = new DynamicObjectType("BD_ACCOUNTPERIOD", IdView.IdViewType, null, DataEntityTypeFlag.Class, objArray2);
            object[] objArray3 = new object[1];
            DataEntityTypeAttribute attribute3 = new DataEntityTypeAttribute {
                Alias = "T_BM_BUDGETPERIOD"
            };

            objArray3[0]           = attribute3;
            BudgetPeriodEntityType = new DynamicObjectType("BudgetPeriodEntity", IdView.IdViewType, null, DataEntityTypeFlag.Class, objArray3);
            object[] objArray4 = new object[1];
            DataEntityTypeAttribute attribute4 = new DataEntityTypeAttribute {
                Alias = "T_BD_ACCOUNTCALENDAR"
            };

            objArray4[0]     = attribute4;
            ORMBD_ACCOUNType = new DynamicObjectType("ORMBD_ACCOUN", NameNumberMasterIdView.NameNumberMasterIdViewType, null, DataEntityTypeFlag.Class, objArray4);
            object[] objArray5 = new object[1];
            DataEntityTypeAttribute attribute5 = new DataEntityTypeAttribute {
                Alias = "T_SEC_user"
            };

            objArray5[0] = attribute5;
            UserType     = new DynamicObjectType("User", IdView.IdViewType, null, DataEntityTypeFlag.Class, objArray5);
            ACIdProperty = BM_BUDGETCALENDARType.RegisterComplexProperty("ACId", ORMBD_ACCOUNType, false, new object[] { new DbIgnoreAttribute() });
            object[] objArray7 = new object[1];
            SimplePropertyAttribute attribute6 = new SimplePropertyAttribute {
                Alias = "FACID"
            };

            objArray7[0]       = attribute6;
            ACId_IdProperty    = BM_BUDGETCALENDARType.RegisterSimpleProperty("ACId_Id", typeof(long), null, false, objArray7);
            AouditorIdProperty = BM_BUDGETCALENDARType.RegisterComplexProperty("AouditorId", UserType, false, new object[] { new DbIgnoreAttribute() });
            object[] objArray9 = new object[1];
            SimplePropertyAttribute attribute7 = new SimplePropertyAttribute {
                Alias = "FAUDITORID"
            };

            objArray9[0]          = attribute7;
            AouditorId_IdProperty = BM_BUDGETCALENDARType.RegisterSimpleProperty("AouditorId_Id", typeof(long), null, false, objArray9);
            object[] objArray10 = new object[1];
            SimplePropertyAttribute attribute8 = new SimplePropertyAttribute {
                Alias = "FAUDITDATE"
            };

            objArray10[0]     = attribute8;
            AuditDateProperty = BM_BUDGETCALENDARType.RegisterSimpleProperty("AuditDate", typeof(DateTime?), null, false, objArray10);
            object[] objArray11 = new object[1];
            SimplePropertyAttribute attribute9 = new SimplePropertyAttribute {
                Alias = "FBUDGETCALENDARTYPE"
            };

            objArray11[0] = attribute9;
            BudgetCalendarTypeProperty     = BM_BUDGETCALENDARType.RegisterSimpleProperty("BudgetCalendarType", typeof(string), null, false, objArray11);
            BudgetPeriodEntityListProperty = BM_BUDGETCALENDARType.RegisterCollectionProperty("BudgetPeriodEntity", BudgetPeriodEntityType, null, new object[0]);
            object[] objArray12 = new object[1];
            SimplePropertyAttribute attribute10 = new SimplePropertyAttribute {
                Alias = "FCREATEDATE"
            };

            objArray12[0]      = attribute10;
            CreateDateProperty = BM_BUDGETCALENDARType.RegisterSimpleProperty("CreateDate", typeof(DateTime?), null, false, objArray12);
            CreatorIdProperty  = BM_BUDGETCALENDARType.RegisterComplexProperty("CreatorId", UserType, false, new object[] { new DbIgnoreAttribute() });
            object[] objArray14 = new object[1];
            SimplePropertyAttribute attribute11 = new SimplePropertyAttribute {
                Alias = "FCREATORID"
            };

            objArray14[0]        = attribute11;
            CreatorId_IdProperty = BM_BUDGETCALENDARType.RegisterSimpleProperty("CreatorId_Id", typeof(long), null, false, objArray14);
            object[] objArray15 = new object[1];
            SimplePropertyAttribute attribute12 = new SimplePropertyAttribute {
                Alias = "FCYCLESELECTTYPE"
            };

            objArray15[0]           = attribute12;
            CycleSelectTypeProperty = BM_BUDGETCALENDARType.RegisterSimpleProperty("CycleSelectType", typeof(string), null, false, objArray15);
            object[] objArray16 = new object[1];
            SimplePropertyAttribute attribute13 = new SimplePropertyAttribute {
                Alias  = "FDAYS",
                DbType = DbType.StringFixedLength
            };

            objArray16[0] = attribute13;
            DAYSProperty  = BM_BUDGETCALENDARType.RegisterSimpleProperty("DAYS", typeof(bool), null, false, objArray16);
            object[] objArray17 = new object[2];
            SimplePropertyAttribute attribute14 = new SimplePropertyAttribute {
                Alias = "FDESCRIPTION"
            };

            objArray17[0]       = attribute14;
            objArray17[1]       = new DbIgnoreAttribute();
            DescriptionProperty = BM_BUDGETCALENDARType.RegisterSimpleProperty("Description", typeof(LocaleValue), null, false, objArray17);
            object[] objArray18 = new object[1];
            SimplePropertyAttribute attribute15 = new SimplePropertyAttribute {
                Alias = "FDOCUMENTSTATUS"
            };

            objArray18[0]          = attribute15;
            DocumentStatusProperty = BM_BUDGETCALENDARType.RegisterSimpleProperty("DocumentStatus", typeof(string), null, false, objArray18);
            object[] objArray19 = new object[1];
            SimplePropertyAttribute attribute16 = new SimplePropertyAttribute {
                Alias = "FENDDATE"
            };

            objArray19[0]   = attribute16;
            EndDateProperty = BM_BUDGETCALENDARType.RegisterSimpleProperty("EndDate", typeof(DateTime?), null, false, objArray19);
            object[] objArray20 = new object[1];
            SimplePropertyAttribute attribute17 = new SimplePropertyAttribute {
                Alias = "FMODIFYDATE"
            };

            objArray20[0]       = attribute17;
            FModifyDateProperty = BM_BUDGETCALENDARType.RegisterSimpleProperty("FModifyDate", typeof(DateTime?), null, false, objArray20);
            object[] objArray21 = new object[1];
            SimplePropertyAttribute attribute18 = new SimplePropertyAttribute {
                Alias = "FFORBIDDATE"
            };

            objArray21[0]       = attribute18;
            ForbidDateProperty  = BM_BUDGETCALENDARType.RegisterSimpleProperty("ForbidDate", typeof(DateTime?), null, false, objArray21);
            ForbidderIdProperty = BM_BUDGETCALENDARType.RegisterComplexProperty("ForbidderId", UserType, false, new object[] { new DbIgnoreAttribute() });
            object[] objArray23 = new object[1];
            SimplePropertyAttribute attribute19 = new SimplePropertyAttribute {
                Alias = "FFORBIDDERID"
            };

            objArray23[0]          = attribute19;
            ForbidderId_IdProperty = BM_BUDGETCALENDARType.RegisterSimpleProperty("ForbidderId_Id", typeof(long), null, false, objArray23);
            object[] objArray24 = new object[1];
            SimplePropertyAttribute attribute20 = new SimplePropertyAttribute {
                Alias = "FFORBIDSTATUS"
            };

            objArray24[0]        = attribute20;
            ForbidStatusProperty = BM_BUDGETCALENDARType.RegisterSimpleProperty("ForbidStatus", typeof(string), null, false, objArray24);
            object[] objArray25 = new object[1];
            SimplePropertyAttribute attribute21 = new SimplePropertyAttribute {
                Alias  = "FHALFOFYEAR",
                DbType = DbType.StringFixedLength
            };

            objArray25[0]      = attribute21;
            HALFOFYEARProperty = BM_BUDGETCALENDARType.RegisterSimpleProperty("HALFOFYEAR", typeof(bool), null, false, objArray25);
            object[] objArray26 = new object[1];
            SimplePropertyAttribute attribute22 = new SimplePropertyAttribute(true)
            {
                Alias = "FID"
            };

            objArray26[0]      = attribute22;
            IdProperty         = BM_BUDGETCALENDARType.RegisterSimpleProperty("Id", typeof(long), null, false, objArray26);
            ModifierIdProperty = BM_BUDGETCALENDARType.RegisterComplexProperty("ModifierId", UserType, false, new object[] { new DbIgnoreAttribute() });
            object[] objArray28 = new object[1];
            SimplePropertyAttribute attribute23 = new SimplePropertyAttribute {
                Alias = "FMODIFIERID"
            };

            objArray28[0]         = attribute23;
            ModifierId_IdProperty = BM_BUDGETCALENDARType.RegisterSimpleProperty("ModifierId_Id", typeof(long), null, false, objArray28);
            object[] objArray29 = new object[1];
            SimplePropertyAttribute attribute24 = new SimplePropertyAttribute {
                Alias  = "FMONTH",
                DbType = DbType.StringFixedLength
            };

            objArray29[0] = attribute24;
            MONTHProperty = BM_BUDGETCALENDARType.RegisterSimpleProperty("MONTH", typeof(bool), null, false, objArray29);
            object[] objArray30 = new object[1];
            SimplePropertyAttribute attribute25 = new SimplePropertyAttribute {
                Alias  = "FSEASON",
                DbType = DbType.StringFixedLength
            };

            objArray30[0]  = attribute25;
            SEASONProperty = BM_BUDGETCALENDARType.RegisterSimpleProperty("SEASON", typeof(bool), null, false, objArray30);
            object[] objArray31 = new object[1];
            SimplePropertyAttribute attribute26 = new SimplePropertyAttribute {
                Alias = "FSTARTDATE"
            };

            objArray31[0]     = attribute26;
            StartDateProperty = BM_BUDGETCALENDARType.RegisterSimpleProperty("StartDate", typeof(DateTime?), null, false, objArray31);
            object[] objArray32 = new object[1];
            SimplePropertyAttribute attribute27 = new SimplePropertyAttribute {
                Alias  = "FTENDAYS",
                DbType = DbType.StringFixedLength
            };

            objArray32[0]   = attribute27;
            TENDAYSProperty = BM_BUDGETCALENDARType.RegisterSimpleProperty("TENDAYS", typeof(bool), null, false, objArray32);
            attributes      = new object[1];
            SimplePropertyAttribute attribute28 = new SimplePropertyAttribute {
                Alias  = "FWEEKS",
                DbType = DbType.StringFixedLength
            };

            attributes[0] = attribute28;
            WEEKSProperty = BM_BUDGETCALENDARType.RegisterSimpleProperty("WEEKS", typeof(bool), null, false, attributes);
            attributes    = new object[1];
            SimplePropertyAttribute attribute29 = new SimplePropertyAttribute {
                Alias  = "FYEAR",
                DbType = DbType.StringFixedLength
            };

            attributes[0] = attribute29;
            YearProperty  = BM_BUDGETCALENDARType.RegisterSimpleProperty("Year", typeof(bool), null, false, attributes);
        }
Beispiel #24
0
        public override void CreateNewData(BizDataEventArgs e)
        {
            base.CreateNewData(e);

            DynamicObjectCollection coll      = GetObjects(this.Context, initSql);
            DynamicObjectType       dtType    = this.View.BusinessInfo.GetDynamicObjectType();
            EntryEntity             entity    = (EntryEntity)this.View.BusinessInfo.GetEntity("F_HS_Entity");
            DynamicObject           objData   = new DynamicObject(dtType);
            DynamicObject           entityObj = null;

            if (coll != null && coll.Count > 0)
            {
                int seq = 1;
                foreach (var item in coll)
                {
                    if (item != null)
                    {
                        if (entity != null)
                        {
                            entityObj = new DynamicObject(entity.DynamicObjectType);
                            entity.DynamicProperty.GetValue <DynamicObjectCollection>(objData).Add(entityObj);

                            entityObj["seq"] = seq;

                            //entityObj["F_HS_Customer_Id"] = Convert.ToInt32(SQLUtils.GetFieldValue(item, "F_HS_B2CCUSTID"));
                            //this.View.Model.SetValue("F_HS_Customer", SQLUtils.GetFieldValue(item, "F_HS_B2CCUSTID"),seq);
                            //this.View.Model.DataObject["F_HS_Customer_Id"] = SQLUtils.GetFieldValue(item, "F_HS_B2CCUSTID");
                            BaseDataField orgId  = this.View.BillBusinessInfo.GetField("F_HS_UseOrgId") as BaseDataField;
                            DynamicObject orgObj = Kingdee.BOS.ServiceHelper.BusinessDataServiceHelper.LoadSingle(this.Context, SQLUtils.GetFieldValue(item, "F_HS_UseOrgId"), orgId.RefFormDynamicObjectType);
                            entityObj["F_HS_UseOrgId"] = orgObj;

                            BaseDataField cust  = this.View.BillBusinessInfo.GetField("F_HS_Customer") as BaseDataField;
                            DynamicObject bdObj = Kingdee.BOS.ServiceHelper.BusinessDataServiceHelper.LoadSingle(this.Context, SQLUtils.GetFieldValue(item, "F_HS_B2CCUSTID"), cust.RefFormDynamicObjectType);
                            entityObj["F_HS_Customer"] = bdObj;

                            entityObj["F_HS_ChangeAmount"]  = SQLUtils.GetFieldValue(item, "changedAmount");
                            entityObj["F_HS_ChangedType"]   = GetChangeTypeDesc(SQLUtils.GetFieldValue(item, "changedType"));
                            entityObj["F_HS_TradeType"]     = SQLUtils.GetFieldValue(item, "F_HS_TradeType");
                            entityObj["F_HS_ChangedCause"]  = GetChangeCauseDesc(SQLUtils.GetFieldValue(item, "changedCause"));
                            entityObj["F_HS_BalanceAmount"] = SQLUtils.GetFieldValue(item, "balanceAmount");
                            entityObj["F_HS_RateToUSA"]     = SQLUtils.GetFieldValue(item, "F_HS_RateToUSA");

                            entityObj["F_HS_SettleCurrId_Id"] = SQLUtils.GetFieldValue(item, "FSETTLECURRID");
                            //this.View.Model.SetValue("F_HS_SettleCurrId", SQLUtils.GetFieldValue(item, "FSETTLECURRID"), seq);
                            //BaseDataField curr = this.View.BusinessInfo.GetField("F_HS_SettleCurrId") as BaseDataField;
                            //curr.RefIDDynamicProperty.SetValue(this.View.Model.DataObject, SQLUtils.GetFieldValue(item, "FSETTLECURRID"));
                            //this.View.Model.DataObject["F_HS_SettleCurrId_Id"] = SQLUtils.GetFieldValue(item, "FSETTLECURRID");
                            //this.Model.SetItemValueByID("F_HS_SettleCurrId", 7, seq);
                            //this.View.UpdateView("F_HS_SettleCurrId",seq);

                            BaseDataField curr  = this.View.BillBusinessInfo.GetField("F_HS_SettleCurrId") as BaseDataField;
                            DynamicObject cdObj = Kingdee.BOS.ServiceHelper.BusinessDataServiceHelper.LoadSingle(this.Context, SQLUtils.GetFieldValue(item, "FSETTLECURRID"), curr.RefFormDynamicObjectType);
                            entityObj["F_HS_SettleCurrId"] = cdObj;

                            //BaseDataField fldCustomer = formMetadata.BusinessInfo.GetField("FMaterialId") as BaseDataField;
                            //var materialObj = Kingdee.BOS.ServiceHelper.BusinessDataServiceHelper.LoadSingle(this.Context, materialId, fldMaterial.RefFormDynamicObjectType);
                            //fldMaterial.RefIDDynamicProperty.SetValue(dynamicRow, materialId);
                            //fldMaterial.DynamicProperty.SetValue(dynamicRow, materialObj);


                            entityObj["F_HS_ChangedAmountUSD"] = SQLUtils.GetFieldValue(item, "changedAmountUSA");
                            entityObj["F_HS_BalanceAmountUSD"] = SQLUtils.GetFieldValue(item, "balanceAmountUSA");
                            entityObj["F_HS_CNYBalance"]       = SQLUtils.GetFieldValue(item, "F_HS_CNYBalance");
                            entityObj["F_HS_UpdateTime"]       = SQLUtils.GetFieldValue(item, "updateTime");


                            BaseDataField user  = this.View.BillBusinessInfo.GetField("F_HS_UpdateUser") as BaseDataField;
                            DynamicObject udObj = Kingdee.BOS.ServiceHelper.BusinessDataServiceHelper.LoadSingle(this.Context, SQLUtils.GetFieldValue(item, "updateUser"), user.RefFormDynamicObjectType);
                            entityObj["F_HS_UpdateUser"] = udObj;

                            entityObj["F_HS_BillNo"]      = SQLUtils.GetFieldValue(item, "FBillNo");
                            entityObj["F_HS_EntryId"]     = SQLUtils.GetFieldValue(item, "fentryID");
                            entityObj["F_HS_NeedFreezed"] = SQLUtils.GetFieldValue(item, "needfreezed") == "1" ? true : false;
                            entityObj["F_HS_Remark"]      = SQLUtils.GetFieldValue(item, "remark");
                            seq++;
                        }
                    }
                }

                e.BizDataObject = objData;
            }
        }
Beispiel #25
0
        }//end method

        public static DynamicObject[] LoadFromCache(this IEnumerable <DynamicObject> dataObject, Context ctx, DynamicObjectType type, Func <DynamicObject, object> selector = null)
        {
            var pkArray = selector != null?dataObject.Select(selector).Distinct().ToArray() : dataObject.Select(data => data.PkId()).Distinct().ToArray();

            return(BusinessDataServiceHelper.LoadFromCache(ctx, pkArray, type));
        }//end method
Beispiel #26
0
 public Organisation(IDynamicPopulation population, DynamicObjectType objectType)
     : base(population, objectType)
 {
 }
Beispiel #27
0
        public Dictionary <DynamicObject, object> ChangedRoles(DynamicObjectType objectType, string name)
        {
            IDynamicRoleType roleType = objectType.RoleTypeByName[name];

            return(this.ChangedRoles(roleType));
        }
Beispiel #28
0
        private void ShowErrTypeInfo()
        {
            long                    curStockOrgId;
            Entity                  entryEntity       = this.View.BusinessInfo.GetEntryEntity("FEntityErrType");
            DynamicObjectType       dynamicObjectType = entryEntity.DynamicObjectType;
            DynamicObjectCollection entityDataObject  = this.Model.GetEntityDataObject(entryEntity);

            entityDataObject.Clear();
            if ((this.opResults == null) || (this.opResults.Count < 1))
            {
                this.ClearEntity("FEntityErrInfo");
                this.ShowHideErrTabDetail(null, ErrType.None);
                this.View.UpdateView("FEntityErrType");
                this.ShowErrGrid(true);
            }
            else
            {
                int entryCurrentRowIndex = this.Model.GetEntryCurrentRowIndex("FEntityAction");
                curStockOrgId = Convert.ToInt64(this.Model.GetValue("FStockOrgID", entryCurrentRowIndex));
                StockOrgOperateResult result = this.opResults.SingleOrDefault <StockOrgOperateResult>(p => p.StockOrgID == curStockOrgId);
                if ((result == null) || result.OperateSuccess)
                {
                    this.ClearEntity("FEntityErrInfo");
                    this.ShowHideErrTabDetail(null, ErrType.None);
                    this.View.UpdateView("FEntityErrType");
                    this.ShowErrGrid(true);
                }
                else
                {
                    DynamicObject obj2;
                    if ((result.ErrInfo != null) && result.ErrInfo.Exists(p => p.ErrType < Convert.ToInt32(ErrType.UnAuditBill)))
                    {
                        obj2 = new DynamicObject(dynamicObjectType)
                        {
                            ["ErrorType"]   = ErrType.OrgStatusErr,
                            ["ErrTypeName"] = string.Format(ResManager.LoadKDString("当前组织状态不符合{0}操作条件", "004023030002140", SubSystemType.SCM, new object[0]), this.isOpenAccount ? ResManager.LoadKDString("反关账", "004023030000238", SubSystemType.SCM, new object[0]) : ResManager.LoadKDString("关账", "004023030000241", SubSystemType.SCM, new object[0]))
                        };
                        entityDataObject.Add(obj2);
                    }
                    if ((result.ErrInfo != null) && result.ErrInfo.Exists(p => p.ErrType == Convert.ToInt32(ErrType.UnAuditBill)))
                    {
                        obj2 = new DynamicObject(dynamicObjectType)
                        {
                            ["ErrorType"]   = ErrType.UnAuditBill,
                            ["ErrTypeName"] = string.Format(ResManager.LoadKDString("当前组织存在未审核的库存单据", "004023030002143", SubSystemType.SCM, new object[0]), new object[0])
                        };
                        entityDataObject.Add(obj2);
                    }
                    if ((result.StkBillDraftErrInfo != null) && (result.StkBillDraftErrInfo.Count > 0))
                    {
                        obj2 = new DynamicObject(dynamicObjectType)
                        {
                            ["ErrorType"]   = ErrType.StkDraftBill,
                            ["ErrTypeName"] = ResManager.LoadKDString("当前组织存在暂存的库存单据", "004023000022222", SubSystemType.SCM, new object[0])
                        };
                        entityDataObject.Add(obj2);
                    }
                    if ((result.StkCountBillAuditErrInfo != null) && (result.StkCountBillAuditErrInfo.Count > 0))
                    {
                        obj2 = new DynamicObject(dynamicObjectType)
                        {
                            ["ErrorType"]   = ErrType.UnAuditStkCountBill,
                            ["ErrTypeName"] = ResManager.LoadKDString("当前组织存在未审核的盘点单据", "004023000018755", SubSystemType.SCM, new object[0])
                        };
                        entityDataObject.Add(obj2);
                    }
                    if (result.MinusErrObject != null)
                    {
                        obj2 = new DynamicObject(dynamicObjectType)
                        {
                            ["ErrorType"]   = ErrType.Minus,
                            ["ErrTypeName"] = string.Format(ResManager.LoadKDString("当前组织存在异常库存数据", "004023030002146", SubSystemType.SCM, new object[0]), new object[0])
                        };
                        entityDataObject.Add(obj2);
                    }
                    this.View.UpdateView("FEntityErrType");
                    this.View.SetEntityFocusRow("FEntityErrType", 0);
                    this.ShowErrInfo();
                }
            }
        }