Exemple #1
0
 public Swarschik[] GetTop3SwarschiksBySalary()
 {
     return(SoftServDB.WorkersDB()
            .OfType <Swarschik>()
            .OrderByDescending(s => s.Salary)
            .Take(3)
            .ToArray());
 }
Exemple #2
0
 public string GetRichestWorkerName()
 {
     return(SoftServDB.WorkersDB()
            .OrderByDescending(w => w.Salary).FirstOrDefault().Name);
     //return SoftServDB.WorkersDB()
     //    .FirstOrDefault(w => w.Salary == SoftServDB.WorkersDB().Max(s => s.Salary)).Name;
     //return SoftServDB.WorkersDB().Select( w => w.Name.Where( s => s. ) )
 }
Exemple #3
0
        public Worker[] GetTop5WorkersBySalary()
        {
            SoftServDB.WorkersDB()
            .OrderByDescending(s => s.Salary)
            .Take(5)
            .ToList().
            ForEach(w => Debug.WriteLine($" {w.GetType().Name}"));



            return(SoftServDB.WorkersDB()
                   .OrderByDescending(s => s.Salary)
                   .Take(5)
                   .ToArray());
        }
Exemple #4
0
        public int GetWorkersQuantityByName(string name)
        {
            var workersCount = SoftServDB.WorkersDB().Where(w => w.Name == name).Count();

            try
            {
                if (workersCount == 0)
                {
                    throw new NameAbsenceException(name);
                }
            }
            catch (NameAbsenceException err)
            {
                var fault = new NameAbsenceFault();
                fault.Result      = false;
                fault.Message     = err.Message;
                fault.Description = "Such name doesn't exits in the current context!!!";
                var reason = new FaultReason(err.Message);
                throw new FaultException <NameAbsenceFault>(fault, reason);
            }

            return(workersCount);
        }
Exemple #5
0
 public decimal GetHighestSalary()
 {
     return(SoftServDB.WorkersDB().Max(w => w.Salary));
 }
Exemple #6
0
 public int GetWorkersQuantity()
 {
     return(SoftServDB.WorkersDB().Count());
 }