示例#1
0
        public ActionResult Edit(ScholarshipsViewModel ScholarshipVM)
        {
            BaseScholarshipsBLL Scholarship = null;

            if (ScholarshipVM.ScholarshipType.ScholarshipTypeID == (int)ScholarshipsTypesEnum.Internal)
            {
                Scholarship = GenericFactoryPattern <BaseScholarshipsBLL, InternalScholarshipsBLL> .CreateInstance();

                ((InternalScholarshipsBLL)Scholarship).Location = ScholarshipVM.Location;
            }
            else if (ScholarshipVM.ScholarshipType.ScholarshipTypeID == (int)ScholarshipsTypesEnum.External)
            {
                Scholarship = GenericFactoryPattern <BaseScholarshipsBLL, ExternalScholarshipsBLL> .CreateInstance();
            }

            Scholarship.ScholarshipID        = ScholarshipVM.ScholarshipID;
            Scholarship.ScholarshipStartDate = ScholarshipVM.ScholarshipStartDate.Value.Date;
            Scholarship.ScholarshipEndDate   = ScholarshipVM.ScholarshipEndDate.Value.Date;
            Scholarship.ScholarshipReason    = ScholarshipVM.ScholarshipReason;
            Scholarship.LoginIdentity        = this.UserIdentity;
            Result result = Scholarship.Edit();

            if (result.EnumMember == ScholarshipsValidationEnum.RejectedBecauseOfAlreadyCanceled.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationScholarshipsAlreadyCanceledText);
            }
            else if (result.EnumMember == ScholarshipsValidationEnum.RejectedBecauseOfAlreadyPassed.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationScholarshipsAlreadyPassedText);
            }

            Classes.Helpers.CommonHelper.ConflictValidationMessage(result);

            return(Json(new { ScholarshipID = Scholarship.ScholarshipID }, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public ActionResult Joining(int id)
        {
            ScholarshipsJoiningViewModel ScholarshipVM = new ScholarshipsJoiningViewModel();
            BaseScholarshipsBLL          Scholarship   = this.GetByScholarshipID(id);

            if (Scholarship != null && Scholarship.ScholarshipID > 0)
            {
                Scholarship = Scholarship.GetByScholarshipID(id);
                ScholarshipVM.ScholarshipTypeID = (int)Scholarship.ScholarshipTypeEnum;
                if ((int)Scholarship.ScholarshipTypeEnum == (Int16)ScholarshipsTypesEnum.External)
                {
                    ScholarshipVM.Country = ((ExternalScholarshipsBLL)Scholarship).Country;
                }
                if ((int)Scholarship.ScholarshipTypeEnum == (Int16)ScholarshipsTypesEnum.Internal)
                {
                    ScholarshipVM.KSACity = ((InternalScholarshipsBLL)Scholarship).KSACity;
                }
                ScholarshipVM.ScholarshipID = Scholarship.ScholarshipID;
                //ScholarshipVM.Qualification = Scholarship.Qualification;
                ScholarshipVM.ScholarshipStartDate = Scholarship.ScholarshipStartDate.Date;
                ScholarshipVM.ScholarshipEndDate   = Scholarship.ScholarshipEndDate.Date;
                ScholarshipVM.ScholarshipPeriod    = Scholarship.ScholarshipPeriod;
                //ScholarshipVM.ScholarshipReason = Scholarship.ScholarshipReason;
            }
            return(View(ScholarshipVM));
        }
示例#3
0
        public ActionResult Edit(int id)
        {
            ScholarshipsViewModel ScholarshipVM = new ScholarshipsViewModel();
            BaseScholarshipsBLL   Scholarship   = this.GetByScholarshipID(id);

            if (Scholarship != null && Scholarship.ScholarshipID > 0)
            {
                Scholarship = Scholarship.GetByScholarshipID(id);
                //ScholarshipVM.ScholarshipTypeID = (int)Scholarship.ScholarshipType;
                ScholarshipVM.ScholarshipType = new ScholarshipsTypesBLL()
                {
                    ScholarshipTypeID = Convert.ToInt32(Scholarship.ScholarshipTypeEnum)
                };
                if ((int)Scholarship.ScholarshipTypeEnum == (Int16)ScholarshipsTypesEnum.External)
                {
                    ScholarshipVM.Country = ((ExternalScholarshipsBLL)Scholarship).Country;
                }
                if ((int)Scholarship.ScholarshipTypeEnum == (Int16)ScholarshipsTypesEnum.Internal)
                {
                    ScholarshipVM.KSACity  = ((InternalScholarshipsBLL)Scholarship).KSACity;
                    ScholarshipVM.Location = ((InternalScholarshipsBLL)Scholarship).Location;
                }
                ScholarshipVM.ScholarshipID        = Scholarship.ScholarshipID;
                ScholarshipVM.ScholarshipReason    = Scholarship.ScholarshipReason;
                ScholarshipVM.ScholarshipStartDate = Scholarship.ScholarshipStartDate;
                ScholarshipVM.ScholarshipEndDate   = Scholarship.ScholarshipEndDate;
                ScholarshipVM.ScholarshipPeriod    = Scholarship.ScholarshipPeriod;
            }

            return(View(ScholarshipVM));
        }
示例#4
0
        public ActionResult GetScholarships(int EmployeeCarrerHistoryID, int PromotionPeriodID)
        {
            EmployeesCareersHistoryBLL emp = new EmployeesCareersHistoryBLL().GetByEmployeeCareerHistoryID(EmployeeCarrerHistoryID);
            PromotionsPeriodsBLL       PromotionPeriodBLL = new PromotionsPeriodsBLL().GetByPromotionPeriodID(PromotionPeriodID);
            var data = new BaseScholarshipsBLL().GetByEmployeeCodeIDNotPassed(emp.EmployeeCode.EmployeeCodeID, emp.JoinDate.Date, PromotionPeriodBLL.PromotionEndDate).Select(x => new
            {
                ScholarshipID        = x.ScholarshipID,
                ScholarshipStartDate = x.ScholarshipStartDate,
                ScholarshipPeriod    = x.ScholarshipPeriod,
                ScholarshipEndDate   = x.ScholarshipEndDate,
                IsPassed             = x.IsPassed
            });

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

            //return Json(new { data = new EmployeesCodesBLL().GetVacationsWithDetailsByEmployeeCodeID(id) }, JsonRequestBehavior.AllowGet);
        }
示例#5
0
        private BaseScholarshipsBLL GetByScholarshipID(int id)
        {
            BaseScholarshipsBLL Scholarship = null;

            Scholarship = new BaseScholarshipsBLL().GetByScholarshipID(id);
            if (Scholarship != null && Scholarship.ScholarshipID > 0)
            {
                if (Scholarship.ScholarshipTypeEnum == ScholarshipsTypesEnum.Internal)
                {
                    Scholarship = (InternalScholarshipsBLL)Scholarship;
                }
                else if (Scholarship.ScholarshipTypeEnum == ScholarshipsTypesEnum.External)
                {
                    Scholarship = (ExternalScholarshipsBLL)Scholarship;
                }
            }
            return(Scholarship);
        }
示例#6
0
        public ActionResult Joining(ScholarshipsJoiningViewModel ScholarshipVM)
        {
            BaseScholarshipsBLL Scholarship = null;

            if (ScholarshipVM.ScholarshipTypeID == (int)ScholarshipsTypesEnum.Internal)
            {
                Scholarship = GenericFactoryPattern <BaseScholarshipsBLL, InternalScholarshipsBLL> .CreateInstance();
            }
            else if (ScholarshipVM.ScholarshipTypeID == (int)ScholarshipsTypesEnum.External)
            {
                Scholarship = GenericFactoryPattern <BaseScholarshipsBLL, ExternalScholarshipsBLL> .CreateInstance();
            }

            Scholarship.ScholarshipID        = ScholarshipVM.ScholarshipID;
            Scholarship.ScholarshipStartDate = ScholarshipVM.ScholarshipStartDate.Value.Date;
            Scholarship.ScholarshipEndDate   = ScholarshipVM.ScholarshipEndDate.Value.Date;
            Scholarship.ScholarshipJoinDate  = ScholarshipVM.ScholarshipJoinDate.Value.Date;
            Scholarship.IsPassed             = ScholarshipVM.IsPassed;
            Scholarship.Notes = ScholarshipVM.Notes;

            Scholarship.LoginIdentity = this.UserIdentity;
            Result result = Scholarship.Joining();

            if (result.EnumMember == ScholarshipsValidationEnum.RejectedBecauseOfAlreadyCanceled.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationScholarshipsAlreadyCanceledText);
            }
            else if (result.EnumMember == ScholarshipsValidationEnum.RejectedBecauseOfAlreadyPassed.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationScholarshipsAlreadyPassedText);
            }
            else if (result.EnumMember == ScholarshipsValidationEnum.RejectedBecauseOfAlreadyJoinedBefore.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationScholarshipsAlreadyJoinedDateText);
            }
            else if (result.EnumMember == ScholarshipsValidationEnum.RejectedBecauseOfScholarshipJoinDateBeforeScholarshipStartDate.ToString())
            {
                throw new CustomException(Resources.Globalization.ValidationScholarshipJoinDateBeforeScholarshipStartDateText);
            }
            else
            {
                return(Json(new { ScholarshipID = Scholarship.ScholarshipID }, JsonRequestBehavior.AllowGet));
            }
        }
