Example #1
0
        private string GetPriorDate()
        {
            strUserIdentity = "fountainhead\bgoff";
            GenericIdentity objGenericIdentity = new GenericIdentity(strUserIdentity);
            CredentialPrincipal credPrincipal = new BAM.Repository.CredentialPrincipal(objGenericIdentity, null, strPerms); ;

            config = new ConfigHelper();
            _dataRepository = config.GetRepository("Persistence");

            Hashtable ht = new Hashtable();
            ht["date"] = DateTime.Now.Date;
            ht["CountryArr"] = "US";

            DataSet ds = GetDataSet("Persistence", "Persistence.StaarsConversion_GetPriorDate", ht);

            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                return ((DateTime)ds.Tables[0].Rows[0][0]).ToShortDateString();
            else
                return String.Empty;
        }
        public override int Execute(Object o, Hashtable inputData)
        {
            int activityIdStarting = UpdateProcessStatus(Enums.ProcessStatus.Starting, "", (State)o );

            if (IfResetOnEachRun)
                ResetOutput();

            PassAlongOutputs(inputData);

            strUserIdentity = "fountainhead\bgoff";
            GenericIdentity objGenericIdentity = new GenericIdentity(strUserIdentity);
            CredentialPrincipal credPrincipal = new BAM.Repository.CredentialPrincipal(objGenericIdentity, null, strPerms); ;

            config = new ConfigHelper();
            _dataRepository = config.GetRepository("GenevaPersistence");

            Hashtable ht = new Hashtable();
            foreach (Object oIn in inputData)
            {
                DataTable dt = oIn as DataTable;
                foreach (DataRow dr in dt.Rows)
                {
                    ht.Clear();

                    switch (columnMapMode)
                    {
                        case 0:
                            for (int i = 0; i < columnCount; i++)
                                ht[dt.Columns[i].ColumnName] = dr[i];
                            break;
                    }

                    //string pquery = String.Format("GenevaPersistence.{0}", query);
                    GetDataSet("GenevaPersistence", query, ht);
                }
            }

            int activityIdEnding = UpdateProcessStatus(Enums.ProcessStatus.Success, "", (State)o );

            log.InfoFormat(job.KeyCode, "GenevaPersistenceAdapter executed.");
            return 0;
        }
