Пример #1
0
 public bool ActivateTrialAccount(Account accObj)
 {
     Account acc = context.Accounts.FirstOrDefault(a => a.ID == accObj.ID);
     if (acc != null)
     {
         if (acc.TrialEnds == null)
         {
             acc.TrialEnds = DateTime.Now.AddDays(CCGlobalValues.trialPeriod);
             context.SaveChanges();
             return true;
         }
         else
         {
             return false;
         }
     }
     else
     {
         return false;
     }
 }
Пример #2
0
 public Account SaveAccount(Account accObj)
 {
     if (accObj.ID == 0)
     {
         context.Accounts.Add(accObj);
         context.SaveChanges();
     }
     else
     {
         var acc = context.Accounts.FirstOrDefault(a => a.ID == accObj.ID);
         acc.AccountName = accObj.AccountName;
         acc.AdditionalDiscount = accObj.AdditionalDiscount;
         acc.PlanID = accObj.PlanID;
         //acc.ConnectionString = accObj.ConnectionString;
         acc.TablePrefix = accObj.TablePrefix;
         acc.StripeCustomerID = accObj.StripeCustomerID;
         acc.LastModifiedDate = DateTime.Now;
         acc.HasPurchased = accObj.HasPurchased;
         acc.isPaymentIssue = accObj.isPaymentIssue;
         acc.isOverFlow = accObj.isOverFlow;
         context.SaveChanges();
     }
     return accObj;
 }
        public int checkToFreezeAccount(Account acc)
        {
            var folderList = CCFolderRepository.CCFolders.Where(f => f.AccountGUID == acc.AccountGUID).ToList();

            foreach(var fold in folderList)
            {
                int FolderItemCount = CCItemRepository.CCContacts.Where(i => i.FolderID == fold.FolderID).Count();

                LimitationsViewModel limitationsObj = new LimitationsViewModel();
                HelperFunctions HF = new HelperFunctions();
                limitationsObj = HF.updateAccountLimitations(acc);

                if ((FolderItemCount > limitationsObj.maxItemCountPerFolder) | (fold.isOverFlow == true))
                {
                    return 1;
                }
            }
            return 0;
        }
Пример #4
0
 public bool UpdateAccountInfo(Account accObj)
 {
     Account acc = context.Accounts.FirstOrDefault(a => a.ID == accObj.ID);
     if (acc != null)
     {
         acc.AccountName = accObj.AccountName;
         acc.AdditionalDiscount = accObj.AdditionalDiscount;
         acc.PlanID = accObj.PlanID;
        // acc.ConnectionString = accObj.ConnectionString;
         acc.TablePrefix = accObj.TablePrefix;
         acc.StripeCustomerID = accObj.StripeCustomerID;
         acc.BusinessAddress = accObj.BusinessAddress;
         acc.TimeZone = accObj.TimeZone;
         acc.LastModifiedDate = DateTime.Now;
         acc.HasPurchased = accObj.HasPurchased;
         acc.isOverFlow = accObj.isOverFlow;
         context.SaveChanges();
         return true;
     }
     else
     {
         return false;
     }
 }
        public Account checkAccountTrialExpiryForAccount(Account acc)
        {
            try
            {
                if ((acc.TrialEnds <= DateTime.Now.Date) & (acc.HasPurchased == false) & (acc.isOverFlow != false))
                {
                    bool executeStatus = CCaccountRepo.setAccountStatus(true, acc.ID);
                    acc = CCaccountRepo.Accounts.FirstOrDefault(a => a.ID == acc.ID);
                    var user = CCUserRepository.Users.FirstOrDefault(u => u.AccountID == acc.ID);
                    var notifObj = new Notification()
                    {
                        Subject = "Corporate contacts Trial End!",
                        RecipientAddress = user.Email,
                        //RecipientAddress = "*****@*****.**",
                        // Message = "Hello, \n\n" + user.FullName + " \nAccount successfully created.\nPlease click the link below to activate your account.\n\n" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + user.GUID + "\n\nCorporate Contacts Team"
                        Message = "Dear " + user.FullName + ",\n"
                        + "This email is generated automatically by the system to notify you that your Trial Period for the registered Account '" + acc.AccountName + "' is over. Please contact one of our Support Staff "
                        + " on [email protected] to help you get back on track or you could simply log in back to your account and purchase a plan of your choice and cotninue enjoying with corporate-contacts.\n\n"

                        //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 registering with Corporate Contacts. You have created a new account</p><p><strong>Login Email :</strong> " + user.Email + "</p><p>You still need to <a>Click Here</a> to Activate your account or Please follow the link below:</p><p><a style='text-decoration:underline;color:#0066cc' href='" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + user.GUID + "' target='_blank'>" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + user.GUID + "</a></p><p>If you did not sign up for this account, this will be the onlycommunication you will receive. All non-confirmed accounts areautomatically deleted after 48 hours and no addresses are kept on file. Weapologize for any inconvenience this correspondence may have caused and weassure you that it was only sent at the request of someone visiting oursite requesting an account.</p><p>If you need help, you can find it here: <a href='http://support.corporate-contacts.com'>support.corporate-contacts.com</a></p><p>Regards,<br><a style='text-decoration:underline;color:#0066cc' href='http://corporate-contacts.com/' target='_blank'>The Corporate Contacts team</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);
                }
            }
            catch (Exception ex)
            { }

            return acc;
        }