Exemplo n.º 1
0
        //Delete Item
        public void Delete(CreditCard creditCard)
        {
            LogRepository logRepository = new LogRepository();
            string        computerName  = logRepository.GetComputerName();
            string        adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0];

            using (TransactionScope ts = TransactionUtils.CreateTransactionScope())
            {
                using (ccdbDC creditCardDatabase = new ccdbDC(ConfigurationManager.ConnectionStrings["CreditCardDatabase"].ConnectionString))
                {
                    creditCardDatabase.spDesktopDataAdmin_DeleteCreditCard_v1(creditCard.CreditCardToken);
                }
                using (HierarchyDC desktopDatabase = new HierarchyDC(Settings.getConnectionString()))
                {
                    desktopDatabase.spDesktopDataAdmin_DeleteClientTopUnitCreditCard_v1(
                        creditCard.CreditCardId,
                        adminUserGuid,
                        creditCard.VersionNumber,
                        Settings.ApplicationName(),
                        Settings.ApplicationVersion(),
                        null,
                        computerName,
                        null,
                        null,
                        13,
                        null,
                        null,
                        null
                        );
                }
                ts.Complete();
            }
        }
Exemplo n.º 2
0
        public bool ChangeWorkflowStep(CodeTorch.Core.Workflow workflow, WorkflowNextStep nextStep, string entityIDValue, string comment)
        {
            bool success = false;


            //get current workflow step
            WorkflowStep currentStep = GetCurrentWorkflowStep(workflow, entityIDValue);

            //see if next workflowstep is in possible
            WorkflowNextStep validNextStep = currentStep.PossibleNextSteps.
                                             Where(s => s.Code.ToLower() == nextStep.Code.ToLower()).SingleOrDefault();

            if (validNextStep != null)
            {
                //check comments
                if ((validNextStep.RequireComment) && (String.IsNullOrEmpty(comment)))
                {
                    throw new ApplicationException("Comments are required to change to this step");
                }
                else
                {
                    WorkflowStep step = workflow.GetStepByCode(validNextStep.Code);


                    string userName;
                    userName = UserIdentityService.GetInstance().IdentityProvider.GetUserName();

                    using (TransactionScope rootScope = TransactionUtils.CreateTransactionScope())
                    {
                        foreach (BaseWorkflowAction action in step.Actions)
                        {
                            action.Execute(null, workflow.Code, currentStep.Code, validNextStep.Code, entityIDValue, comment, userName);
                        }

                        //update workflow step
                        SetStep(workflow, step, entityIDValue, comment);

                        if (step.UpdateEntityWithStatusCode)
                        {
                            //update existing table status
                            SetEntityStatus(workflow, step, entityIDValue);
                        }

                        success = true;

                        rootScope.Complete();
                    }
                }
            }
            else
            {
                //invalid - someone may have changed status
                throw new ApplicationException("Status cannot be changed at this time");
            }


            return(success);
        }
        //Add Data From Linked Tables for Display

        /*public void EditForDisplay(CreditCardClientAccount creditCardClientAccount)
         * {
         *      CreditCardRepository creditCardRepository = new CreditCardRepository();
         *      CreditCard creditCard = new CreditCard();
         *      creditCard = creditCardRepository.GetCreditCard(creditCardClientAccount.CreditCardId);
         *      if (creditCard != null)
         *      {
         *              creditCardClientAccount.CreditCardHolderName = creditCard.CreditCardHolderName;
         *      }
         *
         *      ClientAccountRepository clientAccountRepository = new ClientAccountRepository();
         *      ClientAccount clientAccount = new ClientAccount();
         *      clientAccount = clientAccountRepository.GetClientAccount(creditCardClientAccount.ClientAccountNumber, creditCardClientAccount.SourceSystemCode);
         *      if (clientAccount != null)
         *      {
         *              creditCardClientAccount.ClientAccountName = clientAccount.ClientAccountName;
         *      }
         *
         * }
         */
        //Add CreditCard for ClientAccount
        public void Add(CreditCard creditCard, string can, string ssc)
        {
            LogRepository logRepository = new LogRepository();
            string        computerName  = logRepository.GetComputerName();

            string adminUserGuid          = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0];
            string maskedCreditCardNumber = creditCard.CreditCardNumber.Substring(creditCard.CreditCardNumber.Length - 4).PadLeft(creditCard.CreditCardNumber.Length, '*');
            string maskedCVVNumber        = (!string.IsNullOrEmpty(creditCard.CVV)) ? new string('*', creditCard.CVV.Length) : string.Empty;
            string creditCardToken        = "";

            //Valid To Date Should Be End Of Month
            DateTime creditCardValidTo = new DateTime(creditCard.CreditCardValidTo.Year, creditCard.CreditCardValidTo.Month, 1).AddMonths(1).AddDays(-1);

            using (TransactionScope ts = TransactionUtils.CreateTransactionScope())
            {
                using (ccdbDC creditCardDatabase = new ccdbDC(ConfigurationManager.ConnectionStrings["CreditCardDatabase"].ConnectionString))
                {
                    creditCardDatabase.spDesktopDataAdmin_InsertCreditCard_v1(creditCard.CreditCardNumber, creditCard.CVV, ref creditCardToken);
                }

                using (HierarchyDC desktopDatabase = new HierarchyDC(Settings.getConnectionString()))
                {
                    desktopDatabase.spDesktopDataAdmin_InsertClientAccountCreditCard_v1(
                        ssc,
                        can,
                        creditCardToken,
                        maskedCreditCardNumber,
                        maskedCVVNumber,
                        creditCard.CreditCardValidFrom,
                        creditCardValidTo,
                        creditCard.CreditCardIssueNumber,
                        creditCard.CreditCardHolderName,
                        creditCard.CreditCardVendorCode,
                        creditCard.ClientTopUnitGuid,
                        creditCard.CreditCardTypeId,
                        creditCard.ProductId,
                        creditCard.SupplierCode,
                        adminUserGuid,
                        Settings.ApplicationName(),
                        Settings.ApplicationVersion(),
                        null,
                        computerName,
                        null,
                        null,
                        creditCard.ClientSubUnitGuid,
                        null,
                        null
                        );
                }
                ts.Complete();
            }
        }
Exemplo n.º 4
0
        public void Send(EmailMessage message)
        {
            string AddressID = null;

            using (TransactionScope rootScope = TransactionUtils.CreateTransactionScope())
            {
                message.ID = Guid.NewGuid().ToString();

                InsertMailMessage(message);
                InsertAddress(message, message.From, "FROM");

                foreach (EmailAddress address in message.To)
                {
                    InsertAddress(message, address, "TO");
                }

                foreach (EmailAddress address in message.To)
                {
                    InsertAddress(message, address, "CC");
                }

                foreach (EmailAddress address in message.To)
                {
                    InsertAddress(message, address, "BCC");
                }

                foreach (EmailAddress address in message.ReplyTo)
                {
                    InsertAddress(message, address, "REPLYTO");
                }

                foreach (EmailAttachment attachment in message.Attachments)
                {
                    InsertAttachment(message, attachment);
                }

                rootScope.Complete();
            }
        }