Beispiel #1
0
        protected override void Initialize()
        {
            base.Initialize();
            configObj = Config as TWQCFutureCheckGEDARICConfig;
            EmailAccountInfo emailAccount = EmailAccountManager.SelectEmailAccountByAccountName(configObj.AccountName.Trim());

            accountName                 = emailAccount.AccountName;
            password                    = emailAccount.Password;
            domain                      = emailAccount.Domain;
            mailAdress                  = emailAccount.MailAddress;
            mailFolder                  = configObj.MailFolderPath.Trim();
            txtFilePath                 = configObj.TxtFilePath.Trim();
            listMailTo                  = configObj.MailTo;
            listMailSignature           = configObj.MailSignature;
            strRicChainPattern          = @"\](?<RIC>[A-Za-z0-9]+)\b\s+\b\d{2}\-[A-Z]{3}\-\d{4}\b";
            strRicChainFileName         = DateTime.Now.ToUniversalTime().AddHours(+8).ToString("MMdd") + "FutRic.txt";
            strRicChainMissingPattern   = @"\r\n(?<RIC>[A-Za-z0-9]+)\b\s+\bOFFCL_CODE\b\s+\b(?<Value>[A-Za-z0-9]+)\b";
            strRicDicPattern            = @"\bLONGLINK\d{1,2}\b\s+\b(?<RIC>[A-Za-z0-9]+)\r\n\S+\b";
            strRicFileName              = DateTime.Now.ToUniversalTime().AddHours(+8).ToString("MMdd") + "SpdRic.txt";
            strRicMTXW                  = "0#MTXW:";
            strRicMTX                   = "0#MTX:";
            strEmailKeyWordListRicChain = "Futures Job log file for RA(Region-HKG|Exchanges-TM|TAIFEX)";
            strEmailKeyWordHKGRic       = "Futures Job log file for RA(Region-HKG)";
            strHKGRicPattern            = @"\*\s+\*\s+\b(?<RIC>[A-Za-z0-9]+)\b";
            service                     = MSAD.Common.OfficeUtility.EWSUtility.CreateService(new System.Net.NetworkCredential(accountName, password, domain), new Uri(@"https://apac.mail.erf.thomson.com/EWS/Exchange.asmx"));
        }
        protected override void Initialize()
        {
            configObj = Config as HKIPONDAConfig;
            EmailAccountInfo emailAccount = EmailAccountManager.SelectEmailAccountByAccountName(configObj.AccountName.Trim());

            accountName                   = emailAccount.AccountName;
            password                      = emailAccount.Password;
            domain                        = emailAccount.Domain;
            mailAdress                    = emailAccount.MailAddress;
            listMailTo                    = configObj.MailTo;
            listMailSignature             = configObj.MailSignature;
            strTxtFilePath                = configObj.TxtFilePath;
            strDownloadFilePath           = configObj.FtpFilePath.Trim();
            service                       = EWSUtility.CreateService(new System.Net.NetworkCredential(accountName, password, domain), new Uri(@"https://apac.mail.erf.thomson.com/EWS/Exchange.asmx"));
            strGetYesdayTxtFile           = Path.Combine(strTxtFilePath, DateTime.Now.ToUniversalTime().AddHours(+8).AddDays(-1).ToString("MMdd") + "All_HK_IPO_IDN.txt");
            strGeneratedTodayTxtFile      = Path.Combine(strTxtFilePath, DateTime.Now.ToUniversalTime().AddHours(+8).ToString("MMdd") + "Missing_HK_IPO_NDA.txt");
            strFileNameOnFtpYesterday     = "EM01" + DateTime.Now.ToUniversalTime().AddDays(-1).AddHours(+8).ToString("MMdd") + ".M";
            strFileNameOnFtpToday         = "EM01" + DateTime.Now.ToUniversalTime().AddHours(+8).ToString("MMdd") + ".M";
            strPatternFTP                 = @"^\S{2}(?<RIC>\S{4,10}\.(HK|HS))\b\s+";
            strFileNameReadOnFtpYesterday = "0001" + DateTime.Now.ToUniversalTime().AddDays(-1).AddHours(+8).ToString("MMdd") + ".M";
            strFileNameReadOnFtpToday     = "0001" + DateTime.Now.ToUniversalTime().AddHours(+8).ToString("MMdd") + ".M";

            strFileNameReadOnFtpYesterdayHS = "3200" + DateTime.Now.ToUniversalTime().AddDays(-1).AddHours(+8).ToString("MMdd") + ".M";
            strFileNameReadOnFtpTodayHS     = "3200" + DateTime.Now.ToUniversalTime().AddHours(+8).ToString("MMdd") + ".M";
        }
