示例#1
0
        public Coupon()
        {
            CreationDate = DateTime.Now;
            const int expirationDays = 14;

            ExpirationDate = CreationDate.AddDays(expirationDays);
        }
        public override ExecutionResult Run(IStepExecutionContext context)
        {
            var correctiveAction = new CorrectiveActionWorkflowData();

            correctiveAction.WorkflowId                = context.Workflow.Id;
            correctiveAction.CreationDate              = CreationDate;
            correctiveAction.Description               = Description;
            correctiveAction.FindingID                 = FindingID;
            correctiveAction.EmitterUserID             = EmitterUserID;
            correctiveAction.PlantLocationID           = PlantLocationID;
            correctiveAction.SectorLocationID          = SectorLocationID;
            correctiveAction.PlantTreatmentID          = PlantTreatmentID;
            correctiveAction.SectorTreatmentID         = SectorTreatmentID;
            correctiveAction.ResponsibleUserID         = ResponsibleUserID;
            correctiveAction.ReviewerUserID            = ReviewerUserID;
            correctiveAction.DeadlineDatePlanification = CreationDate.AddDays(_parametrizationCorrectiveActionRepository.GetByCode(STATE_PARAMETRIZATION_CORRECTIVEACTION_CODE_PLANIFICATION));

            correctiveAction.CorrectiveActionStateID = _correctiveActionStateRepository.GetByCode(STATE_OPEN_CODE);
            CorrectiveActionWorkflowData correctiveActionWorkFlowData = _correctiveActionRepository.Add(correctiveAction);

            _correctiveActionStateHistoryRepository.Add(correctiveActionWorkFlowData.CorrectiveActionID, correctiveActionWorkFlowData.CorrectiveActionStateID, EmitterUserID);

            EmailAddresses.AddRange(_userWorkflowRepository.GetUsersEmailResponsibleSGC());
            EmailAddresses.Add(_userWorkflowRepository.GetUserEmailByID(ResponsibleUserID));
            EmailAddresses.Add(_userWorkflowRepository.GetUserEmailByID(ReviewerUserID));
            EmailAddresses.AddRange(_sectorPlantRepository.GetSectorPlantReferredEmail(Convert.ToInt32(correctiveAction.PlantTreatmentID), Convert.ToInt32(correctiveAction.SectorTreatmentID)));

            correctiveAction = _correctiveActionRepository.GetOneByWorkflowId(correctiveAction.WorkflowId);
            var emailType = "new";

            this.EmailSubject = EmailStrings.GetSubjectCorrectiveAction(emailType);
            this.EmailMessage = EmailStrings.GetMessageCorrectiveAction(correctiveAction, _emailSettings.Url, emailType);

            return(ExecutionResult.Next());
        }
示例#3
0
 public Survey(string surveyTitle, DateTime?closingDate = null)
 {
     CreationDate = DateTime.Now;
     SurveyTitle  = surveyTitle;
     ClosingDate  = (closingDate == null) ? CreationDate.AddDays(7) : (DateTime)closingDate;
     SurveyGuid   = Guid.NewGuid().ToString();
 }
示例#4
0
 public void CheckDays()
 {
     if (CreationDate.AddDays(Convert.ToInt32(new PaidToPromotePack(PackId).Ends.Value)) <= AppSettings.ServerTime)
     {
         Finish();
     }
 }
示例#5
0
        public Coupon(IDateTimeProvider dateTimeProvider)
        {
            this.dateTimeProvider = dateTimeProvider;
            CreationDate          = dateTimeProvider.Now;
            const int expirationDays = 14;

            ExpirationDate = CreationDate.AddDays(expirationDays);
        }
示例#6
0
        public override bool InRangeOfTime(DateTime phraseTime)
        {
            var alarmMinDate = CreationDate.AddDays(-Int32.Parse(this.Time));

            DateTime timeWithoutSeconds      = new DateTime(phraseTime.Year, phraseTime.Month, phraseTime.Day);
            DateTime minDateWithoutSeconds   = new DateTime(alarmMinDate.Year, alarmMinDate.Month, alarmMinDate.Day);
            DateTime alarmDateWithoutSeconds = new DateTime(CreationDate.Year, CreationDate.Month, CreationDate.Day);

            return(timeWithoutSeconds >= minDateWithoutSeconds && minDateWithoutSeconds <= alarmDateWithoutSeconds);
        }
示例#7
0
        /// <summary>
        /// Создание этапа.
        /// </summary>
        /// <param name="name"> Имя этапа. </param>
        /// <param name="executor"> Исполнитель этапа. </param>
        /// <param name="comment"> Комментарий этапа. </param>
        public Stage(string name, Executor executor, string comment = "")
        {
            Name     = name;
            Executor = executor;
            Comment  = comment;

            CreationDate   = DateTime.Now;
            ExpirationDate = CreationDate.AddDays(2);
            Status         = Status.Created;
        }
示例#8
0
        /// <summary>
        /// Создание проекта.
        /// </summary>
        /// <param name="name"> Название проекта. </param>
        /// <param name="price"> Цена проекта. </param>
        /// <param name="executor"> Исполнитель проекта. </param>
        /// <param name="stages"> Этапы проекта. </param>
        public Project(string name, int price, Executor executor, List <Stage> stages)
        {
            Name     = name;
            Price    = price;
            Executor = executor;
            Stages   = stages;

            CreationDate   = DateTime.Now;
            ExpirationDate = CreationDate.AddDays(30);
            Status         = Status.Created;
        }
示例#9
0
        public DateTime GetLastPostingDate()
        {
            SavingInterestsPostingEvent lastPosting = (SavingInterestsPostingEvent)Events.OrderByDescending(
                item => item.Date).FirstOrDefault(item => item is SavingInterestsPostingEvent && !item.Deleted);

            if (lastPosting == null)
            {
                if (Product is SavingsBookProduct)
                {
                    if (((SavingsBookProduct)Product).InterestFrequency == OSavingInterestFrequency.EndOfDay ||
                        ((SavingBookContract)this).UseTermDeposit)
                    {
                        return(CreationDate.AddDays(-1));
                    }
                    return(CreationDate);
                }
                return(CreationDate);
            }
            return(lastPosting.Date);
        }
示例#10
0
 public bool IsExpired(int valueDaysUntilExpire)
 {
     return(CreationDate.AddDays(valueDaysUntilExpire) < DateTime.UtcNow.Date);
 }
 public virtual bool IsExpired(DateTime theDate)
 {
     return(CreationDate.AddDays(30) < theDate);
 }
示例#12
0
 // Empty constructor for EntityFramework
 public Survey()
 {
     SurveyGuid   = Guid.NewGuid().ToString();
     CreationDate = DateTime.Now;
     ClosingDate  = CreationDate.AddDays(7);
 }