Пример #1
0
        protected void grvGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            SaveCheckedValues();
            int rowId   = grvGroup.SelectedIndex;
            int groupId = Convert.ToInt32(grvGroup.Rows[rowId].Cells[2].Text.ToString());

            XmlDocument doc    = new XmlDocument();
            ArrayList   arrIDs = ConvertToArrayList(txtListId.Text);

            List <int> list = new List <int>();

            list.Add(groupId);

            doc.LoadXml(MoodleGroup.GetGroupMembers(list, (string)Session["token"]));
            doc.Save("D:\\Grouping_Get_Members_" + cboGrouping.Text + ".xml");

            XmlNode xmlnode = doc.ChildNodes[1];

            treeDetail.Nodes.Clear();
            treeDetail.Nodes.Add(new TreeNode(doc.DocumentElement.Name));
            TreeNode tNode;

            tNode = treeDetail.Nodes[0];
            MoodleUtilites.AddNode(xmlnode, tNode);
            treeDetail.ExpandAll();
            treeDetail.Focus();
        }
Пример #2
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            MoodleDeleteCategory category = new MoodleDeleteCategory
            {
                Id        = Convert.ToInt32(txtDeleteId.Text),
                NewParent = Convert.ToInt32(txtNewParent.Text),
                Recursive = rdbDeleteAllChildren.Checked == true?1:0
            };

            List <MoodleDeleteCategory> list = new List <MoodleDeleteCategory>();

            list.Add(category);

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(MoodleDeleteCategory.DeleteCategories(list, (string)Session["token"]));
            doc.Save("D:\\" + category.Id + ".xml");
            XmlNode xmlnode = doc.ChildNodes[1];

            treeCategoryDetail.Nodes.Clear();
            treeCategoryDetail.Nodes.Add(new TreeNode(doc.DocumentElement.Name));
            TreeNode tNode;

            tNode = treeCategoryDetail.Nodes[0];
            MoodleUtilites.AddNode(xmlnode, tNode);
            treeCategoryDetail.ExpandAll();
        }
Пример #3
0
        protected void btnGetEnrolledUsers_Click(object sender, EventArgs e)
        {
            DCVimaruDataContext dc = new DCVimaruDataContext();
            //get courseId
            ThoiKhoaBieu tkb = dc.ThoiKhoaBieus.Single(t => t.STT == Convert.ToInt32(cboFilterCourse.SelectedValue));

            int courseId = Convert.ToInt32(tkb.Id);

            //create options to get 4 fields of user is id, username, fullname, email
            List <KeyValuePair <string, string> > list = new List <KeyValuePair <string, string> >();

            list.Add(new KeyValuePair <string, string>("userfields", "id"));
            list.Add(new KeyValuePair <string, string>("userfields", "username"));
            list.Add(new KeyValuePair <string, string>("userfields", "fullname"));
            list.Add(new KeyValuePair <string, string>("userfields", "email"));

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(MoodleEnrol.GetEnrolledUsers(courseId, list, (string)Session["token"]));
            doc.Save("D:\\enrolled_users_" + courseId + ".xml");

            XmlNode xmlnode = doc.ChildNodes[1];

            treeDetail.Nodes.Clear();
            treeDetail.Nodes.Add(new TreeNode(doc.DocumentElement.Name));
            TreeNode tNode;

            tNode = treeDetail.Nodes[0];
            MoodleUtilites.AddNode(xmlnode, tNode);
            treeDetail.ExpandAll();
        }
Пример #4
0
        protected void btnGetDetail_Click(object sender, EventArgs e)
        {
            if (txtId.Text == "" || Convert.ToInt32(txtId.Text) < 1)
            {
                lblUpdateUserMessage.Text = "Vui lòng nhập một ID người dùng > 0";
                txtId.Focus();
                return;
            }

            XmlDocument doc = new XmlDocument();

            List <int> list = new List <int>();

            list.Add(Convert.ToInt32(txtId.Text));
            doc.LoadXml(MoodleUser.GetUsersById(list, (string)Session["token"]));
            doc.Save("D:\\user_profile_" + txtId.Text + ".xml");

            XmlNode xmlnode = doc.ChildNodes[1];

            treeDetail.Nodes.Clear();
            treeDetail.Nodes.Add(new TreeNode(doc.DocumentElement.Name));
            TreeNode tNode;

            tNode = treeDetail.Nodes[0];
            MoodleUtilites.AddNode(xmlnode, tNode);
            treeDetail.ExpandAll();
            treeDetail.Focus();
        }
Пример #5
0
        protected void btnDetail_Click(object sender, EventArgs e)
        {
            List <KeyValuePair <string, string> > lst = new List <KeyValuePair <string, string> >();
            int id = ddlCriteria.SelectedIndex;

            if (id == 0)
            {
                lst.Add(new KeyValuePair <string, string> ("id", txtId.Text));
                lst.Add(new KeyValuePair <string, string> ("name", HttpUtility.HtmlDecode(txtName.Text)));
                lst.Add(new KeyValuePair <string, string> ("parent", txtParent.Text));
                lst.Add(new KeyValuePair <string, string> ("idnumber", txtIdnumber.Text));
            }
            else if (id == 1)
            {
                lst.Add(new KeyValuePair <string, string> ("id", txtId.Text));
            }
            else if (id == 2)
            {
                lst.Add(new KeyValuePair <string, string> ("name", HttpUtility.HtmlDecode(txtName.Text)));
            }
            else if (id == 3)
            {
                lst.Add(new KeyValuePair <string, string> ("parent", txtParent.Text));
            }
            else
            {
                lst.Add(new KeyValuePair <string, string> ("idnumber", txtIdnumber.Text));
            }

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(MoodleCategory.GetCategories(lst, chkSubCategory.Checked, (string)Session["token"]));
            doc.Save("D:\\" + txtId.Text + ".xml");
            XmlNode xmlnode = doc.ChildNodes[1];

            treeCategoryDetail.Nodes.Clear();
            treeCategoryDetail.Nodes.Add(new TreeNode(doc.DocumentElement.Name));
            TreeNode tNode;

            tNode = treeCategoryDetail.Nodes[0];
            MoodleUtilites.AddNode(xmlnode, tNode);
            treeCategoryDetail.ExpandAll();
        }