Example #3
0
        public override int Execute(Object o, Hashtable inputData)
        {
            int activityIdStarting = UpdateProcessStatus(Enums.ProcessStatus.Starting, "", (State)o );

            if (IfResetOnEachRun)
                ResetOutput();

            PassAlongOutputs(inputData);

            strUserIdentity = "fountainhead\bgoff";
            GenericIdentity objGenericIdentity = new GenericIdentity(strUserIdentity);
            CredentialPrincipal credPrincipal = new BAM.Repository.CredentialPrincipal(objGenericIdentity, null, strPerms); ;

            config = new ConfigHelper();
            _dataRepository = config.GetRepository(repositoryName);

            DataSet ds = GetDataSet(repositoryName, sqlAlias, null);
            AddToOutputs(this.Name, ds);

            //Hashtable ht = new Hashtable();
            //foreach (Object oIn in inputData)
            //{
            //    DataTable dt = oIn as DataTable;
            //    foreach (DataRow dr in dt.Rows)
            //    {
            //        GetDataSet(repositoryName, sqlAlias, null);
            //    }
            //}

            int activityIdEnding = UpdateProcessStatus(Enums.ProcessStatus.Success, "", (State)o );

            log.InfoFormat(job.KeyCode, "PersistenceAdapter executed.");
            return 0;
        }
        public override int Execute(Object o, Hashtable inputData)
        {
            int activityIdStarting = UpdateProcessStatus(Enums.ProcessStatus.Starting, "", (State)o );

            if (IfResetOnEachRun)
                ResetOutput();

            PassAlongOutputs(inputData);

            strUserIdentity = "fountainhead\bgoff";
            GenericIdentity objGenericIdentity = new GenericIdentity(strUserIdentity);
            CredentialPrincipal credPrincipal = new BAM.Repository.CredentialPrincipal(objGenericIdentity, null, strPerms); ;

            config = new ConfigHelper();
            _dataRepository = config.GetRepository("PersistenceAdapter");

            Hashtable ht = new Hashtable();
            foreach (Object oIn in inputData)
            {
                DataTable dt = oIn as DataTable;
                foreach (DataRow dr in dt.Rows)
                {
                    ht.Clear();

                    ht["entryDate"] = dr[0];
                    ht["datasource"] = dr[1];
                    ht["tradeDate"] = dr[2];
                    ht["symbol"] = dr[3];
                    ht["side"] = dr[4];
                    ht["quantity"] = dr[5];
                    ht["price"] = dr[6];

                    GetDataSet("Persistence", "Persistence.13fReport_SaTradeDelete", ht);
                    GetDataSet("Persistence", "Persistence.13fReport_SaTradeInsert", ht);
                }
            }

            int activityIdEnding = UpdateProcessStatus(Enums.ProcessStatus.DoneSuccess, "", (State)o );

            log.InfoFormat("PersistenceAdapter executed.");
            return 0;
        }
        private string GetCat1CodeFromAccount(string account)
        {
            string strUserIdentity = "fountainhead\bgoff";
            string LE = String.Empty;

            GenericIdentity objGenericIdentity = new GenericIdentity(strUserIdentity);
            CredentialPrincipal credPrincipal = new BAM.Repository.CredentialPrincipal(objGenericIdentity, null, strPerms); ;

            config = new ConfigHelper();
            repository = config.GetRepository("SqlPersistence");

            Hashtable ht = new Hashtable();
            ht["Account"] = account;

            DataSet ds = repository.LoadDataSet("Sql.GetCat1CodeFromAccount", ht);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                LE = ds.Tables[0].Rows[0][0].ToString();

            return LE;
        }
        private double GetCommAndFees(string chargeType, string assetClass, string broker, string underlyingAssetClass, string product, string cat1Code,
            string country, string exchange, string buySell, double price, double quantity, double mktValue)
        {
            string strUserIdentity = "fountainhead\bgoff";

            GenericIdentity objGenericIdentity = new GenericIdentity(strUserIdentity);
            CredentialPrincipal credPrincipal = new BAM.Repository.CredentialPrincipal(objGenericIdentity, null, strPerms); ;

            config = new ConfigHelper();
            repository = config.GetRepository("SqlPersistence");

            Hashtable ht = new Hashtable();
            ht["ChargeType"] = chargeType;
            ht["AssetClass"] = assetClass;
            ht["Broker"] = broker;
            ht["UnderlyingAssetClass"] = underlyingAssetClass;
            ht["Product"] = product;
            ht["Cat1Code"] = cat1Code;
            ht["Country"] = country;
            ht["Exchange"] = exchange;
            ht["BuySell"] = buySell;
            ht["Price"] = price;
            ht["Quantity"] = quantity;
            ht["Price"] = price;
            ht["MarketValue"] = mktValue;
            ht["Price"] = price;
            ht["commission"] = null;
            ht["currency"] = null;

            //DataSet ds = Bam.Framework.Service.Persistence.Repository.GetRepository(repository.Name,
            //        repository.Type, repository.ConnectionString, repository.AliasDirectory).LoadDataSet("Sql.GetCommission", ht);
            DataSet ds = repository.LoadDataSet("Sql.GetCommission", ht);

            double expense = 0;
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                if (!ds.Tables[0].Rows[0]["Commission"].Equals(DBNull.Value))
                    expense = Convert.ToDouble(ds.Tables[0].Rows[0]["Commission"]);

            return expense;
        }
