public virtual Result Remove(int PromotionJobCategoryID) { try { Result result = null; #region Check if JobCategory It has Promotion Record PromotionsJobsCategoriesBLL PromotionJobCategory = new PromotionsJobsCategoriesBLL().GetPromotionsJobsCategoriesByPromotionJobCategoryID(PromotionJobCategoryID); if (PromotionJobCategory != null) { if (new PromotionsRecordsBLL().GetByJobCategory(PromotionJobCategory.JobCategory.JobCategoryID, PromotionJobCategory.PromotionPeriod.PromotionPeriodID).Count > 0) { result = new Result(); result.Entity = this; result.EnumMember = JobsCategoriesValidationEnum.RejectedBecauseOfItHasPromotionRecord.ToString(); result.EnumType = typeof(JobsCategoriesValidationEnum); return(result); } } #endregion new PromotionsJobsCategoriesDAL().Delete(PromotionJobCategoryID, this.LoginIdentity.EmployeeCodeID); return(result = new Result() { EnumType = typeof(LookupsValidationEnum), EnumMember = LookupsValidationEnum.Done.ToString() }); } catch { throw; } }
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; } }