/// <summary>
        /// Gets the available VisibleForUserGroup list as an array of <see cref="SelectableMDOListItem"/>.
        /// </summary>
        /// <param name="webPanelId">The id of the web panel.</param>
        /// <param name="listId">Outs the web panel list id which is used when setting the list of VisibleForUserGroups.</param>
        /// <returns></returns>
        public SelectableMDOListItem[] GetVisibleForUserGroupsList(int webPanelId, out int webPanelListId)
        {
            SelectableMDOListItem[] result = null;

            //Get the list id for managing web panels

            webPanelListId = GetWebPanelListId();

            if (webPanelListId > 0)
            {
                //Get the VisibleFor Lists Items

                using (ListAgent listAgent = new ListAgent())
                {
                    try
                    {
                        result = listAgent.GetVisibleForUserGroups(webPanelListId, webPanelId);
                    }
                    catch (Exception)
                    {
                        //optionally throw new/different exception.
                        throw;
                    }
                }
            }

            return(result);
        }
Esempio n. 2
0
        public ListItemEntity GetListEntityItem(string listName, string listItem)
        {
            ListItemEntity listItemEntity = null;

            var listEntityItem = GetListDefinition(listName);

            if (listEntityItem != null)
            {
                var listItems = GetSimpleList(listName);

                if (listItems != null)
                {
                    var foundListItem = listItems.FirstOrDefault(l => l.Name.Equals(listItem, StringComparison.InvariantCultureIgnoreCase));

                    if (foundListItem != null)
                    {
                        using (ListAgent listAgent = new ListAgent())
                        {
                            listItemEntity = listAgent.GetFromListDefinition(listEntityItem.Id, foundListItem.Id);
                        }
                    }
                }
            }
            return(listItemEntity);
        }
 /// <summary>
 /// Gets a list of <see cref="WebPanelEntity"/> defined by your application.
 /// </summary>
 /// <returns>List of <see cref="WebPanelEntity"/> created with this client_id.</returns>
 public WebPanelEntity[] GetAllWebPanels()
 {
     using (ListAgent listAgent = new ListAgent())
     {
         return(listAgent.GetAppWebPanels());
     }
 }
        public WebPanelEntity UpdateWebPanel(int id, string name, string windowName, string url, string description, Navigation appearLocation,
                                             UrlEncoding urlEncoding = UrlEncoding.None,
                                             bool showInAddressBar   = false,
                                             bool showInMenuBar      = false,
                                             bool showInStatusBar    = false,
                                             bool showInToolBar      = false,
                                             bool deleted            = false)
        {
            WebPanelEntity webPanel;

            using (var listAgent = new ListAgent())
            {
                webPanel                     = listAgent.GetWebPanelEntity(id);
                webPanel.Name                = name;
                webPanel.Tooltip             = description;
                webPanel.WindowName          = windowName;
                webPanel.Url                 = url;
                webPanel.UrlEncoding         = urlEncoding;
                webPanel.VisibleIn           = appearLocation;
                webPanel.ShowInAddressBar    = showInAddressBar;
                webPanel.ShowInMenuBar       = showInMenuBar;
                webPanel.ShowInStatusBar     = showInStatusBar;
                webPanel.ShowInToolBar       = showInToolBar;
                webPanel.OnCentral           = true;
                webPanel.OnSalesMarketingWeb = true;
                webPanel.Deleted             = deleted;
                webPanel                     = listAgent.SaveWebPanelEntity(webPanel);
            }

            return(webPanel);
        }
 /// <summary>
 /// Deletes all web panels created by this application.
 /// </summary>
 public void DeleteAllWebPanels()
 {
     using (ListAgent listAgent = new ListAgent())
     {
         // hard-delete
         listAgent.DeleteAppWebPanels();
     }
 }
        private List <String> GetCSV(string fichier, aImportFichier nbparam)
        {
            int index = 0;

            // Création d'une instance de StreamReader pour permettre la lecture de notre fichier
            StreamReader monStreamReader = new StreamReader(fichier, System.Text.Encoding.Default);
            string       ligne           = string.Empty;
            string       ListAgent;

            List <string> LesAgent = new List <string>();

            // Lecture de toutes les lignes et affichage de chacune sur la page
            //while (ligne != null)
            //{
            ligne = monStreamReader.ReadToEnd();
            // if (!string.IsNullOrEmpty(ligne.Trim()))
            ListAgent = ligne;
            //  index++;

            //}
            ListAgent.Trim(new Char[] { '\r', '\n' });
            // Pour chaque ligne , creer un objet Pls_Ref_Operateur

            int    i       = 0;
            string element = null;

            //foreach (string item in ListAgent)
            //{

            string[] tabOper = ListAgent.Split(new char[] { '|' });

            foreach (string elmt in tabOper)
            {
                //if (element == null)
                //    element += tabOper[i] != null ? tabOper[i] : string.Empty;
                //else
                //    element += tabOper[i] != null ? ";" + tabOper[i] : ";" + string.Empty;

                //i++;
                //if (i == nbparam.NBPARAMETRE)
                //{
                LesAgent.Add(elmt);

                //}
            }
            //}
            //index++;

            // Fermeture du StreamReader (attention très important)
            monStreamReader.Close();
            // monStreamReader.Dispose();

            return(LesAgent);
        }
