示例#1
0
        private void reload_Click(object sender, RoutedEventArgs e)
        {
            var fresh = Current.ToLite().Retrieve();

            Current = null;
            Current = fresh;
        }
示例#2
0
        internal DashboardEntity GetActiveClient()
        {
            DashboardEntity dict = new DashboardEntity();
            DataSet         ds   = new DataSet();
            DataTable       dt   = new DataTable();
            List <ClientApplicationEntity> results = new List <ClientApplicationEntity>();

            try
            {
                StoredProcedureEntity sproc = new StoredProcedureEntity();
                sproc.StoredProcedureName = "mapp.GetActiveClients";
                ds = sql.ExecuteDataSet(CommandType.StoredProcedure, sproc);
                DataTable dt2 = ds.Tables[2];
                results = new ClientApplicationAadpter().AdaptLists(dt2);
                dict.TotalActiveClients   = Convert.ToInt32(ds.Tables[0].Rows[0]["ActiveClient"]).ToString();
                dict.TotalInActiveClients = Convert.ToInt32(ds.Tables[1].Rows[0]["InActiveClient"]).ToString();
                dict.clientApplication    = results;
                foreach (ClientApplicationEntity application in results)
                {
                    application.clientApplicationList = new DashboardRepository(Connection).GetClientsApplication(application.ClientId);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(dict);
        }
示例#3
0
 private void cpCombo_EntityChanged(object sender, bool userInteraction, object oldValue, object newValue)
 {
     if (userInteraction)
     {
         Lite <DashboardEntity> cp = newValue as Lite <DashboardEntity>;
         Current = cp == null ? null : Server.Return((IDashboardServer cps) => cps.RetrieveDashboard(cp));
     }
 }
示例#4
0
        private void reload_Click(object sender, RoutedEventArgs e)
        {
            cpCombo.LoadNow();

            if (Current != null)
            {
                var lite = Current.ToLite();
                Current = null;
                Current = Server.Return((IDashboardServer cps) => cps.RetrieveDashboard(lite));
            }

            cpCombo.Entity = Current.ToLite();
        }
示例#5
0
        private async Task <DashboardEntity> ObtainEmployeeDashboard(EmployeeEntity employee)
        {
            var oneononeList = await oneononesService.ObtainByEmployee(employee.Id);

            var oneononeComposeTask     = oneononeList.Select(ObtainEmployeeOneononeCompose);
            var oneononeComposeComplete = await Task.WhenAll(oneononeComposeTask);

            var dashboardEntity = new DashboardEntity
            {
                Employee  = employee,
                Oneonones = oneononeComposeComplete.ToList(),
            };

            return(dashboardEntity);
        }
示例#6
0
        public static DashboardViewModel ToViewModel(this DashboardEntity entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var viewModel = new DashboardViewModel
            {
                Employee  = entity.Employee.ToViewModel(),
                Oneonones = entity.Oneonones.Select(ComposeMap.ToViewModel).ToList(),
            };

            return(viewModel);
        }
 /// <summary>
 /// Remove an existing dashboard.
 /// </summary>
 /// <param name="entity">The dashboard to remove.</param>
 /// <param name="cancellationToken">A <see cref="CancellationToken"/> allowing the operation to be canceled.</param>
 /// <returns>A task indicating completion.</returns>
 public async Task RemoveAsync(DashboardEntity entity, CancellationToken cancellationToken = default)
 {
     await Client.DeleteAsync(entity, "Self", entity, cancellationToken : cancellationToken).ConfigureAwait(false);
 }
 /// <summary>
 /// Add a new dashboard.
 /// </summary>
 /// <param name="entity">The dashboard to add.</param>
 /// <param name="cancellationToken">A <see cref="CancellationToken"/> allowing the operation to be canceled.</param>
 /// <returns>The dashboard, with server-allocated properties such as <see cref="Entity.Id"/> initialized.</returns>
 public async Task <DashboardEntity> AddAsync(DashboardEntity entity, CancellationToken cancellationToken = default)
 {
     return(await GroupCreateAsync <DashboardEntity, DashboardEntity>(entity, cancellationToken : cancellationToken).ConfigureAwait(false));
 }
示例#9
0
 void DashboardView_Loaded(object sender, RoutedEventArgs e)
 {
     Current        = Server.Return((IDashboardServer cps) => cps.GetHomePageDashboard());
     cpCombo.Entity = Current.ToLite();
 }
示例#10
0
        public async Task <int> GetDashboardId(int pageId)
        {
            DashboardEntity entity = await this.SingleAsync <DashboardEntity>(ent => ent.PageId == pageId);

            return(entity.DashboardId);
        }
        public DashboardEntity GetDashboard(string userId)
        {
            var victimProfileCount       = 0;
            var victimProfilePer         = 0;
            var totalProfile             = 0;
            var totalPhoto               = 0;
            var averageProfilePercentage = 0;
            var averagePhotoPercentage   = 0;
            var victimPhotoPer           = 0;
            var donotTotal               = 0;


            var victimProfileC = _unitOfWork.victimProfileRepository.Find(c => c.VictimStatus == true);

            if (victimProfileC != null)
            {
                victimProfileCount = victimProfileC.Count();
            }

            var victimProfilePr = _unitOfWork.victimPercProfileRepository.GetFirst(c => c.PercentageSum > 0);

            if (victimProfilePr != null)
            {
                victimProfilePer = (int)victimProfilePr.PercentageSum;
            }

            var victimPhotoPr = _unitOfWork.victimPercPhotoRepository.Find(c => c.PhotoStatus == true);

            if (victimPhotoPr != null)
            {
                victimPhotoPer = (int)victimPhotoPr.Count();
            }

            var donotTot = _unitOfWork.DonorRepository.Find(c => c.DonorStatus == true);

            if (donotTot != null)
            {
                donotTotal = donotTot.Count();
            }

            totalProfile             = victimProfileCount;
            totalPhoto               = (int)Math.Ceiling((decimal)victimPhotoPer / 5);
            averageProfilePercentage = PercentageGeneralProfile(victimProfileCount, victimProfilePer);
            averagePhotoPercentage   = PercentageGeneralPhoto(victimProfileCount, victimPhotoPer);

            var victim = _unitOfWork.victimRepository.Get(c => c.VictimStatus == true && c.UserId == userId);

            if (victim != null)
            {
                var percentagePhoto = 0;
                var victimMap       = Mapper.Map <Victim, VictimModel>(victim);
                var percentagePhot  = _unitOfWork.victimPhotoRepository.Find(c => c.PhotoStatus == true && c.VictimId == victim.VictimId);
                if (percentagePhot != null)
                {
                    percentagePhoto = percentagePhot.Count();;
                }
                var dash1          = new DashboardEntity();
                var percentProfile = 20;

                if (victimMap.Street != null && victimMap.CityId != null &&
                    victimMap.IncidentType != null && victimMap.HomeAddress != null &&
                    victimMap.IncidentDescription != null)
                {
                    percentProfile = 100;
                }
                else if (victimMap.Street == null && victimMap.CityId != null &&
                         victimMap.IncidentType != null && victimMap.HomeAddress != null &&
                         victimMap.IncidentDescription != null)
                {
                    percentProfile = 80;
                }
                else if (victimMap.HomeAddress == null && victimMap.Street != null && victimMap.CityId != null &&
                         victimMap.IncidentType != null && victimMap.IncidentDescription != null)
                {
                    percentProfile = 80;
                }

                switch (percentagePhoto)
                {
                case 0:
                    dash1.PercentagePhoto = 0;
                    break;

                case 1:
                    dash1.PercentagePhoto = 20;
                    break;

                case 2:
                    dash1.PercentagePhoto = 40;
                    break;

                case 3:
                    dash1.PercentagePhoto = 60;
                    break;

                case 4:
                    dash1.PercentagePhoto = 80;
                    break;

                case 5:
                    dash1.PercentagePhoto = 100;
                    break;
                }

                var dash = new DashboardEntity()
                {
                    PercentageProfile = percentProfile,
                    PercentagePhoto   = dash1.PercentagePhoto,
                };
                return(dash);
            }
            else
            {
                var dash = new DashboardEntity()
                {
                    PercentageGeneralPercentageProfile = averageProfilePercentage,
                    PercentageGeneralPhoto             = averagePhotoPercentage,
                    TotalGeneralProfile = totalProfile,
                    TotalGeneralPhoto   = totalPhoto,
                    TotalGeneralDonors  = donotTotal,
                };
                return(dash);
            }
        }
 public async Task UpdateAsync(DashboardEntity entity)
 {
     await Client.PutAsync(entity, "Self", entity).ConfigureAwait(false);
 }
 public async Task RemoveAsync(DashboardEntity entity)
 {
     await Client.DeleteAsync(entity, "Self", entity).ConfigureAwait(false);
 }
 public async Task <DashboardEntity> AddAsync(DashboardEntity entity)
 {
     return(await Client.PostAsync <DashboardEntity, DashboardEntity>(entity, "Create", entity).ConfigureAwait(false));
 }