Exemplo n.º 1
0
        public static void InitializeCore()
        {
            System.Windows.Forms.Application.ThreadException += new ThreadExceptionEventHandler(EH_ThreadException);
            AppDomain.CurrentDomain.UnhandledException       += new UnhandledExceptionEventHandler(EH_UnhandledException);

            _Security = null;
            _Version  = CApplicationVersion.StringToApplicationVersion(RsApplicationInfo.VersionString);
            //_Collections = new ArrayList();
            _ChildApps = new CChildApplications();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns true, if connection logon accepted by user, owtherwise false.
        /// If user requires the authentication info also stored
        /// </summary>
        /// <param name="aConnectionInfo">The connection info</param>
        /// <returns>True if dialog accepted, false if not</returns>
        protected bool ShowAuthDialog(string aConnectionName, InternalConnectionInfo aConnectionInfo)
        {
            dlgSetupLogin.ConnectionName = aConnectionName;

            if (dlgSetupLogin.ShowDialog() == DialogResult.OK)
            {
                if (dlgSetupLogin.Authenticate)
                {
                    aConnectionInfo.SetLogon(dlgSetupLogin.UserName, dlgSetupLogin.Password);
                }

                switch (dlgSetupLogin.SaveMode)
                {
                case TLogonInfoSave.lisSaveForDataSource:
                    if (dlgSetupLogin.Authenticate)
                    {
                        CSecurityData.AddSecNode(
                            RsViewEngine.RSSecurity,
                            dlgSetupLogin.ConnectionName,
                            "DatasourceSecurity",
                            dlgSetupLogin.UserName,
                            dlgSetupLogin.Password
                            );
                        RsViewEngine.SaveSecurity();
                    }
                    break;

                case TLogonInfoSave.lisSaveForReport:
                    if (dlgSetupLogin.Authenticate)
                    {
                        CSecurityData.AddSecNode(
                            RsViewEngine.RSSecurity,
                            dlgSetupLogin.ConnectionName,
                            "report",
                            dlgSetupLogin.UserName,
                            dlgSetupLogin.Password,
                            _RptFile
                            );
                        RsViewEngine.SaveSecurity();
                    }
                    break;
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        private static void loadSecurity()
        {
            string lFile = RsViewEngine.ProfileManager.SecurityFile;

            if (!File.Exists(lFile))
            {
                _Security = CSecurityData.CreateNew();
                _Security.Save(lFile);
            }
            else
            {
                if (RsOldSecurity.IsOldFormat(lFile))
                {
                    RsOldSecurity.ConvertToNew(lFile);
                }

                _Security = new CSecurityData();
                _Security.Load(lFile);
            }
        }
Exemplo n.º 4
0
        public static void ConvertToNew(string aFile)
        {
            CSecurityData lNewDoc = CSecurityData.CreateNew();
            XmlDocument   lOldDoc = new XmlDocument();

            lOldDoc.Load(aFile);
            XmlNode lRootNode = XmlTools.getXmlNodeByName("ReportSmartSecurity", lOldDoc);

            foreach (XmlNode iNode in lRootNode)
            {
                CSecurityNode iSecNode = CSecurityData.AddSecNode(
                    lNewDoc,
                    XmlTools.GetAttrib(iNode, "datasource"),
                    iNode.Name
                    );
                iSecNode.UserName = XmlTools.GetAttrib(iNode, "userid");
                iSecNode.Password = XmlTools.GetAttrib(iNode, "passwd");
            }
            lNewDoc.Save(aFile);
        }
Exemplo n.º 5
0
        private void Init(DataTable acf, Assets assets)
        {
            List <string> categoryNameCache = new List <string>();

            for (int i = 0; i < acf.Rows.Count; i++)
            {
                var row = acf.Rows[i];
                if (row.ItemArray.Length < 2)
                {
                    continue;
                }

                var category           = row.ItemArray[0].ToString();
                var name               = row.ItemArray[1].ToString();
                var categoryName       = category + "|" + name;
                var startAssetSequence = categoryNameCache.Count(x => x == categoryName);
                categoryNameCache.Add(categoryName);
                var asset = assets.GetByName(category, startAssetSequence);
                if (asset == null)
                {
                    if (string.IsNullOrEmpty(category))
                    {
                        continue;
                    }

                    var secrutyData = new CSecurityData();
                    secrutyData.AssetId      = -1;
                    secrutyData.SecurityName = category;
                    asset = new Asset(secrutyData);
                }

                for (int j = 2; j < row.ItemArray.Length; j++)
                {
                    DateTime date;
                    if (DateTime.TryParse(acf.Columns[j].ColumnName, out date))
                    {
                        AddAcfUnit(asset, date, name, row.ItemArray[j].ToString());
                    }
                }
            }
        }
Exemplo n.º 6
0
 public Asset(CSecurityData securityData)
 {
     SecurityData = securityData;
 }
Exemplo n.º 7
0
 public AssetLogicModel(DatasetLogicModel datasetLogicModel, CSecurityData securityData)
     : base(datasetLogicModel.ProjectLogicModel)
 {
     m_datasetLogicModel = datasetLogicModel;
     SecurityData        = securityData;
 }