Exemplo n.º 1
0
        public virtual Result CheckPromotionCardsPrintingForEmployeeByEmployeeCodeID(int EmployeeCodeID)
        {
            try
            {
                List <PromotionsPeriodsBLL> promotionsPeriods       = new PromotionsPeriodsBLL().GetPromotionsPeriods();
                PromotionsPeriodsBLL        promotionsPeriodsActive = promotionsPeriods.FirstOrDefault(c => (bool)c.IsActive);
                if (promotionsPeriodsActive == null)
                {
                    return(new Result()
                    {
                        Entity = this,
                        EnumType = typeof(PromotionCardsPrintingValidationEnum),
                        EnumMember = PromotionCardsPrintingValidationEnum.RejectedBecauseOfThereIsNoActivePromotionPeriod.ToString(),
                    });
                }

                List <PromotionCardsPrinting> promotionCardsPrintings = new PromotionCardsPrintingDAL().GetPromotionCardsPrintingByEmployeeCodeID(EmployeeCodeID);
                PromotionCardsPrinting        PromotionCardsPrinting  = promotionCardsPrintings.FirstOrDefault(c => c.PromotionPeriodID == promotionsPeriodsActive.PromotionPeriodID);
                if (PromotionCardsPrinting != null)
                {
                    return(new Result()
                    {
                        Entity = new PromotionCardsPrintingBLL().MapPromotionCardsPrinting(PromotionCardsPrinting),
                        EnumType = typeof(PromotionCardsPrintingValidationEnum),
                        EnumMember = PromotionCardsPrintingValidationEnum.RejectedBecauseOfEmployeeHaveRecordWithSamePeriod.ToString(),
                    });
                }


                return(new Result()
                {
                    Entity = new PromotionCardsPrintingBLL()
                    {
                        EmployeesCodes = new EmployeesCodesBLL()
                        {
                            EmployeeCodeID = EmployeeCodeID
                        }, PromotionsPeriod = new PromotionsPeriodsBLL()
                        {
                            PromotionPeriodID = promotionsPeriodsActive.PromotionPeriodID
                        }
                    },
                    EnumType = typeof(PromotionCardsPrintingValidationEnum),
                    EnumMember = PromotionCardsPrintingValidationEnum.Done.ToString(),
                });
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 2
0
 public virtual List <PromotionCardsPrintingBLL> GetPromotionCardsPrintingByPromotionPeriodID(int PromotionPeriodID)
 {
     try
     {
         List <PromotionCardsPrinting>    PromotionCardsPrintingList    = new PromotionCardsPrintingDAL().GetPromotionCardsPrintingByPromotionPeriodID(PromotionPeriodID);
         List <PromotionCardsPrintingBLL> PromotionCardsPrintingBLLList = new List <PromotionCardsPrintingBLL>();
         foreach (var item in PromotionCardsPrintingList)
         {
             PromotionCardsPrintingBLLList.Add(new PromotionCardsPrintingBLL().MapPromotionCardsPrinting(item));
         }
         return(PromotionCardsPrintingBLLList);
     }
     catch
     {
         throw;
     }
 }