Exemplo n.º 1
0
        // Get PLMN Object data
        public List <IFSDataModel> GetPLMNObjectData()
        {
            List <IFSDataModel> lstIFSData = new List <IFSDataModel>();

            string query = "select id, parent_id, object_name from tt_object;";

            // Create an instance of the User class

            IFSDataModel iFSDataModel;

            //using (MySqlDataReader reader = MySqlHelper.ExecuteReader(connectionLTE_reference, query))
            using (MySqlDataReader reader = MySqlHelper.ExecuteReader(connectionLTE_Ericsson, query))
            {
                // Check if the reader returned any rows

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        iFSDataModel = new IFSDataModel();

                        iFSDataModel.id       = Convert.ToString(reader[0]);
                        iFSDataModel.parentid = Convert.ToString(reader[1]);
                        iFSDataModel.text     = Convert.ToString(reader[2]);

                        lstIFSData.Add(iFSDataModel);
                    }
                }
            }
            return(lstIFSData);
        }
Exemplo n.º 2
0
        // Get folder structure data
        public List <IFSDataModel> GetIFSData()
        {
            List <IFSDataModel> lstIFSData = new List <IFSDataModel>();

            //string query = "select id, parent_id, name from tt_ifs where type = 0;"; // get directories only not files
            //string query = "select id, parent_id, name, type, data_id from tt_ifs;";
            string query = "select ifs.id, ifs.parent_id, ifs.name, ifs.type, ifs.data_id, ifsdata.data " +
                           " from tt_ifs ifs " +
                           " left join tt_ifs_data ifsdata on ifs.data_id = ifsdata.id;";

            // Create an instance of the User class

            IFSDataModel iFSDataModel;

            //using (MySqlDataReader reader = MySqlHelper.ExecuteReader(connectionLTE_reference, query))
            using (MySqlDataReader reader = MySqlHelper.ExecuteReader(connectionLTE_Ericsson, query))
            {
                // Check if the reader returned any rows

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        iFSDataModel = new IFSDataModel();

                        iFSDataModel.id          = Convert.ToString(reader["id"]);
                        iFSDataModel.parentid    = Convert.ToString(reader["parent_id"]);
                        iFSDataModel.text        = Convert.ToString(reader["name"]);
                        iFSDataModel.isDirectory = !Convert.ToBoolean(reader["type"]);
                        iFSDataModel.data_id     = Convert.ToString(reader["data_id"]);
                        if (!(reader["data"] is System.DBNull))
                        {
                            iFSDataModel.template = System.Text.Encoding.UTF8.GetString((byte[])reader["data"]);
                        }
                        lstIFSData.Add(iFSDataModel);
                    }
                }
            }
            return(lstIFSData);
        }