Beispiel #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            RequestWindowFeature(WindowFeatures.NoTitle);
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.AssignJobP3);

            // Create your application here

            WorkerList = new List <Employee>();
            Button btnNext = FindViewById <Button>(Resource.Id.btnNextAJP3);
            Button btnBack = FindViewById <Button>(Resource.Id.btnBackAJP3);

            txtSelectedJob = FindViewById <TextView>(Resource.Id.txtSelectedJob);
            lvSelectedEmps = FindViewById <ListView>(Resource.Id.lvCurrentWorkers);

            txtArea       = FindViewById <TextView>(Resource.Id.txtArea);
            txtTruckNo    = FindViewById <TextView>(Resource.Id.txtTruckNumbers);
            btnSelectDate = FindViewById <Button>(Resource.Id.btnSelectDate);
            btnSelectTime = FindViewById <Button>(Resource.Id.btnSelectTime);

            btnSelectDate.Text = "Date: " + DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");   //setting default date on btn
            DateofJob          = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");
            StartTime          = "06:00:00";
            EndTime            = "18:00:00";

            JobName   = Intent.GetStringExtra("JobName");
            JobID     = Intent.GetIntExtra("JobID", 0);
            JobClient = Intent.GetStringExtra("JobClients");
            JobNumber = Intent.GetIntExtra("JobNumber", 0);
            JobArea   = Intent.GetStringExtra("JobArea");

            txtSelectedJob.Text = JobNumber + " - " + JobName + " - " + JobClient;
            actxtWorkers        = FindViewById <AutoCompleteTextView>(Resource.Id.actxtWorker);
            var workerAdapter = new ArrayAdapter <string>(this, Resource.Layout.list_item, GetEmployees.getEmpNames());

            actxtWorkers.Adapter          = workerAdapter;
            btnBack.Click                += BtnBack_Click;
            btnNext.Click                += BtnNext_Click;
            lvSelectedEmps.ItemLongClick += LvSelectedEmps_ItemLongClick;
            btnSelectDate.Click          += BtnSelectDate_Click;
            btnSelectTime.Click          += BtnSelectTime_Click;

            actxtWorkers.ItemClick += ActxtWorkers_ItemClick;
        }
Beispiel #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.EditPlanItem);

            WorkerList = new List <Employee>();
            //JobTime = Intent.GetStringExtra("AssignSTARTTIME");
            //JobInstructions = Intent.GetStringExtra("AssignINSTRUCTIONS");
            ////JobDate = Intent.GetStringExtra("JobDate");
            //JobTruckNo = Intent.GetStringExtra("AssignTRUCK");
            //JobName = Intent.GetStringExtra("AssignWork");
            JobID = Intent.GetIntExtra("AssignID", 0);
            //JobClient = Intent.GetStringExtra("AssignCLIENT");
            //JobNumber = Intent.GetIntExtra("AssignJOBNUM", 0);
            //JobArea = Intent.GetStringExtra("AssignAREA");
            ej = objplan.ExecuteGetSelectedRequest(JobID);


            JobDate = Convert.ToDateTime(ej.AssignSTARTTIME).ToShortDateString();
            JobTime = Convert.ToString(Convert.ToDateTime(ej.AssignSTARTTIME).TimeOfDay);
            Button btnBackE = FindViewById <Button>(Resource.Id.btnBackE);

            actxtWorkers    = FindViewById <AutoCompleteTextView>(Resource.Id.actxtWorker);
            btnSave         = FindViewById <Button>(Resource.Id.btnSaveEdited);
            btnDate         = FindViewById <Button>(Resource.Id.btnSelectDate);
            btnTime         = FindViewById <Button>(Resource.Id.btnSelectTime);
            txtSelectedJob  = FindViewById <TextView>(Resource.Id.txtSelectedJob);
            txtArea         = FindViewById <EditText>(Resource.Id.txtArea);
            txtTruckNo      = FindViewById <EditText>(Resource.Id.txtTruckNumbers);
            txtNote         = FindViewById <EditText>(Resource.Id.txtNote);
            lvSelectedEmps  = FindViewById <ListView>(Resource.Id.lvCurrentWorkers);
            txtArea.Text    = ej.AssignAREA;
            txtTruckNo.Text = ej.AssignTRUCK;                                         //showing values in correct areas
            txtNote.Text    = ej.AssignINSTRUCTIONS;

            txtSelectedJob.Text = ej.AssignJOBNUM + " - " + ej.AssignWORK + " - " + ej.AssignCLIENT;
            btnDate.Text        = "Date: " + Convert.ToDateTime(ej.AssignSTARTTIME).ToShortDateString();
            btnTime.Text        = "Start time: " + Convert.ToString(Convert.ToDateTime(ej.AssignSTARTTIME).TimeOfDay);


            foreach (var w in ej.EmployeeJobs)
            {
                Employee emp = new Employee();
                emp.empID     = w.employeeJOBSID;               // storing the employee jobs ID
                emp.empNAME   = w.EmpNAME;
                emp.empMobile = GetEmployees.getEmpNumber(w.EmpNAME);
                WorkerList.Add(emp);

                lvSelectedEmps.Adapter = new SelectEmpAdapter(this, WorkerList);
            }

            var workerAdapter = new ArrayAdapter <string>(this, Resource.Layout.list_item, GetEmployees.getEmpNames());        //autocomplete textbox

            actxtWorkers.Adapter          = workerAdapter;
            btnDate.Click                += BtnDate_Click;
            btnTime.Click                += BtnTime_Click;
            actxtWorkers.ItemClick       += ActxtWorkers_ItemClick;
            lvSelectedEmps.ItemLongClick += LvSelectedEmps_ItemLongClick;
            btnSave.Click                += BtnSave_Click;
            btnBackE.Click               += BtnBack_Click;
        }