Example #7
0
        private int UpdateActivityRun(int activityId, string name, string dataType, string source, int numrecs,
            loaderResultsStruct loaderReturn, Hashtable htIdentifierRef, Hashtable htSubTypeRef, Hashtable htTypeRef, Hashtable htXmlData)
        {
            int ret = 0;

            try
            {
                string strUserIdentity = "fountainhead\bgoff";
                GenericIdentity objGenericIdentity = new GenericIdentity(strUserIdentity);
                CredentialPrincipal credPrincipal = new BAM.Repository.CredentialPrincipal(objGenericIdentity, null, strPerms); ;

                _dataRepository = config.GetRepository("GenevaPersistence");

                Hashtable ht = new Hashtable();
                Hashtable htRef = BuildSubTypeNameLookup();
                Hashtable htRecType = BuildRecordTypeLookup();

                int i = 0;
                if (loaderReturn.results != null)
                {
                    foreach (loaderResultsVectorElement result in loaderReturn.results)
                    {
                        string subTypeName = String.Empty;
                        string recType = String.Empty; string identifier = String.Empty;

                        if (htRef.ContainsKey(result.message))
                            subTypeName = htRef[result.message].ToString();
                        if (htRecType.ContainsKey(result.message))
                            recType = htRecType[result.message].ToString();

                        if (subTypeName.Equals(String.Empty))
                        {
                            if (result.keyValue.Equals(String.Empty))
                            {
                                identifier = htIdentifierRef[i].ToString();
                            }
                            else if (htTypeRef.ContainsKey(result.keyValue))
                            {
                                subTypeName = htSubTypeRef[result.keyValue].ToString();
                                identifier = result.keyValue;
                                recType = htTypeRef[result.keyValue].ToString();
                            }
                            else
                            {
                                subTypeName = "EquityNewType";
                                identifier = result.keyValue;
                            }
                        }

                        int rc = 0;
                        Int32.TryParse(result.code, out rc);

                        XmlDocument xdocXmlData = (XmlDocument)htXmlData[i++];

                        if (xdocXmlData != null)
                        {
                            XmlNode exceptionsNode = xdocXmlData.CreateElement("Exceptions", xdocXmlData.DocumentElement.NamespaceURI);

                            XmlNode exceptionNode = xdocXmlData.CreateElement("GenevaErrorCode", xdocXmlData.DocumentElement.NamespaceURI);
                            exceptionNode.InnerXml = result.code;
                            XmlNode exceptionMsgNode = xdocXmlData.CreateElement("Message", xdocXmlData.DocumentElement.NamespaceURI);
                            exceptionMsgNode.InnerXml = result.message;

                            exceptionsNode.AppendChild(exceptionNode);
                            exceptionsNode.AppendChild(exceptionMsgNode);
                            xdocXmlData.FirstChild.AppendChild(exceptionsNode);

                            ht.Clear();
                            ht.Add("RunID", activityId);
                            ht.Add("xmlData", xdocXmlData.InnerXml);
                            ht.Add("SubTypeName", subTypeName);
                            ht.Add("Identifier", identifier);
                            ht.Add("UserID", 0);
                            ht.Add("UserGroupID", 0);
                            ht.Add("ExceptionStatusCode", "m");
                            ht.Add("UserName", String.Empty);
                            ht.Add("dataType", dataType);
                            ht.Add("RecordType", recType);
                            ht.Add("Code", rc);
                            ht.Add("Message", result.message);
                            ht.Add("SuccessKeyValue", result.keyValue);

                            _dataRepository.ExecuteScalar("GenevaPersistence.AddActivityRunDetail", ht);
                        }
                    }
                }
                else
                    log.Warn(job.KeyCode, "No results received from SOAP update.");

                ht.Clear();
                ht.Add("RunID", activityId);
                ht.Add("StatusCode", 'e');
                ht.Add("EndDateTime", DateTime.Now);
                ht.Add("NumberOfRecords", numrecs);
                ht.Add("Note", "");
                ht.Add("Source", source);
                ht.Add("MessageId", "");

                ret = _dataRepository.ExecuteScalar("GenevaPersistence.UpdateActivityRun", ht);
            }
            catch (Exception ex)
            {
                log.Error(job.KeyCode, ex);
            }

            return ret;
        }
Example #8
0
        private int AddActivityRun(string name, string source, int numrecs)
        {
            string strUserIdentity = "fountainhead\bgoff";
            GenericIdentity objGenericIdentity = new GenericIdentity(strUserIdentity);
            CredentialPrincipal credPrincipal = new BAM.Repository.CredentialPrincipal(objGenericIdentity, null, strPerms); ;

            _dataRepository = config.GetRepository("GenevaPersistence");

            Hashtable ht = new Hashtable();
            ht.Add("ActivityName", name);
            ht.Add("MessageID", activityName);
            ht.Add("Source", source);
            ht.Add("NumberOfRecords", numrecs);
            ht.Add("StatusCode", 'p');

            int ret = _dataRepository.ExecuteScalar("GenevaPersistence.AddActivityRun", ht);

            return ret;
        }