public static void ExportCollection(RsReportCollection aCollection)
 {
     if (SaveCollectionDialog.ShowDialog() == DialogResult.OK)
     {
         aCollection.ExportToXML(SaveCollectionDialog.FileName);
     }
 }
        public CReportRootFolder(string aName, RsReportCollection aCollection) : base(aName)
        {
            GUINode.ImageIndex         = 3;
            GUINode.SelectedImageIndex = 3;

            SetCollection(aCollection);
        }
        public void Delete()
        {
            RsReportCollection lCollection = CollectionItem.ReportItem.Collection;

            CollectionItem.ReportItem.Release();
            lCollection.QuickSave();
            Release();
        }
        public CReportRootFolder(string aName, RsReportCollection aCollection)
            : base(aName)
        {
            GUINode.ImageIndex = 3;
            GUINode.SelectedImageIndex = 3;

            SetCollection(aCollection);
        }
        public void AddCollection(RsReportCollection aCollection)
        {
            RsCollectionConfig lConfig = new RsCollectionConfig();
                        lConfig.Path = aCollection.FileName;
                        lConfig.Name = aCollection.CollectionName;
                        lConfig.Type = RsCollectionType.Custom;

                        ProfileManager.Profile.Collections.Add(lConfig);
                        ProfileManager.SaveProfile();
        }
        public void AddCollection(RsReportCollection aCollection)
        {
            RsCollectionConfig lConfig = new RsCollectionConfig();

            lConfig.Path = aCollection.FileName;
            lConfig.Name = aCollection.CollectionName;
            lConfig.Type = RsCollectionType.Custom;

            ProfileManager.Profile.Collections.Add(lConfig);
            ProfileManager.SaveProfile();
        }
 public void RemoveCollection(RsReportCollection aCollection)
 {
     foreach (RsCollectionConfig iConfig in ProfileManager.Profile.Collections)
     {
         if (aCollection.FileName.ToUpper().Equals(iConfig.Path.ToUpper()))
         {
             ProfileManager.Profile.Collections.Remove(iConfig);
             break;
         }
     }
 }
        public RsReportCollection GetCollection(string aCollectionName)
        {
            foreach (RsCollectionConfig iConfig in ProfileManager.Profile.Collections) {
                                if (iConfig.Name.ToUpper().Equals(aCollectionName.ToUpper())) {
                                        RsReportCollection lResult = new RsReportCollection();
                                        lResult.LoadFromXML(iConfig.Path);
                                        return lResult;
                                    }
                            }

                        return null;
        }
        public RsReportCollection GetCollection(string aCollectionName)
        {
            foreach (RsCollectionConfig iConfig in ProfileManager.Profile.Collections)
            {
                if (iConfig.Name.ToUpper().Equals(aCollectionName.ToUpper()))
                {
                    RsReportCollection lResult = new RsReportCollection();
                    lResult.LoadFromXML(iConfig.Path);
                    return(lResult);
                }
            }

            return(null);
        }
        public static RsReportCollection ImportCollection()
        {
            if (OpenCollectionDialog.ShowDialog() == DialogResult.OK)
            {
                RsReportCollection lResult = new RsReportCollection();
                lResult.LoadFromXML(OpenCollectionDialog.FileName);

                RsViewEngine.CollectionManager.AddCollection(lResult);
                return(lResult);
            }
            else
            {
                return(null);
            }
        }
        protected void InitializeCollections()
        {
            RsCollectionConfig lFavCfg = new RsCollectionConfig();

            lFavCfg.Type = RsCollectionType.Favorites;
            lFavCfg.Path = FavoritesFile;
            lFavCfg.Name = "favorites";
            Profile.Collections.Add(lFavCfg);

            if (!lFavCfg.IsCollectionExists())
            {
                RsReportCollection lCollection = new RsReportCollection();
                lCollection.CollectionName = "favorites";
                lCollection.SaveToXML(lFavCfg.Path);
            }
        }
        public void DoAddReport()
        {
            XmlNode lThisData = RsViewEngine.Locale.GetFormData(LOCALE_ALIAS);

            RsReportCollection lCurrColl = getSelectedCollection();

            if (lCurrColl == null)
            {
                CRSMessageBox.ShowBox(
                    XmlTools.getXmlNodeByAttrVal("name", NOCOLLECTION_FILE, lThisData).InnerText,
                    RsViewEngine.Locale.GetTagText("error"),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Exclamation
                    );
            }

            else
            {
                if (lCurrColl is CFavoritesCollection)
                {
                    _dlgAddReport.CollectionName = RsViewEngine.Locale.GetTagText(RsLocalization.TAG_FAVORITES);
                }
                else
                {
                    _dlgAddReport.CollectionName = lCurrColl.CollectionName;
                }
                _dlgAddReport.Modify = false;
                DialogResult lDlgRes = _dlgAddReport.ShowDialog();
                if (lDlgRes == DialogResult.OK)
                {
                    CReportFolder lParent = getCurrentParent();
                    if (lParent == null)
                    {
                        CRSMessageBox.ShowBox(
                            RsViewEngine.Locale.GetTagText("collectionNotSelected"),
                            RsViewEngine.Locale.GetTagText("error"),
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Exclamation);
                        return;
                    }
                    CReportFile lNewFile = new CReportFile(_dlgAddReport.Alias, _dlgAddReport.ReportFile);
                    lNewFile.Parent = lParent;
                    lParent.Collection.ApplyToGUI();
                    lParent.Collection.QuickSave();
                }
            }
        }
        public static void UpdateProfile(string aProfile)
        {
            List <RsCollectionConfig> lNewList = new List <RsCollectionConfig>();
            XmlDocument lDoc = new XmlDocument();

            lDoc.Load(aProfile);

            XmlNode lRoot = XmlTools.GetNode(lDoc, "ReportSmartSettings");

            if (lRoot == null)
            {
                return;
            }

            XmlNode lNode = XmlTools.GetNode(lRoot, "collections");

            if (lNode != null && lNode.ChildNodes != null)
            {
                foreach (XmlNode iNode in lNode.ChildNodes)
                {
                    RsCollectionConfig iConfig = new RsCollectionConfig();
                    iConfig.Path = XmlTools.GetAttrib(iNode, "path");
                    iConfig.Type = iNode.Name == "favorites" ? RsCollectionType.Favorites : RsCollectionType.Custom;

                    lNewList.Add(iConfig);
                }
            }

            lNode.RemoveAll();
            lRoot.RemoveChild(lNode);

            lNode = XmlTools.CreateXmlNode(lDoc, "Collections", lRoot);

            foreach (RsCollectionConfig iConfig in lNewList)
            {
                RsReportCollection iCollection = new RsReportCollection();
                iCollection.LoadFromXML(iConfig.Path);
                XmlNode iNode = XmlTools.CreateXmlNode(lDoc, "collection", lNode);
                XmlTools.SetAttrib(iNode, "path", iConfig.Path);
                XmlTools.SetAttrib(iNode, "type", iConfig.Type.ToString());
                XmlTools.SetAttrib(iNode, "name", iCollection.CollectionName);
            }

            XmlTools.SetAttrib(lRoot, "configVersion", "1");
            lDoc.Save(aProfile);
        }
        public RsReportCollection CreateCollection(string aCollectionName, string aFile)
        {
            // TODO Create a method to handle more than one collection with the same name

                        RsReportCollection lResult;

                        RsReportCollection lCollection = GetCollection(aCollectionName);
                        if (lCollection != null)
                                throw new Exception("Collection named \"" + aCollectionName + "\" already linked.");

                            else {
                                lResult = new RsReportCollection();
                                lResult.CollectionName = aCollectionName;
                                lResult.SaveToXML(aFile);
                                AddCollection(lResult);
                            }

                        return lResult;
        }
        public void DoAddFolder()
        {
            XmlNode lThisData = RsViewEngine.Locale.GetFormData(LOCALE_ALIAS);

            RsReportCollection lCurrColl = getSelectedCollection();

            if (getSelectedItem() == null)
            {
                CRSMessageBox.ShowBox(
                    XmlTools.getXmlNodeByAttrVal("name", NOCOLLECTION_FOLDER, lThisData).InnerText,
                    RsViewEngine.Locale.GetTagText("error"),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Exclamation
                    );
            }
            else
            {
                if (lCurrColl is CFavoritesCollection)
                {
                    _dlgAddFolder.CollectionName = RsViewEngine.Locale.GetTagText(RsLocalization.TAG_FAVORITES);
                }
                else
                {
                    _dlgAddFolder.CollectionName = lCurrColl.CollectionName;
                }

                _dlgAddFolder.FolderName = "";
                DialogResult lDlgRes = _dlgAddFolder.ShowDialog();
                if (lDlgRes == DialogResult.OK)
                {
                    CReportFolder lParent    = getCurrentParent();
                    CReportFolder lNewFolder = new CReportFolder(_dlgAddFolder.FolderName);
                    lNewFolder.Parent = lParent;
                    lParent.Collection.ApplyToGUI();
                    lParent.Collection.QuickSave();
                }
            }
        }
        public RsReportCollection CreateCollection(string aCollectionName, string aFile)
        {
            // TODO Create a method to handle more than one collection with the same name

            RsReportCollection lResult;

            RsReportCollection lCollection = GetCollection(aCollectionName);

            if (lCollection != null)
            {
                throw new Exception("Collection named \"" + aCollectionName + "\" already linked.");
            }

            else
            {
                lResult = new RsReportCollection();
                lResult.CollectionName = aCollectionName;
                lResult.SaveToXML(aFile);
                AddCollection(lResult);
            }

            return(lResult);
        }