Beispiel #3
0
        protected override void Initialize()
        {
            configObj = Config as TWIpoQCConfig;

            EmailAccountInfo emailAccount = EmailAccountManager.SelectEmailAccountByAccountName(configObj.AccountName.Trim());

            accountName       = emailAccount.AccountName;
            password          = emailAccount.Password;
            domain            = emailAccount.Domain;
            mailAdress        = emailAccount.MailAddress;
            mailFolder        = configObj.MailFolderPath.Trim();
            outPutFilePath    = Path.Combine(configObj.OutPutPath.Trim(), "MissingRic.txt");
            listMailTo        = configObj.MailTo;
            listMailSignature = configObj.MailSignature;

            emailKeyWord = "*IPO* RIC Add";//there are two email need to search
            emailPattern = @"For\sTQSEffective\sDate\s+\:\s+\w+\s+\:\s+(?<RIC>\w+\.TWO{0,1})";
            //emailPattern = @"\s(?<RIC>\w+\.[A-Z]{2,3})Displayname";
            gatsPattern = @"(?<RIC>\w+\.[A-Z]{2,3})\s+PROD_PERM\s+\d+\s+";

            listFileCodeInFtp.Add("0126" + fileCodeOfToday + ".M");
            listFileCodeInFtp.Add("1127" + fileCodeOfToday + ".M");
            listFileCodeInFtp.Add("0645" + fileCodeOfToday + ".M");
            //listFileCodeInFtp.Add("01260319.M");
            //listFileCodeInFtp.Add("11270322.M");
            //listFileCodeInFtp.Add("06450319.M");

            ftpPattern = @"(?<RIC>\w+\.[A-Z]{2,3})\s+ENNOCONN ORD\s+";
            strFileNameOnLocalToday = "EM01" + DateTime.Now.ToUniversalTime().AddHours(+8).ToString("MMdd") + ".M";
            publicDownloadPath      = configObj.PublicDownloadPath;
        }
Beispiel #4
0
        protected override void Initialize()
        {
            base.Initialize();
            configObj = Config as CNISINupdateConfig;
            EmailAccountInfo emailAccount = EmailAccountManager.SelectEmailAccountByAccountName(configObj.AccountName.Trim());

            accountName       = emailAccount.AccountName;
            password          = emailAccount.Password;
            domain            = emailAccount.Domain;
            mailAdress        = emailAccount.MailAddress;
            listMailTo        = configObj.MailTo;
            listMailSignature = configObj.MailSignature;
            filePath          = configObj.FilePath;
            dicSSGuoZhai.Add("010", "国债");
            dicSSGuoZhai.Add("019", "国债");
            dicSSGuoZhai.Add("020", "国债");
            dicSSZhaiJuan.Add("12", "债券");
            dicSSZhaiJuan.Add("110", "债券");
            dicSSZhaiJuan.Add("113", "债券");
            dicSZGuoZhai.Add("110", "国债");
            dicSZGuoZhai.Add("101", "国债");
            dicSZGuoZhai.Add("108", "国债");
            dicSZZhaiJuan.Add("11", "债券");
            dicSZZhaiJuan.Add("12", "债券");
        }
        protected override void Initialize()
        {
            configObj = Config as KoreaCheckIpoNdaConfig;

            DateTime dtChina = TimeUtil.ConvertToChina(DateTime.UtcNow);

            emailAccount = EmailAccountManager.SelectEmailAccountByAccountName(configObj.AccountName.Trim());
            //AM
            if (dtChina.Hour >= 12)
            {
                isAfternoonTask = true;
            }

            string currentDate = DateTime.Today.ToString("yyyyMMdd", new CultureInfo("en-US"));

            if (!isAfternoonTask)
            {
                currentDate = DateTime.Today.AddDays(-1).ToString("yyyyMMdd", new CultureInfo("en-US"));
            }

            mFileFolder = configObj.DownloadFilePath.Trim();

            InitializeMailAccount();

            InitializeDseRule();
        }