Esempio n. 7
0
        /// <summary>
        /// Creates a User-Defined List
        /// </summary>
        /// <param name="listName"></param>
        /// <param name="listTooltip"></param>
        /// <returns></returns>
        public ListEntity CreateList(string listName, string listTooltip)
        {
            ListEntity listEntity = null;

            using (ListAgent listAgent = new ListAgent())
            {
                listEntity         = listAgent.CreateDefaultListEntity();
                listEntity.Name    = listName;
                listEntity.Tooltip = listTooltip;
                listEntity         = listAgent.SaveListEntity(listEntity);
            }

            return(listEntity);
        }
Esempio n. 8
0
        public ListItemEntity GetListEntityItem(string listName, int listItem)
        {
            ListItemEntity listEntityItem = null;

            var listDefinition = GetListDefinition(listName);

            if (listDefinition != null)
            {
                using (ListAgent listAgent = new ListAgent())
                {
                    listEntityItem = listAgent.GetFromListDefinition(listItem, listDefinition.Id);
                }
            }

            return(listEntityItem);
        }
Esempio n. 9
0
        public ListEntity GetListEntity(string listName)
        {
            ListEntity listEntity = null;

            var saleSourceListDefinition = GetListDefinition(Constants.Lists.SaleSource);

            if (saleSourceListDefinition != null)
            {
                using (ListAgent listAgent = new ListAgent())
                {
                    listEntity = listAgent.GetListEntity(saleSourceListDefinition.Id);
                }
            }

            return(listEntity);
        }
        /// <summary>
        /// Selects or de-selects a given list of VisibleForUserGroup items for a given web panel.
        /// </summary>
        /// <param name="webPanelListId">Id of web panel list. Use the out parameter from the GetVisibleForUserGroupsList method.</param>
        /// <param name="webPanelId">Id of the web panel item.</param>
        /// <param name="visibleForUserGroups">UserGroups that should be enabled or disabled.</param>
        /// <param name="enable">Set true to enable, or false to disable UserGroups.</param>
        public void SetVisibleForUserGroups(int webPanelListId, int webPanelId, bool enable, params SelectableMDOListItem[] visibleForUserGroups)
        {
            if (webPanelListId == 0 || webPanelId == 0)
            {
                throw new NullReferenceException("Both webPanelListId and webPanelId must be specified!");
            }

            if (visibleForUserGroups != null && visibleForUserGroups.Length > 0)
            {
                using (ListAgent listAgent = new ListAgent())
                {
                    listAgent.SetVisibleForUserGroup(webPanelListId, webPanelId,
                                                     visibleForUserGroups.Select(i => i.Id).ToArray(), enable);
                }
            }
            else
            {
                throw new NullReferenceException("visibleForUserGroups parameter must contain at least on item!");
            }
        }
Esempio n. 11
0
        public ListItemEntity CreateListItem(string listName, string listItemName, string listItemTooltip)
        {
            ListItemEntity listItem = null;

            //Get the root list definition
            var saleSourceListDefinition = GetListDefinition(listName);

            if (saleSourceListDefinition != null)
            {
                using (ListAgent listAgent = new ListAgent())
                {
                    //Create the listItem
                    listItem = listAgent.CreateDefaultListItemEntity();

                    listItem.UdListDefinitionId = saleSourceListDefinition.Id;
                    listItem.Name    = listItemName;
                    listItem.Tooltip = listItemTooltip;

                    listItem = listAgent.SaveListItemEntity(listItem);
                }
            }

            return(listItem);
        }