Example #1
0
        public GlobalCodeMainResponse GetCodes(string categoryName)
        {
            IQueryable <GlobalCodeResponse> data;
            GlobalCodeMainResponse          globalCodeMainResponse = new GlobalCodeMainResponse();

            data = (from gcc in _ObjContext.GlobalCodeCategories
                    join gc in _ObjContext.GlobalCodes on gcc.GlobalCodeCategoryId equals gc.CategoryId
                    where gcc.CategoryName == categoryName && gc.IsDeleted == false && gc.IsActive == true
                    select new GlobalCodeResponse
            {
                GlobalCodeId = gc.GlobalCodeId,
                CodeName = (gc.CodeName == null ? "" : gc.CodeName),
                Description = (gc.Description == null ? String.Empty : gc.Description),
                GlobalCodeCategory = gcc.CategoryName,
                CategoryId = gc.CategoryId,
            });
            globalCodeMainResponse.totalRecords       = data.Count();
            globalCodeMainResponse.globalCodeResponse = data.ToList();
            return(globalCodeMainResponse);
        }
Example #2
0
        public async Task <GlobalCodeMainResponse> GetGlobalCodeByCategoryName(GlobalCodeCategoryRequest categoryNameRequest)
        {
            GlobalCodeMainResponse    globalCodeMainResponse = new GlobalCodeMainResponse();
            List <GlobalCodeResponse> data;

            data = await(from gc in ObjContext.GlobalCodes
                         join gcc in ObjContext.GlobalCodeCategories on categoryNameRequest.Name equals gcc.CategoryName
                         where gc.IsDeleted == false && gc.IsActive &&
                         gcc.IsActive && gcc.IsDeleted == false && gcc.GlobalCodeCategoryId == gc.GlobalCodeCategoryId
                         select new GlobalCodeResponse
            {
                CategoryName         = gcc.CategoryName,
                GlobalCodeId         = gc.GlobalCodeId,
                GlobalCodeCategoryId = gcc.GlobalCodeCategoryId,
                Description          = gc.Description,
                CodeName             = gc.CodeName,
                IsActive             = gc.IsActive
            }).ToListAsync();
            globalCodeMainResponse.totalRecords       = data.Count();
            globalCodeMainResponse.globalCodeResponse = data;
            return(globalCodeMainResponse);
        }
Example #3
0
        public async Task <GlobalCodeMainResponse> GetAllGlobalCodeRecords(LeaveRequest leaveRequest)
        {
            IQueryable <GlobalCodeResponse> data;
            double balance;
            GlobalCodeMainResponse globalCodeMainResponse = new GlobalCodeMainResponse();

            data = from g1 in ObjContext.GlobalCodes
                   where g1.IsDeleted == false && g1.IsActive == true
                   select new GlobalCodeResponse
            {
                GlobalCodeCategoryId = g1.GlobalCodeCategoryId,
                GlobalCodeId         = g1.GlobalCodeId,
                CodeName             = (g1.CodeName == null ? "" : g1.CodeName),
                IsActive             = g1.IsActive,
                Description          = (g1.Description == null ? String.Empty : g1.Description)
            };
            balance = await(from s in ObjContext.LeavesBalance where s.EmployeeId == leaveRequest.EmployeeId select s.Balance).FirstOrDefaultAsync();
            globalCodeMainResponse.balance            = balance;
            globalCodeMainResponse.totalRecords       = data.Count();
            globalCodeMainResponse.globalCodeResponse = await data.ToListAsync();

            return(globalCodeMainResponse);
        }
Example #4
0
        public GetAllYearlyMaintenance GetAllYearlyMaintenance(GetAllYearlyMaintenanceRequest getAllYearlyMaintenanceRequest, GlobalCodeMainResponse feeType)
        {
            IEnumerable <GetYearlyMaintenance> data;
            GetAllYearlyMaintenance            getAllYearlyMaintenance = new GetAllYearlyMaintenance();
            List <GetYearlyMaintenance>        getYearlyMaintenances   = new List <GetYearlyMaintenance>();
            var allYears = _ObjContext.YearlyMaintainence.Where(x => x.IsActive == true && x.IsDeleted == false).ToList();

            if (allYears.Count() != 0)
            {
                for (int i = 0; i <= allYears.Count() - 1; i++)
                {
                    GetYearlyMaintenance getYearlyMaintenance = new GetYearlyMaintenance();

                    var yearlyFee = _ObjContext.YearlyMaintainenceFee.Where(x => x.YearlyMaintainenceId == allYears[i].YearlyMaintainenceId &&
                                                                            x.FeeType == "GeneralFee" &&
                                                                            x.FeeName == "Administration" && x.IsActive == true && x.IsDeleted == false).ToList();

                    decimal yearlyPreFee  = yearlyFee.Where(x => x.TimeFrame == "Pre").Select(x => x.Amount).FirstOrDefault();
                    decimal yearlyPostFee = yearlyFee.Where(x => x.TimeFrame == "Post").Select(x => x.Amount).FirstOrDefault();

                    getYearlyMaintenance.YearlyMaintenanceId = allYears[i].YearlyMaintainenceId;
                    getYearlyMaintenance.Year = allYears[i].Years;
                    getYearlyMaintenance.PreEntryCutOffDate = allYears[i].PreEntryCutOffDate;
                    getYearlyMaintenance.PreEntryFee        = yearlyPreFee;
                    getYearlyMaintenance.PostEntryFee       = yearlyPostFee;
                    getYearlyMaintenance.DateCreated        = allYears[i].Date;

                    getYearlyMaintenances.Add(getYearlyMaintenance);
                }
            }
            data = getYearlyMaintenances.ToList();
            if (data.Count() != 0)
            {
                if (getAllYearlyMaintenanceRequest.SearchTerm != null && getAllYearlyMaintenanceRequest.SearchTerm != "")
                {
                    data = data.Where(x => Convert.ToString(x.Year).Contains(getAllYearlyMaintenanceRequest.SearchTerm) || Convert.ToString(x.PreEntryCutOffDate.Date).Contains(getAllYearlyMaintenanceRequest.SearchTerm) ||
                                      Convert.ToString(x.PreEntryFee).Contains(getAllYearlyMaintenanceRequest.SearchTerm) || Convert.ToString(x.PostEntryFee).Contains(getAllYearlyMaintenanceRequest.SearchTerm) ||
                                      Convert.ToString(x.DateCreated.Date).Contains(getAllYearlyMaintenanceRequest.SearchTerm));
                }
                if (getAllYearlyMaintenanceRequest.OrderByDescending == true)
                {
                    data = data.OrderByDescending(x => x.GetType().GetProperty(getAllYearlyMaintenanceRequest.OrderBy).GetValue(x));
                }
                else
                {
                    data = data.OrderBy(x => x.GetType().GetProperty(getAllYearlyMaintenanceRequest.OrderBy).GetValue(x));
                }
                getAllYearlyMaintenance.TotalRecords = data.Count();
                if (getAllYearlyMaintenanceRequest.AllRecords)
                {
                    getAllYearlyMaintenance.getYearlyMaintenances = data.ToList();
                }
                else
                {
                    getAllYearlyMaintenance.getYearlyMaintenances = data.Skip((getAllYearlyMaintenanceRequest.Page - 1) * getAllYearlyMaintenanceRequest.Limit).Take(getAllYearlyMaintenanceRequest.Limit).ToList();
                }
            }
            return(getAllYearlyMaintenance);
        }