示例#1
0
        public List <EmployeeDelegationBLL> GetEmployeeDelegationsBalanceForYears(int EmployeeCodeID)
        {
            try
            {
                EmployeesCodesBLL            EmployeeCodeBLL           = new EmployeesCodesBLL().GetByEmployeeCodeID(EmployeeCodeID); // check if employeecodeid exist or not
                List <FinancialYearsBLL>     FinancialYearsBLLList     = new FinancialYearsBLL().GetFinancialYears();
                List <EmployeeDelegationBLL> EmployeeDelegationBLLList = new List <EmployeeDelegationBLL>();
                if (FinancialYearsBLLList != null)
                {
                    if (EmployeeCodeBLL != null)
                    {
                        foreach (var item in FinancialYearsBLLList)
                        {
                            EmployeeDelegationBLLList.Add(new EmployeeDelegationBLL(item.FinancialYearStartDate,
                                                                                    item.FinancialYearEndDate,
                                                                                    (int)DelegationsKindsEnum.Tasks,
                                                                                    this.EmployeeCode = new EmployeesCodesBLL()
                            {
                                EmployeeCodeID = EmployeeCodeID
                            }));
                        }
                    }
                }

                return(EmployeeDelegationBLLList.OrderBy(x => x.DelegationFiscalYear).ToList());
            }
            catch
            {
                throw;
            }
        }
        private EmployeeExperiencesWithDetailsViewModel GetByEmployeeCodeID(int id)
        {
            EmployeesCodesBLL EmployeesCodesBLL = new EmployeesCodesBLL().GetByEmployeeCodeID(id);
            EmployeeExperiencesWithDetailsViewModel EmployeeExperienceVM = new EmployeeExperiencesWithDetailsViewModel();
            int year, month, days;

            new EmployeeExperiencesWithDetailsBLL().GetTotalEmployeeExperienceInYMD(id, out year, out month, out days);

            EmployeeExperienceVM.TotalYears  = year;
            EmployeeExperienceVM.TotalMonths = month;
            EmployeeExperienceVM.TotalDays   = days;
            EmployeeExperienceVM.EmployeeVM  = new EmployeesViewModel()
            {
                EmployeeCodeID           = EmployeesCodesBLL.EmployeeCodeID,
                EmployeeCodeNo           = EmployeesCodesBLL.EmployeeCodeNo,
                EmployeeNameAr           = EmployeesCodesBLL.Employee.EmployeeNameAr,
                EmployeeJobName          = EmployeesCodesBLL.EmployeeCurrentJob != null ? EmployeesCodesBLL.EmployeeCurrentJob.OrganizationJob.Job.JobName : null,
                EmployeeRankName         = EmployeesCodesBLL.EmployeeCurrentJob != null ? EmployeesCodesBLL.EmployeeCurrentJob.OrganizationJob.Rank.RankName : null,
                EmployeeOrganizationName = EmployeesCodesBLL.EmployeeCurrentJob != null ? EmployeesCodesBLL.EmployeeCurrentJob.OrganizationJob.OrganizationStructure.OrganizationName : null,
                HiringDate    = EmployeesCodesBLL.HiringRecord != null ? EmployeesCodesBLL.HiringRecord.JoinDate : (DateTime?)null,
                EmployeeIDNo  = EmployeesCodesBLL.Employee.EmployeeIDNo,
                EmployeeJobNo = EmployeesCodesBLL.EmployeeCurrentJob != null ? EmployeesCodesBLL.EmployeeCurrentJob.OrganizationJob.JobNo : null
            };
            return(EmployeeExperienceVM);
        }
示例#3
0
        public HttpResponseMessage GetVacationsByEmployeeCodeNo(string EmployeeCodeNo)
        {
            if (string.IsNullOrEmpty(EmployeeCodeNo))
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            EmployeesCodesBLL emp = new EmployeesCodesBLL().GetByEmployeeCodeNo(EmployeeCodeNo);

            if (emp != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, new EmployeesCodesBLL().GetVacationsDetailsByEmployeeCodeID(emp.EmployeeCodeID).Select(x => new
                {
                    VacationID = x.Vacation.VacationID,
                    VacationDetailID = x.VacationDetailID,
                    FromDate = x.FromDate,
                    ToDate = x.ToDate,
                    VacationPeriod = x.VacationPeriod,
                    VacationTypeName = x.Vacation.VacationTypeName,
                    VacationActionName = x.VacationAction.VacationActionName,
                }).OrderBy(x => x.FromDate)));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Employee not found!"));
            }
        }
