Exemplo n.º 1
0
     JNode IJsonSerializable.ToJNode(object config) {
      var jn = new JNode();
      jn.AddPrimitive("entityType", this.EntityType.Name);
      jn.AddArray("values", this.Values);

      return jn;
    }
Exemplo n.º 2
0
 void IJsonSerializable.FromJNode(JNode jNode) {
   ServiceName = jNode.Get<String>("serviceName");
   // Adapter = null;
   HasServerMetadata = jNode.Get<bool>("hasServerMetadata");
   // JsonResultsAdapter
   UseJsonP = jNode.Get<bool>("useJsonp");
 }
Exemplo n.º 3
0
        public JNode GetNode(DataRow pRow)
        {
            JNode Node = new JNode((int)pRow["Code"], "Driver.JDriver");

            Node.MouseDBClickAction = new JAction("EditDriver", "BusManagment.Driver.DriverForm.ShowDialog", null, new object[] { (int)pRow["Code"] });
            return(Node);
        }
Exemplo n.º 4
0
 public DataService(JNode jNode) {
   ServiceName = jNode.Get<String>("serviceName");
   // Adapter = null;
   HasServerMetadata = jNode.Get<bool>("hasServerMetadata");
   // JsonResultsAdapter
   UseJsonP = jNode.Get<bool>("useJsonp");
 }
Exemplo n.º 5
0
 public EntityKey(JNode jn) {
   var etName = jn.Get<String>("entityType");
   _entityType = MetadataStore.Instance.GetEntityType(etName);
   ClrType = _entityType.ClrType;
   // coerce the incoming data
   Values = jn.GetPrimitiveArray("values", EntityType.KeyProperties.Select(kp => kp.ClrType)).ToArray();
 }
Exemplo n.º 6
0
        public static JNode GetTreeNode()
        {
            JNode Node = new JNode(0, 0);

            Node.Name             = "Shifts";
            Node.MouseClickAction = new JAction("Shifts", "BusManagment.WorkOrder.JShifts.ListView");
            return(Node);
        }
Exemplo n.º 7
0
 void SetParents(JNode node)
 {
     foreach (var ch in node.Children())
     {
         Parents[ch] = node;
         SetParents(ch);
     }
 }
Exemplo n.º 8
0
        public static JNode GetTreeNode()
        {
            JNode Node = new JNode(0, 0);

            Node.Name             = "Payments";
            Node.MouseClickAction = new JAction("Payments", "BusManagment.Documents.JAUTPayments.ListView");
            return(Node);
        }
Exemplo n.º 9
0
        public static JNode GetTreeNode()
        {
            JNode Node = new JNode(0, 0);

            Node.Name             = "RegisterVacation";
            Node.MouseClickAction = new JAction("Vacatrion", "BusManagment.WorkOrder.JAUTVacations.ListView");
            return(Node);
        }
Exemplo n.º 10
0
        JNode IJsonSerializable.ToJNode(object config)
        {
            var jn = new JNode();

            jn.AddEnum("fetchStrategy", this.FetchStrategy);
            jn.AddEnum("mergeStrategy", this.MergeStrategy);
            return(jn);
        }
Exemplo n.º 11
0
 public DataService(JNode jNode) {
   ServiceName = jNode.Get<String>("serviceName");
   HasServerMetadata = jNode.Get<bool>("hasServerMetadata");
   // TODO: implement JsonResultsAdapter
   UseJsonP = jNode.Get<bool>("useJsonp");
   Adapter = GetAdapter(jNode.Get<String>("adapterName"));
   InitializeHttpClient();
 }
Exemplo n.º 12
0
 internal SaveException(EntityManager em, JNode jn) 
   : base() {
   _message = jn.Get<String>("ExceptionMessage") ?? "see EntityErrors";
   var entityErrors = jn.GetArray<EntityError>("Errors", "errors", "EntityErrors", "entityErrors");
   entityErrors = entityErrors.Select(ee => ee.Resolve(em));
   _entityErrors = new SafeList<EntityError>(entityErrors);
   IsServerError = true;
 }
