Exemplo n.º 1
0
        public void Parse(XmlNode oRoot, ASafeLog log)
        {
            if (ReferenceEquals(m_oFieldGroup, null))
            {
                throw new OwnException("Cannot parse: field group is not specified.");
            }

            var oLog = new SafeLog(log);

            oLog.Debug("Parsing group {0}", m_oFieldGroup.Name);

            if (!string.IsNullOrWhiteSpace(m_oFieldGroup.PathToParent))
            {
                XmlNodeList lst = oRoot.SelectNodes(m_oFieldGroup.PathToParent);

                if (lst != null)
                {
                    oLog.Debug("{0} nodes found matching PathToParent", lst.Count);

                    foreach (XmlNode oNode in lst)
                    {
                        ParseOne(oNode, oLog);
                    }
                }         // if nodes found
            }             // if path to parent specified
            else
            {
                ParseOne(oRoot, oLog);
            }
        }         // Parse
Exemplo n.º 2
0
 public QuickOfferData(QuickOfferConfigurationData qoc, AConnection oDB, ASafeLog oLog)
 {
     Log              = new SafeLog(oLog);
     IsValid          = false;
     Cfg              = qoc;
     m_oExperianUtils = new ExperianUtils(oLog);
     DB = oDB;
 }         // constructor
Exemplo n.º 3
0
        }         // GetEnabledStatus

        public QuickOfferConfiguration(AConnection oDB, ASafeLog oLog)
        {
            m_oDB              = oDB;
            m_oLog             = new SafeLog(oLog);
            m_bIsLoaded        = false;
            m_oOfferAmountPct  = new List <Tuple <int, decimal> >();
            m_oPriceCalculator = new SortedTable <int, int, decimal>();
        }         // constructor
        public RequestedTransactionsLibrary(ASafeLog log)
        {
            m_oLog = new SafeLog(log);

            m_oByDate = new SortedDictionary <DateTime, List <RequestedTransaction> >();
            m_oByLoan = new SortedDictionary <int, List <RequestedTransaction> >();

            LoanIDs = string.Empty;
            Count   = 0;
        }         // constructor
Exemplo n.º 5
0
        public MailChimpApiControler(AConnection oDB, ASafeLog oLog)
        {
            string sApikey = System.Configuration.ConfigurationManager.AppSettings["apikey"];

            m_oMcApi = new MCApi(sApikey, true);

            ms_oDB  = oDB;
            ms_oLog = new SafeLog(oLog);

            DbCmd = new DbCommands(ms_oDB, ms_oLog);
        }         // Init
Exemplo n.º 6
0
 public void WriteTextSafe(string logMessage)
 {
     if (tbLogs.InvokeRequired)
     {
         var d = new SafeLog(WriteTextSafe);
         tbLogs.Invoke(d, new object[] { logMessage });
     }
     else
     {
         tbLogs.SelectionStart  = 0;
         tbLogs.SelectionLength = 0;
         //tbLogs.SelectionColor = color;
         tbLogs.SelectedText = logMessage;
     }
 }
Exemplo n.º 7
0
        }         // indexer

        private static void Init(SafeLog oLog)
        {
            lock (typeof(PostcodeToRegion)) {
                oLog.Msg("Initialising UK postcode to region mapping...");

                ms_oPostcodeToRegion = new SortedDictionary <string, string>();

                string[] aryLines = new StreamReader(
                    Assembly.GetExecutingAssembly().GetManifestResourceStream("Ezbob.Utils.uk.postcode.regions.txt")
                    ).ReadToEnd().Split('\n');

                oLog.Debug("{0} rows read from source file.", aryLines.Length);

                string sRegion = string.Empty;

                foreach (string sLine in aryLines)
                {
                    string sCurLine = sLine.Trim();

                    if (string.IsNullOrWhiteSpace(sCurLine) || sCurLine.StartsWith("#"))
                    {
                        continue;
                    }

                    int nPos = sCurLine.IndexOf('=');

                    if (nPos < 0)
                    {
                        sRegion = sCurLine;
                    }
                    else
                    {
                        string sPostcode = sCurLine.Substring(0, nPos).Trim();

                        if (sPostcode != string.Empty && sRegion != string.Empty)
                        {
                            string sNormalPostcode = sPostcode.ToUpper();

                            ms_oPostcodeToRegion[sNormalPostcode] = sRegion;
                            oLog.Debug("UK postcode {0} -> {1} region", sNormalPostcode, sRegion);
                        }         // if
                    }             // if
                }                 // for each line

                oLog.Msg("Initialising UK postcode to region mapping complete.");
            }     // lock
        }         // Init
