Esempio n. 1
0
        private void FormStoringJob_Load(object sender, EventArgs e)
        {
            InsertSQL StoringJob = new InsertSQL();

            if (state == "Edit")
            {
                textBox1.Text   = sj1.Description;
                cbHarvest.Text  = sj1.Harvest_id.ToString();
                cbCrop.Text     = sj1.Crop_id.ToString();
                cbBox.Text      = sj1.Box_id.ToString();
                textBox5.Text   = sj1.Quantity.ToString();
                cbVehicle.Text  = sj1.Vehicle_id.ToString();
                cbEmployee.Text = sj1.Employee_id.ToString();
                dtpStart.Value  = sj1.Date_start;
                dtpEnd.Value    = sj1.Date_end;

                TestSQL ts = new TestSQL();
                cropLists    = ts.GetCropList();
                employeeList = ts.GetEmployeeList();
                vehicleList  = ts.GetVehicleList();
                boxList      = ts.GetBoxList();
                harvestLists = ts.GetHarvestingJobList();

                SowingJob sj11 = new SowingJob();

                foreach (HarvestingJob harvest in harvestLists)
                {
                    string showText = harvest.Id + ". " + harvest.Description;
                    cbCrop.Items.Add(showText);
                }

                foreach (Box box in boxList)
                {
                    string showText = box.Id + ". " + box.Name;
                    cbCrop.Items.Add(showText);
                }

                foreach (Crop crop1 in cropLists)
                {
                    string showText = crop1.Id + ". " + crop1.Name;
                    cbCrop.Items.Add(showText);
                }

                foreach (Vehicle vehicle in vehicleList)
                {
                    string showText = vehicle.Id + ". " + vehicle.Name;
                    cbVehicle.Items.Add(showText);
                }

                foreach (Employee employee in employeeList)
                {
                    if (employee.Admin == false)
                    {
                        string showText = employee.Id + ". " + employee.Username;
                        cbEmployee.Items.Add(showText);
                    }
                }
            }
        }