Пример #1
0
        public getDesignationsList getDesignationsList()
        {
            var model = new getDesignationsList();

            try
            {
                var DesignationsList = _DesignationsRepo.GetAll().ToList();
                var list             = new List <getDesignationsList_Designations>();
                foreach (var item in DesignationsList)
                {
                    var temp = new getDesignationsList_Designations()
                    {
                        Id   = item.Id,
                        Name = item.Name
                    };
                    list.Add(temp);
                }
                ;
                model = new getDesignationsList()
                {
                    _Designations = list
                };
            }
            catch (Exception)
            {
            }
            return(model);
        }
Пример #2
0
        public getStaffsList getStaffsList(getStaffsList obj)
        {
            var model = new getStaffsList();

            try
            {
                var StaffsList       = _StaffsRepo.GetAll().ToList();
                var DesignationsList = _DesignationsRepo.GetAll().ToList();
                var genders          = _GendersRepo.GetAll().ToList();
                var query            = (from _Staffs in StaffsList
                                        join _Designations in DesignationsList on _Staffs?.DesignationId equals _Designations?.Id
                                        join _genders in genders on _Staffs?.GenderId equals _genders.Id
                                        orderby _Staffs.FirstName ascending
                                        select new { _Staffs, _Designations, _genders });

                var list = new List <getStaffsList_Staffs>();
                foreach (var item in query)
                {
                    string path = string.IsNullOrEmpty(item._Staffs.IP300X200) ? "" : item._Staffs.IP300X200;
                    var    temp = new getStaffsList_Staffs()
                    {
                        Id            = item._Staffs.Id,
                        DesignationId = item._Staffs.DesignationId,
                        FirstName     = item._Staffs.FirstName,
                        LastName      = item._Staffs.LastName,
                        Name          = item._Staffs.FirstName + " " + item._Staffs.LastName,
                        GenderId      = item._Staffs.GenderId,
                        GenderName    = item._genders.Name,
                        IP300X200     = _commonServ.CommImage_WrapperDefaultImage(path, obj.WebRootPath, item._Staffs.GenderId),
                        Designation   = item._Designations.Name,
                        Cell          = item._Staffs.Cell,
                        Email         = item._Staffs.Email,
                        Education     = item._Staffs.Education,
                        Address       = item._Staffs.Address
                    };
                    list.Add(temp);
                }
                ;


                model = new getStaffsList()
                {
                    _Staffs = list
                };
            }
            catch (Exception ex)
            {
                var test = ex.Message;
            }
            return(model);
        }
        public getSalariesList getSalariesList(long staffId, long salaryYear)
        {
            var model = new getSalariesList();

            try
            {
                var SalariesList     = _SalariesRepo.GetAll().ToList();
                var StaffsList       = _StaffsRepo.GetAll().ToList();
                var DesignationsList = _DesignationsRepo.GetAll().ToList();
                var getPayScale      = _PayScalesRepo.GetAll().ToList();
                //[NOTE: get staff details of particular staff]
                var staffDetails = (from _Staffs in StaffsList
                                    where _Staffs.Id == staffId
                                    join _Designations in DesignationsList on _Staffs?.DesignationId equals _Designations?.Id
                                    orderby _Staffs.FirstName ascending
                                    select new { _Staffs, _Designations }).SingleOrDefault();
                var staffs = new getSalariesList_Staffs()
                {
                    Id            = staffDetails._Staffs.Id,
                    DesignationId = staffDetails._Staffs.DesignationId,
                    FirstName     = staffDetails._Staffs.FirstName,
                    LastName      = staffDetails._Staffs.LastName,
                    Name          = staffDetails._Staffs.FirstName + " " + staffDetails._Staffs.LastName,
                    Designation   = staffDetails._Designations.Name,
                    Cell          = staffDetails._Staffs.Cell,
                    Email         = staffDetails._Staffs.Email,
                    Address       = staffDetails._Staffs.Address
                };
                //[NOTE: get staff salaries by Id]
                var query = (from _Salaries in SalariesList
                             join _Staffs in StaffsList on _Salaries.StaffId equals _Staffs.Id
                             where _Salaries.Date.Year == salaryYear
                             select new { _Salaries, _Staffs });
                var payScale = (from p in getPayScale
                                where p.StaffId == staffId && p.SalaryYear.Year == salaryYear
                                select p).SingleOrDefault();
                var list = new List <getSalariesList_Salaries>();
                foreach (var item in query)
                {
                    var temp = new getSalariesList_Salaries()
                    {
                        Id           = item._Salaries.Id,
                        StaffId      = item._Salaries.StaffId,
                        StaffName    = item._Staffs.FirstName + " " + item._Staffs.LastName,
                        Date         = item._Salaries.Date,
                        TermNo       = item._Salaries.TermNo,
                        SalaryTypeId = item._Salaries.SalaryTypeId,
                        Amount       = item._Salaries.Amount,
                        Remark       = item._Salaries.Remark
                    };
                    list.Add(temp);
                }
                ;
                model = new getSalariesList()
                {
                    Staffs      = staffs,
                    Amount      = payScale.BasicSalary,
                    BonusAmount = payScale.BonusSalary,
                    _Salaries   = list
                };
            }
            catch (Exception)
            {
            }
            return(model);
        }