Наследование: System.MarshalByRefObject
Пример #1
0
 public static JsDataTable add_Column(this JsDataTable jsDataTable, string title, string _class)
 {
     jsDataTable.aoColumns.Add(new JsDataTable.JsDataColumn {
         sTitle = title, sClass = _class
     });
     return(jsDataTable);
 }
Пример #2
0
 public static JsDataTable add_Columns(this JsDataTable jsDataTable, params string[] titles)
 {
     foreach (var title in titles)
     {
         jsDataTable.add_Column(title);
     }
     return(jsDataTable);
 }
Пример #3
0
        //old mode (to remove)
        /*		[WebMethod(EnableSession = true)]
        public JsDataTable JsDataTableWithGuidanceItemsInViews(List<Guid> viewIds)
        {
            if (viewIds.size()==1)
            {
                var guidanceInLibrary = javascriptProxy.GetGuidanceItemsInLibrary_XmlDB(viewIds[0]);
                if (guidanceInLibrary.size()>0)
                    return getDataTableFromGuidanceItems(guidanceInLibrary);
            }
            var rawGuidanceItems = javascriptProxy.GetGuidanceItemsInViews_XmlDB(viewIds);
            return getDataTableFromGuidanceItems(rawGuidanceItems);
        }

        [WebMethod(EnableSession = true)]
        public JsDataTable JsDataTableWithGuidanceItemsIn_Library(Guid libraryId)
        {
            var rawGuidanceItems = javascriptProxy.GetGuidanceItemsInLibrary_XmlDB(libraryId);
            return getDataTableFromGuidanceItems(rawGuidanceItems);
        }

        [WebMethod(EnableSession = true)]
        public JsDataTable JsDataTableWithGuidanceItemsIn_Folder(Guid folderId)
        {
            var rawGuidanceItems = javascriptProxy.GetGuidanceItemsInFolder_XmlDB(folderId);
            return getDataTableFromGuidanceItems(rawGuidanceItems);
        }

        [WebMethod(EnableSession = true)]
        public JsDataTable JsDataTableWithGuidanceItemsIn_View(Guid viewId)
        {
            var rawGuidanceItems = javascriptProxy.GetGuidanceItemsInViews_XmlDB(new List<Guid>().add(viewId));
            return getDataTableFromGuidanceItems(rawGuidanceItems);
        }
        */
        public JsDataTable getDataTableFromGuidanceItems(List<TeamMentor_Article> rawGuidanceItems)
        {
            var guidanceItems = rawGuidanceItems.GroupBy((guidanceItem)=>guidanceItem.Metadata.Id)
                                                .Select ((g)=>g.First())
                                                .ToList();

            var jsDataTable =  new JsDataTable();
            jsDataTable.add_Columns("Check", "Title",  "Technology", "Phase", "Type", "Category", "Id");
            foreach(var guidanceItem in guidanceItems)
                    jsDataTable.add_Row("<input type='checkbox' class='GuidanceItemCheckBox' style='text-align: center'/>",
                                        guidanceItem.Metadata.Title.trim(),
                                        guidanceItem.Metadata.Technology.trim() ,
                                        guidanceItem.Metadata.Phase ?? "",
                                        guidanceItem.Metadata.Type.trim() ,
                                        //guidanceItem.type ?? "(TBD2)",
                                        guidanceItem.Metadata.Category.trim() ,
                                        guidanceItem.Metadata.Id);
            return jsDataTable;
        }
Пример #4
0
        //old mode (to remove)

/*		[WebMethod(EnableSession = true)]
 *      public JsDataTable JsDataTableWithGuidanceItemsInViews(List<Guid> viewIds)
 *      {
 *          if (viewIds.size()==1)
 *          {
 *              var guidanceInLibrary = javascriptProxy.GetGuidanceItemsInLibrary_XmlDB(viewIds[0]);
 *              if (guidanceInLibrary.size()>0)
 *                  return getDataTableFromGuidanceItems(guidanceInLibrary);
 *          }
 *          var rawGuidanceItems = javascriptProxy.GetGuidanceItemsInViews_XmlDB(viewIds);
 *          return getDataTableFromGuidanceItems(rawGuidanceItems);
 *      }
 *
 *      [WebMethod(EnableSession = true)]
 *      public JsDataTable JsDataTableWithGuidanceItemsIn_Library(Guid libraryId)
 *      {
 *          var rawGuidanceItems = javascriptProxy.GetGuidanceItemsInLibrary_XmlDB(libraryId);
 *          return getDataTableFromGuidanceItems(rawGuidanceItems);
 *      }
 *
 *      [WebMethod(EnableSession = true)]
 *      public JsDataTable JsDataTableWithGuidanceItemsIn_Folder(Guid folderId)
 *      {
 *          var rawGuidanceItems = javascriptProxy.GetGuidanceItemsInFolder_XmlDB(folderId);
 *          return getDataTableFromGuidanceItems(rawGuidanceItems);
 *      }
 *
 *      [WebMethod(EnableSession = true)]
 *      public JsDataTable JsDataTableWithGuidanceItemsIn_View(Guid viewId)
 *      {
 *          var rawGuidanceItems = javascriptProxy.GetGuidanceItemsInViews_XmlDB(new List<Guid>().add(viewId));
 *          return getDataTableFromGuidanceItems(rawGuidanceItems);
 *      }
 */

        public JsDataTable getDataTableFromGuidanceItems(List <TeamMentor_Article> rawGuidanceItems)
        {
            var guidanceItems = rawGuidanceItems.GroupBy((guidanceItem) => guidanceItem.Metadata.Id)
                                .Select((g) => g.First())
                                .ToList();

            var jsDataTable = new JsDataTable();

            jsDataTable.add_Columns("Check", "Title", "Technology", "Phase", "Type", "Category", "Id");
            foreach (var guidanceItem in guidanceItems)
            {
                jsDataTable.add_Row("<input type='checkbox' class='GuidanceItemCheckBox' style='text-align: center'/>",
                                    guidanceItem.Metadata.Title.trim(),
                                    guidanceItem.Metadata.Technology.trim(),
                                    guidanceItem.Metadata.Phase ?? "",
                                    guidanceItem.Metadata.Type.trim(),
                                    //guidanceItem.type ?? "(TBD2)",
                                    guidanceItem.Metadata.Category.trim(),
                                    guidanceItem.Metadata.Id);
            }
            return(jsDataTable);
        }
Пример #5
0
 public static JsDataTable add_Column(this JsDataTable jsDataTable, string title)
 {
     return(jsDataTable.add_Column(title, null));
 }
Пример #6
0
 public static JsDataTable add_Row(this JsDataTable jsDataTable, List <object> cells)
 {
     jsDataTable.aaData.Add(cells);
     return(jsDataTable);
 }
Пример #7
0
 public static JsDataTable add_Row(this JsDataTable jsDataTable, params object[] cells)
 {
     return(jsDataTable.add_Row(cells.ToList()));
 }
Пример #8
0
 public static string jsonString(this JsDataTable jsDataTable)
 {
     return(new JavaScriptSerializer().Serialize(jsDataTable));
 }