Ejemplo n.º 1
0
        // GET: InformationCardForPromotion
        public ActionResult Index()
        {
            EmployeeCodeNo = WindowsUserIdentity;// WindowsUserIdentity;//"90044011";// "90044140"; //
            EmployeesCodesBLL employeesCodes = new EmployeesCodesBLL().GetByEmployeeCodeNo(EmployeeCodeNo);


            Result result = new PromotionCardsPrintingBLL().CheckPromotionCardsPrintingForEmployeeByEmployeeCodeID(employeesCodes.EmployeeCodeID);
            PromotionCardsPrintingBLL ResultPromotionCardsPrintingBLL = (PromotionCardsPrintingBLL)result.Entity;

            if (result.EnumMember == PromotionCardsPrintingValidationEnum.RejectedBecauseOfThereIsNoActivePromotionPeriod.ToString())
            {
                return(View("NoActivePromotionsPeriods"));
            }
            else if (result.EnumMember == PromotionCardsPrintingValidationEnum.RejectedBecauseOfEmployeeHaveRecordWithSamePeriod.ToString())
            {
                ViewBag.PrintedBefor = true.ToString();
                return(View(new PromotionCardsPrintingDetailsViewModel()
                {
                    PromotionCardPrintingID = ResultPromotionCardsPrintingBLL.PromotionCardPrintingID, EmployeeCodeID = ResultPromotionCardsPrintingBLL.EmployeesCodes.EmployeeCodeID
                }));
            }
            else
            {
                ViewBag.PrintedBefor = false.ToString();
                return(View(new PromotionCardsPrintingDetailsViewModel()
                {
                    PromotionPeriodID = ResultPromotionCardsPrintingBLL.PromotionsPeriod.PromotionPeriodID, EmployeeCodeID = ResultPromotionCardsPrintingBLL.EmployeesCodes.EmployeeCodeID
                }));
            }
        }
Ejemplo n.º 2
0
        public ActionResult Create(PromotionCardsPrintingViewModel PromotionCardPrintingVM)
        {
            PromotionCardsPrintingBLL PromotionCardPrintingBLL = new PromotionCardsPrintingBLL()
            {
                EmployeesCodes = new EmployeesCodesBLL()
                {
                    EmployeeCodeID = PromotionCardPrintingVM.EmployeeCodeID
                },
                PromotionsPeriod = new PromotionsPeriodsBLL()
                {
                    PromotionPeriodID = PromotionCardPrintingVM.PromotionPeriodID
                },
                LoginIdentity = new EmployeesCodesBLL()
                {
                    EmployeeCodeID = UserIdentity.EmployeeCodeID
                },
            };
            Result result = PromotionCardPrintingBLL.Add();

            if ((System.Type)result.EnumType == typeof(LookupsValidationEnum))
            {
                if (result.EnumMember == LookupsValidationEnum.Done.ToString())
                {
                    PromotionCardPrintingVM.PromotionCardPrintingID = ((PromotionCardsPrintingBLL)result.Entity).PromotionCardPrintingID;
                }
            }
            return(Json(new { PromotionCardPrintingVM.EmployeeCodeID, PromotionCardPrintingVM.PromotionPeriodID }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public JsonResult GetInformationCardForPromotionConfirmed(int PromotionPeriodID)
        {
            var list = new PromotionCardsPrintingBLL().GetPromotionCardsPrintingByPromotionPeriodID(PromotionPeriodID)
                       .Select(x => new
            {
                PromotionCardPrintingID = x.PromotionCardPrintingID,
                EmployeeCodeNo          = x.EmployeesCodes.EmployeeCodeNo,
                EmployeeNameAr          = x.EmployeesCodes.Employee.EmployeeNameAr,
                PromotionStartDate      = x.PromotionsPeriod.PromotionStartDate,
                PromotionEndDate        = x.PromotionsPeriod.PromotionEndDate,
                MaturityYear            = x.PromotionsPeriod.Year.MaturityYear
            });

            return(Json(new { data = list }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 4
0
        public ActionResult Approved(PromotionCardsPrintingDetailsViewModel PromotionCardsPrintingDetailsViewModel)
        {
            #region  Validate ViewModel
            bool IsApprovedYouHaveJobWithAllowncesAndGotJobWithoutAllowncesDetails = false;
            if (PromotionCardsPrintingDetailsViewModel.IsApprovedYouHaveJobWithAllowncesAndGotJobWithoutAllowncesDetails == null)
            {
                throw new CustomException(Resources.Globalization.ValidateIsApprovedYouHaveJobWithAllowncesAndGotJobWithoutAllowncesDetailsText);
            }

            if (!PromotionCardsPrintingDetailsViewModel.IsApprovedDetails)
            {
                throw new CustomException(Resources.Globalization.ValidationRatificationText);
            }

            IsApprovedYouHaveJobWithAllowncesAndGotJobWithoutAllowncesDetails = (bool)PromotionCardsPrintingDetailsViewModel.IsApprovedYouHaveJobWithAllowncesAndGotJobWithoutAllowncesDetails;
            #endregion
            var IsApprovedYouHaveJobWithAllowncesAndGotJobWithoutAllowncesText = IsApprovedYouHaveJobWithAllowncesAndGotJobWithoutAllowncesDetails ? Resources.Globalization.YesText : Resources.Globalization.NoText;

            Result result = new PromotionCardsPrintingBLL()
            {
                LoginIdentity = new EmployeesCodesBLL()
                {
                    EmployeeCodeID = PromotionCardsPrintingDetailsViewModel.EmployeeCodeID
                },
                PromotionsPeriod = new PromotionsPeriodsBLL()
                {
                    PromotionPeriodID = PromotionCardsPrintingDetailsViewModel.PromotionPeriodID
                },
                EmployeesCodes = new EmployeesCodesBLL()
                {
                    EmployeeCodeID = PromotionCardsPrintingDetailsViewModel.EmployeeCodeID
                }
            }.Add();
            PromotionCardsPrintingBLL PromotionCardsPrinting;
            if (result.EnumMember == PromotionCardsPrintingValidationEnum.Done.ToString())
            {
                PromotionCardsPrinting = (PromotionCardsPrintingBLL)result.Entity;
                return(Redirect(string.Format("~/WebForms/Reports/AfterRatificationPromotionCard.aspx?EmployeeCodeID={0}&PromotionPeriodID={1}&PromotionCardPrintingID={2}&IsApprovedYouHaveJobWithAllowncesAndGotJobWithoutAllownces={3}", PromotionCardsPrinting.EmployeesCodes.EmployeeCodeID, PromotionCardsPrinting.PromotionsPeriod.PromotionPeriodID, PromotionCardsPrinting.PromotionCardPrintingID, IsApprovedYouHaveJobWithAllowncesAndGotJobWithoutAllowncesText)));
            }
            else if (result.EnumMember == PromotionCardsPrintingValidationEnum.RejectedBecauseOfEmployeeHaveRecordWithSamePeriod.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationEmployeeHasRecordWithSamePeriodText);
            }
            return(Json(new { PromotionPeriodID = PromotionCardsPrintingDetailsViewModel.PromotionPeriodID }, JsonRequestBehavior.AllowGet));
        }