Example #1
0
        public HttpResponseMessage RemovePromotionJobCategory(int id)
        {
            Result result = null;

            result = new PromotionsJobsCategoriesBLL()
            {
                LoginIdentity = UserIdentity
            }.Remove(id);
            if ((System.Type)result.EnumType == typeof(JobsCategoriesValidationEnum))
            {
                if (result.EnumMember == JobsCategoriesValidationEnum.RejectedBecauseOfItHasPromotionRecord.ToString())
                {
                    throw new CustomException(Resources.Globalization.ValidationJobCategoryHasPromotionRecordText);
                }
            }
            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
Example #2
0
        public HttpResponseMessage AddPromotionJobCategory(JobsCategoriesViewModel JobCategoryVM)
        {
            PromotionsJobsCategoriesBLL PromotionJobCategory = new PromotionsJobsCategoriesBLL()
            {
                JobCategory = new JobsCategoriesBLL()
                {
                    JobCategoryID = JobCategoryVM.PromotionJobCategory.JobCategory.JobCategoryID
                },
                PromotionPeriod = new PromotionsPeriodsBLL()
                {
                    PromotionPeriodID = (int)JobCategoryVM.PromotionPeriodID
                },
                AssignedJobCategory = new JobsCategoriesBLL()
                {
                    JobCategoryID = (int)JobCategoryVM.AssignedJobCategoryJobCategoryID
                },
                LoginIdentity = UserIdentity
            };
            Result result = PromotionJobCategory.Add();

            if ((System.Type)result.EnumType == typeof(JobsCategoriesValidationEnum))
            {
                if (result.EnumMember == JobsCategoriesValidationEnum.RejectedBecauseOfItHasPromotionRecord.ToString())
                {
                    throw new CustomException(Resources.Globalization.ValidationJobCategoryHasPromotionRecordText);
                }
            }
            if ((System.Type)result.EnumType == typeof(PromotionsJobsCategoriesValidationEnum))
            {
                PromotionsJobsCategoriesBLL JobEntity = (PromotionsJobsCategoriesBLL)result.Entity;
                if (result.EnumMember == PromotionsJobsCategoriesValidationEnum.RejectedBecauseAssignedJobCategorySameJobCategory.ToString())
                {
                    throw new CustomException(Resources.Globalization.ValidationAssignedJobCategorySameJobCategoryText);
                }
            }
            if ((System.Type)result.EnumType == typeof(LookupsValidationEnum))
            {
                PromotionsJobsCategoriesBLL JobEntity = (PromotionsJobsCategoriesBLL)result.Entity;
                if (result.EnumMember == PromotionsJobsCategoriesValidationEnum.Done.ToString())
                {
                    JobCategoryVM.PromotionJobCategory.PromotionJobCategoryID = ((PromotionsJobsCategoriesBLL)result.Entity).PromotionJobCategoryID;
                }
            }
            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
Example #3
0
        public JsonResult GetPromotionsJobsCategoriesByJobCategoryID(int id)
        {
            List <PromotionsJobsCategoriesBLL> PromotionsJobsCategoriesList = new PromotionsJobsCategoriesBLL().GetPromotionsJobsCategoriesByJobCategoryID(id);

            return(Json(new { data = PromotionsJobsCategoriesList }, JsonRequestBehavior.AllowGet));
        }