Esempio n. 1
0
        protected void CheckField <T>(string name, string displayName, bool specialField, bool requiredField)
        {
            ViewField field = ViewFields.FindByName(name);

            Assert.That(field, Is.Not.Null, "Unabled to find field: {0}", name);

            FieldMapping specialFieldMapping  = ModuleMapping.GetFieldMapping(field, true);
            FieldMapping requiredFieldMapping = ModuleMapping.GetFieldMapping(field, false);

            if (specialField)
            {
                Assert.That(specialFieldMapping, Is.Not.Null);
                Assert.That(specialFieldMapping, Is.TypeOf <T>());
                Assert.That(specialFieldMapping.Name, Is.EqualTo(displayName));
            }
            else
            {
                Assert.That(specialFieldMapping, Is.Null);
            }

            if (requiredField)
            {
                Assert.That(requiredFieldMapping, Is.Not.Null);
                Assert.That(requiredFieldMapping, Is.TypeOf <T>());
                Assert.That(requiredFieldMapping.Name, Is.EqualTo(displayName));
            }
            else
            {
                Assert.That(requiredFieldMapping, Is.Null);
            }
        }
        void UpdateViewField()
        {
            Fov fov = new Fov(_viewField, _visibleMap);

            fov.Refresh(_playerPosition);
            _viewField = fov.viewField;
        }
Esempio n. 3
0
        protected override DataRow GetGridRow(object obj)
        {
            DataRow row = this.DtSource.NewRow();

            PickDetailQuery pickLine = obj as PickDetailQuery;
            Type            type     = pickLine.GetType();

            for (int i = 0; i < this.PickHeadViewFieldList.Length; i++)
            {
                ViewField field    = this.PickHeadViewFieldList[i];
                string    strValue = string.Empty;
                System.Reflection.FieldInfo fieldInfo = type.GetField(field.FieldName);
                if (fieldInfo != null)
                {
                    strValue = fieldInfo.GetValue(pickLine).ToString();
                }
                if (field.FieldName == "Status")
                {
                    strValue = languageComponent1.GetString(pickLine.Status);
                }
                if (field.FieldName == "QTY")//2位小数
                {
                    strValue = pickLine.QTY.ToString("0.00");
                }
                if (field.FieldName == "OutStorageCode")
                {
                    strValue = pickLine.StorageCode;
                }
                row[i + 1] = strValue;
            }

            return(row);
        }
Esempio n. 4
0
        public FieldMapping GetFieldMapping(ViewField field, bool isModelField)
        {
            FieldMapping fieldMapping = null;

            if (isModelField)
            {
                Func <FieldMapping> fieldMappingFunc;
                if (specialMappingFuncs.TryGetValue(field.Name, out fieldMappingFunc))
                {
                    return(fieldMappingFunc());
                }
                if (field.ReadOnly)
                {
                    fieldMapping = new ReadOnlyFieldMapping(field.DisplayName);
                }
                else
                {
                    fieldMapping = new ModelFieldMapping(field.DisplayName, field.DataType);
                }
            }
            else
            {
                Func <FieldMapping> fieldMappingFunc;
                if (requiredMappingFuncs.TryGetValue(field.Name, out fieldMappingFunc))
                {
                    return(fieldMappingFunc());
                }
            }

            return(fieldMapping);
        }
Esempio n. 5
0
        protected override string[] FormatExportRecord(object obj)
        {
            //return new string[]{((ASN)obj).StNo,
            //                    FormatHelper.ToDateString(((ASN)obj).CDate),
            //                    ((ASN)obj).CUser,
            //                    this.GetInvInName(((ASN)obj).StType),
            //                    ((ASN)obj).InvNo,
            //                    this.GetStatusName(((ASN)obj).Status),
            //                    ((ASN)obj).StorageCode,
            //                    FormatHelper.ToDateString(((ASN)obj).PreictDate),
            //                    ((ASN)obj).DirectFlag,
            //                    ((ASN)obj).PickNo,
            //                    ((ASN)obj).VendorCode,
            //                    ((ASN)obj).ExigencyFlag,
            //                    ((ASN)obj).RejectsFlag,
            //                    ((ASN)obj).OANo,
            //                    ((ASN)obj).PackingListNo,
            //                    FormatHelper.ToDateString(((ASN)obj).ProvideDate),
            //                    ((ASN)obj).GrossWeight.ToString(),
            //                    ((ASN)obj).Volume,
            //                    ((ASN)obj).FromStorageCode,
            //                    ((ASN)obj).Remark1
            //                  };
            string[] objs = new string[this.SAPHeadViewFieldList.Length];
            ASN      inv  = obj as ASN;
            Type     type = inv.GetType();

            for (int i = 0; i < this.SAPHeadViewFieldList.Length; i++)
            {
                ViewField field    = this.SAPHeadViewFieldList[i];
                string    strValue = string.Empty;
                System.Reflection.FieldInfo fieldInfo = type.GetField(field.FieldName);
                if (fieldInfo != null)
                {
                    strValue = fieldInfo.GetValue(inv).ToString();
                }
                if (field.FieldName == "CDate")
                {
                    strValue = FormatHelper.ToDateString(inv.CDate);
                }
                else if (field.FieldName == "StorageInType")
                {
                    strValue = this.GetInvInName(inv.StType);
                }
                else if (field.FieldName == "Status")
                {
                    strValue = this.GetStatusName(inv.Status);
                }
                else if (field.FieldName == "PredictDate")
                {
                    strValue = FormatHelper.ToDateString(inv.PreictDate);
                }
                else if (field.FieldName == "ProvideDate")
                {
                    strValue = inv.ProvideDate;// FormatHelper.ToDateString(inv.ProvideDate);
                }
                objs[i] = strValue;
            }
            return(objs);
        }