Exemplo n.º 8
0
        }         // static constructor

        public RequestedTransaction(string sRawData, ASafeLog oLog)
        {
            m_oLog = new SafeLog(oLog);

            string[] aryFields = sRawData.Split(',');

            if (aryFields.Length != 3)
            {
                throw new Exception("Wrong number of fields in " + sRawData);
            }

            Date       = DateTime.ParseExact(aryFields[0], "dd/mm/yyyy", ms_oCulture, DateTimeStyles.None).Date;
            LoanID     = Convert.ToInt32(aryFields[1]);
            PaidAmount = Convert.ToDecimal(aryFields[2]);

            m_oLog.Debug("{0} -> {1}", sRawData, this);
        }         // constructor
Exemplo n.º 9
0
        }         // Parse

        private void ParseOne(XmlNode oNode, SafeLog oLog)
        {
            var oData = new ParsedDataItem();

            foreach (KeyValuePair <string, OutputFieldBuilder> pair in m_oFieldGroup.OutputFieldBuilders)
            {
                pair.Value.Clear();
            }

            foreach (Field fld in m_oFieldGroup.Fields)
            {
                XmlNode oValue = oNode.SelectSingleNode(fld.SourcePath);

                string sValue = (oValue == null) ? null : oValue.InnerText;

                fld.SetValue(sValue);
            }             // for each field

            foreach (KeyValuePair <string, OutputFieldBuilder> pair in m_oFieldGroup.OutputFieldBuilders)
            {
                oData[pair.Key] = pair.Value.Build();
            }

            if (m_oFieldGroup.HasChildren())
            {
                foreach (var grp in m_oFieldGroup.Children)
                {
                    var oGroupData = new ParsedData(grp);
                    oData.Children[grp.Name] = oGroupData;

                    oGroupData.Parse(oNode, oLog);
                }         // foreach child
            }             // if

            Data.Add(oData);
        }         // ParseOne
Exemplo n.º 10
0
 public ExperianUtils(ASafeLog oLog)
 {
     Log = new SafeLog(oLog);
 }         // constructor
Exemplo n.º 11
0
 public TestCode(SafeLog log)
 {
     safeLog = log;
     logger  = new MyLogger(this);
 }
Exemplo n.º 12
0
 public DbCommands(AConnection oDB, ASafeLog oLog)
 {
     m_oDB  = oDB;
     m_oLog = new SafeLog(oLog);
 }         // constructor
Exemplo n.º 13
0
 public ParsePacNetText()
 {
     Logger = new SafeLog();
 }
Exemplo n.º 14
0
 static PacNetBalance()
 {
     Logger = new SafeLog();
 }         // static constructor
Exemplo n.º 15
0
 public GoogleAnalytics(ASafeLog oLog = null)
 {
     Log = new SafeLog(oLog);
 }         // constructor
Exemplo n.º 16
0
 private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     SafeLog.WriteErrorAndOpenFile(e.ExceptionObject as Exception);
 }
Exemplo n.º 17
0
 public ParsePacNetText(string loginAddress, string loginPassword)
 {
     this.loginAddress  = loginAddress;
     this.loginPassword = loginPassword;
     Logger             = new SafeLog();
 }
Exemplo n.º 18
0
 public ModuleBase()
 {
     this.ReadMetadatum();
     this.Log = SafeLog.GetLogger(this.Name);
 }
Exemplo n.º 19
0
 public Configuration(string sInstanceName, AConnection oDB, ASafeLog oLog) : base(sInstanceName)
 {
     m_oDB  = oDB;
     m_oLog = new SafeLog(oLog);
 }         // constructor