示例#4
0
        public HttpResponseMessage GetPromotionRecordsByEmployeeCodeNo(string EmployeeCodeNo)
        {
            if (string.IsNullOrEmpty(EmployeeCodeNo))
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            EmployeesCodesBLL emp = new EmployeesCodesBLL().GetByEmployeeCodeNo(EmployeeCodeNo);

            if (emp != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, new EmployeesCodesBLL().GetPromotionRecordsByEmployeeCodeID(emp.EmployeeCodeID).Select(x => new
                {
                    Year = x.PromotionRecord.PromotionPeriod.Year.MaturityYear,
                    PeriodName = x.PromotionRecord.PromotionPeriod.Period.PeriodName,
                    PromotionRecordNo = x.PromotionRecord.PromotionRecordNo,
                    PromotionRecordDate = x.PromotionRecord.PromotionRecordDate,
                    RankName = x.CurrentEmployeeCareer.OrganizationJob.Rank.RankName,
                    JobName = x.CurrentEmployeeCareer.OrganizationJob.Job.JobName,
                    JobNo = x.CurrentEmployeeCareer.OrganizationJob.JobNo,
                    IsPromoted = x.NewEmployeeCareer,
                    IsRemoval = x.IsRemovedAfterIncluding,
                    PromotionCandidateAddedWayName = x.PromotionCandidateAddedWay.PromotionCandidateAddedWayName,
                })));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Employee not found!"));
            }
        }
示例#5
0
        /// <summary>
        ///  to get all organizations that the employee was assigned to these organization as manager
        /// </summary>
        /// <param name="ManagerCodeNo"></param>
        /// <returns></returns>
        public List <OrganizationsStructuresBLL> GetAllOrganizationsForManagerByManagerCodeNo(string ManagerCodeNo)
        {
            try
            {
                EmployeesCodesBLL EmployeeCodeBLL = new EmployeesCodesBLL().GetByEmployeeCodeNo(ManagerCodeNo);
                if (EmployeeCodeBLL != null)
                {
                    List <OrganizationsStructures> OrganizationsStructuresList = new OrganizationsStructuresDAL().GetOrganizationsUnderManagerByManagerCodeID(EmployeeCodeBLL.EmployeeCodeID);
                    if (OrganizationsStructuresList.Count() > 0)
                    {
                        List <OrganizationsStructuresBLL> OrganizationsStructureBLLList = new List <OrganizationsStructuresBLL>();
                        foreach (var item in OrganizationsStructuresList)
                        {
                            OrganizationsStructureBLLList.Add(MapOrganization(item));
                        }

                        return(OrganizationsStructureBLLList);
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#6
0
        //[OutputCache(Duration = 40, VaryByCustom = "SessionID")]
        public ActionResult UserProfile()
        {
            EmployeesCodesBLL Employee = null;

            if (Session["Employee"] != null)
            {
                Employee = (EmployeesCodesBLL)Session["Employee"];
            }
            else
            {
                Employee = new EmployeesCodesBLL().GetByEmployeeCodeNo(Session["EmployeeCodeNo"].ToString());
            }

            AccountViewModel AccountVM = new AccountViewModel()
            {
                UserName         = Employee.EmployeeCodeNo,
                EmployeeName     = Employee.Employee.EmployeeNameAr,
                OrganizationName = Employee.EmployeeCurrentJob.OrganizationJob.OrganizationStructure.OrganizationName,
                JobName          = Employee.EmployeeCurrentJob.OrganizationJob.Job.JobName,
                RankName         = Employee.EmployeeCurrentJob.OrganizationJob.Rank.RankName,
                IsAdmin          = Convert.ToBoolean(Session["IsAdmin"]),
                UserPic          = Employee.Employee.EmployeePicture
            };

            //ViewBag.CurrentTime = DateTime.Now;
            return(View(AccountVM));
        }
        private EServicesProxiesChartViewModel MapToChartVM(EmployeesCodesBLL EmployeeCode, int ToEmployeeProxyAssigned)
        {
            int pid = EmployeeCode.EmployeeCurrentJob.OrganizationJob.OrganizationStructure.ParentOrganization.OrganizationManager != null ? EmployeeCode.EmployeeCurrentJob.OrganizationJob.OrganizationStructure.OrganizationManager.EmployeeCodeID : 0;
            int id  = EmployeeCode.EmployeeCodeID;

            //pid = pid == id ? 0 : pid;
            if (pid == id)
            {
                pid = -1; id = 0;
            }
            string ManagerEmployeeCodeNo = WindowsUserIdentity;

            return(new EServicesProxiesChartViewModel()
            {
                EmployeeCodeID = EmployeeCode.EmployeeCodeID,
                id = id,   //EmployeeCode.EmployeeCodeID,   //UniqueID++,//EmployeeCode.EmployeeCodeID + EmployeeCode.EmployeeCurrentJob.OrganizationJob.OrganizationStructure.OrganizationID,
                //pid = EmployeeCode.EmployeeCurrentJob.OrganizationJob.OrganizationStructure.ParentOrganization != null ? EmployeeCode.EmployeeCurrentJob.OrganizationJob.OrganizationStructure.ParentOrganization.OrganizationID : 0,
                pid = pid, //EmployeeCode.EmployeeCurrentJob.OrganizationJob.OrganizationStructure.ParentOrganization.OrganizationManager != null ? EmployeeCode.EmployeeCurrentJob.OrganizationJob.OrganizationStructure.OrganizationManager.EmployeeCodeID : 0,
                OrganizationName = EmployeeCode.EmployeeCurrentJob.OrganizationJob.OrganizationStructure.OrganizationName,
                FullOrganizationName = EmployeeCode.EmployeeCurrentJob.OrganizationJob.OrganizationStructure.FullOrganizationName,
                CurrentJobName = EmployeeCode.EmployeeCurrentJob.OrganizationJob.Job.JobName,
                EmployeeCodeNo = EmployeeCode.EmployeeCodeNo,
                FullEmployeeName = EmployeeCode.Employee.EmployeeNameAr,
                EmployeeName = EmployeeCode.EmployeeCodeNo + " - " + EmployeeCode.Employee.FirstNameAr + " " + EmployeeCode.Employee.LastNameAr,
                IsProxyAssignedImg = "/BaseEServices/RetrieveImage/" + (ToEmployeeProxyAssigned == EmployeeCode.EmployeeCodeID ? "done.jpg" : "blank.png"),
                Picture = "/Employees/RetrieveImage/" + EmployeeCode.EmployeeCodeNo,
                //tags = totalNodes > 4 ? GetTags(EmployeeCode.EmployeeCurrentJob.OrganizationJob.OrganizationStructure) : new string[] { },
                btnImg = "/BaseEServices/RetrieveImage/" + (ToEmployeeProxyAssigned == EmployeeCode.EmployeeCodeID ? "error2.png" : "plus.png"),
                nodeBg = (ToEmployeeProxyAssigned == EmployeeCode.EmployeeCodeID ? "#F57C00" : "#ffffff")
            });
        }
示例#8
0
        public JsonResult GetUserIdentityInfo()
        {
            //EmployeesCodesBLL UserIdentity = new EmployeesCodesBLL().GetByEmployeeCodeNo(this.WindowsUserIdentity);
            //Session["IsUserKnown"] = UserIdentity != null ? true : false;

            //EmployeesCodesBLL UserIdentity = Session["UserIdentity"] != null ? (EmployeesCodesBLL)Session["UserIdentity"] : null;

            EmployeesCodesBLL UserIdentity = WindowsEmployeeCode;

            PlacementBLL CurrentPlacement = new PlacementBLL().GetCurrentActualOrgAndActualJob(this.WindowsUserIdentity);

            var data = new
            {
                UserCodeID = UserIdentity?.EmployeeCodeID,
                UserCodeNo = UserIdentity?.EmployeeCodeNo,
                UserName   = UserIdentity?.Employee?.EmployeeNameAr,
                UserIDNo   = UserIdentity?.Employee?.EmployeeIDNo,
                //OrganizationName = UserIdentity != null ? UserIdentity.EmployeeCurrentJob != null ? UserIdentity.EmployeeCurrentJob.OrganizationJob.OrganizationStructure.OrganizationName : string.Empty : string.Empty,
                //OrganizationName = ((InternalAssigningBLL)new InternalAssigningBLL().GetEmployeeActiveAssigning(this.WindowsUserIdentity))?.Organization?.FullOrganizationName,
                OrganizationName = CurrentPlacement?.Organization?.FullOrganizationName,
                JobName          = CurrentPlacement?.Job?.JobName,
                UserPicture      = UserIdentity?.Employee?.EmployeePicture
            };

            return(Json(new { data }, JsonRequestBehavior.AllowGet));
        }
示例#9
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
                }));
            }
        }