Esempio n. 6
0
        protected override string[] FormatExportRecord(object obj)
        {
            string[] objs = new string[this.PickHeadViewFieldList.Length];

            PickDetailQuery pickLine = obj as PickDetailQuery;
            Type            type     = pickLine.GetType();

            for (int i = 0; i < this.PickHeadViewFieldList.Length; i++)
            {
                ViewField field    = this.PickHeadViewFieldList[i];
                string    strValue = string.Empty;
                System.Reflection.FieldInfo fieldInfo = type.GetField(field.FieldName);
                if (fieldInfo != null)
                {
                    strValue = fieldInfo.GetValue(pickLine).ToString();
                }
                if (field.FieldName == "Status")
                {
                    strValue = languageComponent1.GetString(pickLine.Status);
                }
                if (field.FieldName == "QTY")//2位小数
                {
                    strValue = pickLine.QTY.ToString("0.00");
                }

                if (field.FieldName == "OutStorageCode")
                {
                    strValue = pickLine.StorageCode;
                }
                objs[i] = strValue;
            }
            return(objs);
        }
        protected override DataRow GetGridRow(object obj)
        {
            DataRow row = this.DtSource.NewRow();

            //row["InvNo"] = ((InvoicesDetailExt)obj).InvNo;
            //row["StorageInType"] = this.GetInvInName(((InvoicesDetailExt)obj).InvType);
            //row["FacCode"] = ((InvoicesDetailExt)obj).FacCode;
            //row["StorageCode1"] = ((InvoicesDetailExt)obj).StorageCode;
            //row["InvLine1"] = ((InvoicesDetailExt)obj).InvLine;
            //row["Status1"] = ((InvoicesDetailExt)obj).InvLineStatus;
            //row["SAPMCode"] = ((InvoicesDetailExt)obj).MCode;
            //row["DQMCode"] = ((InvoicesDetailExt)obj).DQMCode;
            //row["MENShortDesc"] = ((InvoicesDetailExt)obj).MenshortDesc;
            //row["Unit1"] = ((InvoicesDetailExt)obj).Unit;
            //row["PlanQty1"] = ((InvoicesDetailExt)obj).PlanQty;
            //row["ActQty1"] = ((InvoicesDetailExt)obj).ActQty;
            //row["FROMSTORAGECODE"] = ((InvoicesDetailExt)obj).FromStorageCode;
            //return row;


            InvoicesDetailExt1 inv = obj as InvoicesDetailExt1;
            Type type = inv.GetType();

            for (int i = 1; i < this.DtSource.Columns.Count; i++)
            {
                ViewField field    = this.SAPHeadViewFieldList[i - 1];
                string    strValue = string.Empty;
                System.Reflection.FieldInfo fieldInfo = type.GetField(field.FieldName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.IgnoreCase | System.Reflection.BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    strValue = fieldInfo.GetValue(inv).ToString();
                }
                if (field.FieldName == "InvType")
                {
                    strValue = this.GetInvInName(inv.InvType);
                }


                else if (field.FieldName == "InvStatus1")
                {
                    strValue = this.GetStatusName(inv.InvLineStatus);
                }

                else if (field.FieldName == "CDate")
                {
                    strValue = FormatHelper.ToDateString(inv.CDate);
                }
                else if (field.FieldName == "CTime")
                {
                    strValue = FormatHelper.ToTimeString(inv.CTime);
                }

                //PlanSendDate
                row[i] = strValue;
            }

            return(row);
        }
Esempio n. 8
0
        private void LoadRelation()
        {
            var parent = _connector.ParentEntity;
            var child  = _model.Views.FirstOrDefault(x => x.Name == lblSecondaryTable.Text);

            this.LoadFields(lblPrimaryTable.Text, cboParentField);
            this.LoadViewFields(lblSecondaryTable.Text, cboChildField);

            //Load fields that are set
            var relationId = Guid.Empty;

            relationId = _connector.Id;

            var relation  = _model.AllRelations.FirstOrDefault(x => x.Id == relationId);
            var fieldList = _model.RelationFields.Where(x => x.RelationID == relationId);

            foreach (var columnSet in fieldList)
            {
                var       field1 = parent.Fields.FirstOrDefault(x => x.Id == columnSet.SourceFieldId);
                ViewField field2 = null;
                if (child != null)
                {
                    field2 = child.Fields.FirstOrDefault(x => x.Id == columnSet.TargetFieldId);
                }

                if (field1 != null && field2 != null)
                {
                    this.AddColumnMap(field1.Name, field2.Name);
                    foreach (string s in cboParentField.Items)
                    {
                        if (s == field1.Name)
                        {
                            cboParentField.SelectedItem = s;
                        }
                    }

                    foreach (string s in cboChildField.Items)
                    {
                        if (s == field2.Name)
                        {
                            cboChildField.SelectedItem = s;
                        }
                    }
                }
            }

            //New relation, nothing selected, so default to PK
            if (cboParentField.SelectedIndex == -1)
            {
                var pk = parent.PrimaryKeyFields.FirstOrDefault();
                if (pk != null)
                {
                    cboParentField.SelectedItem = pk.Name;
                }
            }

            txtRole.Text = _connector.RoleName;
        }
        /// <summary>
        /// Updates the model.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="name">The name.</param>
        /// <param name="value">The value.</param>
        /// <param name="useDisplayName">if set to <c>true</c> [use display name].</param>
        public void UpdateModel(object model, string name, string value, bool useDisplayName)
        {
            ViewField field = useDisplayName ? viewFieldsCollection.FindByDisplayName(name) : viewFieldsCollection.FindByName(name);

            if (field != null)
            {
                modelProperties.TrySetValueFromString(model, field.DisplayName, value);
            }
        }
Esempio n. 10
0
        /**
         * Attacke the enemy on given target.
         * @param viewField: the field of view of this AI.
         * Returns a yield instruction.
         */
        public IEnumerator AttackTarget(ViewField viewField)
        {
            _isAttacking = true;
            viewField.Target.GetComponent <EnergyManager>().CurrentValue -= Damage;
            // play attack animation (no loop)
            yield return(new WaitForSeconds(AttackRate));

            //stop attack animation
            _isAttacking = false;
        }