Beispiel #6
0
        public static EmailAccountInfo SelectEmailAccountByAccountName(string accountName)
        {
            try
            {
                if (accountName == null || accountName.Trim() == "")
                {
                    return(null);
                }

                string where = string.Format("where AccountName = '{0}' and Status = 'Active'", accountName);
                DataTable dt = ManagerBase.Select(ETI_EMAILACCOUNT_TABLE_NAME, new string[] { "*" }, where);

                if (dt == null || dt.Rows.Count == 0)
                {
                    return(null);
                }

                //Column AccountName is unique so dt.Row.Count==1
                DataRow          dr           = dt.Rows[0];
                EmailAccountInfo emailAccount = new EmailAccountInfo();
                emailAccount.AccountName = Convert.ToString(dr["AccountName"]);
                emailAccount.Domain      = Convert.ToString(dr["Domain"]);
                emailAccount.MailAddress = Convert.ToString(dr["MailAddress"]);
                emailAccount.Password    = Convert.ToString(dr["Password"]);
                emailAccount.Status      = (AccountStatus)Enum.Parse(typeof(AccountStatus), Convert.ToString(dr["Status"]));

                return(emailAccount);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Beispiel #7
0
        protected override void Initialize()
        {
            configObj = Config as KoreaCheckIpoNdaConfig;

            DateTime dtChina = TimeUtil.ConvertToChina(DateTime.UtcNow);

            emailAccount = EmailAccountManager.SelectEmailAccountByAccountName(configObj.AccountName.Trim());
            //AM
            if (dtChina.Hour >= 12)
            {
                isAfternoonTask = true;
            }

            string currentDate = DateTime.Today.ToString("yyyyMMdd", new CultureInfo("en-US"));

            if (!isAfternoonTask)
            {
                currentDate = DateTime.Today.AddDays(-1).ToString("yyyyMMdd", new CultureInfo("en-US"));
            }

            //mFileFolder = CreateFolderUnderCurrentPath(
            //    string.Format(@"{0}\{1}\{2}", "Output", this.TaskTypeName, currentDate));//GetOutputFilePath();

            mFileFolder = configObj.downloadFilePath.Trim();

            InitializeMailAccount();

            InitializeDseRule();
        }
Beispiel #8
0
        protected override void Initialize()
        {
            ConfigObj = Config as DataStreamRicCreationWithFileDownloadConfig;
            TaskResultList.Add(new TaskResultEntry("LOG File", "LOG File", Logger.FilePath));

            usrName  = ConfigObj.Username;
            passWord = ConfigObj.Password;

            usrName  = usrName.Replace("@", "%40");
            passWord = passWord.Replace("@", "%40");


            accountName = ConfigObj.AccountName.Trim();
            EmailAccountInfo emailAccount = EmailAccountManager.SelectEmailAccountByAccountName(ConfigObj.AccountName.Trim());

            if (emailAccount != null)
            {
                accountName    = emailAccount.AccountName;
                email_password = emailAccount.Password;
                domain         = emailAccount.Domain;
            }

            listMailTo        = ConfigObj.MailTo;
            listMailSignature = ConfigObj.MailSignature;

            service = MSAD.Common.OfficeUtility.EWSUtility.CreateService(new System.Net.NetworkCredential(accountName, email_password, domain), new Uri(@"https://apac.mail.erf.thomson.com/EWS/Exchange.asmx"));


            InitializeDownloadUrlDirectory();
            InitializeFileDirectory();

            string msg = "Initialize...OK!";

            Logger.Log(msg);
        }
Beispiel #9
0
        /// <summary>
        /// 设置邮箱登录相关信息
        /// </summary>
        /// <returns></returns>
        public Result SetEmailInfo(EmailAccountInfo info)
        {
            var result = new Result();

            if (info == null)
            {
                result.IsSuccess = false;
                result.Message   = "邮箱登录相关信息为空,请检查后重试!";
                return(result);
            }

            var property0 = JsonConvert.SerializeObject(info);
            var sysValue  = _context.Sys_ConfigValues.FirstOrDefault(x => x.Key == (int)SystemCfgType.EmailAccount);

            if (sysValue == null)
            {
                _context.Sys_ConfigValues.Add(new Sys_ConfigValues()
                {
                    Key       = (int)SystemCfgType.EmailAccount,
                    Property0 = property0
                });
            }
            else
            {
                sysValue.Property0 = property0;
            }

            result.IsSuccess = _context.SaveChanges() > 0;
            result.Message   = result.IsSuccess ? "邮箱登录相关信息设置/更新成功!" : "邮箱登录相关信息设置/更新失败!";
            return(result);
        }
Beispiel #10
0
        protected override void Initialize()
        {
            configObj    = Config as ChinaIpoQCAfternoonConfig;
            emailAccount = EmailAccountManager.SelectEmailAccountByAccountName(configObj.AccountName.Trim());

            if (emailAccount == null)
            {
                MessageBox.Show("email account is not exist in DB. ");
                return;
            }

            service           = MSAD.Common.OfficeUtility.EWSUtility.CreateService(new System.Net.NetworkCredential(emailAccount.AccountName, emailAccount.Password, emailAccount.Domain), new Uri(@"https://apac.mail.erf.thomson.com/EWS/Exchange.asmx"));
            listMailTo        = configObj.MailTo;
            listMailSignature = configObj.MailSignature;
            inputPath         = Path.Combine(configObj.InputPath.Trim(), string.Format(@"output\RIC_{0}.txt", DateTime.Now.ToUniversalTime().AddHours(+8).ToString("yyyy-MM-dd")));
            patternIDN        = @"\r\n(?<RIC>\w{5,15}[\.|\=]\w{1,10})\s+PROD_PERM\s+";
            patternTxtRic     = @"(?<RIC>\w{5,15}[\.|\=]\w{1,10})";
            patternNDA        = @"^\b\S+(?<RIC>\w{5,15}[\.|\=]\w{1,10})";
            listCodeNDA       = new List <string>();
            listCodeNDA.Add("0163" + DateTime.Now.ToUniversalTime().AddHours(+8).ToString("MMdd") + ".M");
            listCodeNDA.Add("0179" + DateTime.Now.ToUniversalTime().AddHours(+8).ToString("MMdd") + ".M");
            listCodeNDA.Add("3201" + DateTime.Now.ToUniversalTime().AddHours(+8).ToString("MMdd") + ".M");
            //listCodeNDA.Add("0163" + "0408" + ".M");
            //listCodeNDA.Add("0179" + "0408" + ".M");
            resultFilePath = Path.Combine(configObj.OutputPath, "output");
        }
Beispiel #11
0
        private Dictionary <string, EmailAccountInfo> LoadAccounts()
        {
            Dictionary <string, EmailAccountInfo> accounts = new Dictionary <string, EmailAccountInfo>();

            if (accountsDataFilePath != null)
            {
                List <String[]> ls = CSVUtil.ReadFromFile(this.accountsDataFilePath);

                //i start from 1, skip title
                for (int i = 1; i < ls.Count; i++)
                {
                    if (ls[i].Length != CSVUtil.ColumnCount)
                    {
                        LogManager.SingleInstance.Log("Invalid account record found: {0}, it will be removed", ls[i]);
                        continue;
                    }
                    String[] strArr = ls[i];
                    Dictionary <string, string> extendedProperties = null;

                    extendedProperties = new Dictionary <string, string>();
                    extendedProperties[Constants.ExtendedParam_DGs] = strArr[(int)CSVUtil.AccountPropertyIndex.DistributionLists];
                    extendedProperties[Constants.KeyForwardEmail]   = strArr[(int)CSVUtil.AccountPropertyIndex.KeyForwardEmail];
                    extendedProperties[Constants.KeyActiveSync]     = strArr[(int)CSVUtil.AccountPropertyIndex.KeyActiveSync];

                    EmailAccountInfo info = new EmailAccountInfo(extendedProperties);
                    if (strArr.Length > (int)CSVUtil.AccountPropertyIndex.AdditionalEmailAddresses)
                    {
                        char[] splitters = { '|' };
                        if (!string.IsNullOrEmpty(strArr[(int)CSVUtil.AccountPropertyIndex.AdditionalEmailAddresses]))
                        {
                            string[] emailAddresses = strArr[(int)CSVUtil.AccountPropertyIndex.AdditionalEmailAddresses].Split(splitters);
                            foreach (string emailAddress in emailAddresses)
                            {
                                info.AdditionalEmailAddresses.Add(emailAddress);
                            }
                        }
                    }

                    info.AccountId           = strArr[(int)CSVUtil.AccountPropertyIndex.AccountId];
                    info.DisplayName         = strArr[(int)CSVUtil.AccountPropertyIndex.DisplayName];
                    info.PrimaryEmailAddress = strArr[(int)CSVUtil.AccountPropertyIndex.PrimaryEmailAddress];

                    bool parseResult = true;
                    if (Boolean.TryParse(strArr[(int)CSVUtil.AccountPropertyIndex.Enabled], out parseResult))
                    {
                        info.Enabled = parseResult;
                    }

                    info.FirstName = strArr[(int)CSVUtil.AccountPropertyIndex.FirstName];
                    info.LastName  = strArr[(int)CSVUtil.AccountPropertyIndex.LastName];
                    LogManager.SingleInstance.Log("Account loaded: {0}", info.ToString());
                    accounts.Add(info.AccountId, info);
                }
            }
            return(accounts);
        }
Beispiel #12
0
        public static int UpdateEmailAccount(EmailAccountInfo emailAccount)
        {
            try
            {
                if (emailAccount == null || emailAccount.AccountName.Trim() == "")
                {
                    return(0);
                }

                string where = string.Format("where AccountName = '{0}'", emailAccount.AccountName);
                DataTable dt = Select(ETI_EMAILACCOUNT_TABLE_NAME, new string[] { "*" }, where);

                if (dt == null)
                {
                    return(0);
                }

                if (dt.Rows.Count > 0)
                {
                    //Column AccountName is unique so dt.Row.Count==1
                    DataRow dr = dt.Rows[0];

                    dr["AccountName"] = emailAccount.AccountName;
                    dr["Domain"]      = emailAccount.Domain;
                    dr["MailAddress"] = emailAccount.MailAddress;
                    dr["Password"]    = emailAccount.Password;
                    dr["Status"]      = emailAccount.Status.ToString();
                    dr["Description"] = emailAccount.Description;
                }
                else
                {
                    DataRow dr = dt.NewRow();

                    dr["AccountName"] = emailAccount.AccountName;
                    dr["Domain"]      = emailAccount.Domain;
                    dr["MailAddress"] = emailAccount.MailAddress;
                    dr["Password"]    = emailAccount.Password;
                    dr["Status"]      = emailAccount.Status.ToString();
                    dr["Description"] = emailAccount.Description;

                    dt.Rows.Add(dr);
                }

                return(UpdateDbTable(dt, ETI_EMAILACCOUNT_TABLE_NAME));
            }
            catch (Exception)
            {
                return(0);
            }
        }
 public EmailAccountInfo CreateAccount(EmailAccountInfo info, string password)
 {
     try
     {
         return(EmailService.AddAccount(info));
     }
     catch (AccountExistsException)
     {
         throw new HostedEmailAdaptorException(HostedEmailAdaptorErrorCode.AccountAlreadyExists, new AddinErrorRecord()
         {
             Message = Resources.ErrMsg_OnlineUserAlreadyExist,
             Title   = Resources.ErrTitle_OnlineUserAlreadyExist,
         });
     }
 }
Beispiel #14
0
        protected override void Initialize()
        {
            configObj         = Config as DownloadNDAFileConfig;
            strFilePath       = configObj.FilePath;
            listNDAFileSimple = configObj.ListSimpleFileName;
            strDateTime       = configObj.DateTime;
            strFtp            = @"ftp://*****:*****@ds1.rds.reuters.com//";
            accountName       = configObj.AccountName.Trim();
            EmailAccountInfo emailAccount = EmailAccountManager.SelectEmailAccountByAccountName(configObj.AccountName.Trim());

            accountName = emailAccount.AccountName;
            password    = emailAccount.Password;
            domain      = emailAccount.Domain;
            listMailTo  = configObj.MailTo;
            service     = MSAD.Common.OfficeUtility.EWSUtility.CreateService(new NetworkCredential(accountName, password, domain), new Uri(@"https://apac.mail.erf.thomson.com/EWS/Exchange.asmx"));
        }
Beispiel #15
0
        protected override void Initialize()
        {
            configObj = Config as JPNDATradingSymbolUpdateConfig;

            if (!string.IsNullOrEmpty(configObj.AccountName))
            {
                emailAccount = EmailAccountManager.SelectEmailAccountByAccountName(configObj.AccountName.Trim());
            }

            if (emailAccount == null)
            {
                MessageBox.Show(configObj.AccountName + "is not exist in DB.");
                return;
            }

            emailFolder       = configObj.MailFoder.Trim();
            service           = MSAD.Common.OfficeUtility.EWSUtility.CreateService(new System.Net.NetworkCredential(emailAccount.AccountName, emailAccount.Password, emailAccount.Domain), new Uri(@"https://apac.mail.erf.thomson.com/EWS/Exchange.asmx"));
            listMailTo        = configObj.MailTo;
            listMailSignature = configObj.MailSignature;
            startDate         = Convert.ToDateTime(configObj.EmailDate);
            endDate           = startDate.AddDays(+1);
            //keyWordIFFM = "OSEOMX IFFM - EDA Automation Report";
            keyWordIFFM = "OSD_OTFC Report for SO_6 of OSD feed";
            //patternIFFM = @"(?<RIC>[0-9A-Za-z]+\.OS)\s{5}\S+";
            patternIFFM = @"\s+(?<RIC>[0-9A-Z]+\.OS)\s+";
            listKeyWordOthersBody.Add("JNI Index Option additional strike price added");
            listKeyWordOthersBody.Add("JTI Index Option additional strike price added");
            patternOthersBody = @"(?<RIC>[^\\n][0-9A-Za-z]+\.OS)";
            //listKeyWordOthersAttachment.Add("OSE JNI Index Options Rollover Ric List");
            //listKeyWordOthersAttachment.Add("OSE JTI Index Options Rollover Ric List");
            listKeyWordOthersAttachment.Add("OSE JNI/JTI Index Options Rollover Ric List");
            outPutPath = configObj.OutputPath.Trim();
            iffmPath   = Path.Combine(outPutPath, string.Format("NDA_OSE_Stk_Opt_Ref_{0}.csv", DateTime.Now.ToString("ddMMMyyy")));
            othersPath = Path.Combine(outPutPath, string.Format("NDA_OSE_Index_Opt_Ref_{0}.csv", DateTime.Now.ToString("ddMMMyyy")));
            List <string> listIFFMTitle = new List <string>()
            {
                "RIC", "DERIVATIVES LAST TRADING DAY", "DERIVATIVES LOT SIZE", "TRADING SYMBOL"
            };

            dicListIFFM.Add("title", listIFFMTitle);
            List <string> listIndeTitle = new List <string>()
            {
                "RIC", "TRADING SYMBOL"
            };

            dicListOthers.Add("title", listIndeTitle);
        }
        protected override void Initialize()
        {
            base.Initialize();
            configObj = Config as TWQCOptionCheckNDARICConfig;
            EmailAccountInfo emailAccount = EmailAccountManager.SelectEmailAccountByAccountName(configObj.AccountName.Trim());

            accountName             = emailAccount.AccountName;
            password                = emailAccount.Password;
            domain                  = emailAccount.Domain;
            mailAdress              = emailAccount.MailAddress;
            listMailTo              = configObj.MailTo;
            listMailSignature       = configObj.MailSignature;
            filePath                = configObj.FilePath;
            strPattern              = @"^\b\w{2}(?<RIC>\w+\.[A-Z]{2,3})\b\s+?";
            strRicFilePath          = Path.Combine(filePath, "OptionRic.txt");
            strFilePathFromFtpOfRic = "7137" + DateTime.Now.ToUniversalTime().AddHours(+8).ToString("MMdd") + ".M";
        }
Beispiel #17
0
        protected override void Initialize()
        {
            configObj    = Config as ChinaIpoQCMorningConfig;
            emailAccount = EmailAccountManager.SelectEmailAccountByAccountName(configObj.AccountName.Trim());

            if (emailAccount == null)
            {
                MessageBox.Show("email account is not exist in DB. ");
                return;
            }

            service           = MSAD.Common.OfficeUtility.EWSUtility.CreateService(new System.Net.NetworkCredential(emailAccount.AccountName, emailAccount.Password, emailAccount.Domain), new Uri(@"https://apac.mail.erf.thomson.com/EWS/Exchange.asmx"));
            listMailTo        = configObj.MailTo;
            listMailSignature = configObj.MailSignature;
            downloadFilePath  = Path.Combine(configObj.OutputPath, "downloadFile");
            resultFilePath    = Path.Combine(configObj.OutputPath, "output");
            mailFolder        = configObj.MailFolder.Trim();
        }
        public EmailAccountInfo AddAccount(EmailAccountInfo info)
        {
            lock (this)
            {
                if (ContainsPrimaryEmailAddress(info.PrimaryEmailAddress))
                {
                    throw new AccountExistsException();
                }

                var accountId = Guid.NewGuid().ToString();
                info.AccountId = accountId;
                var accounts = LoadAccounts();
                accounts.Add(accountId, info);
                SaveAccounts(accounts);

                return info;
            }
        }
Beispiel #19
0
        private bool isExistIPO = false;//IsExist ipo file in the attachement


        protected override void Initialize()
        {
            configObj = Config as HKIPOIDNConfig;
            EmailAccountInfo emailAccount = EmailAccountManager.SelectEmailAccountByAccountName(configObj.AccountName.Trim());

            accountName           = emailAccount.AccountName;
            password              = emailAccount.Password;
            domain                = emailAccount.Domain;
            mailAdress            = emailAccount.MailAddress;
            mailFolder            = configObj.MailFolderPath.Trim();
            listMailTo            = configObj.MailTo;
            listMailSignature     = configObj.MailSignature;
            txtFilePath           = configObj.TxtFilePath.Trim();
            strEmailKeyWord       = "HKFM_";
            strPatternGATS        = @"\r\n(?<Ric>[A-Za-z0-9#]+\.HK)\b\s+\bPROD_PERM\b\s+\b(?<Value>[0-9]+)\r\n";;            //find ipo from GATS
            txtFileNameAllRIC     = DateTime.Now.ToUniversalTime().AddHours(+8).ToString("MMdd") + "All_HK_IPO_IDN.txt";;    //all ric file name
            txtFileNameRemovedRIC = DateTime.Now.ToUniversalTime().AddHours(+8).ToString("MMdd") + "Missing_HK_IPO_IDN.txt"; //removed ric file name
        }
Beispiel #20
0
        public EmailAccountInfo AddAccount(EmailAccountInfo info)
        {
            lock (this)
            {
                if (ContainsPrimaryEmailAddress(info.PrimaryEmailAddress))
                {
                    throw new AccountExistsException();
                }

                var accountId = Guid.NewGuid().ToString();
                info.AccountId = accountId;
                var accounts = LoadAccounts();
                accounts.Add(accountId, info);
                SaveAccounts(accounts);

                return(info);
            }
        }
 public EmailAccountInfo AddAccount(EmailAccountInfo info)
 {
     if (info == null)
     {
         throw new ArgumentNullException("info");
     }
     return(SimulateOnlineCall(MethodBase.GetCurrentMethod().Name, () =>
     {
         ValidateEmailAddress(info.PrimaryEmailAddress);
         if (info.AdditionalEmailAddresses != null)
         {
             foreach (string emailAddress in info.AdditionalEmailAddresses)
             {
                 ValidateEmailAddress(emailAddress);
             }
         }
         return accountManager.AddAccount(info);
     }));
 }
        public bool loadUserData()
        {
            bool ret = false;

            string forwardEmail = string.Empty;
            string activeSync   = "False";

            using (ManualResetEvent done = new ManualResetEvent(false))
            {
                ThreadPool.QueueUserWorkItem((state) =>
                {
                    if (!manager.Connected)
                    {
                        if (!manager.Connect())
                        {
                            ret = false;
                        }
                    }

                    try
                    {
                        EmailAccountInfo = manager.GetAccount(UserName);
                        if (null != EmailAccountInfo.ExtendedProperties)
                        {
                            EmailAccountInfo.ExtendedProperties.TryGetValue(KeyForwardEmail, out forwardEmail);
                            EmailAccountInfo.ExtendedProperties.TryGetValue(KeyActiveSync, out activeSync);
                        }
                    }
                    catch (Exception)
                    {
                        ret = false;
                    }

                    ret = true;
                    done.Set();
                });
                done.WaitOne();
            }

            this.textBoxEmail.Text          = forwardEmail;
            this.checkBoxActiveSync.Checked = bool.Parse(activeSync);
            return(ret);
        }
 public void UpdateAccount(EmailAccountInfo info)
 {
     try
     {
         EmailService.UpdateAccount(info);
     }
     catch (AccountNotExistsException)
     {
         throw new HostedEmailAdaptorException(HostedEmailAdaptorErrorCode.AccountNotExists, null);
     }
     catch (AccountExistsException)
     {
         throw new HostedEmailAdaptorException(HostedEmailAdaptorErrorCode.AccountAlreadyExists, null);
     }
     catch (InvalidEmailAddressException)
     {
         throw new HostedEmailAdaptorException(HostedEmailAdaptorErrorCode.InvalidEmailAddress, null);
     }
 }
Beispiel #24
0
        protected override void Initialize()
        {
            base.Initialize();
            configObj = Config as TWQCFutureCheckNDARICConfig;
            EmailAccountInfo emailAccount = EmailAccountManager.SelectEmailAccountByAccountName(configObj.AccountName.Trim());

            accountName                = emailAccount.AccountName;
            password                   = emailAccount.Password;
            domain                     = emailAccount.Domain;
            mailAdress                 = emailAccount.MailAddress;
            listMailTo                 = configObj.MailTo;
            listMailSignature          = configObj.MailSignature;
            filePath                   = configObj.FilePath;
            strFutPattern              = @"^\b(?<RIC>\w+)\b.+?";
            strSpdPattern              = @"^\b(?<RIC>\S+)\b\s+?";
            strFutRicFilePath          = Path.Combine(filePath, DateTime.Now.ToUniversalTime().AddHours(+8).AddDays(-1).ToString("MMdd") + "FutRic.txt");
            strSpdRicFilePath          = Path.Combine(filePath, DateTime.Now.ToUniversalTime().AddHours(+8).AddDays(-1).ToString("MMdd") + "SpdRic.txt");
            strFilePathFromFtpOfFutRic = "5225" + DateTime.Now.ToUniversalTime().AddHours(+8).ToString("MMdd") + ".M";
            strFilePathFromFtpOfSpdRic = "5673" + DateTime.Now.ToUniversalTime().AddHours(+8).ToString("MMdd") + ".M";
            service                    = MSAD.Common.OfficeUtility.EWSUtility.CreateService(new System.Net.NetworkCredential(accountName, password, domain), new Uri(@"https://apac.mail.erf.thomson.com/EWS/Exchange.asmx"));
        }
Beispiel #25
0
        protected override void Initialize()
        {
            base.Initialize();
            configObj = Config as TWQCOptionCheckGEDARICConfig;
            EmailAccountInfo emailAccount = EmailAccountManager.SelectEmailAccountByAccountName(configObj.AccountName.Trim());

            accountName                  = emailAccount.AccountName;
            password                     = emailAccount.Password;
            domain                       = emailAccount.Domain;
            mailAdress                   = emailAccount.MailAddress;
            mailFolder                   = configObj.MailFolderPath.Trim();
            txtFilePath                  = configObj.TxtFilePath.Trim();
            listMailTo                   = configObj.MailTo;
            listMailSignature            = configObj.MailSignature;
            strRicFirstEmailPattern      = @"RIC\s+\[(?<RIC>\w+\.[A-Z]{2,3})\]\s+for\s+Exch\s+symbol";
            strRicSecondEmailPattern     = @"\b(?<RIC>\w+[A-Z]{1}\d{1}\.TM)\b";
            strRicGATSPattern            = @"\r\n(?<RIC>\w+\.[A-Z]{2,3})\b\s+\bOFFCL_CODE\b\s+\b(?<Value>\w+)";
            strRicFileName               = "OptionRic.txt";
            strFirstEmailKeyWordListRic  = "TAIFO IFFM - EDA Automation Report";
            strSecondEmailKeyWordListRic = "TAIFEX_OPT_IFFM Report for Weekly Option of Taifex option iffm feed";
        }
Beispiel #26
0
 public void UpdateAccount(EmailAccountInfo info)
 {
     lock (this)
     {
         var accounts  = LoadAccounts();
         var accountId = info.AccountId;
         if (!accounts.ContainsKey(accountId))
         {
             throw new AccountNotExistsException();
         }
         if (!string.IsNullOrEmpty(info.PrimaryEmailAddress))
         {
             if (accounts.Values.Where((i) => { return(string.Equals(i.PrimaryEmailAddress, info.PrimaryEmailAddress, StringComparison.OrdinalIgnoreCase) && !string.Equals(i.AccountId, info.AccountId, StringComparison.OrdinalIgnoreCase)); }).Count() > 0)
             {
                 throw new AccountExistsException();
             }
         }
         accounts[accountId] = info;
         SaveAccounts(accounts);
     }
 }
 public void UpdateAccount(EmailAccountInfo info)
 {
     lock (this)
     {
         var accounts = LoadAccounts();
         var accountId = info.AccountId;
         if (!accounts.ContainsKey(accountId))
         {
             throw new AccountNotExistsException();
         }
         if (!string.IsNullOrEmpty(info.PrimaryEmailAddress))
         {
             if (accounts.Values.Where((i) => { return string.Equals(i.PrimaryEmailAddress, info.PrimaryEmailAddress, StringComparison.OrdinalIgnoreCase) && !string.Equals(i.AccountId, info.AccountId, StringComparison.OrdinalIgnoreCase); }).Count() > 0)
             {
                 throw new AccountExistsException();
             }
         }
         accounts[accountId] = info;
         SaveAccounts(accounts);
     }
 }
        private Dictionary<string, EmailAccountInfo> LoadAccounts()
        {
            Dictionary<string, EmailAccountInfo> accounts = new Dictionary<string, EmailAccountInfo>();
            if (accountsDataFilePath != null)
            {
                List<String[]> ls = CSVUtil.ReadFromFile(this.accountsDataFilePath);

                //i start from 1, skip title
                for (int i = 1; i < ls.Count; i++)
                {
                    if (ls[i].Length != CSVUtil.ColumnCount)
                    {
                        LogManager.SingleInstance.Log("Invalid account record found: {0}, it will be removed", ls[i]);
                        continue;
                    }
                    String[] strArr = ls[i];
                    Dictionary<string, string> extendedProperties = null;

                    extendedProperties = new Dictionary<string, string>();
                    extendedProperties[Constants.ExtendedParam_DGs] = strArr[(int)CSVUtil.AccountPropertyIndex.DistributionLists];
                    extendedProperties[Constants.KeyForwardEmail] = strArr[(int)CSVUtil.AccountPropertyIndex.KeyForwardEmail];
                    extendedProperties[Constants.KeyActiveSync] = strArr[(int)CSVUtil.AccountPropertyIndex.KeyActiveSync];

                    EmailAccountInfo info = new EmailAccountInfo(extendedProperties);
                    if (strArr.Length > (int)CSVUtil.AccountPropertyIndex.AdditionalEmailAddresses)
                    {
                        char[] splitters = {'|'};
                        if (!string.IsNullOrEmpty(strArr[(int)CSVUtil.AccountPropertyIndex.AdditionalEmailAddresses]))
                        {
                            string[] emailAddresses = strArr[(int)CSVUtil.AccountPropertyIndex.AdditionalEmailAddresses].Split(splitters);
                            foreach (string emailAddress in emailAddresses)
                            {
                                info.AdditionalEmailAddresses.Add(emailAddress);
                            }
                        }
                    }

                    info.AccountId = strArr[(int)CSVUtil.AccountPropertyIndex.AccountId];
                    info.DisplayName = strArr[(int)CSVUtil.AccountPropertyIndex.DisplayName];
                    info.PrimaryEmailAddress = strArr[(int)CSVUtil.AccountPropertyIndex.PrimaryEmailAddress];

                    bool parseResult = true;
                    if (Boolean.TryParse(strArr[(int)CSVUtil.AccountPropertyIndex.Enabled], out parseResult))
                    {
                        info.Enabled = parseResult;
                    }

                    info.FirstName = strArr[(int)CSVUtil.AccountPropertyIndex.FirstName];
                    info.LastName = strArr[(int)CSVUtil.AccountPropertyIndex.LastName];
                    LogManager.SingleInstance.Log("Account loaded: {0}", info.ToString());
                    accounts.Add(info.AccountId, info);
                }
            }
            return accounts;
        }
Beispiel #29
0
 public Result SetEmailInfo(EmailAccountInfo info)
 {
     return(_email.SetEmailInfo(info));
 }
 public EmailAccountInfo CreateAccount(EmailAccountInfo info, string password)
 {
     try
     {
         return EmailService.AddAccount(info);
     }
     catch (AccountExistsException)
     {
         throw new HostedEmailAdaptorException(HostedEmailAdaptorErrorCode.AccountAlreadyExists, new AddinErrorRecord()
         {
             Message = Resources.ErrMsg_OnlineUserAlreadyExist,
             Title = Resources.ErrTitle_OnlineUserAlreadyExist,
         });
     }
 }
 public void UpdateAccount(EmailAccountInfo info)
 {
     try
     {
         EmailService.UpdateAccount(info);
     }
     catch (AccountNotExistsException)
     {
         throw new HostedEmailAdaptorException(HostedEmailAdaptorErrorCode.AccountNotExists, null);
     }
     catch (AccountExistsException)
     {
         throw new HostedEmailAdaptorException(HostedEmailAdaptorErrorCode.AccountAlreadyExists, null);
     }
     catch (InvalidEmailAddressException)
     {
         throw new HostedEmailAdaptorException(HostedEmailAdaptorErrorCode.InvalidEmailAddress, null);
     }
 }
 public void UpdateAccount(EmailAccountInfo info)
 {
     if (info == null)
     {
         throw new ArgumentNullException("info");
     }
     if (info.PrimaryEmailAddress != null)
     {
         ValidateEmailAddress(info.PrimaryEmailAddress);
     }
     SimulateOnlineCall(MethodBase.GetCurrentMethod().Name, () =>
     {
         var original = accountManager.GetAccountById(info.AccountId);
         if (original == null)
         {
             throw new AccountNotExistsException();
         }
         EmailAccountInfo updated = null;
         if (info.ExtendedProperties == null)
         {// No extended properties to update, just copy the changed properties to original one
             if (info.PrimaryEmailAddress != null)
             {
                 original.PrimaryEmailAddress = info.PrimaryEmailAddress;
             }
             if (info.DisplayName != null)
             {
                 original.DisplayName = info.DisplayName;
             }
             if (info.FirstName != null)
             {
                 original.FirstName = info.FirstName;
             }
             if (info.LastName != null)
             {
                 original.LastName = info.LastName;
             }
             updated = original;
         }
         else
         {// There is some extended properties to update, copy original properties to non-changed ones
             if (info.PrimaryEmailAddress == null)
             {
                 info.PrimaryEmailAddress = original.PrimaryEmailAddress;
             }
             if (info.DisplayName == null)
             {
                 info.DisplayName = original.DisplayName;
             }
             if (info.FirstName == null)
             {
                 info.FirstName = original.FirstName;
             }
             if (info.LastName == null)
             {
                 info.LastName = original.LastName;
             }
             if (original.ExtendedProperties != null)
             {
                 foreach (var pair in original.ExtendedProperties)
                 {
                     if (!info.ExtendedProperties.ContainsKey(pair.Key))
                     {
                         info.ExtendedProperties.Add(pair.Key, pair.Value);
                     }
                 }
             }
             // this should not be changed by this method, there are specific methods for enable/disable
             info.Enabled = original.Enabled;
             updated      = info;
         }
         ValidateEmailAddress(info.PrimaryEmailAddress);
         if (info.AdditionalEmailAddresses != null)
         {
             foreach (string emailAddress in info.AdditionalEmailAddresses)
             {
                 ValidateEmailAddress(emailAddress);
             }
         }
         accountManager.UpdateAccount(info);
     });
 }