Exemplo n.º 13
0
        /// <summary>
        /// تشکیل زیردرخت کلاس اطلاعات پایه
        /// </summary>
        public JNode[] TreeView()
        {
            JNode[] N = new JNode[2];
            N[0] = JAStaticAction._SubsidiariessNode();
            //N[1] = JAStaticAction._DefineKartablNode();

            return(N);
        }
Exemplo n.º 14
0
Arquivo: Path.cs Projeto: CoolWirya/BS
        public static JNode GetTreeNode()
        {
            JNode Node = new JNode(0, 0);

            Node.Name             = "Path";
            Node.MouseClickAction = new JAction("Path", "BusManagment.Line.JLineNodePathse.ListView");

            return(Node);
        }
Exemplo n.º 15
0
        public static JNode GetTreeNode()
        {
            JNode Node = new JNode(0, 0);

            Node.Name             = "Atumobile";
            Node.MouseClickAction = new JAction("Autombile", "AUTOMOBILE.AutomobileDefine.JAutomobileDefines.ListView");

            return(Node);
        }
Exemplo n.º 16
0
 JNode IJsonSerializable.ToJNode() {
   var jo = new JNode();
   jo.Add("serviceName", this.ServiceName);
   jo.Add("adapterName", this.Adapter == null ? null : this.Adapter.Name);
   jo.Add("hasServerMetadata", this.HasServerMetadata);
   jo.Add("jsonResultsAdapter", this.JsonResultsAdapter == null ? null : this.JsonResultsAdapter.Name);
   jo.Add("useJsonp", this.UseJsonP);
   return jo;
 }
Exemplo n.º 17
0
        public static JNode GetTreeNode()
        {
            JNode Node = new JNode(0, 0);

            Node.Name             = "SellerTickets";
            Node.MouseClickAction = new JAction("SellerTicket", "BusManagment.SellerTicket.JSellerTickets.ListView");

            return(Node);
        }
Exemplo n.º 18
0
    public static JRef AsRef(this JNode node)
    {
        if (node is JRef jRef)
        {
            return(jRef);
        }

        return(null);
    }
Exemplo n.º 19
0
        public static JNode GetTreeNode()
        {
            JNode Node = new JNode(0, 0);

            Node.Name             = "WorkOrder";
            Node.MouseClickAction = new JAction("WorkOrder", "BusManagment.WorkOrder.JTarrfiHokmeKarBaseDefines.ListView");

            return(Node);
        }
Exemplo n.º 20
0
        public static JNode GetTreeNode()
        {
            JNode Node = new JNode(0, 0);

            Node.Name             = "Device";
            Node.MouseClickAction = new JAction("Device", "AUTOMOBILE.Device.JDevices.ListView");

            return(Node);
        }
Exemplo n.º 21
0
        public static JNode GetTreeNode()
        {
            JNode Node = new JNode(0, 0);

            Node.Name             = "UserDynamicDashboard";
            Node.MouseClickAction = new JAction("UserDynamicDashboard", "BusManagment.UserDynamicDashboard.JUserDynamicDashboards.ListView");

            return(Node);
        }
Exemplo n.º 22
0
        public ClassLibrary.JNode[] TreeView()
        {
            JNode[] Node = new JNode[3];
            Node[0] = Documents.JAUTDocument.GetTreeNode();
            Node[1] = Documents.JAUTPayment.GetTreeNode();
            Node[2] = Documents.JAUTDocumentReport.GetTreeNode();

            return(Node);
        }
Exemplo n.º 23
0
    public static bool IsList(this JNode node)
    {
        if (node is JRef jRef)
        {
            return(jRef.Reference.IsList());
        }

        return(node is JList);
    }