Esempio n. 11
0
        private static void LoadFromDisk(IEnumerable <View> list, nHydrateModel model, DiskModel diskModel)
        {
            #region Load other parameter/field information

            foreach (var view in diskModel.Views)
            {
                var item = list.FirstOrDefault(x => x.Id == new Guid(view.id));
                if (item == null)
                {
                    item = new View(model.Partition, new PropertyAssignment[] { new PropertyAssignment(ElementFactory.IdPropertyAssignment, new Guid(view.id)) });
                    model.Views.Add(item);
                }

                System.Windows.Forms.Application.DoEvents();

                item.Name                   = view.name;
                item.CodeFacade             = view.codefacade;
                item.Schema                 = view.schema;
                item.GeneratesDoubleDerived = view.generatesdoublederived != 0;
                item.Summary                = view.summary;
                item.SQL = view.sql;

                var nameList = new List <string>();
                foreach (var fieldNode in view.fieldset)
                {
                    var subItemID = new Guid(fieldNode.id);
                    var field     = item.Fields.FirstOrDefault(x => x.Id == subItemID);
                    if (field == null)
                    {
                        field = new ViewField(item.Partition, new PropertyAssignment[] { new PropertyAssignment(ElementFactory.IdPropertyAssignment, subItemID) });
                        item.Fields.Add(field);
                    }

                    field.Name       = fieldNode.name;
                    field.CodeFacade = fieldNode.codefacade;
                    nameList.Add(field.Name.ToLower());
                    field.Nullable = fieldNode.nullable != 0;
                    if (Enum.TryParse <DataTypeConstants>(fieldNode.datatype, true, out var dt))
                    {
                        field.DataType = dt;
                    }
                    field.Default      = fieldNode.@default;
                    field.Length       = fieldNode.length;
                    field.Scale        = fieldNode.scale;
                    field.Summary      = fieldNode.summary;
                    field.IsPrimaryKey = fieldNode.isprimarykey != 0;
                }
                if (item.Fields.Remove(x => !nameList.Contains(x.Name.ToLower())) > 0)
                {
                    item.nHydrateModel.IsDirty = true;
                }
            }

            #endregion
        }
Esempio n. 12
0
        private ViewField CreateEntityViewField()
        {
            ViewField obj = new ViewField();


            obj.AllowEdit     = true;
            obj.Name          = "ProductCode";
            obj.CheckStatus   = CheckStatus.Default;
            obj.ColSpan       = 1;
            obj.IsVisible     = true;
            obj.Property      = "26a00de9-61f9-4c27-b73a-5d0840c7b2dc";
            obj.RowSpan       = 1;
            obj.Sequence      = 1;
            obj.Title         = "55c22cca-2dd9-46a5-9c74-0340df368504";
            obj.ViewFieldType = ViewFieldType.Link;

            obj.CreateDrillDownLink();
            obj.DrillDownLink.TargetViewInternal = "View-ProductsVList-{522967ec-c5bd-440c-a930-17d270eaa721}.EasyBpart";
            obj.DrillDownLink.TargetViewProperty = "ca467839-09dd-4f55-9d51-ed4ddd323db8";
            LinkParameter lp = new LinkParameter();

            lp.Expression            = "Prueba";
            lp.ViewParameterInternal = "Codigo";
            obj.DrillDownLink.AddLinkParameter(lp);

            obj.CreateViewFielLov();
            obj.Lov.DisplayProperty = "14017e77 - 39ff - 4141 - bc7e - 41e1198534dc";
            obj.Lov.EntityInternal  = "Entity-AccountType-{e27b5580-1c07-4a7a-9fcc-e03e921f0b0d}.EasyBpart";
            obj.Lov.CreateInLineLink();
            obj.Lov.InLineLink.TargetViewInternal = "View-AccountTypeInLineViewEdit-{8602d3d0-75cc-4c75-8868-b3dcaf6ccfba}.EasyBpart";
            obj.Lov.InLineLink.ExpressionCode     = "Where a = 1";
            obj.Lov.ShowPropertiesInternal.Add(Guid.Parse("7d4c8f88-ca8e-459e-9e07-503f87c6f3e4"));
            obj.Lov.SqlOrderBy    = "Code ASC";
            obj.Lov.SqlWhere      = "IsActive";
            obj.Lov.ValueProperty = "7d4c8f88-ca8e-459e-9e07-503f87c6f3e4";



            Lov lv = new Lov();

            lv.DisplayValue = "15b4a1a1-aea3-42ec-ba6f-ca77b47b6a85";
            lv.Value        = "Available";

            Lov lv2 = new Lov();

            lv2.DisplayValue = "f71449c4-786b-4f4a-85b4-b19fa24b5e13";
            lv2.Value        = "Loaded";

            obj.Lov.AddLov(lv);
            obj.Lov.AddLov(lv2);



            return(obj);
        }
Esempio n. 13
0
        protected void CheckSpecialField <T>(string name, string displayName)
        {
            ViewField field = ViewFields.FindByName(name);

            Assert.That(field, Is.Not.Null, "Unabled to find field: {0}", name);

            FieldMapping specialFieldMapping = ModuleMapping.GetFieldMapping(field, true);

            Assert.That(specialFieldMapping, Is.Not.Null);
            Assert.That(specialFieldMapping, Is.TypeOf <T>());
            Assert.That(specialFieldMapping.Name, Is.EqualTo(displayName));
        }
        private void ViewField_OnDraw(CanvasControl sender, CanvasDrawEventArgs args)
        {
            using (var sesh = args.DrawingSession)
            {
                foreach (var actor in ViewModel.GameModel.Actors)
                {
                    sesh.FillGeometry(actor.Geometry, new Vector2(0f, 0f), actor.Brush);
                }
            }

            ViewField.Invalidate();
        }
