Exemple #1
0
        private async void PopelateData(int pcNo)
        {
            BeBusy(true);

            var lookups = await rcs.GetLookUPsData();

            //Projects
            List <Projects> ProjectsList = new List <Projects>();

            ProjectsList                   = lookups.projects;
            projectName.ItemsSource        = ProjectsList;
            projectName.ItemDisplayBinding = new Binding("Name");

            //Contractors
            List <Contractors> ContractorstList = new List <Contractors>();

            ContractorstList              = lookups.contractors;
            contractor.ItemsSource        = ContractorstList;
            contractor.ItemDisplayBinding = new Binding("Name");

            //locations
            List <Locations> LocationstList = new List <Locations>();

            LocationstList              = lookups.locations;
            location.ItemsSource        = LocationstList;
            location.ItemDisplayBinding = new Binding("Name");

            ////ParameterCatagory
            //List<ParameterCategory> ParameterCategoryList = new List<ParameterCategory>();
            //ParameterCategoryList = lookups.parameterCatagories;
            //parameterCategory.ItemsSource = ParameterCategoryList;
            //parameterCategory.ItemDisplayBinding = new Binding("Name");

            //VoltageLevels
            List <VoltageLevels> VoltageLevelstList = new List <VoltageLevels>();

            VoltageLevelstList              = lookups.voltageLevels;
            voltageLevel.ItemsSource        = VoltageLevelstList;
            voltageLevel.ItemDisplayBinding = new Binding("Name");

            //Users
            List <Users> WorkOrderUserList = new List <Users>();

            WorkOrderUserList                = lookups.users;
            workOrderUser.ItemsSource        = WorkOrderUserList;
            workOrderUser.ItemDisplayBinding = new Binding("Name");

            if (DataStore.getRole().Equals("normal"))
            {
                workOrderUserLbl.IsVisible = false;
                workOrderUser.IsVisible    = false;
            }

            BeBusy(false);
        }
        private async void popelateData(int ID)
        {
            await BeBusy(true);

            try
            {
                //WorkOrders wo = new WorkOrders();
                wo = await rcs.getWorkOrderByIDAsync(ID);

                var lookups = await rcs.GetLookUPsData();


                //ID
                woNo.Text = wo.Number;

                //Projects
                List <Projects> ProjectsList = new List <Projects>();
                ProjectsList                   = lookups.projects;
                projectName.ItemsSource        = ProjectsList;
                projectName.ItemDisplayBinding = new Binding("Name");
                projectName.SelectedItem       = ProjectsList.Find(p => p.ID == wo.project_FKID);


                //Contractors
                List <Contractors> ContractorstList = new List <Contractors>();
                ContractorstList              = lookups.contractors;
                contractor.ItemsSource        = ContractorstList;
                contractor.ItemDisplayBinding = new Binding("Name");
                contractor.SelectedItem       = ContractorstList.Find(p => p.ID == wo.contractors_FKID);

                //Place
                List <Locations> LocationstList = new List <Locations>();
                LocationstList              = lookups.locations;
                location.ItemsSource        = LocationstList;
                location.ItemDisplayBinding = new Binding("Name");
                location.SelectedItem       = LocationstList.Find(p => p.ID == wo.location_FKID);

                //Length
                //Length.Text = wo.totalLenght.ToString();

                //startDate
                StartDate.Date = wo.startingDate.Value;

                //ParameterCatagory
                //List<ParameterCategory> ParameterCategoryList = new List<ParameterCategory>();
                //ParameterCategoryList = await rcs.getAllParameterCategoryAsync();
                //parameterCategory.ItemsSource = ParameterCategoryList;
                //parameterCategory.ItemDisplayBinding = new Binding("Name");
                //parameterCategory.SelectedItem = ParameterCategoryList.Find(p => p.ID == wo.ParameterCategory_FKID);

                //VoltageLevels
                List <VoltageLevels> VoltageLevelstList = new List <VoltageLevels>();
                VoltageLevelstList              = lookups.voltageLevels;
                voltageLevel.ItemsSource        = VoltageLevelstList;
                voltageLevel.ItemDisplayBinding = new Binding("Name");
                voltageLevel.SelectedItem       = VoltageLevelstList.Find(p => p.ID == wo.voltageLevels_FKID);

                //workOrderValue
                workOrderValue.Text = wo.value.ToString();

                //Users
                List <Users> WorkOrderUserList = new List <Users>();
                WorkOrderUserList                = lookups.users;
                workOrderUser.ItemsSource        = WorkOrderUserList;
                workOrderUser.ItemDisplayBinding = new Binding("Name");
                workOrderUser.SelectedItem       = WorkOrderUserList.Find(p => p.ID == wo.user_FKID);



                await BeBusy(false);
            }
            catch (Exception err)
            {
                await DisplayAlert("", err.Message, "ok");
            }
        }