Esempio n. 1
0
        public static ConfigData BuildConfigData(string xmlFilePath)
        {
            if (!File.Exists(xmlFilePath))
            {
                throw new FileNotFoundException();
            }
            else
            {
                ConfigData result = new ConfigData();
                AuthToken  token  = new AuthToken();

                string phlEmailList = ""; // gets the unseperated string
                string accEmailList = ""; // --//--

                Stream            stream   = new FileStream(xmlFilePath, FileMode.Open);
                XmlReaderSettings settings = new XmlReaderSettings();
                settings.Async = true;

                bool isDirectory    = false;
                bool isUsername     = false;
                bool isPassword     = false;
                bool isPHLEmailList = false;
                bool isAccEmailList = false;


                using (XmlReader reader = XmlReader.Create(stream, settings))
                {
                    while (reader.Read())
                    {
                        switch (reader.NodeType)
                        {
                        case XmlNodeType.Element:
                            if (reader.Name == "directoryForDwedReports")
                            {
                                isDirectory = true;
                            }
                            else if (reader.Name == "emailFromName")
                            {
                                isUsername = true;
                            }
                            else if (reader.Name == "emailFromPassword")
                            {
                                isPassword = true;
                            }
                            else if (reader.Name == "emailToListPHL")
                            {
                                isPHLEmailList = true;
                            }
                            else if (reader.Name == "emailToListAcc")
                            {
                                isAccEmailList = true;
                            }
                            break;

                        case XmlNodeType.Text:
                            if (isDirectory)
                            {
                                result.DownloadPath = reader.Value;
                            }
                            else if (isUsername)
                            {
                                token.Username = reader.Value;
                            }
                            else if (isPassword)
                            {
                                token.Password   = reader.Value;
                                result.authToken = token;
                            }
                            else if (isPHLEmailList)
                            {
                                phlEmailList = reader.Value;
                            }
                            else if (isAccEmailList)
                            {
                                accEmailList = reader.Value;
                            }

                            break;

                        case XmlNodeType.EndElement:
                            if (reader.Name == "directoryForDwedReports")
                            {
                                isDirectory = false;
                            }
                            else if (reader.Name == "emailFromName")
                            {
                                isUsername = false;
                            }
                            else if (reader.Name == "emailFromPassword")
                            {
                                isPassword = false;
                            }
                            else if (reader.Name == "emailToListPHL")
                            {
                                isPHLEmailList = false;
                            }
                            else if (reader.Name == "emailToListAcc")
                            {
                                isAccEmailList = false;
                            }
                            break;
                        }
                    } // end while
                }     // end using

                result.adWordsPHLTeamEmails = phlEmailList.Split(',');
                result.accountantEmails     = accEmailList.Split(',');

                return(result);
            }
        }
Esempio n. 2
0
 public static bool SendChargeEmail(string[] accountantsEmailList, string ammountToLoad, string accountNumberAndName,
                                    AuthToken authToken)
 {
     return(false);
 }
Esempio n. 3
0
 private static bool SendEmail(string[] emails, string body, string subject, AuthToken authToken)
 {
     return(false);
 }
Esempio n. 4
0
 /// <summary>
 /// Sends Callfire Report to our PHL Team emails which have been selected
 /// </summary>
 /// <param name="phlTeamEmails">String collection of emails</param>
 /// <param name="authToken">Authentication Token (Username & Password)</param>
 /// <param name="accountNumber">The number of the account that is the report for.</param>
 /// <returns>True for successfull email send / False for failure to send the email</returns>
 public static bool SendCFReportsEmail(string[] selectedPhlTeamEmails, string accountNumber,
                                       AuthToken authToken)
 {
     return(false);
 }