示例#7
0
        public JsonResult GetScholarships()
        {
            var data = new BaseScholarshipsBLL().GetScholarships()
                       .Select(x => new
            {
                ScholarshipID        = x.ScholarshipID,
                ScholarshipStartDate = Globals.Calendar.GetUmAlQuraDate(x.ScholarshipStartDate),
                ScholarshipEndDate   = Globals.Calendar.GetUmAlQuraDate(x.ScholarshipEndDate),
                ScholarshipType      = x.ScholarshipType.ScholarshipType,
                EmployeeCodeNo       = x.Employee.EmployeeCodeNo,
                EmployeeNameAr       = x.Employee.Employee.EmployeeNameAr,
                Qualification        = x.Qualification != null ? x.Qualification.QualificationName : null,
                ScholarshipReason    = x.ScholarshipReason,
                ScholarshipJoinDate  = x.ScholarshipJoinDate,
                IsPassed             = x.IsPassed,
                KSACityName          = x.ScholarshipType.ScholarshipTypeID == (int)ScholarshipsTypesEnum.Internal ? ((InternalScholarshipsBLL)x).KSACity.KSACityName : null,
                Location             = x.ScholarshipType.ScholarshipTypeID == (int)ScholarshipsTypesEnum.Internal ? ((InternalScholarshipsBLL)x).Location : null,
                CountryName          = x.ScholarshipType.ScholarshipTypeID == (int)ScholarshipsTypesEnum.External ? ((ExternalScholarshipsBLL)x).Country.CountryName : null,
                CreatedDate          = Globals.Calendar.GetUmAlQuraDate(x.CreatedDate)
            });

            return(Json(new { data = data }, JsonRequestBehavior.AllowGet));
        }