示例#10
0
        public JsonResult GetAllEmployeesManagersByOrganizationID(int EServiceTypeID)
        {
            int    OrganizationID        = this.WindowsUserOrganizationID;
            string ManagerEmployeeCodeNo = this.WindowsUserIdentity;

            EServicesProxiesBLL EServiceProxy
                = new EServicesProxiesBLL().GetActiveByFromEmployeeCodeID(this.WindowsEmployeeCode.EmployeeCodeID, (EServicesTypesEnum)EServiceTypeID);
            int ToEmployeeProxyAssigned               = EServiceProxy == null ? 0 : EServiceProxy.ToEmployee.EmployeeCodeID;
            List <EmployeesCodesBLL> Orgs             = new EmployeesCodesBLL().GetAllEmployeesManagersByOrganizationID(OrganizationID, (EServicesTypesEnum)EServiceTypeID);
            List <EServicesProxiesChartViewModel> lst = new List <EServicesProxiesChartViewModel>();
            EServicesProxiesChartViewModel        obj;

            foreach (var item in Orgs)
            {
                obj = MapToChartVM(item, ToEmployeeProxyAssigned);
                if (obj != null)
                {
                    lst.Add(obj);
                }
            }
            //lst.AddRange(Orgs.Select(x => MapToChartVM(x, ToEmployeeProxyAssigned)).ToList());

            if (Orgs != null)
            {
                return(Json(new
                {
                    total = Orgs.Count,
                    data = lst
                }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                throw new Exception();
            }
        }
示例#11
0
        /// <summary>
        /// Dated : 05-12-2020
        /// Task # 217 -- Deduct GovernmentFundsDeductions only when (IsActive = true && RemainingDeductionAmount > 0)
        /// </summary>
        /// <param name="EmployeeCode"></param>
        /// <param name="BasicSalary"></param>
        /// <param name="GovernmentFunds"></param>
        /// <returns></returns>
        private SalaryDetailsBLL GetSalaryDetailsDeductionsByEmployeeCodeNo(EmployeesCodesBLL EmployeeCode, double BasicSalary, List <GovernmentFundsBLL> GovernmentFunds)
        {
            try
            {
                SalaryDetailsBLL SalaryDetails = new SalaryDetailsBLL();

                SalaryDetails.Deductions = new SalaryDeductions()
                {
                    RetirmentDeduction        = Math.Round(BasicSalary * EmployeeCode.EmployeeCurrentJob.OrganizationJob.Rank.RankCategory.RetirementPercentage / 100, 2),
                    TakafulDeductions         = new List <Deduction>(),
                    GovernmentFundsDeductions = GovernmentFunds.Where(x => x.EmployeeCode.EmployeeCodeID == EmployeeCode.EmployeeCodeID &&
                                                                      (x.IsActive.HasValue ? x.IsActive.Value : false) == true &&
                                                                      x.RemainingDeductionAmount > 0).ToList(),
                };

                SalaryDetails.Deductions.TotalDeductions = Math.Round(SalaryDetails.Deductions.RetirmentDeduction +
                                                                      double.Parse(SalaryDetails.Deductions.TakafulDeductions.Sum(x => x.DeductionAmount).ToString()) +
                                                                      SalaryDetails.Deductions.GovernmentFundsDeductions.Sum(x => x.MonthlyDeductionAmount), 2);
                return(SalaryDetails);
            }
            catch
            {
                throw;
            }
        }
示例#12
0
        public EmployeesCareersHistoryBLL GetHiringRecordByEmployeeCodeID(int EmployeeCodeID)
        {
            EmployeesCareersHistoryBLL Obj = new EmployeesCodesBLL().GetCareerHistoryByEmployeeCodeID(EmployeeCodeID).FirstOrDefault(x => x.EmployeeCode.EmployeeCodeID.Equals(EmployeeCodeID) &&
                                                                                                                                     x.CareerHistoryType.CareerHistoryTypeID.Equals((int)CareersHistoryTypesEnum.Hiring));

            return(Obj);
        }
示例#13
0
        private int ChangeCurrentJobByEmployeeCodeID(int EmployeeCodeID)
        {
            List <EmployeesCareersHistoryBLL> ObjList = new EmployeesCodesBLL().GetCareerHistoryByEmployeeCodeID(EmployeeCodeID).OrderByDescending(x => x.JoinDate).ToList();

            foreach (var item in ObjList)
            {
                EmployeesCareersHistory EmployeeCareerHistory = new EmployeesCareersHistory()
                {
                    EmployeeCareerHistoryID = item.EmployeeCareerHistoryID,
                    LastUpdatedBy           = this.LoginIdentity != null ? this.LoginIdentity.EmployeeCodeID : (int?)null,
                    LastUpdatedDate         = DateTime.Now,
                };

                if (ObjList.IndexOf(item) == 0)
                {
                    EmployeeCareerHistory.IsActive = true;
                }
                else
                {
                    EmployeeCareerHistory.IsActive = false;
                }

                new EmployeesCareersHistoryDAL().UpdateIsActive(EmployeeCareerHistory);
            }
            return(0);
        }
示例#14
0
        public HttpResponseMessage GetPassengerOrdersByEmployeeCodeNo(string EmployeeCodeNo)
        {
            if (string.IsNullOrEmpty(EmployeeCodeNo))
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            EmployeesCodesBLL emp = new EmployeesCodesBLL().GetByEmployeeCodeNo(EmployeeCodeNo);

            if (emp != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, new EmployeesCodesBLL().GetPassengerOrdersByEmployeeCodeID(emp.EmployeeCodeID).Select(x => new
                {
                    PassengerOrderID = x.PassengerOrderID,
                    //PassengerOrderTypeName = x.PassengerOrderType.PassengerOrderTypeID == 1 ? "إنتداب" : "ابتعاث تدريبي",

                    //?????? needs to review
                    //StartDate = (PassengerOrdersTypesEnum)x.PassengerOrderType.PassengerOrderTypeID == HCMBLL.Enums.PassengerOrdersTypesEnum.Delegation ? ((DelegationsDetailsBLL)x.EmployeeCareerHistory).Delegation.DelegationStartDate : ((InternshipScholarshipsDetailsBLL)x.EmployeeCareerHistory).InternshipScholarship.InternshipScholarshipStartDate,
                    //EndDate = (PassengerOrdersTypesEnum)x.PassengerOrderType.PassengerOrderTypeID == HCMBLL.Enums.PassengerOrdersTypesEnum.Delegation ? ((DelegationsDetailsBLL)x.EmployeeCareerHistory).Delegation.DelegationEndDate : ((InternshipScholarshipsDetailsBLL)x.EmployeeCareerHistory).InternshipScholarship.InternshipScholarshipEndDate,
                    //Reason = (PassengerOrdersTypesEnum)x.PassengerOrderType.PassengerOrderTypeID == HCMBLL.Enums.PassengerOrdersTypesEnum.Delegation ? ((DelegationsDetailsBLL)x.EmployeeCareerHistory).Delegation.DelegationReason : ((InternshipScholarshipsDetailsBLL)x.EmployeeCareerHistory).InternshipScholarship.InternshipScholarshipReason,
                    TravellingDate = x.TravellingDate,
                    Going = x.Going,
                    Returning = x.Returning,
                })));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Employee not found!"));
            }
        }