Esempio n. 15
0
        public void ViewField05SaverJSON()
        {
            ViewField obj   = CreateEntity();
            SaverJson saver = new SaverJson();

            saver.BuildDefaultJsonSettings();
            saver.SerializeObject(@".\Data\ViewField05SaverJSON.EasyBpart", obj);
            Assert.True(File.Exists(@".\Data\ViewField05SaverJSON.EasyBpart"));

            ViewField impobj = saver.ImportPart <ViewField>(@".\Data\ViewField05SaverJSON.EasyBpart");

            Assert.Equal(impobj.Name, obj.Name);
            Assert.Equal(impobj.AllowAdvancedSearch, obj.AllowAdvancedSearch);
            Assert.Equal(impobj.AllowEdit, obj.AllowEdit);
            Assert.Equal(impobj.AllowMultiEdit, obj.AllowMultiEdit);
            Assert.Equal(impobj.AllowSearch, obj.AllowSearch);
            Assert.Equal(impobj.ColSpan, obj.ColSpan);
            Assert.Equal(impobj.IsVisible, obj.IsVisible);
            Assert.Equal(impobj.IsVisibleOnCreation, obj.IsVisibleOnCreation);
            Assert.Equal(impobj.RowSpan, obj.RowSpan);
            Assert.Equal(impobj.ShowInCollapsedGrid, obj.ShowInCollapsedGrid);
            Assert.Equal(impobj.ShowInExpandedGrid, obj.ShowInExpandedGrid);
            Assert.Equal(impobj.ImageNameFalse, obj.ImageNameFalse);
            Assert.Equal(impobj.ImageNameTrue, obj.ImageNameTrue);
            Assert.Equal(impobj.ImageFalseMode, obj.ImageFalseMode);
            Assert.Equal(impobj.IsRequired, obj.IsRequired);
            Assert.Equal(impobj.Sequence, obj.Sequence);
            Assert.Equal(impobj.SearchResource, obj.SearchResource);
            Assert.Equal(impobj.ViewAdvancedSearch, obj.ViewAdvancedSearch);
            Assert.Equal(impobj.Validator, obj.Validator);
            Assert.Equal(impobj.Title, obj.Title);
            Assert.Equal(impobj.Tooltip, obj.Tooltip);
            Assert.Equal(impobj.Property, obj.Property);

            Assert.NotNull(impobj.DrillDownLink);
            Assert.Equal(impobj.DrillDownLink.LinkParametersInternal.Count, obj.DrillDownLink.LinkParametersInternal.Count);
            Assert.Equal(impobj.DrillDownLink.TargetViewInternal, obj.DrillDownLink.TargetViewInternal);
            Assert.Equal(impobj.DrillDownLink.TargetViewProperty, obj.DrillDownLink.TargetViewProperty);

            Assert.NotNull(impobj.Lov);
            Assert.Equal(impobj.Lov.EntityInternal, obj.Lov.EntityInternal);
            Assert.Equal(impobj.Lov.DisplayProperty, obj.Lov.DisplayProperty);
            Assert.Equal(impobj.Lov.DependantProperty, obj.Lov.DependantProperty);
            Assert.Equal(impobj.Lov.DependantViewFieldLOV, obj.Lov.DependantViewFieldLOV);
            Assert.Equal(impobj.Lov.ValueProperty, obj.Lov.ValueProperty);
            Assert.Equal(impobj.Lov.SqlOrderBy, obj.Lov.SqlOrderBy);
            Assert.Equal(impobj.Lov.SqlWhere, obj.Lov.SqlWhere);

            Assert.NotNull(impobj.Lov.InLineLink);
            Assert.Equal(impobj.Lov.InLineLink.TargetViewProperty, obj.Lov.InLineLink.TargetViewProperty);
            Assert.Equal(impobj.Lov.InLineLink.TargetViewInternal, obj.Lov.InLineLink.TargetViewInternal);
            Assert.Equal(impobj.Lov.InLineLink.ExpressionCode, obj.Lov.InLineLink.ExpressionCode);
        }
Esempio n. 16
0
        private static void LoadFromDisk(IEnumerable <View> list, nHydrateModel model, DiskModelYaml diskModel)
        {
            #region Load other parameter/field information

            foreach (var view in diskModel.Views)
            {
                var item = list.FirstOrDefault(x => x.Id == view.Id);
                if (item == null)
                {
                    item = new View(model.Partition, new PropertyAssignment[] { new PropertyAssignment(ElementFactory.IdPropertyAssignment, view.Id) });
                    model.Views.Add(item);
                }

                System.Windows.Forms.Application.DoEvents();

                item.Name                   = view.Name;
                item.CodeFacade             = view.CodeFacade;
                item.Schema                 = view.Schema;
                item.GeneratesDoubleDerived = view.GeneratesDoubleDerived;
                item.Summary                = view.Summary;
                item.SQL = view.Sql;

                var nameList = new List <string>();
                foreach (var fieldNode in view.Fields)
                {
                    var field = item.Fields.FirstOrDefault(x => x.Id == fieldNode.Id);
                    if (field == null)
                    {
                        field = new ViewField(item.Partition, new PropertyAssignment[] { new PropertyAssignment(ElementFactory.IdPropertyAssignment, fieldNode.Id) });
                        item.Fields.Add(field);
                    }

                    field.Name       = fieldNode.Name;
                    field.CodeFacade = fieldNode.CodeFacade;
                    nameList.Add(field.Name.ToLower());
                    field.Nullable     = fieldNode.Nullable;
                    field.DataType     = fieldNode.Datatype.Convert <DataTypeConstants>();
                    field.Default      = fieldNode.Default;
                    field.Length       = fieldNode.Length;
                    field.Scale        = fieldNode.Scale;
                    field.Summary      = fieldNode.Summary;
                    field.IsPrimaryKey = fieldNode.IsPrimaryKey;
                }
                if (item.Fields.Remove(x => !nameList.Contains(x.Name.ToLower())) > 0)
                {
                    item.nHydrateModel.IsDirty = true;
                }
            }

            #endregion
        }