Exemplo n.º 24
0
        public static JNode GetTreeNode()
        {
            JNode Node = new JNode(0, 0);

            Node.Name             = "Personel";
            Node.MouseClickAction = new JAction("Personel", "BusManagment.Personel.JPersonels.ListView");

            return(Node);
        }
Exemplo n.º 25
0
        public static JNode GetTreeNode()
        {
            JNode Node = new JNode(0, 0);

            Node.Name             = "Line";
            Node.MouseClickAction = new JAction("Line", "BusManagment.Line.JLineServicess.ListView");

            return(Node);
        }
Exemplo n.º 26
0
        public static JNode GetTreeNode()
        {
            JNode Node = new JNode(0, 0);

            Node.Name             = "Price";
            Node.MouseClickAction = new JAction("Price", "BusManagment.Price.JPrices.ListView");

            return(Node);
        }
Exemplo n.º 27
0
        public ClassLibrary.JNode[] TreeView()
        {
            JNode[] Node = new JNode[3];
            Node[0] = WorkOrder.JShift.GetTreeNode();
            Node[1] = WorkOrder.JTariff.GetTreeNode();
            Node[2] = WorkOrder.JAUTVacation.GetTreeNode();

            return(Node);
        }
Exemplo n.º 28
0
        public ClassLibrary.JNode[] TreeView()
        {
            JNode[] Node = new JNode[3];
            Node[0] = AutomobileDefine.JAutomobileDefine.GetTreeNode();
            Node[1] = (new ClassLibrary.JBaseDefine()).GetNode(ClassLibrary.JBaseDefine.AutomobileType);
            Node[2] = Device.JDevice.GetTreeNode();

            return(Node);
        }
Exemplo n.º 29
0
        public static JNode GetTreeNode()
        {
            JNode Node = new JNode(0, 0);

            Node.Name             = "Station";
            Node.MouseClickAction = new JAction("Station", "BusManagment.Station.JStations.ListView");

            return(Node);
        }
Exemplo n.º 30
0
        public static JNode GetTreeNode()
        {
            JNode Node = new JNode(0, 0);

            Node.Name             = "Fleet";
            Node.MouseClickAction = new JAction("Fleet", "BusManagment.Fleet.JFleets.ListView");

            return(Node);
        }
Exemplo n.º 31
0
Arquivo: Bus.cs Projeto: CoolWirya/BS
        public static JNode GetTreeNode()
        {
            JNode Node = new JNode(0, 0);

            Node.Name             = "Bus";
            Node.MouseClickAction = new JAction("Bus", "BusManagment.Bus.JBuses.ListView");

            return(Node);
        }
Exemplo n.º 32
0
    public static bool IsData(this JNode node)
    {
        if (node is JRef jRef)
        {
            return(jRef.Reference.IsData());
        }

        return(node is IJData);
    }
Exemplo n.º 33
0
 public JNode[] TreeView()
 {
     JNode[] T = new JNode[4];
     T[0] = JAStaticNode._ArchivePlaceNode();
     T[1] = JAStaticNode._ArchiveSubjectNode();
     T[2] = JAStaticNode._ArchiveDocuments();
     T[3] = JAStaticNode._RequestArchiveFile();
     return(T);
 }
Exemplo n.º 34
0
        public static JNode GetTreeNode()
        {
            JNode Node = new JNode(0, 0);

            Node.Name             = "Driver";
            Node.MouseClickAction = new JAction("Driver", "BusManagment.Driver.JDriverse.ListView");

            return(Node);
        }
Exemplo n.º 35
0
 public static void NodeSubscribe <T>(this IService service, JNode node, JNodeEvent eventFilter, Action <T> action) where T : JNode
 {
     service.NodeSubscribe(node, eventFilter, n =>
     {
         if (n is T jNode)
         {
             action(jNode);
         }
     });
 }
