/// ----------------------------------------------------------------------------- /// <summary> /// ImportModule implements the IPortable ImportModule Interface /// </summary> /// <param name="moduleId">The Id of the module to be imported</param> /// <param name="content">The content to be imported</param> /// <param name="version">The version of the module to be imported</param> /// <param name="userId">The Id of the user performing the import</param> /// ----------------------------------------------------------------------------- public void ImportModule(int moduleId, string content, string version, int userId) { var controller = new ItemController(); var items = DotNetNuke.Common.Globals.GetContent(content, "Items"); var xmlNodeList = items.SelectNodes("CourseOffering"); if (xmlNodeList == null) { return; } foreach (XmlNode item in xmlNodeList) { var newItem = new CourseOffering() { ModuleId = moduleId, // assigning everything to the current UserID, because this might be a new DNN installation // your use case might be different though CreatedByUserId = userId, LastModifiedByUserId = userId, CreatedOnDate = DateTime.Now, LastModifiedOnDate = DateTime.Now }; // NOTE: If moving from one installation to another, this user will not exist newItem.AssignedUserId = int.Parse(item.SelectSingleNode("AssignedUserId").InnerText, NumberStyles.Integer); // newItem.ItemDescription = item.SelectSingleNode("ItemDescription").InnerText; // newItem.ItemName = item.SelectSingleNode("ItemName").InnerText; controller.CreateItem(newItem); } }
public void UpdateItem(CourseOffering t) { using (IDataContext ctx = DataContext.Instance()) { IRepository <CourseOffering> rep = ctx.GetRepository <CourseOffering>(); rep.Update(t); } }
public void DeleteItem(int Id, int moduleId) { CourseOffering t = GetItem(Id, moduleId); DeleteItem(t); }