Esempio n. 17
0
        /**
         * The movement of the AI.
         * @param rig: the 2D rigidbody for physical movement.
         * @param viewField: the field of view for the target to move.
         */
        public void Move(Rigidbody2D rig, ViewField viewField)
        {
            Vector2 targetPos;

            if (viewField.Target == null)
            {
                return;
            }

            targetPos = viewField.Target.position;
            var targetPositionRelative = targetPos - rig.position;

            rig.MovePosition(rig.position + targetPositionRelative.normalized * Speed * Time.fixedDeltaTime);
        }
        public override IEnumerable <ViewMetadata> GetViews(string recordType)
        {
            var viewFields            = new List <ViewField>();
            var allObjects            = RetreiveAll(new QueryDefinition(recordType));
            var areExplicitGridFields = false;

            foreach (var propertyInfo in GetPropertyInfos(recordType))
            {
                var hiddenAttribute = propertyInfo.GetCustomAttribute <HiddenAttribute>();
                if (propertyInfo.CanRead && hiddenAttribute == null)
                {
                    var gridFieldAttribute = propertyInfo.GetCustomAttribute <GridField>();
                    if (gridFieldAttribute != null && !areExplicitGridFields)
                    {
                        areExplicitGridFields = true;
                        viewFields.Clear();
                    }
                    //so lets not display a field if it is read only and is out of contxt for all records
                    if (!propertyInfo.CanWrite && allObjects.All(o => {
                        var instance = ((ObjectRecord)o).Instance;
                        return(instance.GetPropertyValue(propertyInfo.Name) == null || !instance.IsInContext(propertyInfo.Name));
                    }))
                    {
                        continue;
                    }
                    if (areExplicitGridFields && gridFieldAttribute == null)
                    {
                        continue;
                    }
                    //these initial values repeated
                    var viewField      = new ViewField(propertyInfo.Name, 10000, 200);
                    var orderAttribute = propertyInfo.GetCustomAttribute <DisplayOrder>();
                    if (orderAttribute != null)
                    {
                        viewField.Order = orderAttribute.Order;
                    }
                    var widthAttribute = propertyInfo.GetCustomAttribute <GridWidth>();
                    if (widthAttribute != null)
                    {
                        viewField.Width = widthAttribute.Width;
                    }
                    viewFields.Add(viewField);
                }
            }
            return(new[] { new ViewMetadata(viewFields.OrderBy(o => o.Order).ToArray())
                           {
                               ViewType = ViewType.LookupView
                           } });
        }
        public override void Process(ReportProcessorArgs args)
        {
            args.ResultTableForView = new DataTable();

            var viewField = new ViewField <string>("CrmId");

            args.ResultTableForView.Columns.Add(viewField.ToColumn());

            var customViewField = new ViewField <bool>("ActiveCustomer");

            args.ResultTableForView.Columns.Add(customViewField.ToColumn());

            var productViewField = new ViewField <DataTable>("ProductPurchases");

            args.ResultTableForView.Columns.Add(productViewField.ToColumn());
        }
Esempio n. 20
0
        public void RotateToTarget(Transform transform, ViewField viewField)
        {
            var self = transform;

            if (viewField.Target == null)
            {
                return;
            }

            var targetPos = viewField.Target.position;
            var rot       = Quaternion.LookRotation(self.position - targetPos, Vector3.forward);

            rot.x = 0;
            rot.y = 0;

            transform.rotation = rot;
        }
Esempio n. 21
0
        /**
         * Attack the given target if it is in the range of the field of view.
         * @param transform: the transform of the AI.
         * @param viewField: the field of view of the AI.
         * @param call: the a coroutin function.
         */
        public void AttackTarget(Transform transform, ViewField viewField, System.Func <IEnumerator, Coroutine> call)
        {
            if (viewField.Target == null)
            {
                return;
            }

            var distanceToTarget = Vector3.Distance(transform.position, viewField.Target.position);

            if (distanceToTarget < Distance)
            {
                if (!_isAttacking)
                {
                    call(AttackTarget(viewField));
                }
            }
        }
Esempio n. 22
0
        protected override string[] FormatExportRecord(object obj)
        {
            string[] objs = new string[this.PickHeadViewFieldList.Length];
            PickdetailmaterialQuery pickLine = obj as PickdetailmaterialQuery;
            Type type = pickLine.GetType();

            for (int i = 0; i < this.PickHeadViewFieldList.Length; i++)
            {
                ViewField field    = this.PickHeadViewFieldList[i];
                string    strValue = string.Empty;
                System.Reflection.FieldInfo fieldInfo = type.GetField(field.FieldName);
                if (fieldInfo != null)
                {
                    strValue = fieldInfo.GetValue(pickLine).ToString();
                }
                objs[i] = strValue;
            }
            return(objs);
        }
