public object GetResult(ccEntities db, CC.Data.Services.IPermissionsBase permissionsBase) { var source = from c in db.Clients.Where(permissionsBase.ClientsFilter) where c.Id == this.ClientId from item in c.UnmetNeeds1 where item.ClientId == this.ClientId select new { StartDate = item.StartDate, WeeklyHours = item.WeeklyHours }; var filtered = source; var ordered = filtered.OrderByField(this.sSortCol_0, this.sSortDir_0 == "asc"); return(new jQueryDataTableResult { sEcho = this.sEcho, iTotalDisplayRecords = filtered.Count(), iTotalRecords = source.Count(), aaData = ordered.Skip(this.iDisplayStart).Take(this.iDisplayLength).ToList().Select(f => new { StartDate = f.StartDate.ToShortDateString(), IsoStartDate = f.StartDate.ToString("s"), WeeklyHours = f.WeeklyHours.ToString() }) }); }
public CriSupportiveCommunitiesHelper(CC.Data.Services.IPermissionsBase permissions) : base(permissions) { this.columns = new List <jQueryDataTableColumn>() { new jQueryDataTableColumn() { sName = "RowIndex", sTitle = "Row Index" }, new jQueryDataTableColumn() { sName = "ClientId", sTitle = "CC ID" }, new jQueryDataTableColumn() { sName = "HoursHoldCost", sTitle = "Household cost" }, new jQueryDataTableColumn() { sName = "MonthsCount", sTitle = "Months reported" }, new jQueryDataTableColumn() { sName = "Errors", sTitle = "Errors" } }; }
public object GetResult(ccEntities db, CC.Data.Services.IPermissionsBase permissionsBase) { var source = from c in db.Clients.Where(permissionsBase.ClientsFilter) where c.Id == this.ClientId from item in c.GrandfatherHours where item.ClientId == this.ClientId select new { StartDate = item.StartDate, Value = item.Value, Type = item.Type }; var filtered = source; var ordered = filtered.OrderByField(this.sSortCol_0, this.sSortDir_0 == "asc"); return(new jQueryDataTableResult { sEcho = this.sEcho, iTotalDisplayRecords = filtered.Count(), iTotalRecords = source.Count(), aaData = ordered.Skip(this.iDisplayStart).Take(this.iDisplayLength).ToList().Select(f => new { StartDate = f.StartDate.ToShortDateString(), IsoStartDate = f.StartDate.ToString("s"), Value = f.Value.ToString(), Type = f.Type == 0 ? "Grandfathered" : f.Type == 1 ? "Exceptional" : "BMF Approved" //Type = f.Type == 0 ? "Grandfathered" : "Exceptional" }) }); }
public CriClientEventsCountHelper(CC.Data.Services.IPermissionsBase permissions) : base(permissions) { this.columns = new List <jQueryDataTableColumn>() { new jQueryDataTableColumn() { sName = "RowIndex", sTitle = "Row Index" }, new jQueryDataTableColumn() { sName = "EventDate", sTitle = "Date of Event" }, new jQueryDataTableColumn() { sName = "JNVCount", sTitle = "Count of JNV attending" }, new jQueryDataTableColumn() { sName = "TotalCount", sTitle = "Count of Total Attendees" }, new jQueryDataTableColumn() { sName = "Remarks", sTitle = "Remarks" }, new jQueryDataTableColumn() { sName = "Errors", sTitle = "Errors" } }; }
public IQueryable <UsersListRow> GetUsers(CC.Data.ccEntities db, CC.Data.Services.IPermissionsBase permissions) { return(from ag in db.Users.Where(permissions.UsersFilter) select new UsersListRow { Id = ag.Id, RegionId = ag.Agency.AgencyGroup.Country.RegionId, CountryId = ag.Agency.AgencyGroup.CountryId, AgencyGroupId = ag.Agency.GroupId, AgencyId = ag.AgencyId, FirstName = ag.FirstName, LastName = ag.LastName, Username = ag.UserName, Email = ag.Email, UniqueId = ag.UniqueId, RoleId = ag.RoleId, Role = ag.Role.Name, Disabled = ag.Disabled, RoleEnd = ag.RoleId == (int)FixedRoles.RegionOfficer ? ag.Region.Name : ag.RoleId == (int)FixedRoles.RegionAssistant ? ag.Region.Name : (ag.RoleId == (int)FixedRoles.Ser || ag.RoleId == (int)FixedRoles.SerAndReviewer) ? ag.AgencyGroup.Name : (ag.RoleId == (int)FixedRoles.AgencyUser || ag.RoleId == (int)FixedRoles.AgencyUserAndReviewer || ag.RoleId == (int)FixedRoles.DafEvaluator || ag.RoleId == (int)FixedRoles.DafReviewer) ? ag.Agency.Name : null }); }
public CriQuantiyAmountHelper(CC.Data.Services.IPermissionsBase permissions) : base(permissions) { this.columns = new List <jQueryDataTableColumn>() { new jQueryDataTableColumn() { sName = "RowIndex", sTitle = "Row Index" }, new jQueryDataTableColumn() { sName = "ClientId", sTitle = "CC ID" }, new jQueryDataTableColumn() { sName = "ClientName", sTitle = "Client Name" }, new jQueryDataTableColumn() { sName = "Quantity", sTitle = "Quantity" }, new jQueryDataTableColumn() { sName = "TotalAmount", sTitle = "Amount" }, new jQueryDataTableColumn() { sName = "Remarks", sTitle = "Remarks" }, new jQueryDataTableColumn() { sName = "Errors", sTitle = "Errors" } }; }
public object GetResult(ccEntities db, CC.Data.Services.IPermissionsBase permissionsBase) { var source = from c in db.Clients.Where(permissionsBase.ClientsFilter) where c.Id == this.ClientId from item in c.UnmetNeedsOthers where item.ClientId == this.ClientId select new { ServiceTypeID = item.ServiceTypeId, ServiceType = item.ServiceType.Name, Amount = item.Amount, CUR = item.CurrencyId }; var filtered = source; var ordered = filtered.OrderByField(this.sSortCol_0, this.sSortDir_0 == "asc"); return(new jQueryDataTableResult { sEcho = this.sEcho, iTotalDisplayRecords = filtered.Count(), iTotalRecords = source.Count(), aaData = ordered.Skip(this.iDisplayStart).Take(this.iDisplayLength).ToList().Select(f => new { ServiceTypeId = f.ServiceTypeID, ServiceType = f.ServiceType, Amount = f.Amount.Format(), CUR = f.CUR }) }); }
protected override void OnStartProcessingRequest(ProcessRequestArgs args) { string username = HttpContext.Current.User.Identity.Name; permissions = CC.Data.Services.PermissionsFactory.GetPermissionsFor(username); base.OnStartProcessingRequest(args); }
public void LoadData(CC.Data.ccEntities db, CC.Data.Services.IPermissionsBase permissions, User user) { var availableAgencyGroups = db.AgencyGroups.Where(permissions.AgencyGroupsFilter).Select(f => new { Id = f.Id, Name = f.DisplayName }); Funds = new SelectList(db.Funds.Select(f => new { Id = f.Id, Name = f.Name }).OrderBy(f => f.Name), "Id", "Name", this.FundId); Apps = new SelectList(db.Apps.Where(this.Permissions.AppsFilter) .Where(f => FundId == null || f.FundId == FundId) .Select(f => new { Id = f.Id, Name = f.Name }) .OrderBy(f => f.Name), "Id", "Name", this.AppId); }
public IEnumerable <OverViewDataRow> LinqData(CC.Data.ccEntities db, CC.Data.Services.IPermissionsBase permissions) { var source = this.Filter(db, permissions); var q = from a in source group a by new { a.AppId, a.ServiceId, } into g select new { g.Key.AppId, g.Key.ServiceId, Quantity = g.Sum(f => f.Quantity), Amount = g.Sum(f => f.Amount), ClientsCount = g.Select(f => f.ClientId).Distinct().Count(), CcGrant = g.Select(f => new { f.AppId, f.ServiceId, f.CcGrant }).Distinct().Sum(f => f.CcGrant) }; var r = from f in q join b in db.viewAppExchangeRates on new { AppId = f.AppId, ToCur = this.CurId } equals new { AppId = b.AppId, ToCur = b.ToCur } join s in db.Services on f.ServiceId equals s.Id join a in db.Apps on f.AppId equals a.Id select new OverViewDataRow { ServiceTypeName = s.ServiceType.Name, ServiceName = s.Name, FundName = a.Fund.Name, AppName = a.Name, Quantity = f.Quantity, Amount = b.Value * f.Amount, ClientsCount = f.ClientsCount, AverageCostPerClient = b.Value * f.Amount / (f.ClientsCount == 0 ? (int?)null : f.ClientsCount), AverageCostPerUnit = b.Value * f.Amount / (f.Quantity == 0 ? (int?)null : f.Quantity), MasterFundName = a.Fund.MasterFund.Name, CcGrant = b.Value * f.CcGrant, Cur = this.CurId, ServiceId = f.ServiceId, AppId = f.AppId }; if (this.iDisplayLength != int.MaxValue) { r = r .OrderBy(f => f.AppId) .Skip(this.iDisplayStart).Take(this.iDisplayLength + 1); } return(r.ToList()); }
public static IQueryable <UnmetDataRow> PreviewQuery(ccEntities db, CC.Data.Services.IPermissionsBase Permissions, Guid Id, bool newRows) { var maxDate = DateTime.Now.Date; var source = from item in ( from n in db.ImportUnmetNeedsOthers where n.ImportId == Id join c in db.Clients.Where(Permissions.ClientsFilter) on n.ClientId equals c.Id into cg join d in db.ImportUnmetNeedsOthers.Where(f => f.ImportId == Id) on new { ClientId = n.ClientId, ServiceTypeImportId = n.ServiceTypeImportId } equals new { ClientId = d.ClientId, ServiceTypeImportId = d.ServiceTypeImportId } into dg join de in db.UnmetNeedsOthers on new { ClientId = n.ClientId, ServiceTypeImportId = n.ServiceTypeImportId } equals new { ClientId = de.ClientId, ServiceTypeImportId = de.ServiceTypeId } into deg from c in cg.DefaultIfEmpty() select new { RowIndex = n.RowIndex, ClientId = n.ClientId, FirstName = c.FirstName, LastName = c.LastName, ServiceTypeId = n.ServiceTypeImportId, Amount = n.Amount, RowErrors = new { ClientNotFound = c.Id == null, InvalidAmount = n.Amount < 0, DuplicatesRowIndexes = dg.Where(f => f.RowIndex != n.RowIndex).Select(f => f.RowIndex), DuplicateEntries = deg.Any() && newRows, InvalidServiceType = db.ServiceTypes.Any(f => f.Id == n.ServiceTypeImportId && f.DoNotReportInUnmetNeedsOther) } }) select new UnmetDataRow { RowIndex = item.RowIndex, ClientId = item.ClientId, FirstName = item.FirstName, LastName = item.LastName, ServiceTypeImportId = item.ServiceTypeId, Amount = item.Amount, RowErrors = new UnmetDataRow.Errors { ClientNotFound = item.RowErrors.ClientNotFound, DuplicatesRowIndexes = item.RowErrors.DuplicatesRowIndexes, DuplicateEntries = item.RowErrors.DuplicateEntries, InvalidServiceType = item.RowErrors.InvalidServiceType, Any = item.RowErrors.ClientNotFound || item.RowErrors.InvalidAmount || item.RowErrors.DuplicatesRowIndexes.Any() || item.RowErrors.DuplicateEntries || item.RowErrors.InvalidServiceType } }; return(source); }
public Models.jQueryDataTableResult GetJqResult(CC.Data.ccEntities db, CC.Data.Services.IPermissionsBase permissions) { var source = Data(db, permissions); return(new CC.Web.Models.jQueryDataTableResult { aaData = source.Take(this.iDisplayLength), iTotalDisplayRecords = source.Count() > this.iDisplayLength ? this.iDisplayStart + this.iDisplayLength + 1 : this.iDisplayStart + 1, sEcho = this.sEcho }); }
public void LoadRelatedData(CC.Data.ccEntities db, CC.Data.Services.IPermissionsBase permissions) { var validStatuses = AppBudget.ValidStatuses.Select(f => (int? )f); this.MainReport.AppBudget = db.AppBudgets .Include(f => f.App.Fund) .Include(f => f.App.AgencyGroup) .Where(permissions.AppBudgetsFilter) .Where(f => validStatuses.Contains(f.StatusId)) .Single(f => f.Id == this.MainReport.AppBudgetId); IsLoaded = true; }
public Models.jQueryDataTableResult GetJqResult(CC.Data.ccEntities db, CC.Data.Services.IPermissionsBase permissions) { var source = Data(db, permissions); var filtered = Filter(source); var sorted = filtered.OrderByField(this.sSortCol_0, this.bSortDir_0); return(new CC.Web.Models.jQueryDataTableResult { aaData = sorted.Skip(this.iDisplayStart).Take(this.iDisplayLength).ToList(), iTotalDisplayRecords = filtered.Count(), iTotalRecords = source.Count(), sEcho = this.sEcho }); }
public CriEmergencyHelper(CC.Data.Services.IPermissionsBase permissions) : base(permissions) { this.columns = new List <jQueryDataTableColumn>() { new jQueryDataTableColumn() { sName = "RowIndex", sTitle = "Row Index" }, new jQueryDataTableColumn() { sName = "ClientId", sTitle = "CC ID" }, new jQueryDataTableColumn() { sName = "ClientName", sTitle = "Client Name" }, new jQueryDataTableColumn() { sName = "Date", sTitle = "Date", sType = "date", format = "dd MMM yyyy" }, new jQueryDataTableColumn() { sName = "TypeName", sTitle = "Type Name" }, new jQueryDataTableColumn() { sName = "Amount", sTitle = "Amount" }, new jQueryDataTableColumn() { sName = "Remarks", sTitle = "Purpose of grant" }, new jQueryDataTableColumn() { sName = "Discretionary", sTitle = "Discretionary" }, new jQueryDataTableColumn() { sName = "UniqueCircumstances", sTitle = "Unique Circumstances" }, new jQueryDataTableColumn() { sName = "Errors", sTitle = "Errors" } }; }
/// <summary> /// load relation ends /// </summary> /// <param name="db"></param> /// <param name="permissions"></param> internal void LoadData(ccEntities db, CC.Data.Services.IPermissionsBase permissions) { AgenciesSelectList = new SelectList(db.Agencies.Where(permissions.AgencyFilter).Select(f => new { Id = f.Id, Name = f.Name }).OrderBy(f => f.Name), "Id", "Name", this.AgencyId); var agencygroups = db.AgencyGroups.Where(permissions.AgencyGroupsFilter).Select(f => new { Id = f.Id, Name = f.DisplayName }).OrderBy(f => f.Name); AgencyGroupsSelectList = new SelectList(agencygroups, "Id", "Name", this.AgencyGroupId); POAgencyGroups = new MultiSelectList(agencygroups, "Id", "Name", this.AgencyGroupIds); PAAgencyGroups = new MultiSelectList(agencygroups, "Id", "Name", this.AgencyGroupIds); RegionsSelectList = new SelectList(db.Regions.Where(permissions.RegionsFilter).Select(f => new { Id = f.Id, Name = f.Name }).OrderBy(f => f.Name), "Id", "Name", this.RegionId); RolesSelectList = new SelectList(permissions.AllowedRoles.Select(f => new { Key = (int)f, Value = f.DisplayName() }), "Key", "Value", this.RoleId); if (this.RoleId == (int)FixedRoles.Ser || this.RoleId == (int)FixedRoles.SerAndReviewer) { EditRolesSelectList = new SelectList(permissions.AllowedRoles.Where(f => f == FixedRoles.Ser || f == FixedRoles.SerAndReviewer).Select(f => new { Key = (int)f, Value = f.DisplayName() }), "Key", "Value", this.RoleId); } else if (this.RoleId == (int)FixedRoles.AgencyUser || this.RoleId == (int)FixedRoles.AgencyUserAndReviewer) { EditRolesSelectList = new SelectList(permissions.AllowedRoles.Where(f => f == FixedRoles.AgencyUser || f == FixedRoles.AgencyUserAndReviewer).Select(f => new { Key = (int)f, Value = f.DisplayName() }), "Key", "Value", this.RoleId); } }
public IEnumerable <OverViewDataRow> Data(CC.Data.ccEntities db, CC.Data.Services.IPermissionsBase permissions) { var data = db.spFinancialSummaryDetails(this.CurId, this.StartDate, this.EndDate , !this.IncludeNotSubmittedReports , !this.HideEstimatedAmounts , this.AgencyId , this.RegionId , this.CountryId , this.StateId , this.ServiceTypeId , this.ServiceId , this.MasterFundId , this.FundId , this.AppId , this.ClientId , this.sSearch , this.sSortCol_0 , this.sSortDir_0 == "asc" , this.iDisplayLength == int.MaxValue ? int.MaxValue : this.iDisplayLength + 1 , this.iDisplayStart , permissions.User.Id); return(data.Select(f => new OverViewDataRow { SubReportId = f.SubReportId, FirstName = f.FirstName, LastName = f.LastName, ClientId = f.ClientId, AgencyId = f.AgencyId, ServiceTypeName = f.ServiceTypeName, ServiceName = f.ServiceName, ReportStart = f.ReportStart, ReportEnd = f.ReportEnd, FundName = f.FundName, AppName = f.AppName, Quantity = f.Quantity, Amount = f.Amount, Cur = this.CurId, IsEstimated = f.IsEstimated ?? false, SubReportId1 = f.SubReportId }).ToList()); }
public void LoadData(CC.Data.ccEntities db, CC.Data.Services.IPermissionsBase permissions, CC.Data.User user) { var dbData = db.MainReports .Where(permissions.MainReportsFilter); if (this.Filter != null) { if (this.Filter.RegionId.HasValue) { dbData = dbData.Where(f => f.AppBudget.App.AgencyGroup.Country.RegionId == this.Filter.RegionId); } if (this.Filter.CountryId.HasValue) { dbData = dbData.Where(f => f.AppBudget.App.AgencyGroup.CountryId == this.Filter.CountryId); } if (this.Filter.StateId.HasValue) { dbData = dbData.Where(f => f.AppBudget.App.AgencyGroup.StateId == this.Filter.StateId.Value); } if (this.Filter.AgencyGroupId.HasValue) { dbData = dbData.Where(f => f.AppBudget.App.AgencyGroupId == this.Filter.AgencyGroupId); } if (this.Filter.Start.HasValue) { dbData = dbData.Where(f => f.End > this.Filter.Start); } if (this.Filter.End.HasValue) { dbData = dbData.Where(f => f.Start < this.Filter.End); } if (this.Filter.StatusId.HasValue) { dbData = dbData.Where(f => f.StatusId == (int)this.Filter.StatusId.Value); } if (this.Filter.GGOnly) { dbData = dbData.Where(f => f.AppBudget.App.Fund.MasterFundId == 73); } } }
public IEnumerable <OverViewDataRow> SpData(CC.Data.ccEntities db, CC.Data.Services.IPermissionsBase permissions) { var data = db.spFinancialSummarySummary(this.CurId, this.StartDate, this.EndDate , !this.IncludeNotSubmittedReports , !this.HideEstimatedAmounts , this.AgencyId , this.RegionId , this.CountryId , this.StateId , this.ServiceTypeId , this.ServiceId , this.MasterFundId , this.FundId , this.AppId , this.ClientId , this.sSearch , this.sSortCol_0 , this.sSortDir_0 == "asc" , this.iDisplayLength == int.MaxValue ? int.MaxValue : this.iDisplayLength + 1 , this.iDisplayStart , permissions.User.Id); return(data.Select(f => new OverViewDataRow { ServiceTypeName = f.ServiceType, ServiceName = f.Service, FundName = f.Fund, AppName = f.App, Quantity = f.Quantity, Amount = f.Amount, ClientsCount = f.ClientsCount, AverageCostPerClient = f.AverageCostPerClient, AverageCostPerUnit = f.AverageCostPerUnit, MasterFundName = f.MasterFund, CcGrant = f.CcGrant, Cur = this.CurId, ServiceId = f.ServiceId, AppId = f.AppId }).ToList()); }
internal void Insert(ccEntities db, CC.Data.Services.IPermissionsBase permissionsBase) { var c = db.Clients.Where(permissionsBase.ClientsFilter).SingleOrDefault(f => f.Id == this.ClientId); if (c == null) { throw new Exception("Client not found."); } else { var gfHour = this.GetGFHour; gfHour.UpdatedBy = permissionsBase.User.Id; db.GrandfatherHours.AddObject(gfHour); try { db.SaveChanges(); } catch (System.Data.UpdateException ex) { var msg = ex.InnerException.Message; if (msg.Contains("PK_GFHours")) { throw new Exception("Duplicate entry.", ex); } else if (msg.Contains("FK_GFHours_Clients")) { throw new Exception("Client not found.", ex); } else if (msg.Contains("CK_GFHours_Value")) { throw new Exception("Invalid Value.", ex); } else { throw; } } } }
public CriHcWeeklyImportHelper(CC.Data.Services.IPermissionsBase permissions) : base(permissions) { this.columns = new List <jQueryDataTableColumn>() { new jQueryDataTableColumn() { sName = "RowIndex", sTitle = "Row Index" }, new jQueryDataTableColumn() { sName = "ClientId", sTitle = "CC ID" }, new jQueryDataTableColumn() { sName = "ClientName", sTitle = "Client Name" }, new jQueryDataTableColumn() { sName = "Week", sTitle = "Week" }, new jQueryDataTableColumn() { sName = "Rate", sTitle = "Rate" }, new jQueryDataTableColumn() { sName = "Quantity", sTitle = "Quantity" }, new jQueryDataTableColumn() { sName = "Remarks", sTitle = "Remarks" }, new jQueryDataTableColumn() { sName = "Errors", sTitle = "Errors" } }; }
public static IClientReportImportHelper GetByReportingTypeId(int id, CC.Data.Services.IPermissionsBase permissions) { switch ((Service.ReportingMethods)id) { case Service.ReportingMethods.TotalCostWithListOfClientNames: return(new CriImportHelper(permissions)); case Service.ReportingMethods.ClientNamesAndCosts: return(new CriClientNamesAndCostsHelper(permissions)); case Service.ReportingMethods.ClientUnit: return(new CriClientUnitHelper(permissions)); case Service.ReportingMethods.ClientUnitAmount: return(new CriQuantiyAmountHelper(permissions)); case Service.ReportingMethods.Emergency: return(new CriEmergencyHelper(permissions)); case Service.ReportingMethods.Homecare: return(new CriHcImportHelper(permissions)); case Service.ReportingMethods.HomecareWeekly: return(new CriHcWeeklyImportHelper(permissions)); case Service.ReportingMethods.SupportiveCommunities: return(new CriSupportiveCommunitiesHelper(permissions)); case Service.ReportingMethods.SoupKitchens: return(new CriSoupKitchensHelper(permissions)); case Service.ReportingMethods.ClientEventsCount: return(new CriClientEventsCountHelper(permissions)); default: throw new NotImplementedException(); } }
public void Load(CC.Data.ccEntities db, CC.Data.Services.IPermissionsBase permissions) { this.AgenciesList = new SelectList( db.Agencies.Where(permissions.AgencyFilter) .Select(f => new { Id = f.Id, Name = f.Name }) .OrderBy(f => f.Name), "id", "name"); this.AppsList = new SelectList( db.Apps.Where(permissions.AppsFilter) .Select(f => new { Id = f.Id, Name = f.Name }) .OrderBy(f => f.Name), "id", "name"); this.MusterFundsList = new SelectList( (from a in db.Apps.Where(permissions.AppsFilter) group a by a.Fund.MasterFund into g select g.Key) .Select(f => new { Id = f.Id, Name = f.Name }) .OrderBy(f => f.Name), "id", "name"); this.FundsList = new SelectList( (from a in db.Apps.Where(permissions.AppsFilter) group a by a.Fund into g select g.Key) .Select(f => new { Id = f.Id, Name = f.Name }) .OrderBy(f => f.Name), "id", "name"); this.ServicesList = new SelectList( (from ag in db.AgencyGroups.Where(permissions.AgencyGroupsFilter) from app in ag.Apps from s in app.Services select s).Distinct() .Select(f => new { Id = f.Id, Name = f.Name }).Distinct() .OrderBy(f => f.Name), "id", "Name"); this.ServiceTypesList = new SelectList( (from ag in db.AgencyGroups.Where(permissions.AgencyGroupsFilter) from app in ag.Apps from s in app.Services select s.ServiceType) .Select(f => new { Id = f.Id, Name = f.Name }).Distinct() .OrderBy(f => f.Name), "id", "name"); this.Currencies = new SelectList(CC.Data.Currency.ConvertableCurrencies); }
public CriSoupKitchensHelper(CC.Data.Services.IPermissionsBase permissions) : base(permissions) { this.columns = new List <jQueryDataTableColumn>() { new jQueryDataTableColumn() { sName = "RowIndex", sTitle = "Row Index" }, new jQueryDataTableColumn() { sName = "ClientId", sTitle = "CC ID" }, new jQueryDataTableColumn() { sName = "Date", sTitle = "Report Date", sType = "date", format = "dd MMM yyyy" }, new jQueryDataTableColumn() { sName = "Errors", sTitle = "Errors" } }; }
internal void Insert(ccEntities db, CC.Data.Services.IPermissionsBase permissionsBase) { var c = db.Clients.Where(permissionsBase.ClientsFilter).SingleOrDefault(f => f.Id == this.ClientId); if (c == null) { throw new Exception("Client not found."); } else { db.UnmetNeedsOthers.AddObject(this.GetUnmetNeedsOther); try { db.SaveChanges(); } catch (System.Data.UpdateException ex) { var msg = ex.InnerException.Message; if (msg.Contains("PK_UnmetNeedsOther")) { throw new Exception("Duplicate entry.", ex); } else if (msg.Contains("FK_UnmetNeedsOther_Clients")) { throw new Exception("Client not found.", ex); } else if (msg.Contains("CK_UnmetNeedsOther_Amount")) { throw new Exception("Invalid Amount Value. Must be >=0", ex); } else { throw; } } } }
public MainReportSelectAppModel(CC.Data.ccEntities db, User user, CC.Data.Services.IPermissionsBase permissions) : this() { LoadData(db, permissions, user); }
/// <summary> /// Returns ienumerable collection that is ready to be written to excel as is /// </summary> /// <param name="clients"></param> /// <param name="predicate"></param> /// <returns></returns> internal static IQueryable <acprow> GetExportData(IQueryable <Client> clients, ccEntities db, CC.Data.Services.IPermissionsBase Permissions) { var q = from c in clients join dc in db.Clients.Where(Permissions.ClientsFilter) on c.MasterId equals dc.Id into dcg from dc in dcg.DefaultIfEmpty() select new acprow { CLIENT_ID = c.Id, ORG_ID = c.AgencyId, LAST_NAME = c.LastName, FIRST_NAME = c.FirstName, MIDDLE_NAME = c.MiddleName, DOB = c.BirthDate, ADDRESS = c.Address, CITY = c.City, ZIP = c.ZIP, STATE_CODE = c.State.Code, COUNTRY_CODE = c.Agency.AgencyGroup.Country.Code, TYPE_OF_ID = c.NationalIdType.Name, SS = c.NationalId, PHONE = c.Phone, CLIENT_COMP_PROGRAM = c.IsCeefRecipient, COMP_PROG_REG_NUM = c.CeefId, AdditionalComp = c.AddCompName, AdditionalCompNum = c.AddCompId, Deceased = (bool?)(c.DeceasedDate.HasValue || c.LeaveReasonId == (int)LeaveReasonEnum.Deceased), DOD = c.DeceasedDate, New_Client = c.New_Client, Place_of_Birth_City = c.PobCity, Place_of_Birth_Country = c.BirthCountry.Name, Previous_First_Name = c.PrevFirstName, Previous_Last_Name = c.PrevLastName, Upload_Date = c.CreatedAt, MatchFlag = c.MatchFlag, claim_status = c.FundStatus.Name, CLIENT_MASTER_ID = dc.MasterId, Internal_Client_ID = c.InternalId }; return(q); }
public IQueryable <AgencyReportingHomecareDetailsRow> GetAgencyReportingData(CC.Data.ccEntities db, CC.Data.Services.IPermissionsBase permissions) { db.CommandTimeout = 600; var source = db.spAgencyReportingHomecareDetails(this.CurId, this.StartDate, this.EndDate , !this.IncludeNotSubmittedReports , this.AgencyId , this.RegionId , this.CountryId , this.StateId , this.ServiceId , this.MasterFundId , this.FundId , this.AppId , this.ClientId , this.sSearch , this.sSortCol_0 , this.sSortDir_0 == "asc" , this.iDisplayLength == int.MaxValue ? int.MaxValue : this.iDisplayLength + 1 , this.iDisplayStart , permissions.User.Id).ToList(); DateTimeFormatInfo dfi = DateTimeFormatInfo.CurrentInfo; Calendar cal = dfi.Calendar; var q = from item in source select new AgencyReportingHomecareDetailsRow { AgencyId = item.AgencyId, Cur = this.CurId, ClientId = item.ClientId, FundName = item.FundName, AppName = item.AppName, ServiceName = item.ServiceName, Quantity = item.Quantity, Rate = item.Rate, Amount = item.Amount, Date = item.ReportDate, IsWeekly = item.IsWeekly.Value, WeekNumber = "W" + (item.IsWeekly.Value ? (cal.GetWeekOfYear(item.ReportDate, dfi.CalendarWeekRule, item.SelectedDayOfWeek != null ? (DayOfWeek)item.SelectedDayOfWeek : item.MrStart.DayOfWeek)).ToString() : item.ReportDate.Month.ToString()) }; return(q.AsQueryable()); }
public static IQueryable <DataRow> PreviewQuery(ccEntities db, CC.Data.Services.IPermissionsBase Permissions, Guid Id) { var maxDate = DateTime.Now.Date; var source = from item in ( from n in db.ImportGovHcHours where n.ImportId == Id join c in db.Clients.Where(Permissions.ClientsFilter) on n.ClientId equals c.Id into cg join d in db.ImportGovHcHours.Where(f => f.ImportId == Id) on new { ClientId = n.ClientId, StartDate = n.StartDate } equals new { ClientId = (int?)d.ClientId, StartDate = (DateTime?)d.StartDate } into dg from c in cg.DefaultIfEmpty() join e in db.GovHcHours on new { ClientId = n.ClientId, StartDate = n.StartDate } equals new { ClientId = (int?)e.ClientId, StartDate = (DateTime?)e.StartDate } into eg from e in eg.DefaultIfEmpty() let lastReport = (from cr in db.ClientReports where cr.ClientId == c.Id join sr in db.SubReports on cr.SubReportId equals sr.Id join mr in db.MainReports.Where(MainReport.Submitted) on sr.MainReportId equals mr.Id where sr.AppBudgetService.Service.ReportingMethodId == (int)Service.ReportingMethods.Homecare || sr.AppBudgetService.Service.ReportingMethodId == (int)Service.ReportingMethods.HomecareWeekly select mr).OrderByDescending(f => f.Start).FirstOrDefault() let max = lastReport != null ? (DateTime?)lastReport.End : (DateTime?)null select new { RowIndex = n.RowIndex, ClientId = n.ClientId, FirstName = c.FirstName, LastName = c.LastName, StartDate = n.StartDate, Value = n.Value, ExistingValue = e.Value, RowErrors = new { ClientNotFound = c.Id == null, NegativeValue = n.Value <0, FutureStartDate = n.StartDate> maxDate, InvalidStartDate = n.StartDate <c.JoinDate || n.StartDate> c.LeaveDate, DuplicatesRowIndexes = dg.Where(f => f.RowIndex != n.RowIndex).Select(f => f.RowIndex), StartDateBeforeReportDate = Permissions.User.RoleId != (int)FixedRoles.Admin && (n.StartDate < max) } }) select new DataRow { RowIndex = item.RowIndex, ClientId = item.ClientId, FirstName = item.FirstName, LastName = item.LastName, StartDate = item.StartDate, Value = item.Value, ExistingValue = item.Value, RowErrors = new DataRow.Errors { ClientNotFound = item.RowErrors.ClientNotFound, NegativeValue = item.RowErrors.NegativeValue, FutureStartDate = item.RowErrors.FutureStartDate, InvalidStartDate = item.RowErrors.InvalidStartDate, DuplicatesRowIndexes = item.RowErrors.DuplicatesRowIndexes, Any = item.RowErrors.ClientNotFound || item.RowErrors.NegativeValue || item.RowErrors.FutureStartDate || item.RowErrors.InvalidStartDate || item.RowErrors.DuplicatesRowIndexes.Any(), StartDateBeforeReportEnd = item.RowErrors.StartDateBeforeReportDate } }; return(source); }
public void Load(CC.Data.ccEntities db, CC.Data.Services.IPermissionsBase permissions) { this.Currencies = new SelectList(CC.Data.Currency.ConvertableCurrencies); }