示例#8
0
        public ActionResult Extend(int id)
        {
            ScholarshipsExtentionViewModel ScholarshipVM = new ScholarshipsExtentionViewModel();
            BaseScholarshipsBLL            Scholarship   = this.GetByScholarshipID(id);

            if (Scholarship != null && Scholarship.ScholarshipID > 0)
            {
                Scholarship = Scholarship.GetByScholarshipID(id);
                ScholarshipVM.ScholarshipTypeID = (int)Scholarship.ScholarshipTypeEnum;
                if ((int)Scholarship.ScholarshipTypeEnum == (Int16)ScholarshipsTypesEnum.External)
                {
                    ScholarshipVM.Country = ((ExternalScholarshipsBLL)Scholarship).Country;
                }
                if ((int)Scholarship.ScholarshipTypeEnum == (Int16)ScholarshipsTypesEnum.Internal)
                {
                    ScholarshipVM.KSACity = ((InternalScholarshipsBLL)Scholarship).KSACity;
                }
                ScholarshipVM.ScholarshipID = Scholarship.ScholarshipID;
                ScholarshipVM.FromDate      = Scholarship.ScholarshipEndDate.AddDays(1);
                ScholarshipVM.ToDate        = null;
            }

            return(View(ScholarshipVM));
        }
示例#9
0
        public ActionResult Create(ScholarshipsViewModel ScholarshipVM)
        {
            BaseScholarshipsBLL EmployeeScholarship = null;

            switch (ScholarshipVM.ScholarshipType.ScholarshipTypeID)
            {
            case (int)ScholarshipsTypesEnum.Internal:
            {
                EmployeeScholarship = GenericFactoryPattern <BaseScholarshipsBLL, InternalScholarshipsBLL> .CreateInstance();

                EmployeeScholarship.ScholarshipTypeEnum  = (ScholarshipsTypesEnum)ScholarshipVM.ScholarshipType.ScholarshipTypeID;
                EmployeeScholarship.ScholarshipStartDate = ScholarshipVM.ScholarshipStartDate.Value;
                EmployeeScholarship.ScholarshipEndDate   = ScholarshipVM.ScholarshipEndDate.Value;
                EmployeeScholarship.Employee             = new EmployeesCodesBLL()
                {
                    EmployeeCodeID = ScholarshipVM.EmployeeCodeID
                };
                ((InternalScholarshipsBLL)EmployeeScholarship).Location = ScholarshipVM.Location;
                ((InternalScholarshipsBLL)EmployeeScholarship).KSACity  = new KSACitiesBLL()
                {
                    KSACityID = ScholarshipVM.KSACity.KSACityID
                };
                EmployeeScholarship.ScholarshipReason = ScholarshipVM.ScholarshipReason;
                EmployeeScholarship.Qualification     = new QualificationsBLL()
                {
                    QualificationID = ScholarshipVM.Qualification.QualificationID
                };
                EmployeeScholarship.LoginIdentity = UserIdentity;
                Result result = EmployeeScholarship.Add();

                if (result.EnumMember == ScholarshipsValidationEnum.Done.ToString())
                {
                    ScholarshipVM.ScholarshipID = ((InternalScholarshipsBLL)result.Entity).ScholarshipID;
                }

                Classes.Helpers.CommonHelper.ConflictValidationMessage(result);
                break;
            }

            case (int)ScholarshipsTypesEnum.External:
            {
                EmployeeScholarship = GenericFactoryPattern <BaseScholarshipsBLL, ExternalScholarshipsBLL> .CreateInstance();

                EmployeeScholarship.ScholarshipTypeEnum  = (ScholarshipsTypesEnum)ScholarshipVM.ScholarshipType.ScholarshipTypeID;
                EmployeeScholarship.ScholarshipStartDate = ScholarshipVM.ScholarshipStartDate.Value;
                EmployeeScholarship.ScholarshipEndDate   = ScholarshipVM.ScholarshipEndDate.Value;
                EmployeeScholarship.Employee             = new EmployeesCodesBLL()
                {
                    EmployeeCodeID = ScholarshipVM.EmployeeCodeID
                };
                EmployeeScholarship.ScholarshipReason = ScholarshipVM.ScholarshipReason;
                ((ExternalScholarshipsBLL)EmployeeScholarship).Country = new CountriesBLL()
                {
                    CountryID = ScholarshipVM.Country.CountryID
                };
                EmployeeScholarship.Qualification = new QualificationsBLL()
                {
                    QualificationID = ScholarshipVM.Qualification.QualificationID
                };
                EmployeeScholarship.LoginIdentity = UserIdentity;
                Result result = EmployeeScholarship.Add();

                if (result.EnumMember == ScholarshipsValidationEnum.Done.ToString())
                {
                    ScholarshipVM.ScholarshipID = ((ExternalScholarshipsBLL)result.Entity).ScholarshipID;
                }
                Classes.Helpers.CommonHelper.ConflictValidationMessage(result);
                break;
            }

            default:
                break;
            }

            return(Json(new { ScholarshipID = ScholarshipVM.ScholarshipID }, JsonRequestBehavior.AllowGet));
        }