Esempio n. 23
0
    void OnSceneGUI()
    {
        ViewField target = null;
        ViewField fow    = (ViewField)target;

        Handles.color = Color.white;
        Handles.DrawWireArc(fow.transform.position, Vector3.up, Vector3.forward, 360, fow.viewRadius);
        Vector3 viewAngleA = fow.DirFromAngle(-fow.viewAngle / 2, false);
        Vector3 viewAngleB = fow.DirFromAngle(fow.viewAngle / 2, false);

        Handles.DrawLine(fow.transform.position, fow.transform.position + viewAngleA * fow.viewRadius);
        Handles.DrawLine(fow.transform.position, fow.transform.position + viewAngleB * fow.viewRadius);

        Handles.color = Color.red;
        foreach (Transform visibleTarget in fow.visibleTargets)
        {
            Handles.DrawLine(fow.transform.position, visibleTarget.position);
        }
    }
    void Start()
    {
        _rBody              = GetComponent <Rigidbody>();
        _fJoint             = GetComponent <FixedJoint>();
        _viewField          = GetComponent <ViewField>();
        _bufferSensor       = GetComponent <BufferSensorComponent>();
        _behaviorParameters = GetComponent <BehaviorParameters>();

        var parent = transform.parent;

        _manager     = parent.GetComponent <ObjectsManager>();
        _config      = parent.GetComponent <Config>();
        _spawnHelper = parent.GetComponent <SpawnHelper>();
        _seenHolder  = parent.GetComponent <SeenHolder>();

        team = _behaviorParameters.TeamId == (int)Team.Hider ? Team.Hider : Team.Seeker;

        MaxStep = _config.episodeLength;
    }
        protected override DataRow GetGridRow(object obj)
        {
            DataRow row = this.DtSource.NewRow();

            SAPInvoicesDetail pickLine = obj as SAPInvoicesDetail;
            Type type = pickLine.GetType();

            for (int i = 0; i < this.PickHeadViewFieldList.Length; i++)
            {
                ViewField field    = this.PickHeadViewFieldList[i];
                string    strValue = string.Empty;
                System.Reflection.FieldInfo fieldInfo = type.GetField(field.FieldName.ToUpper());
                if (fieldInfo != null)
                {
                    strValue = fieldInfo.GetValue(pickLine).ToString();
                }
                row[i + 1] = strValue;
            }

            return(row);
        }
    private void OnSceneGUI()
    {
        ViewField vw = (ViewField)target;

        Handles.color = new Color(0, 1, 0, (float)0.1);

        Handles.DrawSolidArc(vw.transform.position, Vector3.up, vw.DirFromAngle(-vw.viewAngle / 2),
                             vw.viewAngle, vw.viewRadius);

        Vector3 viewAngleA = vw.DirFromAngle(-vw.viewAngle / 2);
        Vector3 viewAngleB = vw.DirFromAngle(vw.viewAngle / 2);

        Handles.DrawLine(vw.transform.position, vw.transform.position + viewAngleA * vw.viewRadius);
        Handles.DrawLine(vw.transform.position, vw.transform.position + viewAngleB * vw.viewRadius);

        Handles.color = Color.magenta;
        foreach (GameObject obj in vw.collectVisibleObjects())
        {
            Handles.DrawLine(vw.transform.position, obj.transform.position);
        }
    }