示例#15
0
        public HttpResponseMessage GetDelegationsByEmployeeCodeNo(string EmployeeCodeNo)
        {
            if (string.IsNullOrEmpty(EmployeeCodeNo))
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            EmployeesCodesBLL emp = new EmployeesCodesBLL().GetByEmployeeCodeNo(EmployeeCodeNo);

            if (emp != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, new EmployeesCodesBLL().GetDelegationsByEmployeeCodeID(emp.EmployeeCodeID).Select(x => new
                {
                    DelegationID = x.DelegationID,
                    DelegationTypeName = x.DelegationType.DelegationTypeName,
                    DelegationKindName = x.DelegationKind.DelegationKindName,
                    DelegationStartDate = x.DelegationStartDate,
                    DelegationEndDate = x.DelegationEndDate,
                    DelegationPeriod = x.DelegationPeriod
                })));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Employee not found!"));
            }
        }
示例#16
0
        public ActionResult Login(AccountViewModel AccountVM)
        {
            AuthenticationResult result = new UsersBLL().AuthenticateUser(AccountVM.UserName, AccountVM.Password);

            if (result != null)
            {
                #region stop login if the app under Upgrading
                bool IsAppUnderUpgrading = Convert.ToBoolean(ConfigurationManager.AppSettings["IsAppUnderUpgrading"].ToString());
                if (IsAppUnderUpgrading)
                {
                    List <int> AllowedEmpCodes = Utilities.ConvertToList(ConfigurationManager.AppSettings["AllowEmployeeCodesWhileUpgrading"], ',');
                    if (!AllowedEmpCodes.Contains(Convert.ToInt32((result.User.UserName))))
                    {
                        throw new CustomException(Resources.Globalization.AppUnderUpgradingMsgText);
                    }
                }
                #endregion

                EmployeesCodesBLL EmployeeCode = new EmployeesCodesBLL().GetByEmployeeCodeNo(result.User.UserName);
                //AuthenticationResult result = JsonConvert.DeserializeObject<AuthenticationResult>(response.Content.ReadAsStringAsync().Result);
                Session["Employee"]       = EmployeeCode;
                Session["Authentication"] = result;
                Session["EmployeeCodeNo"] = result.User.UserName;
                Session["UserID"]         = result.User.UserID;
                Session["IsAdmin"]        = result.User.IsAdmin;
                Session["EmployeeName"]   = EmployeeCode.Employee.EmployeeNameAr;
                Session["EmployeeCodeID"] = EmployeeCode.EmployeeCodeID;

                if (AccountVM.RememberMe)
                {
                    #region save the user name in cookies
                    var JsonUserName = JsonConvert.SerializeObject(int.Parse(result.User.UserName));
                    var UserCookie   = new HttpCookie("HCMUser", JsonUserName);
                    UserCookie.Expires = DateTime.Now.AddDays(30);
                    Response.Cookies.Add(UserCookie);
                    #endregion
                }
                else
                {
                    #region remove the user name in cookies
                    var UserCookie = Request.Cookies["HCMUser"];
                    if (UserCookie != null)
                    {
                        UserCookie.Value = null;
                        UserCookie.Expires.AddTicks(1);
                        Response.SetCookie(UserCookie);
                    }
                    #endregion
                }
            }
            else
            {
                throw new CustomException(Resources.Globalization.NotAuthenticatedText);
            }

            //return new HttpResponseMessage(HttpStatusCode.OK);
            return(null);
        }