Beispiel #17
0
        public static bool SaveCollection(RsReportCollection aCollection)
        {
            if (aCollection.FileName == "")
            {
                bool lNoSave = false;

                while (RsViewEngine._dlgSaveCollection.ShowDialog() != DialogResult.OK)
                {
                    if (CRSMessageBox.ShowBox(
                            RsViewEngine.Locale.GetMessage("collectionmustsave"),
                            RsViewEngine.Locale.GetMessageTitle("collectionmustsave"),
                            MessageBoxButtons.OKCancel,
                            MessageBoxIcon.Asterisk
                            ) == DialogResult.Cancel)
                    {
                        lNoSave = true;
                        break;
                    }
                }

                if (!lNoSave)
                {
                    aCollection.SaveToXML(RsViewEngine._dlgSaveCollection.FileName);
                }
                else
                {
                    RsViewEngine.CloseCollection(aCollection);
                    return(false);
                }
            }
            else
            {
                aCollection.QuickSave();
            }

            return(true);
        }
 public void RemoveCollection(RsReportCollection aCollection)
 {
     foreach (RsCollectionConfig iConfig in ProfileManager.Profile.Collections) {
                         if (aCollection.FileName.ToUpper().Equals(iConfig.Path.ToUpper())) {
                                 ProfileManager.Profile.Collections.Remove(iConfig);
                                 break;
                             }
                     }
 }
        public void DoRemove()
        {
            XmlNode            lThisData   = RsViewEngine.Locale.GetFormData(LOCALE_ALIAS);
            CReportItem        lSelected   = getSelectedItem();
            RsReportCollection lCollection = getSelectedCollection();
            string             lVerifyMsg;
            string             lItemName;

            if (lSelected == null)
            {
                CRSMessageBox.ShowBox(
                    XmlTools.getXmlNodeByAttrVal("name", "itemNotSelected_del", lThisData).InnerText,
                    RsViewEngine.Locale.GetTagText("error"),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Exclamation
                    );
                return;
            }

            lItemName = lSelected.ItemName;
            if (lSelected is CReportRootFolder)
            {
                if (lSelected is CReportFavoritesRoot)
                {
                    lVerifyMsg = XmlTools.getXmlNodeByAttrVal("name", "verify_eraseFavs", lThisData).InnerText;
                }
                else
                {
                    lVerifyMsg = XmlTools.getXmlNodeByAttrVal("name", "verify_rmCollection", lThisData).InnerText + " " + lCollection.CollectionName + "?";
                }
                DialogResult lDlgRes = CRSMessageBox.ShowBox(
                    lVerifyMsg,
                    RsViewEngine.Locale.GetTagText("verify"),
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Exclamation
                    );
                if (lDlgRes == DialogResult.Yes)
                {
                    if (lSelected is CReportFavoritesRoot)
                    {
                        lCollection.ClearCollection();
                        lCollection.QuickSave();
                        lCollection.ApplyToGUI();
                        _eCollection.SelectedNode = lCollection.RootFolder.GUINode;
                    }
                    else
                    {
                        if (lCollection.Modified)
                        {
                            lDlgRes = CRSMessageBox.ShowBox(
                                XmlTools.getXmlNodeByAttrVal("name", "nosaved_collection", lThisData).InnerText + " " + lCollection.CollectionName + "?",
                                RsViewEngine.Locale.GetTagText("save"),
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question
                                );
                            if (lDlgRes == DialogResult.Yes)
                            {
                                RsViewEngine.SaveCollection(lCollection);
                            }
                        }
                        RsViewEngine.CloseCollection(lCollection);
                        _eCollection.SelectedNode = RsViewEngine.Favorites.RootFolder.GUINode;
                    }
                }
            }
            else
            {
                if (lSelected is CReportFolder)
                {
                    lVerifyMsg = XmlTools.getXmlNodeByAttrVal("name", "verify_rmFolder", lThisData).InnerText + " " + lItemName + "?";
                }
                else
                {
                    lVerifyMsg = XmlTools.getXmlNodeByAttrVal("name", "verify_rmFile", lThisData).InnerText + " " + lItemName + "?";
                }

                DialogResult lDlgRes = CRSMessageBox.ShowBox(
                    lVerifyMsg,
                    RsViewEngine.Locale.GetTagText("verify"),
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Exclamation
                    );

                if (lDlgRes == DialogResult.Yes)
                {
                    _eCollection.SelectedNode = lSelected.GUINode;
                    lSelected.Release();
                    lCollection.QuickSave();
                }
            }
        }
Beispiel #20
0
 public static void CloseCollection(RsReportCollection aCollection)
 {
     CollectionManager.RemoveCollection(aCollection);
     aCollection.QuickSave();
     aCollection.Release();
 }