Exemple #1
0
        public virtual Result Add()
        {
            Result result = null;

            #region Check AssignedJobCategory same JobCategory
            if (this.AssignedJobCategory.JobCategoryID == this.JobCategory.JobCategoryID)
            {
                result            = new Result();
                result.Entity     = this;
                result.EnumMember = PromotionsJobsCategoriesValidationEnum.RejectedBecauseAssignedJobCategorySameJobCategory.ToString();
                result.EnumType   = typeof(PromotionsJobsCategoriesValidationEnum);
                return(result);
            }
            #endregion

            #region Check if JobCategory It has Promotion Record
            if (new PromotionsRecordsBLL().GetByJobCategory(this.JobCategory.JobCategoryID, this.PromotionPeriod.PromotionPeriodID).Count > 0)
            {
                result            = new Result();
                result.Entity     = this;
                result.EnumMember = JobsCategoriesValidationEnum.RejectedBecauseOfItHasPromotionRecord.ToString();
                result.EnumType   = typeof(JobsCategoriesValidationEnum);
                return(result);
            }
            #endregion

            result = new Result();
            PromotionsJobsCategories PromotionJobCategory = new PromotionsJobsCategories();
            PromotionJobCategory.JobCategoryID         = this.JobCategory.JobCategoryID;
            PromotionJobCategory.PromotionPeriodID     = this.PromotionPeriod.PromotionPeriodID;
            PromotionJobCategory.AssignedJobCategoryID = this.AssignedJobCategory.JobCategoryID;
            PromotionJobCategory.CreatedDate           = DateTime.Now;
            PromotionJobCategory.CreatedBy             = this.LoginIdentity.EmployeeCodeID;
            this.PromotionJobCategoryID = new PromotionsJobsCategoriesDAL().Insert(PromotionJobCategory);
            if (this.PromotionJobCategoryID != 0)
            {
                result.Entity     = this;
                result.EnumType   = typeof(LookupsValidationEnum);
                result.EnumMember = LookupsValidationEnum.Done.ToString();
            }

            return(result);
        }
Exemple #2
0
 public PromotionsJobsCategoriesBLL MapPromotionJobCategory(PromotionsJobsCategories PromotionJobCategory)
 {
     try
     {
         PromotionsJobsCategoriesBLL PromotionsJobsCategoriesBLL = null;
         if (PromotionJobCategory != null)
         {
             PromotionsJobsCategoriesBLL = new PromotionsJobsCategoriesBLL()
             {
                 PromotionJobCategoryID = PromotionJobCategory.PromotionJobCategoryID,
             };
             if (PromotionJobCategory.JobsCategories != null)
             {
                 PromotionsJobsCategoriesBLL.JobCategory = new JobsCategoriesBLL().MapJobCategory(PromotionJobCategory.JobsCategories);
             }
             if (PromotionJobCategory.PromotionsPeriods != null)
             {
                 PromotionsJobsCategoriesBLL.PromotionPeriod = new PromotionsPeriodsBLL().MapPromotionPeriod(PromotionJobCategory.PromotionsPeriods);
             }
             else
             {
                 PromotionsJobsCategoriesBLL.PromotionPeriod = new PromotionsPeriodsBLL();
             }
             if (PromotionJobCategory.AssignedJobsCategories != null)
             {
                 PromotionsJobsCategoriesBLL.AssignedJobCategory = new JobsCategoriesBLL().MapJobCategory(PromotionJobCategory.AssignedJobsCategories);
             }
             else
             {
                 PromotionsJobsCategoriesBLL.AssignedJobCategory = new JobsCategoriesBLL();
             }
         }
         return(PromotionsJobsCategoriesBLL);
     }
     catch
     {
         throw;
     }
 }