Exemplo n.º 36
0
        public JNode GetNode(DataRow pDR)
        {
            JNode _Node = new JNode((int)pDR["Code"], this.GetType().FullName);
            //درخواست آرشیو
            JAction editAction = new JAction("Request Archive...", "ArchivedDocuments.JRequestArchiveFile.ReferShow", new object[] { 0, _Node.Code, 0 }, null);

            //_Node.MouseDBClickAction = editAction;
            _Node.Popup.Insert(editAction);
            return(_Node);
        }
Exemplo n.º 37
0
        public static JNode GetTreeNode()
        {
            JNode Node = new JNode(0, "Documents.JAUTDocumentReportForm");

            Node.Name = "Reports";
            JAction Ac = new JAction("Reports", "BusManagment.Documents.JAUTDocumentReportForm.ShowDialog", null, null, false);

            Node.MouseClickAction = Ac;
            return(Node);
        }
Exemplo n.º 38
0
    /// <summary>
    /// For internal use only.
    /// </summary>
    /// <param name="jNode"></param>
    public DataService(JNode jNode) {
      ServiceName = jNode.Get<String>("serviceName");
      HasServerMetadata = jNode.Get<bool>("hasServerMetadata");

      UseJsonP = jNode.Get<bool>("useJsonp");
      Adapter = GetAdapter(jNode.Get<String>("adapterName"));
      // TODO: need to do the same as above with JsonResultsAdapter.
      JsonResultsAdapter = Adapter.JsonResultsAdapter;
      InitializeHttpClient(null);

    }
Exemplo n.º 39
0
    private JNode DataToJNode(StructuralAspect aspect) {
      var jn = new JNode();
      var stype = aspect.StructuralType;

      stype.DataProperties.ForEach(dp => {
        var val = aspect.GetValue(dp.Name);
        // handle nonscalar dps
        if (dp.IsComplexProperty) {
          jn.AddJNode(dp.NameOnServer, DataToJNode(((IComplexObject)val).ComplexAspect));
        } else {
          jn.AddPrimitive(dp.NameOnServer, val, dp.DefaultValue);
        }
      });
      return jn;
    }
Exemplo n.º 40
0
 private JNode BuildEntityAspectNode(EntityAspect entityAspect) {
   var nc = MetadataStore.Instance.NamingConvention;
   var jn = new JNode();
   var entityType = entityAspect.EntityType;
     
   jn.AddPrimitive("entityTypeName", entityType.Name);
   jn.AddEnum("entityState", entityAspect.EntityState);
   jn.AddPrimitive("defaultResourceName", entityType.DefaultResourceName);
   jn.AddJNode("originalValuesMap", BuildOriginalValuesMapNode(entityAspect, nc));
   var agkType = entityType.AutoGeneratedKeyType;
   if (agkType != AutoGeneratedKeyType.None) {
     var agkNode = new JNode();
     agkNode.AddPrimitive("propertyName", entityType.KeyProperties[0].Name);
     agkNode.AddEnum("autoGeneratedKeyType", agkType);
     jn.AddJNode("autoGeneratedKey", agkNode);
   }
   return jn;
 }
Exemplo n.º 41
0
 JNode IJsonSerializable.ToJNode(object config) {
   var jn = new JNode();
   jn.AddEnum("fetchStrategy", this.FetchStrategy );
   jn.AddEnum("mergeStrategy", this.MergeStrategy );
   return jn;
 }
Exemplo n.º 42
0
    //public SaveOptions(JNode jNode) {
      
      
    //}

    JNode IJsonSerializable.ToJNode(object config) {
      var jn = new JNode();
      jn.AddPrimitive("allowConcurrentSaves", AllowConcurrentSaves);
      jn.AddPrimitive("tag", Tag);
      return jn;
    }
Exemplo n.º 43
0
 JNode IJsonSerializable.ToJNode(object config) {
   var jn = new JNode();
   
   return jn;
 }
Exemplo n.º 44
0
 public SaveOptions(JNode jNode) {
   
   
 }
