Example #1
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 #2
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;
        }