Ejemplo n.º 1
0
        /// <summary>
        /// Delete researchIssue
        /// </summary>
        /// <param name="researchIssue">ResearchIssue</param>
        public virtual void DeleteResearchIssue(ResearchIssue researchIssue)
        {
            if (researchIssue == null)
            {
                throw new ArgumentNullException(nameof(researchIssue));
            }

            _researchIssueRepository.Delete(researchIssue);

            //event notification
            _eventPublisher.EntityDeleted(researchIssue);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Inserts researchIssue
        /// </summary>
        /// <param name="researchIssue">ResearchIssue</param>
        public virtual void InsertResearchIssue(ResearchIssue researchIssue)
        {
            if (researchIssue == null)
            {
                throw new ArgumentNullException(nameof(researchIssue));
            }

            if (researchIssue is IEntityForCaching)
            {
                throw new ArgumentException("Cacheable entities are not supported by Entity Framework");
            }

            _researchIssueRepository.Insert(researchIssue);

            //cache
            _cacheManager.RemoveByPattern(ResearchResearchIssueDefaults.ResearchIssuesPatternCacheKey);
            // _staticCacheManager.RemoveByPattern(ResearchResearchIssueDefaults.ResearchIssuesPatternCacheKey);

            //event notification
            _eventPublisher.EntityInserted(researchIssue);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Prepare researchIssue model
        /// </summary>
        /// <param name="model">ResearchIssue model</param>
        /// <param name="researchIssue">ResearchIssue</param>
        /// <param name="excludeProperties">Whether to exclude populating of some properties of model</param>
        /// <returns>ResearchIssue model</returns>
        public virtual ResearchIssueModel PrepareResearchIssueModel(ResearchIssueModel model, ResearchIssue researchIssue, bool excludeProperties = false)
        {
            if (researchIssue != null)
            {
                //fill in model values from the entity
                model            = model ?? researchIssue.ToModel <ResearchIssueModel>();
                model.Id         = researchIssue.Id;
                model.FiscalYear = researchIssue.FiscalYear;
                model.IssueCode  = researchIssue.IssueCode;
                model.Name       = researchIssue.Name;
            }
            else
            {
                model.IssueCode  = _researchIssueService.GetNextNumber();
                model.FiscalYear = DateTime.Today.Year + 543;
            }

            _baseAdminModelFactory.PrepareFiscalYears(model.AvailableFiscalYears, true, "--ระบุปี--");

            return(model);
        }