示例#17
0
        public HttpResponseMessage GetVacationBalanceByEmployeeCodeNo(VacationsTypesEnum VacationType, string EmployeeCodeNo)
        {
            if (string.IsNullOrEmpty(EmployeeCodeNo))
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            EmployeesCodesBLL emp = new EmployeesCodesBLL().GetByEmployeeCodeNo(EmployeeCodeNo);

            if (emp != null)
            {
                BaseVacationsBLL Vacation = GenericFactoryPattern <BaseVacationsBLL, NormalVacationsBLL> .CreateInstance();

                DateTime CurrentDate = DateTime.Now.Date;
                int      MaturityYearFromCurrentDate  = Globals.Calendar.GetUmAlQuraYear(CurrentDate);
                int      MaturityMonthFromCurrentDate = Globals.Calendar.GetUmAlQuraMonth(CurrentDate);
                int      MaturityDayFromCurrentDate   = Globals.Calendar.GetUmAlQuraDay(CurrentDate);

                ((NormalVacationsBLL)Vacation).GetVacationBalances(emp.EmployeeCodeID, MaturityYearFromCurrentDate, MaturityMonthFromCurrentDate, MaturityDayFromCurrentDate);

                return(Request.CreateResponse(HttpStatusCode.OK, (NormalVacationsBLL)Vacation));

                //return Request.CreateResponse(HttpStatusCode.OK, new
                //{
                //    EmployeeCodeID = ((NormalVacationsBLL)Vacation).EmployeeCareerHistory.EmployeeCode.EmployeeCodeID,
                //    EmployeeCodeNo = ((NormalVacationsBLL)Vacation).EmployeeCareerHistory.EmployeeCode.EmployeeCodeNo,
                //    EmployeeNameAr = ((NormalVacationsBLL)Vacation).EmployeeCareerHistory.EmployeeCode.Employee.EmployeeNameAr,

                //    DeservedOldBalance = ((NormalVacationsBLL)Vacation).DeservedOldBalance,
                //    ConsumedOldBalance = ((NormalVacationsBLL)Vacation).ConsumedOldBalance,
                //    RemainingOldBalance = ((NormalVacationsBLL)Vacation).RemainingOldBalance,

                //    DeservedCurrentBalance = ((NormalVacationsBLL)Vacation).DeservedCurrentBalance,
                //    ConsumedCurrentBalance = ((NormalVacationsBLL)Vacation).ConsumedCurrentBalance,
                //    ExpiredCurrentBalance = ((NormalVacationsBLL)Vacation).ExpiredCurrentBalance,
                //    RemainingCurrentBalance = ((NormalVacationsBLL)Vacation).RemainingCurrentBalance,

                //    TotalDeservedBalance = ((NormalVacationsBLL)Vacation).TotalDeservedBalance,
                //    TotalConsumedBalance = ((NormalVacationsBLL)Vacation).TotalConsumedBalance,
                //    TotalRemainingBalance = ((NormalVacationsBLL)Vacation).TotalRemainingBalance,

                //    TotalConsumedSeparatedDays = ((NormalVacationsBLL)Vacation).TotalConsumedSeparatedDays,

                //    InAdvanceBalance = ((NormalVacationsBLL)Vacation).InAdvanceBalance,

                //    TotalAvailableVacationBalance = ((NormalVacationsBLL)Vacation).TotalAvailableVacationBalance,

                //}.ToXml());
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Employee not found!"));
            }
        }
