Пример #1
0
        private void LoadFlow(Form_able abstract_Iter_able, List <object> value, List <string> index)
        {
            IQuery_able facade = abstract_Iter_able.facade.getFacade();

            current_Viewable = new CNTR_Viewable();
            List <string>             key_List    = abstract_Iter_able.list_Column_Headers;
            List_able                 list_Able   = new List_able();
            List <Abstract_Iter_able> object_List = facade.GetByIdWhere(value, index);
            string iterable_Title = abstract_Iter_able.GetType().ToString();

            list_Able.setListableState(iterable_Title, object_List);
            current_Viewable.setViewState(list_Able, iterable_Title, key_List);
            string key_String = "";
            int    j          = 0;

            foreach (string key in key_List)
            {
                key_String += "Key" + j + "= " + key + " | ";
                j++;
            }
        }
Пример #2
0
        private void LoadForm(Abstract_Iter_able abstract_Iter_able, List <object> value, List <string> index, Form_able form)
        {
            IQuery_able facade = abstract_Iter_able.getFacade();

            current_Viewable = new CNTR_Viewable();
            List <string> key_List = abstract_Iter_able.getListOfKeys();
            List <Guid>   aggregate_Indexes;
            List_able     list_Able = new List_able();

            if (form == null)
            {
                aggregate_Indexes = new List <Guid> {
                };
            }
            else
            {
                aggregate_Indexes = form.list_View_Items;
            }
            List <Abstract_Iter_able> object_List;

            object_List = facade.GetAll();

            string iterable_Title = abstract_Iter_able.GetType().ToString();

            list_Able.setListableState(iterable_Title, object_List.Cast <Abstract_Iter_able>().ToList());
            current_Viewable.setViewState(list_Able, iterable_Title, key_List);

            string key_String = "";
            int    j          = 0;

            foreach (string key in key_List)
            {
                key_String += "Key" + j + "= " + key + " | ";
                j++;
            }
        }
 public List <string> GetColumns()
 {
     if (HttpContext.Current.Session["current_Viewable"] == null)
     {
         List <string> failure = new List <string>();
         failure.Add("No Columns Detected");
         return(failure);
     }
     else
     {
         CNTR_Viewable    view       = (CNTR_Viewable)Session["current_Viewable"];
         int              selected   = (int)Session["hidden_field"];
         List <Form_able> masterList = (List <Form_able>)Session["master_Forms_List"];
         DataTable        dt         = (DataTable)view.getView(masterList[selected], 0, 0, 1, 0, "", "", out int filteredCount);
         //Session["dt"] = dt;
         dt.Columns.Add(new DataColumn("Options"));
         List <string> data_Columns = new List <string>();
         foreach (DataColumn data_Column in dt.Columns)
         {
             data_Columns.Add(data_Column.ColumnName);
         }
         return(data_Columns);
     }
 }
        public void GetData(int draw, int start, int length)
        {
            int              order      = Convert.ToInt32(HttpContext.Current.Request["order[0][column]"]);
            string           direction  = HttpContext.Current.Request["order[0][dir]"];
            string           search     = HttpContext.Current.Request["search[value]"];
            CNTR_Viewable    view       = (CNTR_Viewable)Session["current_Viewable"];
            int              selected   = (int)Session["hidden_field"];
            List <Form_able> masterList = (List <Form_able>)Session["master_Forms_List"];

            EventLog.WriteEntry("ICSNET", "Getting Data");

            if (length == -1)
            {
                length = view.getCount();
            }
            EventLog.WriteEntry("ICSNET", "Getting View");
            DataTable dt = (DataTable)view.getView(masterList[selected], 0, start, length, order, search, direction, out int filteredCount);

            EventLog.WriteEntry("ICSNET", "Retrieved View");
            dt.Columns.Add(new DataColumn("Options"));
            StringBuilder jsonString = new StringBuilder();
            DataSet       data_Set   = new DataSet();

            data_Set.Merge(dt);
            string list_Data = "[]";

            if (data_Set != null && data_Set.Tables[0].Rows.Count > 0)
            {
                jsonString.Append("[");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    jsonString.Append("{");
                    for (int k = 0; k < data_Set.Tables[0].Columns.Count; k++)
                    {
                        if (k < data_Set.Tables[0].Columns.Count - 1)
                        {
                            jsonString.Append("\"" + data_Set.Tables[0].Columns[k].ColumnName.ToString() + "\":" + "\"" + data_Set.Tables[0].Rows[i][k].ToString() + "\",");
                        }
                        else if (k == data_Set.Tables[0].Columns.Count - 1)
                        {
                            jsonString.Append("\"" + data_Set.Tables[0].Columns[k].ColumnName.ToString() + "\":" + "null");
                        }
                    }
                    if (i == dt.Rows.Count - 1)
                    {
                        jsonString.Append("}");
                    }
                    else
                    {
                        jsonString.Append("},");
                    }
                }
                jsonString.Append("]");
                list_Data = jsonString.ToString();
            }



            string modified_Data = "{ \"draw\": " + draw.ToString() + ",\"recordsTotal\": " + view.getCount().ToString() + ",\"recordsFiltered\": " + filteredCount.ToString() + ", \"data\": " + list_Data + "}";


            /*var xdoc = XDocument.Parse(list_Data);
             * var items = xdoc.Descendants("Item")
             *              .ToDictionary(i => (string)i.Attribute("Key"),
             *                              i => (string)i.Attribute("Value"));
             * var jsonserializer = new System.Web.Script.Serialization.JavaScriptSerializer();
             * string json = jsonserializer.Serialize(items);*/
            HttpContext.Current.Response.Write(modified_Data);
        }