Exemplo n.º 1
0
        private async Task LoadMachines(int defaultmachineid)
        {
            var machines = new ObservableCollection <Machine>();

            foreach (var m in await _machineService.GetAll())
            {
                machines.Add(Converter.Convert(m));
            }
            int defaultM = await _machineService.GetDetaultMachine();

            Machines = machines;

            var defaultmachine = machines.FirstOrDefault(m => m.MachineID == defaultmachineid);

            if (defaultmachine == null)
            {
                defaultmachine = machines.FirstOrDefault(m => m.MachineID == defaultM);
            }

            if (defaultmachine == null && machines.Count > 0)
            {
                defaultmachine = machines[0];
            }

            Machine = defaultmachine;
        }
Exemplo n.º 2
0
        public IActionResult GetAll()
        {
            var machines = machineService.GetAll();

            if (machines != null)
            {
                machines.Sort((x, y) => x.Processor.CompareTo(y.Processor));
                return(Ok(machines));
            }

            return(NotFound());
        }
Exemplo n.º 3
0
        public dynamic GetList(string _search, long nd, int rows, int?page, string sidx, string sord, string filters = "")
        {
            // Construct where statement

            string strWhere = GeneralFunction.ConstructWhere(filters);

            // Get Data
            var query = _MachineService.GetAll().Where(d => d.IsDeleted == false);

            var list = query as IEnumerable <Machine>;

            var pageIndex    = Convert.ToInt32(page) - 1;
            var pageSize     = rows;
            var totalRecords = query.Count();
            var totalPages   = (int)Math.Ceiling((float)totalRecords / (float)pageSize);

            // default last page
            if (totalPages > 0)
            {
                if (!page.HasValue)
                {
                    pageIndex = totalPages - 1;
                    page      = totalPages;
                }
            }

            list = list.Skip(pageIndex * pageSize).Take(pageSize);

            return(Json(new
            {
                total = totalPages,
                page = page,
                records = totalRecords,
                rows = (
                    from item in list
                    select new
                {
                    id = item.Id,
                    cell = new object[] {
                        item.Id,
                        item.Code,
                        item.Name,
                        item.Description,
                        item.CreatedAt,
                        item.UpdatedAt,
                    }
                }).ToArray()
            }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 4
0
        public IActionResult GetMachines()
        {
            var Machines = _service.GetAll();

            if (Machines.Count == 0)
            {
                return(NoContent());
            }

            return(Ok(
                       Machines.Select(m => new
            {
                m.MachineId,
                m.Name,
                TotalProduction = _service.GetTotalProduction(m.MachineId)
            })
                       ));
        }
Exemplo n.º 5
0
 public async Task <IEnumerable <Machine> > Get()
 {
     return(await _service.GetAll());
 }
Exemplo n.º 6
0
 private List <Machine> GetAllMachines()
 {
     return(_machineService.GetAll());
 }
Exemplo n.º 7
0
        // GET: Machines
        public ActionResult Index()
        {
            var machines = _MachineService.GetAll();

            return(View(machines.ToList()));
        }
 public IEnumerable <MachineViewModel> GetMachines()
 {
     return(_machineService.GetAll());
 }
Exemplo n.º 9
0
 public IActionResult Get()
 {
     return(Ok(_machineService.GetAll()));
 }
Exemplo n.º 10
0
 private void Makineler_Load(object sender, EventArgs e)
 {
     dgvMachines.DataSource   = _machineService.GetAll();
     dgvCategories.DataSource = _categoryService.GetAll();
 }
Exemplo n.º 11
0
 private void MakineSecim_Load(object sender, EventArgs e)
 {
     dgvMachine.DataSource = _machineService.GetAll();
 }