/// ImportModule implements the IPortable ImportModule Interface
        /// -----------------------------------------------------------------------------
        public void ImportModule(int ModuleID, string Content, string Version, int UserId)
        {
            try
            {
                System.Collections.Specialized.NameValueCollection ForeignKeyTranslator = new System.Collections.Specialized.NameValueCollection();
                XmlNode Node         = null;
                XmlNode xmlDocuments = Globals.GetContent(Content, "contentdejour");

                var MyConfiguration = new Configuration(ModuleID);
                Node = xmlDocuments.SelectSingleNode("configuration");
                string category            = string.Empty;
                string profilePropertyName = string.Empty;
                MyConfiguration.SelectBy          = (Enums.SelectBy)Enum.Parse(typeof(Enums.SelectBy), Node["SelectBy"].InnerText);
                MyConfiguration.MultipleHandling  = (Enums.MultipleHandling)Enum.Parse(typeof(Enums.MultipleHandling), Node["MultipleHandling"].InnerText);
                MyConfiguration.Interval          = Convert.ToInt32(Node["Interval"].InnerText);
                MyConfiguration.IncludeDisabled   = Convert.ToBoolean(Node["IncludeDisabled"].InnerText);
                MyConfiguration.HideWhenNoContent = Convert.ToBoolean(Node["HideWhenNoContent"].InnerText);
                MyConfiguration.ReplaceTitle      = Convert.ToBoolean(Node["ReplaceTitle"].InnerText);
                MyConfiguration.ReplaceTokens     = Convert.ToBoolean(Node["ReplaceTokens"].InnerText);
                if (Version == "04.00.00")
                {
                    MyConfiguration.ProfilePropertyName      = Defaults.ProfilePropertyName;
                    MyConfiguration.EnableUserTimeConversion = Defaults.EnableUserTimeConversion;
                }
                else
                {
                    MyConfiguration.ProfilePropertyName      = Node["ProfilePropertyName"].InnerText;
                    MyConfiguration.EnableUserTimeConversion = Convert.ToBoolean(Node["EnableUserTimeConversion"].InnerText);
                }

                category = Node["Category"].InnerText;
                var cdc = new ContentDejourController();

                CategoryInfo objCategory = null;
                foreach (XmlNode NodeWithinLoop in xmlDocuments.SelectNodes("categories/category"))
                {
                    Node                  = NodeWithinLoop;
                    objCategory           = new CategoryInfo();
                    objCategory.ModuleID  = ModuleID;
                    objCategory.Category  = NodeWithinLoop["Category"].InnerText;
                    objCategory.ViewOrder = int.Parse(NodeWithinLoop["ViewOrder"].InnerText);
                    try
                    {
                        cdc.AddCategory(objCategory);
                    }
                    catch
                    {
                    }
                }
                ForeignKeyTranslator.Add("CAT-", "-1");
                foreach (CategoryInfo objCategoryWithinLoop in cdc.GetCategories(ModuleID))
                {
                    objCategory = objCategoryWithinLoop;
                    ForeignKeyTranslator.Add("CAT-" + objCategoryWithinLoop.Category, objCategoryWithinLoop.CategoryID.ToString());
                    if (objCategoryWithinLoop.Category == category)
                    {
                        MyConfiguration.CategoryID = objCategoryWithinLoop.CategoryID;
                    }
                }

                MyConfiguration.SaveSettings();

                var rc       = new RoleController();
                var portalID = MyConfiguration.PortalSettings.PortalId;

                foreach (XmlNode NodeWithinLoop in xmlDocuments.SelectNodes("contents/content"))
                {
                    Node = NodeWithinLoop;
                    var objContent = new ContentDejourInfo();
                    objContent.ModuleID = ModuleID;
                    if (Version == "04.00.00")
                    {
                        objContent.Months               = (new MonthArray()).AddMonth(Convert.ToInt16(NodeWithinLoop["Month"].InnerText));
                        objContent.Days                 = (new DayArray()).AddDay(Convert.ToInt32(NodeWithinLoop["Day"].InnerText));
                        objContent.DaysofWeek           = (new DayofWeekArray()).AddDay(Convert.ToInt32(NodeWithinLoop["DayofWeek"].InnerText));
                        objContent.ProfilePropertyValue = string.Empty;
                    }
                    else
                    {
                        objContent.Months               = new MonthArray(Convert.ToInt16(NodeWithinLoop["Months"].InnerText));
                        objContent.Days                 = new DayArray(Convert.ToInt32(NodeWithinLoop["Days"].InnerText));
                        objContent.DaysofWeek           = new DayofWeekArray(Convert.ToByte(NodeWithinLoop["DaysofWeek"].InnerText));
                        objContent.ProfilePropertyValue = NodeWithinLoop["ProfilePropertyValue"].InnerText;
                    }
                    objContent.StartDate  = new DateInteger(Convert.ToInt32(NodeWithinLoop["StartDate"].InnerText));
                    objContent.EndDate    = new DateInteger(Convert.ToInt32(NodeWithinLoop["EndDate"].InnerText));
                    objContent.StartTime  = Convert.ToInt32(NodeWithinLoop["StartTime"].InnerText);
                    objContent.EndTime    = Convert.ToInt32(NodeWithinLoop["EndTime"].InnerText);
                    objContent.CategoryID = Convert.ToInt32(ForeignKeyTranslator["CAT-" + NodeWithinLoop["Category"].InnerText]);

                    var groupName = NodeWithinLoop["GroupName"] == null ? "": NodeWithinLoop["GroupName"].InnerText;
                    if (groupName != "")
                    {
                        var role = rc.GetRoleByName(portalID, groupName);
                        if (role != null && role.SecurityMode != SecurityMode.SecurityRole && role.Status == RoleStatus.Approved)
                        {
                            objContent.GroupID = role.RoleID;
                        }
                    }

                    objContent.Title          = HttpUtility.HtmlEncode(NodeWithinLoop["Title"].InnerText);
                    objContent.DesktopHTML    = NodeWithinLoop["DesktopHTML"].InnerText;
                    objContent.DesktopSummary = NodeWithinLoop["DesktopSummary"].InnerText;
                    cdc.AddContent(objContent, UserId); //Note all content will be have CreatedByUserID set to UserID of current user
                }
            }
            catch (Exception exc)
            {
                string Msg = exc.Message;
            }
        }
 public void UpdateCategory(CategoryInfo objCategory)
 {
     DataProvider.Instance().UpdateCategory(objCategory);
 }
Example #3
0
 public abstract void UpdateCategory(CategoryInfo objCategory);
 public void AddCategory(CategoryInfo objCategory)
 {
     DataProvider.Instance().AddCategory(objCategory);
 }
Example #5
0
 public abstract void AddCategory(CategoryInfo objCategory);