public getStaffList getStaffList(string currentPath)
        {
            var model = new getStaffList();

            try
            {
                var StaffsList       = _StaffsRepo.GetAll().ToList();
                var DesignationsList = _DesignationsRepo.GetAll().ToList();
                var getPayScales     = _PayScalesRepo.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
                                        join payScales in getPayScales on _Staffs.Id equals payScales.StaffId
                                        select new { _Staffs, _Designations, _genders, payScales });
                var list = new List <getStaffList_Staffs>();
                foreach (var item in query)
                {
                    string path = string.IsNullOrEmpty(item._Staffs.IP300X200) ? "" : item._Staffs.IP300X200;
                    var    temp = new getStaffList_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,
                        SalaryYear    = item.payScales.SalaryYear,
                        IP300X200     = _commonServ.CommImage_WrapperDefaultImage(path, currentPath, item._Staffs.GenderId),
                        Designation   = item._Designations.Name,
                        NetSalary     = netSallary(item._Staffs.Id, item.payScales.SalaryYear.Year),
                        YearlyTermNo  = item.payScales.BasicSalaryTermNo,
                        Cell          = item._Staffs.Cell,
                        Email         = item._Staffs.Email,
                        Address       = item._Staffs.Address
                    };
                    list.Add(temp);
                }
                ;
                model = new getStaffList()
                {
                    _Staffs = list
                };
            }
            catch (Exception)
            {
            }
            return(model);
        }
Exemplo n.º 2
0
        public IEnumerable <dropdown_Genders> Dropdown_Genders()
        {
            var genders = _GendersRepo.GetAll().ToList();
            var query   = from g in genders
                          orderby g.Name
                          select g;

            //[NOTE: add new record]
            var queryResult = new List <dropdown_Genders>()
            {
                new dropdown_Genders()
                {
                    Id = 0, Name = "Select Gender"
                }
            };

            foreach (var item in query)
            {
                var d = new dropdown_Genders()
                {
                    Id   = item.Id,
                    Name = item.Name
                };
                queryResult.Add(d);
            }
            return(queryResult);
        }
        public SearchStudentList SearchStudentList(SearchStudentList obj)
        {
            var model = (dynamic)null;

            try
            {
                var studentsList = _studentsRepo.GetAll().ToList();
                var ClassList    = _classesRepo.GetAll().ToList();
                var GendersList  = _GendersRepo.GetAll().ToList();
                var query        = (from _students in studentsList
                                    where _students.RegistrationNo == obj.RegistrationId
                                    join _Classes in ClassList on _students?.ClassId equals _Classes?.Id
                                    join _Genders in GendersList on _students?.GenderId equals _Genders?.Id
                                    orderby _students.ClassId, _students.FirstName ascending
                                    select new { _students, _Classes, _Genders }).SingleOrDefault();
                if (query != null)
                {
                    var temp = new SearchStudentList_Students()
                    {
                        Id               = query._students.Id,
                        RegistrationNo   = query._students.RegistrationNo,
                        ClassId          = query._Classes.Id,
                        ClassName        = query._Classes.Name,
                        GenderId         = query._Genders.Id,
                        GenderName       = query._Genders.Name,
                        FirstName        = query._students.FirstName,
                        LastName         = query._students.LastName,
                        StudentName      = query._students.FirstName + "  " + query._students.LastName,
                        IP300X200        = query._students.IP300X200,
                        AdmittedYear     = query._students.AdmittedYear,
                        PresentAddress   = query._students.PresentAddress,
                        PermanentAddress = query._students.PermanentAddress,
                        DOB              = query._students.DOB,
                        IsActive         = query._students.IsActive,
                        AddedBy          = 0,
                        AddedDate        = DateTime.Now,
                        ModifiedBy       = 0,
                        ModifiedDate     = DateTime.Now,
                        DataType         = null
                    };
                    model = new SearchStudentList()
                    {
                        Students = temp
                    };
                }
                else
                {
                    model = new SearchStudentList()
                    {
                        Students = null
                    };
                }
            }
            catch (Exception)
            {
            }
            return(model);
        }
Exemplo n.º 4
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 getStudentsList.getStudentsList getStudentList(getStudentsList.getStudentsList obj)
        {
            var model = (dynamic)null;

            try
            {
                var studentsList          = _studentsRepo.GetAll().ToList();
                var StudentPromotionsList = _StudentPromotionsRepo.GetAll().ToList();
                var thisYear    = DateTime.Now.Year;
                var ClassList   = _classesRepo.GetAll().ToList();
                var GendersList = _GendersRepo.GetAll().ToList();
                var query       = (from _students in studentsList
                                   join _Classes in ClassList on _students?.ClassId equals _Classes?.Id
                                   join _Genders in GendersList on _students?.GenderId equals _Genders?.Id
                                   join _studentPromotion in StudentPromotionsList on _students.Id equals _studentPromotion.StudentId
                                   join _promotionClass in ClassList on _studentPromotion.ClassId equals _promotionClass.Id
                                   where _studentPromotion.StudentId == _students.Id && _studentPromotion.ClassYear.Value.Year == thisYear
                                   orderby _students.ClassId, _students.FirstName ascending
                                   select new { _students, _Classes, _Genders, _studentPromotion, _promotionClass });
                var list = new List <getStudentsList.getStudentsList_Students>();
                foreach (var item in query)
                {
                    string path = string.IsNullOrEmpty(item._students.IP300X200) ? "" : item._students.IP300X200;
                    var    temp = new getStudentsList.getStudentsList_Students()
                    {
                        Id               = item._students.Id,
                        ClassId          = item._students.ClassId,
                        RollNO           = item._studentPromotion.RollNo,
                        CurrentClassId   = item._studentPromotion.ClassId,
                        CurrentYear      = item._studentPromotion.ClassYear,
                        ClassName        = item._Classes.Name,
                        GenderId         = item._students.GenderId,
                        RegistrationNo   = item._students.RegistrationNo,
                        GenderName       = item._Genders.Name,
                        FirstName        = item._students.FirstName,
                        LastName         = item._students.LastName,
                        StudentName      = item._students.FirstName + "  " + item._students.LastName,
                        IP300X200        = _commonServ.CommImage_WrapperDefaultImage(path, obj.WebRootPath, item._students.GenderId),
                        AdmittedYear     = item._students.AdmittedYear,
                        PresentAddress   = item._students.PresentAddress,
                        PermanentAddress = item._students.PermanentAddress,
                        DOB              = item._students.DOB,
                        IsActive         = item._students.IsActive,
                        AddedBy          = 0,
                        AddedDate        = DateTime.Now,
                        ModifiedBy       = 0,
                        ModifiedDate     = DateTime.Now,
                        DataType         = null
                    };
                    list.Add(temp);
                }
                ;
                model = new getStudentsList.getStudentsList()
                {
                    _Students = list
                };
            }
            catch (Exception)
            {
            }
            return(model);
        }