Пример #6
0
        protected void btnGetDetail_Click(object sender, EventArgs e)
        {
            if (txtId.Text == "" || Convert.ToInt32(txtId.Text) < 1)
            {
                lblUpdateMessage.Text = "Vui lòng nhập một ID khoa> 0";
                txtId.Focus();
                return;
            }

            List <KeyValuePair <string, string> > list = new List <KeyValuePair <string, string> >();
            int id = ddlCriteria.SelectedIndex;

            if (id == 0)
            {
                list.Add(new KeyValuePair <string, string> ("id", txtId.Text));
            }
            else if (id == 1)
            {
                list.Add(new KeyValuePair <string, string> ("idnumber", txtIdnumber.Text));
            }
            else
            {
                list.Add(new KeyValuePair <string, string> ("name", HttpUtility.HtmlDecode(txtName.Text)));
            }

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(MoodleCategory.GetCategories(list, chkSubCategory.Checked, (string)Session["token"]));
            doc.Save("D:\\faculty_" + txtId.Text + ".xml");
            XmlNode xmlnode = doc.ChildNodes[1];

            treeDetail.Nodes.Clear();
            treeDetail.Nodes.Add(new TreeNode(doc.DocumentElement.Name));
            TreeNode tNode;

            tNode = treeDetail.Nodes[0];
            MoodleUtilites.AddNode(xmlnode, tNode);
            treeDetail.ExpandAll();
            treeDetail.Focus();
        }
Пример #7
0
        protected void grvCourse_SelectedIndexChanged(object sender, EventArgs e)
        {
            SaveCheckedValues();

            int         rowId = grvCourse.SelectedIndex;
            GridViewRow row   = grvCourse.Rows[rowId];
            XmlDocument doc   = new XmlDocument();
            int         id    = Convert.ToInt32(row.Cells[2].Text);
            List <int>  list  = new List <int>();

            list.Add(id);

            doc.LoadXml(MoodleCourse.GetCourses(list, (string)Session["token"]));
            doc.Save("D:\\course_detail_" + row.Cells[3].Text + ".xml");

            XmlNode xmlNode = doc.ChildNodes[1];

            treeDetail.Nodes.Clear();
            treeDetail.Nodes.Add(new TreeNode(doc.DocumentElement.Name));
            TreeNode treeNode;

            treeNode = treeDetail.Nodes[0];
            MoodleUtilites.AddNode(xmlNode, treeNode);
            treeDetail.ExpandAll();

            doc.LoadXml(MoodleCourse.GetCourseContents(id, (string)Session["token"]));
            doc.Save("D:\\course_contents_" + row.Cells[3].Text + ".xml");

            xmlNode = doc.ChildNodes[1];
            treeContent.Nodes.Clear();
            treeContent.Nodes.Add(new TreeNode(doc.DocumentElement.Name));
            treeNode = treeContent.Nodes[0];
            MoodleUtilites.AddNode(xmlNode, treeNode);
            treeContent.ExpandAll();

            treeDetail.Focus();
        }
Пример #8
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            if (txtId.Text == "")
            {
                lblCategoryMessage.Text = "Vui lòng nhập id mục cần cập nhật!";
                txtId.Focus();
                return;
            }

            MoodleCategory category = new MoodleCategory();

            category.Id = Convert.ToInt32(txtId.Text);

            if (txtName.Text != "")
            {
                category.Name = txtName.Text;
            }

            if (txtParent.Text == "")
            {
                category.Parent = 0;
            }
            else
            {
                category.Parent = Convert.ToInt32(txtParent.Text);
            }

            if (txtIdnumber.Text == "")
            {
                category.IdNumber = null;
            }
            else
            {
                category.IdNumber = txtIdnumber.Text;
            }

            if (txtDecscription.Text == "")
            {
                category.Description = null;
            }
            else
            {
                category.Description = txtDecscription.Text;
            }

            if (txtDescriptionFormat.Text == "")
            {
                category.DescriptionFormat = 1;
            }
            else
            {
                category.DescriptionFormat = Convert.ToInt32(txtDescriptionFormat.Text);
            }

            if (txtTheme.Text == "")
            {
                category.Theme = null;
            }
            else
            {
                category.Theme = txtTheme.Text;
            }

            XmlDocument doc = new XmlDocument();

            List <MoodleCategory> lst = new List <MoodleCategory>();

            lst.Add(category);
            doc.LoadXml(MoodleCategory.UpdateCategories(lst, (string)Session["token"]));
            doc.Save("D:\\" + txtId.Text + ".xml");
            XmlNode xmlnode = doc.ChildNodes[1];

            treeCategoryDetail.Nodes.Clear();
            treeCategoryDetail.Nodes.Add(new TreeNode(doc.DocumentElement.Name));
            TreeNode tNode;

            tNode = treeCategoryDetail.Nodes[0];
            MoodleUtilites.AddNode(xmlnode, tNode);
            treeCategoryDetail.ExpandAll();
        }