示例#18
0
        public ActionResult GetAbsence(int EmployeeCarrerHistoryID, int PromotionPeriodID)
        {
            EmployeesCareersHistoryBLL emp = new EmployeesCareersHistoryBLL().GetByEmployeeCareerHistoryID(EmployeeCarrerHistoryID);
            PromotionsPeriodsBLL       PromotionPeriodBLL          = new PromotionsPeriodsBLL().GetByPromotionPeriodID(PromotionPeriodID);
            List <TimeAttendanceBLL>   EmployeesEvaluationsBLLList = new EmployeesCodesBLL().GetAbsenceByEmployeeCodeID(emp.EmployeeCode.EmployeeCodeID, emp.JoinDate.Date, PromotionPeriodBLL.PromotionEndDate);
            var data = EmployeesEvaluationsBLLList.Select(x => new
            {
                AbsenceDate = x.Date,
            });

            return(Json(new { data = data }, JsonRequestBehavior.AllowGet));
        }
示例#19
0
        public ActionResult GetAssigningByEmployeeCodeID(int id)
        {
            // get assigning from assignings module
            var AssigningAsEmployees = new EmployeesCodesBLL().GetAssigningsByEmployeeCodeID(id)
                                       .Select(x => new
            {
                x.AssigningID,
                //x.AssigningType.AssigningTypeName,
                x.AssigningStartDate,
                x.AssigningEndDate,
                x.IsFinished,
                Organization = x.AssigningType.AssigningTypeID == (int)AssigningsTypesEnum.Internal ? ((InternalAssigningBLL)x).Organization.FullOrganizationName : ((ExternalAssigningBLL)x).ExternalOrganization,
                JobName      = x.AssigningType.AssigningTypeID == (int)AssigningsTypesEnum.Internal ? ((InternalAssigningBLL)x).Job.JobName : string.Empty,
            });

            // get assigning from organization structure module
            var AssigningAsManagers = new OrganizationsManagersBLL().GetOrganizationsOfManager(id)
                                      .Select(x => new
            {
                AssigningID = x.OrganizationMangerID,
                //AssigningTypeName = "fsdf",
                AssigningStartDate = x.FromDate,
                AssigningEndDate   = x.ToDate,
                IsFinished         = x.ToDate.HasValue && x.ToDate.Value < DateTime.Now.Date ? true : false,
                Organization       = x.Organization.GetOrganizationNameTillLastParentExceptPresident(x.Organization.OrganizationID),
                JobName            = Resources.Globalization.ManagerText + " " + x.Organization.OrganizationName
            });

            var AllData = (from x in AssigningAsEmployees
                           select new
            {
                x.AssigningID,
                //x.AssigningTypeName,
                x.AssigningStartDate,
                x.AssigningEndDate,
                x.IsFinished,
                x.Organization,
                x.JobName
            }).Union(from x in AssigningAsManagers
                     select new
            {
                x.AssigningID,
                //x.AssigningTypeName,
                x.AssigningStartDate,
                x.AssigningEndDate,
                x.IsFinished,
                x.Organization,
                x.JobName
            });

            return(SetJsonResultWithMaxJsonLength(AllData));
        }
