Beispiel #1
0
        public void InsertModules(ExtractModuleInfo objExtract, int portalID, out string showInpages, out int newUserModuleID)
        {
            string roleName     = "";
            string allowAcess   = "";
            string permissionID = "";

            foreach (TemplatePermission objPermission in objExtract.ModuleDef.UserModule.TemplatePermission)
            {
                allowAcess   += objPermission.AllowAccess + ",";
                roleName     += objPermission.RoleName + ",";
                permissionID += objPermission.PermissionID + ",";
            }
            SQLHandler sagesql = new SQLHandler();
            //objExtract.ModuleDef.UserModule.ShowInPages;
            List <KeyValuePair <string, object> > PageParamCollModule = new List <KeyValuePair <string, object> >();

            PageParamCollModule.Add(new KeyValuePair <string, object>("@pageID", objExtract.ModuleDef.UserModule.PageID));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@ModuleName", objExtract.ModuleName));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@FriendlyName", objExtract.FriendlyName));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@userModuleTitle", objExtract.ModuleDef.FriendlyName));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@paneName", objExtract.ModuleDef.UserModule.PaneName));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@allowAcess", allowAcess));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@roleName", roleName));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@permissionID", permissionID));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@portalID", portalID));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@allPages", objExtract.ModuleDef.UserModule.AllPages));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@inheritViewPermissions", objExtract.ModuleDef.UserModule.InheritViewPermissions));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@header", objExtract.ModuleDef.UserModule.Header));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@footer", objExtract.ModuleDef.UserModule.Footer));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@isActive", objExtract.ModuleDef.UserModule.IsActive));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@seoName", objExtract.ModuleDef.UserModule.SEOName));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@ShowInPages", objExtract.ModuleDef.UserModule.ShowInPages));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@IsHandheld", objExtract.ModuleDef.UserModule.IsHandheld));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@suffixClass", objExtract.ModuleDef.UserModule.SuffixClass));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@headerText", objExtract.ModuleDef.UserModule.HeaderText));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@showHeaderText", objExtract.ModuleDef.UserModule.ShowHeaderText));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@isInAdmin", objExtract.ModuleDef.UserModule.IsInAdmin));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@query", objExtract.ModuleDef.UserModule.Query));
            PageParamCollModule.Add(new KeyValuePair <string, object>("@level", objExtract.ModuleDef.UserModule.Level));

            ExtractUserModule objUserModule = new ExtractUserModule();

            try
            {
                objUserModule   = sagesql.ExecuteAsObject <ExtractUserModule>("usp_Template_InsertModule ", PageParamCollModule);
                newUserModuleID = objUserModule.UserModuleId;
                showInpages     = objExtract.ModuleDef.UserModule.ShowInPages;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void InsertModules(ExtractModuleInfo objExtract, int portalID, out string showInpages, out int newUserModuleID)
        {
            string roleName = "";
            string allowAcess = "";
            string permissionID = "";

            foreach (TemplatePermission objPermission in objExtract.ModuleDef.UserModule.TemplatePermission)
            {
                allowAcess += objPermission.AllowAccess + ",";
                roleName += objPermission.RoleName + ",";
                permissionID += objPermission.PermissionID + ",";
            }
            SQLHandler sagesql = new SQLHandler();
            //objExtract.ModuleDef.UserModule.ShowInPages;
            List<KeyValuePair<string, object>> PageParamCollModule = new List<KeyValuePair<string, object>>();
            PageParamCollModule.Add(new KeyValuePair<string, object>("@pageID", objExtract.ModuleDef.UserModule.PageID));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@ModuleName", objExtract.ModuleName));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@FriendlyName", objExtract.FriendlyName));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@userModuleTitle", objExtract.ModuleDef.FriendlyName));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@paneName", objExtract.ModuleDef.UserModule.PaneName));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@allowAcess", allowAcess));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@roleName", roleName));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@permissionID", permissionID));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@portalID", portalID));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@allPages", objExtract.ModuleDef.UserModule.AllPages));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@inheritViewPermissions", objExtract.ModuleDef.UserModule.InheritViewPermissions));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@header", objExtract.ModuleDef.UserModule.Header));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@footer", objExtract.ModuleDef.UserModule.Footer));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@isActive", objExtract.ModuleDef.UserModule.IsActive));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@seoName", objExtract.ModuleDef.UserModule.SEOName));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@ShowInPages", objExtract.ModuleDef.UserModule.ShowInPages));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@IsHandheld", objExtract.ModuleDef.UserModule.IsHandheld));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@suffixClass", objExtract.ModuleDef.UserModule.SuffixClass));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@headerText", objExtract.ModuleDef.UserModule.HeaderText));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@showHeaderText", objExtract.ModuleDef.UserModule.ShowHeaderText));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@isInAdmin", objExtract.ModuleDef.UserModule.IsInAdmin));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@query", objExtract.ModuleDef.UserModule.Query));
            PageParamCollModule.Add(new KeyValuePair<string, object>("@level", objExtract.ModuleDef.UserModule.Level));

            ExtractUserModule objUserModule = new ExtractUserModule();
            try
            {
                objUserModule = sagesql.ExecuteAsObject<ExtractUserModule>("usp_Template_InsertModule ", PageParamCollModule);
                newUserModuleID = objUserModule.UserModuleId;
                showInpages = objExtract.ModuleDef.UserModule.ShowInPages;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 // Extratracting ModuleList
 List<ExtractModuleInfo> ModuleList(XmlNode page, DataSet objDataset)
 {
     List<ExtractModuleInfo> lstModules = new List<ExtractModuleInfo>();
     XmlNodeList modulelist = page.SelectNodes("Module");
     foreach (XmlNode module in modulelist)
     {
         ExtractModuleInfo m = new ExtractModuleInfo();
         m.ModuleID = int.Parse(Utils.CleanString(module["ModuleID"].InnerText));
         m.FriendlyName = Utils.CleanString(module["FriendlyName"].InnerText);
         m.Description = Utils.CleanString(module["Description"].InnerText);
         m.Version = Utils.CleanString(module["Version"].InnerText);
         m.IsPremium = bool.Parse(Utils.CleanString(module["IsPremium"].InnerText));
         m.IsAdmin = bool.Parse(Utils.CleanString(module["IsAdmin"].InnerText));
         m.IsRequired = bool.Parse(Utils.CleanString(module["IsRequired"].InnerText));
         m.BusinessControllerClass = Utils.CleanString(module["BusinessControllerClass"].InnerText);
         m.FolderName = Utils.CleanString(module["FolderName"].InnerText);
         m.ModuleName = Utils.CleanString(module["ModuleName"].InnerText);
         m.SupportedFeatures = int.Parse(Utils.CleanString(module["SupportedFeatures"].InnerText));
         m.CompatibleVersions = Utils.CleanString(module["CompatibleVersions"].InnerText);
         m.Dependencies = Utils.CleanString(module["Dependencies"].InnerText);
         m.PackageID = int.Parse(Utils.CleanString(module["PackageID"].InnerText));
         m.IsActive = bool.Parse(Utils.CleanString(module["IsActive"].InnerText));
         m.ModuleDef = ModuleDef(module["ModuleDef"], objDataset);
         lstModules.Add(m);
     }
     return lstModules;
 }