Esempio n. 27
0
        private static ViewMetadata GetView(RecordMetadata recordMetadata, string excelFile, LogController controller, CustomisationImportResponse response)
        {
            var recordType = recordMetadata.SchemaName;
            var fieldRows  = ExcelUtility.SelectPropertyBagsFromExcelTab(excelFile,
                                                                         FieldsTabName);

            var viewFields = new List <ViewField>();

            try
            {
                foreach (
                    var row in
                    fieldRows.Where(r => r.GetFieldAsString(Headings.Fields.RecordTypeSchemaName) == recordType))
                {
                    var fieldName = row.GetFieldAsString(Headings.Fields.SchemaName);

                    var viewOrderString = row.GetFieldAsString(Headings.Fields.ViewOrder);
                    if (!string.IsNullOrWhiteSpace(viewOrderString))
                    {
                        var order = row.GetFieldAsInteger(Headings.Fields.ViewOrder);
                        if (order >= 0)
                        {
                            var viewWidth = string.IsNullOrWhiteSpace(row.GetFieldAsString("View Width"))
                                ? 100
                                : row.GetFieldAsInteger("View Width");
                            var viewField = new ViewField(fieldName, order
                                                          , viewWidth);
                            viewFields.Add(viewField);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                response.AddResponseItem(recordMetadata, ex);
            }
            return(new ViewMetadata(viewFields));
        }
        private static void LoadFromDisk(IEnumerable<View> list, nHydrateModel model, string rootFolder, Microsoft.VisualStudio.Modeling.Store store)
        {
            var folder = Path.Combine(rootFolder, FOLDER_VW);
            if (!Directory.Exists(folder)) return;

            #region Load other parameter/field information
            var fList = Directory.GetFiles(folder, "*.configuration.xml");
            foreach (var f in fList)
            {
                var document = new XmlDocument();
                try
                {
                    document.Load(f);
                }
                catch (Exception ex)
                {
                    //Do Nothing
                    MessageBox.Show("The file '" + f + "' is not valid and could not be loaded!", "Load Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                var fi = new FileInfo(f);
                var name = fi.Name.Substring(0, fi.Name.Length - ".configuration.xml".Length).ToLower();
                var itemID = XmlHelper.GetAttributeValue(document.DocumentElement, "id", Guid.Empty);
                var item = list.FirstOrDefault(x => x.Id == itemID);
                if (item == null)
                {
                    item = new View(model.Partition, new PropertyAssignment[] { new PropertyAssignment(ElementFactory.IdPropertyAssignment, XmlHelper.GetAttributeValue(document.DocumentElement, "id", Guid.NewGuid())) });
                    model.Views.Add(item);
                }

                System.Windows.Forms.Application.DoEvents();

                item.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(FieldParameter_PropertyChanged);
                item.Name = XmlHelper.GetAttributeValue(document.DocumentElement, "name", item.Name);
                item.PrecedenceOrder = XmlHelper.GetAttributeValue(document.DocumentElement, "precedenceorder", item.PrecedenceOrder);
                item.IsGenerated = XmlHelper.GetAttributeValue(document.DocumentElement, "isgenerated", item.IsGenerated);
                item.CodeFacade = XmlHelper.GetAttributeValue(document.DocumentElement, "codefacade", item.CodeFacade);
                item.Schema = XmlHelper.GetAttributeValue(document.DocumentElement, "schema", item.Schema);
                item.GeneratesDoubleDerived = XmlHelper.GetAttributeValue(document.DocumentElement, "generatesdoublederived", item.GeneratesDoubleDerived);
                item.Summary = XmlHelper.GetNodeValue(document.DocumentElement, "summary", item.Summary);
                item.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(FieldParameter_PropertyChanged);

                //Fields
                var fieldsNodes = document.DocumentElement.SelectSingleNode("//fieldset");
                if (fieldsNodes != null)
                {
                    var nameList = new List<string>();
                    foreach (XmlNode n in fieldsNodes.ChildNodes)
                    {
                        var subItemID = XmlHelper.GetAttributeValue(n, "id", Guid.Empty);
                        var field = item.Fields.FirstOrDefault(x => x.Id == subItemID);
                        if (field == null)
                        {
                            field = new ViewField(item.Partition, new PropertyAssignment[] { new PropertyAssignment(ElementFactory.IdPropertyAssignment, XmlHelper.GetAttributeValue(n, "id", Guid.NewGuid())) });
                            item.Fields.Add(field);
                        }

                        field.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(FieldParameter_PropertyChanged);
                        field.Name = XmlHelper.GetAttributeValue(n, "name", field.Name);
                        field.CodeFacade = XmlHelper.GetAttributeValue(n, "codefacade", field.CodeFacade);
                        nameList.Add(field.Name.ToLower());
                        field.Nullable = XmlHelper.GetAttributeValue(n, "nullable", field.Nullable);
                        var dtv = XmlHelper.GetAttributeValue(n, "datatype", field.DataType.ToString());
                        DataTypeConstants dt;
                        if (Enum.TryParse<DataTypeConstants>(dtv, true, out dt))
                            field.DataType = dt;
                        field.Default = XmlHelper.GetAttributeValue(n, "default", field.Default);
                        field.IsGenerated = XmlHelper.GetAttributeValue(n, "isgenerated", field.IsGenerated);
                        field.Length = XmlHelper.GetAttributeValue(n, "length", field.Length);
                        field.Scale = XmlHelper.GetAttributeValue(n, "scale", field.Scale);
                        field.Summary = XmlHelper.GetNodeValue(n, "summary", field.Summary);
                        field.PropertyChanged -= new System.ComponentModel.PropertyChangedEventHandler(FieldParameter_PropertyChanged);
                    }
                    if (item.Fields.Remove(x => !nameList.Contains(x.Name.ToLower())) > 0)
                        item.nHydrateModel.IsDirty = true;
                }

                LoadModules(folder, item);
            }
            #endregion

            #region Load SQL
            fList = Directory.GetFiles(folder, "*.sql");
            foreach (var f in fList)
            {
                var fi = new FileInfo(f);
                if (fi.Name.ToLower().EndsWith(".sql"))
                {
                    var name = fi.Name.Substring(0, fi.Name.Length - 4).ToLower();
                    var item = list.FirstOrDefault(x => x.Name.ToLower() == name);
                    if (item != null)
                    {
                        item.SQL = File.ReadAllText(f);
                        System.Windows.Forms.Application.DoEvents();
                    }
                }
            }
            #endregion
        }
        protected override string[] FormatExportRecord(object obj)
        {
            //return new string[]{((InvoicesExt)obj).InvNo,
            //                    this.GetInvInName(((InvoicesExt)obj).InvType),
            //                    this.GetStatusName(((InvoicesExt)obj).InvStatus),
            //                    ((InvoicesExt)obj).FinishFlag,
            //                    ((InvoicesExt)obj).CUser,
            //                    FormatHelper.ToDateString(((InvoicesExt)obj).CDate),
            //                    "",//((InvoicesExt)obj).VendorCode,
            //                    ((InvoicesExt)obj).VendorName,
            //                    ((InvoicesExt)obj).OaMo,
            //                    ((InvoicesExt)obj).AsnAvailable
            //                   };

            string[]    objs = new string[this.SAPHeadViewFieldList.Length];
            InvoicesExt inv  = obj as InvoicesExt;
            Type        type = inv.GetType();

            for (int i = 0; i < this.SAPHeadViewFieldList.Length; i++)
            {
                ViewField field    = this.SAPHeadViewFieldList[i];
                string    strValue = string.Empty;
                System.Reflection.FieldInfo fieldInfo = type.GetField(field.FieldName);
                if (fieldInfo != null)
                {
                    strValue = fieldInfo.GetValue(inv).ToString();
                }
                if (field.FieldName == "InvType")
                {
                    strValue = this.GetInvInName(inv.InvType);
                }
                if (field.FieldName == "FinishFlag1")
                {
                    strValue = inv.FinishFlag;
                }
                else if (field.FieldName == "OrderStatus1")
                {
                    strValue = inv.OrderStatus;// this.GetStatusName(inv.OrderStatus);
                }
                else if (field.FieldName == "InvStatus")
                {
                    strValue = inv.InvStatus;// this.GetStatusName(inv.InvStatus);
                }
                else if (field.FieldName == "PoCreateDate")
                {
                    strValue = FormatHelper.ToDateString(inv.PoCreateDate);
                }
                else if (field.FieldName == "PoupDateDate")
                {
                    strValue = FormatHelper.ToDateString(inv.PoupDateDate);
                }
                else if (field.FieldName == "PoupDateTime")
                {
                    strValue = FormatHelper.ToTimeString(inv.PoupDateTime);
                }
                else if (field.FieldName == "ApplyDate")
                {
                    strValue = FormatHelper.ToDateString(inv.ApplyDate);
                }
                else if (field.FieldName == "VoucherDate")
                {
                    strValue = FormatHelper.ToDateString(inv.VoucherDate);
                }
                else if (field.FieldName == "CDate")
                {
                    strValue = FormatHelper.ToDateString(inv.CDate);
                }
                else if (field.FieldName == "CTime")
                {
                    strValue = FormatHelper.ToTimeString(inv.CTime);
                }
                else if (field.FieldName == "PlangiDate")
                {
                    strValue = FormatHelper.ToDateString(inv.PlangiDate);
                }
                else if (field.FieldName == "DnMDate")
                {
                    strValue = FormatHelper.ToDateString(inv.DnMDate);
                }
                else if (field.FieldName == "AsnAvailable")
                {
                    if (CanCreateASN(inv.InvNo))
                    {
                        strValue = "是";
                    }
                    else
                    {
                        strValue = "否";
                    }
                }
                objs[i] = strValue;
            }
            return(objs);
        }
        protected override DataRow GetGridRow(object obj)
        {
            DataRow row = this.DtSource.NewRow();

            //row["InvNo"] = ((InvoicesExt)obj).InvNo;
            //row["StorageInType"] = this.GetInvInName(((InvoicesExt)obj).InvType);//入库类型(单据类型)
            //row["StorageInTypeCode"] = ((InvoicesExt)obj).InvType;
            //row["InvStatus"] = this.GetStatusName(((InvoicesExt)obj).InvStatus);
            //row["FinishFlag"] = ((InvoicesExt)obj).FinishFlag;
            ////row["CUser"] = ((InvoicesExt)obj).CUser;
            ////row["CDate"] = ((InvoicesExt)obj).CDate;
            //row["CUser"] = ((InvoicesExt)obj).CreateUser;
            //row["CDate"] = ((InvoicesExt)obj).PoCreateDate;
            //row["VendorCode"] = ((InvoicesExt)obj).VendorCode; // ((InvoicesExt)obj).VendorCode;
            //row["VendorName"] = ((InvoicesExt)obj).VendorName;
            //row["OANo"] = ((InvoicesExt)obj).OaMo;
            //row["ASNAvailable"] = ((InvoicesExt)obj).AsnAvailable;

            InvoicesExt inv  = obj as InvoicesExt;
            Type        type = inv.GetType();

            for (int i = 0; i < this.SAPHeadViewFieldList.Length; i++)
            {
                ViewField field    = this.SAPHeadViewFieldList[i];
                string    strValue = string.Empty;
                System.Reflection.FieldInfo fieldInfo = type.GetField(field.FieldName);
                if (fieldInfo != null)
                {
                    strValue = fieldInfo.GetValue(inv).ToString();
                }
                if (field.FieldName == "InvType")
                {
                    strValue = this.GetInvInName(inv.InvType);
                }
                if (field.FieldName == "FinishFlag1")
                {
                    strValue = inv.FinishFlag;
                }
                else if (field.FieldName == "OrderStatus1")
                {
                    strValue = inv.OrderStatus;// this.GetStatusName(inv.OrderStatus);
                }
                else if (field.FieldName == "InvStatus")
                {
                    strValue = inv.InvStatus;// this.GetStatusName(inv.InvStatus);
                }
                else if (field.FieldName == "OrderStatus")
                {
                    strValue = this.GetStatusName(inv.OrderStatus);
                }
                else if (field.FieldName == "CreateUser")
                {
                    strValue = inv.CreateUser;
                    //if ((inv.InvType == "PRC") || (inv.InvType == "YFR") || (inv.InvType == "GZC"))
                    //{
                    //    strValue = inv.SAPCuser;
                    //}
                    //else
                    //{
                    //    strValue = inv.CreateUser;
                    //}
                }
                else if (field.FieldName == "PoCreateDate")
                {
                    if ((inv.InvType == "PRC") || (inv.InvType == "YFR") || (inv.InvType == "GZC"))
                    {
                        strValue = FormatHelper.ToDateString(inv.PoupDateDate);
                    }
                    else
                    {
                        strValue = FormatHelper.ToDateString(inv.PoCreateDate);
                    }
                }
                else if (field.FieldName == "PoupDateDate")
                {
                    strValue = FormatHelper.ToDateString(inv.PoupDateDate);
                }
                else if (field.FieldName == "PoupDateTime")
                {
                    strValue = FormatHelper.ToTimeString(inv.PoupDateTime);
                }
                else if (field.FieldName == "ApplyDate")
                {
                    strValue = FormatHelper.ToDateString(inv.ApplyDate);
                }
                else if (field.FieldName == "VoucherDate")
                {
                    strValue = FormatHelper.ToDateString(inv.VoucherDate);
                }

                else if (field.FieldName == "MESCDate")
                {
                    strValue = FormatHelper.ToDateString(inv.CDate);
                }
                else if (field.FieldName == "MESCTime")
                {
                    strValue = FormatHelper.ToTimeString(inv.CTime);
                }
                else if (field.FieldName == "MESCUser")
                {
                    strValue = inv.CUser;
                }
                else if (field.FieldName == "MESMaintainUser")
                {
                    strValue = inv.MaintainUser;
                }
                else if (field.FieldName == "MESMaintainDate")
                {
                    strValue = FormatHelper.ToDateString(inv.MaintainDate);
                }
                else if (field.FieldName == "MESMaintainTime")
                {
                    strValue = FormatHelper.ToTimeString(inv.MaintainTime);
                }

                else if (field.FieldName == "PlangiDate")
                {
                    strValue = FormatHelper.ToDateString(inv.PlangiDate);
                }
                else if (field.FieldName == "DnMDate")
                {
                    strValue = FormatHelper.ToDateString(inv.DnMDate);
                }
                else if (field.FieldName == "SAPRSCuser ")
                {
                    strValue = inv.SAPCuser;
                }
                else if (field.FieldName == "InvNo")
                {
                }
                else if (field.FieldName == "AsnAvailable")
                {
                    if (CanCreateASN(inv.InvNo))
                    {
                        strValue = "是";
                    }
                    else
                    {
                        strValue = "否";
                    }
                }
                else if (field.FieldName.ToUpper() == "NOTOUTCHECKFLAG")
                {
                    if (string.IsNullOrEmpty(inv.NotOutCheckFlag))
                    {
                        strValue = "否";
                    }
                    else if (inv.NotOutCheckFlag.ToUpper() == "X")
                    {
                        strValue = "是";
                    }
                    else
                    {
                        strValue = inv.NotOutCheckFlag;
                    }
                }
                //PlanSendDate
                row[i + 1] = strValue;
            }

            return(row);
        }
Esempio n. 31
0
 public Fov(ViewField viewField, VisibleMap visibleMap)
 {
     _viewField   = viewField;
     _visiableMap = visibleMap;
 }
 public override void Process(ReportProcessorArgs args)
 {
     args.ResultTableForView = new DataTable();
     var viewField = new ViewField<string>("DeveloperId");
     args.ResultTableForView.Columns.Add(viewField.ToColumn());
 }