public xmlClassOutput checkAccountTrialExpiry()
        {
            List<Account> accountList = new List<Account>();
            accountList = CCaccountRepo.Accounts.Where(a=>a.isOverFlow == false).ToList();

            xmlClassOutput resultsObj = new xmlClassOutput();
            resultsObj.title = "List of Expired Accounts";
            resultsObj.accountNameList = new List<string>();

            foreach(var acc in accountList)
            {
                try
                {
                    if ((acc.TrialEnds == DateTime.Now.Date) & (acc.HasPurchased == false))
                    {
                        var user = CCUserRepository.Users.FirstOrDefault(u => u.AccountID == acc.ID && u.UserType != "SystemAdmin");
                        if (user != null)
                        {
                            bool executeStatus = CCaccountRepo.setAccountStatus(true, acc.ID);

                            var notifObj = new Notification()
                            {
                                Subject = "Corporate Contacts Trial Expiry",
                                RecipientAddress = user.Email,
                                Message = "<div><center> <table border='0' cellpadding='0' cellspacing='0' height='100%' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> </tr><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td align='center' valign='top' width='600' style='padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;border-top:1px solid #cccccc;border-right:1px solid #cccccc;border-left:1px solid #cccccc;background-color:#ffffff'><img src='http://corporate-contacts.com/wp-content/uploads/2014/03/CorporateContactslogo3a2.png' style='max-width: 450px;margin-top: 20px;' alt='Dyn'></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc;background-color:#ffffff'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color:#ffffff'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='top' style='padding-top:20px;padding-right:30px;padding-left:30px'><table align='left' border='0' cellpadding='0' cellspacing='0'> <tbody><tr> <td valign='top' style='color:#444444;font-family:Helvetica;font-size:16px;line-height:125%;text-align:left;padding-bottom:20px'><p>Dear " + user.FullName + "</p><p>Thank you for trying Corporate Contacts. </p><p>Your 15 day trial period has now expired. We hope you tried all of the features available and have decided on the package that's right for you.  Click <a href=''>here</a> to purchase the account you require and continue using Corporate Contacts.</p><p>Don't worry! If you decide this package is not right for you and your business you can easily select and alternative by visiting the Billings Option page and upgrade or downgrade your chosen package.</p><p>Regards,<br><a style='text-decoration:underline;color:#0066cc' href='http://corporate-contacts.com/' target='_blank'>The Corporate Contacts team</a></p><p><a href='http://www.support.corporate-contacts.com'>www.support.corporate-contacts.com</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color: #209FD1;'> <tbody><tr> <td align='center' valign='bottom'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td valign='bottom' width='600' style='padding-top:0px;padding-right:20px;padding-left:20px;padding-bottom:10px'><table align='left' border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Corporate Contacts Ltd.<br>Beverley, UK.</td><td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Phone: +44 1482 869700<br>E-Mail: [email protected]</td></tr></tbody></table> </td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></center></div>"
                            };
                            notifManager.SendNotification(notifObj);

                            resultsObj.accountNameList.Add(acc.AccountName);
                        }
                    }
                }
                catch (Exception ex)
                { }
            }

            return resultsObj;
        }
        public xmlClassOutput freezeAccount()
        {
            List<Account> accountList = new List<Account>();
            accountList = CCaccountRepo.Accounts.Where(a => a.isOverFlow == false).ToList();

            xmlClassOutput resultsObj = new xmlClassOutput();
            resultsObj.title = "List of Frozen Accounts";
            resultsObj.accountNameList = new List<string>();

            foreach (var acc in accountList)
            {
                try
                {
                    if (checkToFreezeAccount(acc) == 1)
                    {
                        var user = CCUserRepository.Users.FirstOrDefault(u => u.AccountID == acc.ID && u.UserType != "SystemAdmin");
                        if (user != null)
                        {
                            bool executeStatus = CCaccountRepo.setAccountStatus(true, acc.ID);
                            var notifObj = new Notification()
                            {
                                Subject = "Corporate Contacts – account being paused",
                                RecipientAddress = user.Email,
                                Message = "<div><center> <table border='0' cellpadding='0' cellspacing='0' height='100%' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> </tr><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td align='center' valign='top' width='600' style='padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;border-top:1px solid #cccccc;border-right:1px solid #cccccc;border-left:1px solid #cccccc;background-color:#ffffff'><img src='http://corporate-contacts.com/wp-content/uploads/2014/03/CorporateContactslogo3a2.png' style='max-width: 450px;margin-top: 20px;' alt='Dyn'></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc;background-color:#ffffff'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color:#ffffff'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='top' style='padding-top:20px;padding-right:30px;padding-left:30px'><table align='left' border='0' cellpadding='0' cellspacing='0'> <tbody><tr> <td valign='top' style='color:#444444;font-family:Helvetica;font-size:16px;line-height:125%;text-align:left;padding-bottom:20px'><p>Dear " + user.FullName + "</p><p>Your Corporate Contacts account for " + acc.AccountName + " has been paused. This is because you have reached the limit of Connections of Items for your current plan.</p><p>To continue using the Corporate Contacts please go to our Billing Options page and upgrade your plan. Alternatively you can delete some of your contact or appointment items. However doing this may mean you do not get the full benefits of this software.</p><p>Please note this email is automatically generated. Do not reply to this email.</p><p>For assistance visit www.support.corporate-contacts.com or call +44 1482 869700.</p><p>Regards,<br><a style='text-decoration:underline;color:#0066cc' href='http://corporate-contacts.com/' target='_blank'>The Corporate Contacts team</a></p><p><a href='http://www.support.corporate-contacts.com'>www.support.corporate-contacts.com</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color: #209FD1;'> <tbody><tr> <td align='center' valign='bottom'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td valign='bottom' width='600' style='padding-top:0px;padding-right:20px;padding-left:20px;padding-bottom:10px'><table align='left' border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Corporate Contacts Ltd.<br>Beverley, UK, HU17 0LD<br>Manchester, NH 03101</td><td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Phone: +44 1482 869700<br>E-Mail: [email protected]</td></tr></tbody></table> </td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></center></div>"
                            };
                            notifManager.SendNotification(notifObj);

                            resultsObj.accountNameList.Add(acc.AccountName);
                        }
                    }
                }
                catch (Exception ex)
                { }
            }

            return resultsObj;
        }