示例#20
0
        public JsonResult GetDelegationBalanceByEmployeeCodeNo(string EmployeeCodeNo, string DelegationStartDate, string DelegationEndDate)
        {
            EmployeesCodesBLL EmployeeCode = new EmployeesCodesBLL().GetByEmployeeCodeNo(EmployeeCodeNo);

            if (EmployeeCode != null)
            {
                return(Json(new { data = new EmployeesCodesBLL().GetDelegationBalanceByEmployeeCodeID(EmployeeCode.EmployeeCodeID, Convert.ToDateTime(DelegationStartDate), Convert.ToDateTime(DelegationEndDate)) }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(null);
            }
        }
示例#21
0
        public ActionResult GetEvaluations(int EmployeeCodeID, int PromotionRecordEmployeeID)
        {
            List <EmployeesEvaluationsBLL> EmployeesEvaluationsBLLList = new EmployeesCodesBLL().GetEvaluationsByEmployeeCodeID(EmployeeCodeID, PromotionRecordEmployeeID);

            var data = EmployeesEvaluationsBLLList.Select(x => new
            {
                EvaluationDegree = x.EvaluationDegree,
                EvaluationYear   = x.MaturityYearsBalances.MaturityYear,
                Evaluation       = x.EvaluationPoints.Evaluation,
                Points           = x.Points
            });

            return(Json(new { data = data }, JsonRequestBehavior.AllowGet));
        }
示例#22
0
        public ActionResult CreateEmployeeCodeNo(CreateEmployeeCodeNoViewModel EmployeeVM)
        {
            EmployeesCodesBLL employee = new EmployeesCodesBLL();

            employee.EmployeeCodeNo = EmployeeVM.EmployeeCodeNo;
            employee.Employee       = new EmployeesBLL()
            {
                EmployeeID = EmployeeVM.EmployeeID
            };
            employee.EmployeeType  = EmployeeVM.EmployeeType;
            employee.LoginIdentity = this.UserIdentity;
            employee.AddOrEdit();
            return(View());
        }
示例#23
0
        public List <OverTimesBLL> GetByEmployeeCodeID(int EmployeeCodeID, DateTime StartDate, DateTime EndDate)
        {
            List <OverTimesBLL> OverTimesBll         = new EmployeesCodesBLL().GetOverTimesByEmployeeCodeID(EmployeeCodeID);
            List <OverTimesBLL> OverTimesWithDaysBll = new List <OverTimesBLL>();

            foreach (var OverTime in OverTimesBll)
            {
                if (OverTime.OverTimesDays.Exists(c => c.OverTimeDay >= StartDate && c.OverTimeDay <= EndDate))
                {
                    OverTimesWithDaysBll.Add(OverTime);
                }
            }
            return(OverTimesWithDaysBll);
        }
示例#24
0
        public override ActionResult Index()
        {
            //UsersBLL userBLL = new UsersBLL();
            //if (Session["User"] != null)
            //    userBLL = (UsersBLL)Session["User"];

            EmployeesCodesBLL EmployeeCodeNo = new EmployeesCodesBLL().GetByEmployeeCodeNo(Session["EmployeeCodeNo"].ToString());
            AccountViewModel  AccountVM      = new AccountViewModel()
            {
                UserPic = EmployeeCodeNo.Employee.EmployeePicture,
            };

            ViewBag.Year = Globals.Calendar.GetUmAlQuraYear(DateTime.Now);
            return(PartialView("~/Views/Account/_Index.cshtml", AccountVM));
        }
示例#25
0
        public ActionResult Create()
        {
            EmployeesCodesBLL  AuthorizedPersonBLL = new EmployeesCodesBLL().GetEVacationAuthorizedPersonOfEmployee(WindowsUserIdentity, EServicesTypesEnum.Vacation);
            EmployeesViewModel AuthorizedPerson    = AuthorizedPersonBLL != null ? new EmployeesViewModel()
            {
                EmployeeCodeNo = AuthorizedPersonBLL?.EmployeeCodeNo, EmployeeNameAr = AuthorizedPersonBLL?.Employee?.EmployeeNameAr
            } : null;
            VacationsViewModel VacationVM = new VacationsViewModel()
            {
                VacationType              = new VacationsTypesBLL(),
                EmployeeCodeNo            = WindowsUserIdentity,
                EVacationAuthorizedPerson = AuthorizedPerson
            };

            return(View(VacationVM));
        }
示例#26
0
 public JsonResult GetEmployeeByEmployeeCodeNo(string EmployeeCodeNo)
 {
     try
     {
         EmployeesCodesBLL Employee = new EmployeesCodesBLL().GetByEmployeeCodeNo(EmployeeCodeNo);
         if (Employee == null)
         {
             Employee = new EmployeesCodesBLL();
         }
         return(Json(Employee, JsonRequestBehavior.AllowGet));
     }
     catch
     {
         throw;
     }
 }
示例#27
0
        public ActionResult GetPassengerOrderByEmployeeCodeID(int id)
        {
            var data = new EmployeesCodesBLL().GetPassengerOrdersByEmployeeCodeID(id).Select(x => new
            {
                PassengerOrderID = x.PassengerOrderID,
                //??????????? needs to review
                //StartDate = (PassengerOrdersTypesEnum)x.PassengerOrderType.PassengerOrderTypeID == HCMBLL.Enums.PassengerOrdersTypesEnum.Delegation ? ((DelegationsDetailsBLL)x.EmployeeCareerHistory).Delegation.DelegationStartDate : ((InternshipScholarshipsDetailsBLL)x.EmployeeCareerHistory).InternshipScholarship.InternshipScholarshipStartDate,
                //EndDate = (PassengerOrdersTypesEnum)x.PassengerOrderType.PassengerOrderTypeID == HCMBLL.Enums.PassengerOrdersTypesEnum.Delegation ? ((DelegationsDetailsBLL)x.EmployeeCareerHistory).Delegation.DelegationEndDate : ((InternshipScholarshipsDetailsBLL)x.EmployeeCareerHistory).InternshipScholarship.InternshipScholarshipEndDate,
                //Reason = (PassengerOrdersTypesEnum)x.PassengerOrderType.PassengerOrderTypeID == HCMBLL.Enums.PassengerOrdersTypesEnum.Delegation ? ((DelegationsDetailsBLL)x.EmployeeCareerHistory).Delegation.DelegationReason : ((InternshipScholarshipsDetailsBLL)x.EmployeeCareerHistory).InternshipScholarship.InternshipScholarshipReason,
                TravellingDate = x.TravellingDate,
                Going          = x.Going,
                Returning      = x.Returning,
            });

            return(Json(new { data = data }, JsonRequestBehavior.AllowGet));
        }
示例#28
0
        public ActionResult GetVacationsByEmployeeCodeID(int id)
        {
            var data = new EmployeesCodesBLL().GetVacationsDetailsByEmployeeCodeID(id).Select(x => new
            {
                VacationID         = x.Vacation.VacationID,
                VacationDetailID   = x.VacationDetailID,
                FromDate           = x.FromDate,
                ToDate             = x.ToDate,
                VacationPeriod     = x.VacationPeriod,
                VacationTypeName   = x.Vacation.VacationTypeName,
                VacationActionName = x.VacationAction.VacationActionName,
            }).OrderBy(x => x.FromDate);

            return(Json(new { data = data.OrderBy(x => x.FromDate.Date) }, JsonRequestBehavior.AllowGet));

            //return Json(new { data = new EmployeesCodesBLL().GetVacationsWithDetailsByEmployeeCodeID(id) }, JsonRequestBehavior.AllowGet);
        }
示例#29
0
        public virtual Result Update()
        {
            try
            {
                Result result = null;

                #region Validation Employee must be Contractor (Saudi / Non-Saudi)
                EmployeesCodesBLL EmployeeCode = new EmployeesCodesBLL().GetByEmployeeCodeID(this.EmployeeCode.EmployeeCodeID);
                if (EmployeeCode.EmployeeCurrentJob.OrganizationJob.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.Employee ||
                    EmployeeCode.EmployeeCurrentJob.OrganizationJob.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.SaudiLabor ||
                    EmployeeCode.EmployeeCurrentJob.OrganizationJob.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.User ||
                    EmployeeCode.EmployeeCurrentJob.OrganizationJob.Rank.RankCategory.RankCategoryID == (int)RanksCategoriesEnum.Army)
                {
                    result            = new Result();
                    result.Entity     = this;
                    result.EnumType   = typeof(ContractorsBasicSalariesValidationEnum);
                    result.EnumMember = ContractorsBasicSalariesValidationEnum.RejectedBecauseOfEmployeeMustBeContractualEmployee.ToString();
                    return(result);
                }
                #endregion

                ContractorsBasicSalaries ContractorBasicSalary = new ContractorsBasicSalaries();
                ContractorBasicSalary.ContractorBasicSalaryID = this.ContractorBasicSalaryID;
                ContractorBasicSalary.EmployeeCodeID          = this.EmployeeCode.EmployeeCodeID;
                ContractorBasicSalary.BasicSalary             = this.BasicSalary;
                ContractorBasicSalary.TransfareAllowance      = this.TransfareAllowance;
                ContractorBasicSalary.LastUpdatedDate         = DateTime.Now;
                ContractorBasicSalary.LastUpdatedBy           = this.LoginIdentity.EmployeeCodeID;

                int UpdateResult = new ContractorsBasicSalariesDAL().Update(ContractorBasicSalary);
                if (UpdateResult != 0)
                {
                    result            = new Result();
                    result.Entity     = this;
                    result.EnumType   = typeof(ContractorsBasicSalariesValidationEnum);
                    result.EnumMember = ContractorsBasicSalariesValidationEnum.Done.ToString();
                }

                return(result);
            }
            catch
            {
                throw;
            }
        }
示例#30
0
        public HttpResponseMessage GetEmployeeQualificationsByEmployeeCodeNo(string EmployeeCodeNo)
        {
            if (string.IsNullOrEmpty(EmployeeCodeNo))
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            EmployeesCodesBLL emp = new EmployeesCodesBLL().GetByEmployeeCodeNo(EmployeeCodeNo);

            if (emp != null)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, new EmployeesCodesBLL().GetQualificationsByEmployeeCodeID(emp.EmployeeCodeID, 0)));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Employee not found!"));
            }
        }