示例#1
0
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                TestController controller = new TestController();
                TestInfo item = new TestInfo();

                item.Content = txtContent.Text;
                item.ItemId = itemId;
                item.ModuleId = this.ModuleId;
                item.CreatedByUser = this.UserId;

                //determine if we are adding or updating
                if (Null.IsNull(item.ItemId))
                    controller.AddTest(item);
                else
                    controller.UpdateTest(item);

                Response.Redirect(Globals.NavigateURL(), true);
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    List<TestInfo> items;
                    TestController controller = new TestController();

                    items = controller.GetTests(this.ModuleId);

                    //check if we have some content to display, otherwise
                    //display a sample default conent from the resource
                    //settings
                    if (items.Count == 0)
                    {
                        TestInfo item = new TestInfo();
                        item.ModuleId = this.ModuleId;
                        item.CreatedByUser = this.UserId;
                        item.Content = Localization.GetString("DefaultContent", LocalResourceFile);

                        items.Add(item);
                    }

                    //bind the data
                    lstContent.DataSource = items;
                    lstContent.DataBind();
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
示例#3
0
 /// <summary>
 /// update a info object already stored in the database
 /// </summary>
 /// <param name="info"></param>
 public void UpdateTest(TestInfo info)
 {
     //check we have some content to update
     if (info.Content != string.Empty)
     {
         DataProvider.Instance().UpdateTest(info.ModuleId, info.ItemId, info.Content, info.CreatedByUser);
     }
 }
示例#4
0
 /// <summary>
 /// Adds a new TestInfo object into the database
 /// </summary>
 /// <param name="info"></param>
 public void AddTest(TestInfo info)
 {
     //check we have some content to store
     if (info.Content != string.Empty)
     {
         DataProvider.Instance().AddTest(info.ModuleId, info.Content, info.CreatedByUser);
     }
 }
示例#5
0
        /// <summary>
        /// imports a module from an xml file
        /// </summary>
        /// <param name="ModuleID"></param>
        /// <param name="Content"></param>
        /// <param name="Version"></param>
        /// <param name="UserID"></param>
        public void ImportModule(int ModuleID, string Content, string Version, int UserID)
        {
            XmlNode infos = DotNetNuke.Common.Globals.GetContent(Content, "Tests");

            foreach (XmlNode info in infos.SelectNodes("Test"))
            {
                TestInfo TestInfo = new TestInfo();
                TestInfo.ModuleId = ModuleID;
                TestInfo.Content = info.SelectSingleNode("content").InnerText;
                TestInfo.CreatedByUser = UserID;

                AddTest(TestInfo);
            }
        }