Beispiel #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button4_Click(object sender, EventArgs e)
        {
            LearningObjectContextModel ctx = new LearningObjectContextModel();

            OntoLearningObject obj = new OntoLearningObject();
            ctx.LearningObject_ID = txtID.Text;
            ctx.MediaFormat =  txtMediaFormat.Text;
            ctx.MediaType = cmbMediaType.SelectedItem.ToString();
            ctx.Title = txtTitle.Text;
            ctx.MoodleCommunity = TxtLOComunidade.Text;
            ctx.Link = txtLink.Text;
            ctx.ObjectLearningStyle = cmbLearningStyle.SelectedItem.ToString();
            ctx.Description = txtDescription.Text;
            ctx.Idiom = cmbIdiom.SelectedItem.ToString();
            ctx.Size = txtSize.Text;
            ctx.KeywordsList = txtkeyword.Text;

            var json = new JavaScriptSerializer().Serialize(ctx);
            Console.WriteLine(json);
               //WebServiceSoapClient.Service1 webSevice = new WebServiceSoapClient.Service1();
               //webSevice.SaveLearningObjectinOntology(json);

            this.Cursor = Cursors.WaitCursor;
            ServiceReference3.Service1SoapClient soa = new Service1SoapClient();
            soa.SaveLearningObjectinOntology(json);
            this.Cursor = Cursors.Default;
        }
Beispiel #2
0
        /// <summary>
        /// Insere um objeto de aprendizagem
        /// </summary>
        public void insertLO()
        {
            LearningObjectContextModel LO = new LearningObjectContextModel();
            LO.LearningObject_ID = "LO_123";
            //LO.LearningObjectFormat = "wmv";

            dog.Begin();
            Graph g = null;
            OntoLearningObject learningObject = new OntoLearningObject();
            learningObject.insertLearningObject(ref g, LO); dog.SaveGraph(g);
            learningObject.insertLearningObjectFormat(ref g, LO); dog.SaveGraph(g);

            dog.Commit();
        }
        public void SaveLearningObjectinOntology(String jsonObject)
        {
            Graph g = new Graph();
            LearningObjectContextModel ctx = null;

            try
            {
                ctx = JsonConvert.DeserializeObject<LearningObjectContextModel>(jsonObject);
            }
            catch (IOException) { }

            SingletonStarDog dog = SingletonStarDog.getDbInstance();
            OntoLearningObject obj = new OntoLearningObject();

            #region Ontologia
            dog.GetDBConnection().Begin();
            obj.insertLearningObject(ref g, ctx);
            dog.GetDBConnection().SaveGraph(g);
            dog.GetDBConnection().Commit();

            dog.GetDBConnection().Begin();
            obj.insertLearningObjectTitle(ref g, ctx);
            dog.GetDBConnection().SaveGraph(g);
            dog.GetDBConnection().Commit();

            dog.GetDBConnection().Begin();
            obj.insertLearningObjectLink(ref g, ctx);
            dog.GetDBConnection().SaveGraph(g);
            dog.GetDBConnection().Commit();

            dog.GetDBConnection().Begin();
            obj.insertLearningObjectComunidade(ref g, ctx);
            dog.GetDBConnection().SaveGraph(g);
            dog.GetDBConnection().Commit();

            dog.GetDBConnection().Begin();
            obj.insertLearningObjectDescription(ref g, ctx);
            dog.GetDBConnection().SaveGraph(g);
            dog.GetDBConnection().Commit();

            dog.GetDBConnection().Begin();
            obj.insertLearningObjectFormat(ref g, ctx);
            dog.GetDBConnection().SaveGraph(g);
            dog.GetDBConnection().Commit();

            dog.GetDBConnection().Begin();
            obj.insertLearningObjectMediaType(ref g, ctx);
            dog.GetDBConnection().SaveGraph(g);
            dog.GetDBConnection().Commit();

            dog.GetDBConnection().Begin();
            obj.insertLearningObjectSize(ref g, ctx);
            dog.GetDBConnection().SaveGraph(g);
            dog.GetDBConnection().Commit();

            dog.GetDBConnection().Begin();
            obj.insertLearningObjectIdiom(ref g, ctx);
            dog.GetDBConnection().SaveGraph(g);
            dog.GetDBConnection().Commit();

            dog.GetDBConnection().Begin();
            obj.insertLearningObjectKeywords(ref g, ctx);
            dog.GetDBConnection().SaveGraph(g);
            dog.GetDBConnection().Commit();

            dog.GetDBConnection().Begin();
            obj.insertLearningObjectMediaLearningStyle(ref g, ctx);
            dog.GetDBConnection().SaveGraph(g);
            dog.GetDBConnection().Commit();
            #endregion
        }