Exemplo n.º 45
0
 public QueryOptions(JNode jNode) {
   FetchStrategy = jNode.GetNullableEnum<FetchStrategy>("fetchStrategy");
   MergeStrategy = jNode.GetNullableEnum<MergeStrategy>("mergeStrategy");
   
 }
 private JNode PrepareSaveBundle(IEnumerable<IEntity> entitiesToSave, SaveOptions saveOptions) {
   var jn = new JNode();
   jn.AddArray("entities", entitiesToSave.Select(e => EntityToJNode(e)));
   jn.AddJNode("saveOptions", saveOptions);
   return jn;
 }
    private SaveResult ProcessSaveResult(EntityManager entityManager, SaveOptions saveOptions, JNode jNode) {

      var kms = jNode.GetArray<KeyMapping>("KeyMappings");
      var keyMappings = kms.Select(km => ToEntityKeys(km, entityManager.MetadataStore)).ToDictionary(tpl => tpl.Item1, tpl => tpl.Item2);
      using (entityManager.NewIsLoadingBlock(false)) {
        keyMappings.ForEach(km => {
          var targetEntity = entityManager.GetEntityByKey(km.Key);
          targetEntity.EntityAspect.SetDpValue(km.Key.EntityType.KeyProperties[0], km.Value.Values[0]);
        });

        var entityNodes = jNode.GetToken<JArray>("Entities");

        var serializer = new JsonSerializer();
        var mappingContext = new MappingContext() {
          EntityManager = entityManager,
          MergeStrategy = MergeStrategy.OverwriteChanges,
          LoadingOperation = LoadingOperation.Save,
          JsonResultsAdapter = saveOptions.DataService.JsonResultsAdapter
        };
        var jsonConverter = new JsonEntityConverter(mappingContext);
        serializer.Converters.Add(jsonConverter);
        // serializer.Converters.Add(new StringEnumConverter());
        // Don't use the result of the Deserialize call to get the list of entities 
        // because it won't include entities added on the server.
        serializer.Deserialize<IEnumerable<IEntity>>(entityNodes.CreateReader());
        var allEntities = mappingContext.Entities;
        allEntities.ForEach(e => e.EntityAspect.AcceptChanges());
        return new SaveResult(allEntities, keyMappings);
      }

    }
Exemplo n.º 48
0
    private SaveResult ProcessSaveResult(EntityManager entityManager, string saveResultJson) {

      var jo = JObject.Parse(saveResultJson);

      var jn = new JNode(jo);
      var kms = jn.GetArray<KeyMapping>("KeyMappings");
      var keyMappings = kms.Select(km => ToEntityKeys(km)).ToDictionary(tpl => tpl.Item1, tpl => tpl.Item2);
      using (entityManager.NewIsLoadingBlock(false)) {
        keyMappings.ForEach(km => {
          var targetEntity = entityManager.FindEntityByKey(km.Key);
          targetEntity.EntityAspect.SetDpValue(km.Key.EntityType.KeyProperties[0], km.Value.Values[0]);
        });

        var prop = jo.Property("Entities");
        if (prop == null) return null;
        var entityNodes = (JArray)prop.Value;
        var serializer = new JsonSerializer();
        var jsonConverter = new JsonEntityConverter(entityManager, MergeStrategy.OverwriteChanges, NormalizeEntityTypeName);
        serializer.Converters.Add(jsonConverter);
        // Don't use the result of the Deserialize call to get the list of entities 
        // because it won't include entities added on the server.
        serializer.Deserialize<IEnumerable<IEntity>>(entityNodes.CreateReader());
        var allEntities = jsonConverter.AllEntities;
        allEntities.ForEach(e => e.EntityAspect.AcceptChanges());
        return new SaveResult(allEntities, keyMappings);
      }

    }
Exemplo n.º 49
0
    //public SaveOptions(JNode jNode) {
      
      
    //}

    JNode IJsonSerializable.ToJNode(object config) {
      var jn = new JNode();
      
      jn.AddPrimitive("tag", Tag);
      return jn;
    }