示例#1
0
        public void checkEmpty(CheckBox empty)
        {
            string status = "";
            string uprn   = "";

            if (empty.Checked)
            {
                if (checkNetwork())
                {
                    status = "E";
                    uprn   = empty.Tag.ToString();
                    TableRow tr            = (TableRow)View.FindViewWithTag(uprn);
                    CheckBox noAnswer      = (CheckBox)tr.GetVirtualChildAt(1);
                    CheckBox derelict      = (CheckBox)tr.GetVirtualChildAt(3);
                    CheckBox postalRequest = (CheckBox)tr.GetVirtualChildAt(4);
                    CheckBox delivered     = (CheckBox)tr.GetVirtualChildAt(5);
                    noAnswer.Checked      = false;
                    derelict.Checked      = false;
                    postalRequest.Checked = false;
                    delivered.Checked     = false;
                    noAnswer.Text         = "";
                    tr.SetBackgroundColor(Resources.GetColor(Resource.Color.highlight));
                    //Console.WriteLine("Empty is working");
                    //Console.WriteLine (tr.ChildCount);
                    NetworkCalls.SendStatus(DataController.token, status, uprn, DataController.canvassID);
                    lockRow(tr);
                }
                else
                {
                    empty.Checked = false;
                    showNetworkError();
                }
            }
            else if (!empty.Checked)
            {
                if (checkNetwork())
                {
                    status = "NV";
                    uprn   = empty.Tag.ToString();
                    TableRow tr = (TableRow)View.FindViewWithTag(uprn);
                    if (tr.Id % 2 == 0)
                    {
                        tr.SetBackgroundColor(Resources.GetColor(Resource.Color.even));
                    }
                    else
                    {
                        tr.SetBackgroundColor(Resources.GetColor(Resource.Color.odd));
                    }
                    NetworkCalls.SendStatus(DataController.token, status, uprn, DataController.canvassID);
                    //Console.WriteLine ("Empty: " + empty.Tag);
                }
                else
                {
                    empty.Checked = true;
                    showNetworkError();
                }
            }
        }
示例#2
0
        public void checkDeliveredRequest(CheckBox deliveredRequest)
        {
            string status = "";
            string uprn   = "";

            if (deliveredRequest.Checked)
            {
                if (checkNetwork())
                {
                    status = "HEF-D";
                    uprn   = deliveredRequest.Tag.ToString();
                    TableRow    tr            = (TableRow)View.FindViewWithTag(uprn);
                    CheckBox    noAnswer      = (CheckBox)tr.GetVirtualChildAt(1);
                    CheckBox    empty         = (CheckBox)tr.GetVirtualChildAt(2);
                    CheckBox    derelict      = (CheckBox)tr.GetVirtualChildAt(3);
                    CheckBox    postalRequest = (CheckBox)tr.GetVirtualChildAt(4);
                    ImageButton residents     = (ImageButton)tr.GetVirtualChildAt(7);
                    noAnswer.Checked      = false;
                    derelict.Checked      = false;
                    empty.Checked         = false;
                    postalRequest.Checked = false;
                    noAnswer.Text         = "";
                    tr.SetBackgroundColor(Resources.GetColor(Resource.Color.highlight));
                    NetworkCalls.SendStatus(DataController.token, status, uprn, DataController.canvassID);
                    lockRow(tr);
                }
                else
                {
                    deliveredRequest.Checked = false;
                    showNetworkError();
                }
            }
            else if (!deliveredRequest.Checked)
            {
                if (checkNetwork())
                {
                    status = "NV";
                    uprn   = deliveredRequest.Tag.ToString();
                    TableRow tr = (TableRow)View.FindViewWithTag(uprn);
                    if (tr.Id % 2 == 0)
                    {
                        tr.SetBackgroundColor(Resources.GetColor(Resource.Color.even));
                    }
                    else
                    {
                        tr.SetBackgroundColor(Resources.GetColor(Resource.Color.odd));
                    }
                    NetworkCalls.SendStatus(DataController.token, status, uprn, DataController.canvassID);
                    //Console.WriteLine ("Postal Request: " + deliveredRequest.Tag);
                }
                else
                {
                    deliveredRequest.Checked = true;
                    showNetworkError();
                }
            }
        }
示例#3
0
 public override void OnHiddenChanged(bool hidden)
 {
     base.OnHiddenChanged(hidden);
     if (!hidden)
     {
         TableRow    row       = (TableRow)View.FindViewWithTag(DataController.uprn);
         ImageButton residents = (ImageButton)row.GetVirtualChildAt(7);
         residents.Enabled = true;
         if (DataController.uprn != null && DataController.propertyChange)
         {
             TableRow tr = (TableRow)View.FindViewWithTag(DataController.uprn);
             tr.SetBackgroundColor(Resources.GetColor(Resource.Color.highlight));
             lockRow(tr);
             DataController.uprn           = "";
             DataController.propertyChange = false;
         }
         else if (DataController.propertyReset)
         {
             TableRow  tr            = (TableRow)View.FindViewWithTag(DataController.uprn);
             CheckBox  noAnswer      = (CheckBox)tr.GetVirtualChildAt(1);
             CheckBox  empty         = (CheckBox)tr.GetVirtualChildAt(2);
             CheckBox  derelict      = (CheckBox)tr.GetVirtualChildAt(3);
             CheckBox  postalRequest = (CheckBox)tr.GetVirtualChildAt(4);
             CheckBox  delivered     = (CheckBox)tr.GetVirtualChildAt(5);
             ImageView itr           = (ImageView)tr.GetVirtualChildAt(6);
             noAnswer.Text         = "";
             noAnswer.Checked      = false;
             noAnswer.Enabled      = true;
             empty.Enabled         = true;
             derelict.Enabled      = true;
             postalRequest.Enabled = true;
             delivered.Enabled     = true;
             NetworkCalls.SendStatus(DataController.token, "NV", DataController.uprn, DataController.canvassID);
             if (tr.Id % 2 == 0)
             {
                 tr.SetBackgroundColor(Resources.GetColor(Resource.Color.even));
             }
             else
             {
                 tr.SetBackgroundColor(Resources.GetColor(Resource.Color.odd));
             }
             DataController.propertyReset = false;
         }
     }
 }
示例#4
0
        public void checkNoAnswer(CheckBox noAnswer)
        {
            string uprn = "";

            if (noAnswer.Checked)
            {
                if (checkNetwork())
                {
                    int i = 0;
                    uprn = noAnswer.Tag.ToString();
                    TableRow    tr            = (TableRow)View.FindViewWithTag(uprn);
                    CheckBox    empty         = (CheckBox)tr.GetVirtualChildAt(2);
                    CheckBox    derelict      = (CheckBox)tr.GetVirtualChildAt(3);
                    CheckBox    postalRequest = (CheckBox)tr.GetVirtualChildAt(4);
                    CheckBox    delivered     = (CheckBox)tr.GetVirtualChildAt(5);
                    ImageView   itr           = (ImageView)tr.GetVirtualChildAt(6);
                    ImageButton residents     = (ImageButton)tr.GetVirtualChildAt(7);
                    empty.Checked         = false;
                    derelict.Checked      = false;
                    postalRequest.Checked = false;
                    delivered.Checked     = false;
                    itr.Enabled           = false;
                    if (noAnswer.Text == "")
                    {
                        noAnswer.Text = "1";
                        //Console.WriteLine ("uprn"+uprn);
                        //this is for testing
                        lockRow(tr);
                    }
                    else if (Convert.ToInt32(noAnswer.Text) <= 2)
                    {
                        i = Convert.ToInt32(noAnswer.Text);
                        i++;
                        noAnswer.Text = i.ToString();
                        if (i == 2)
                        {
                            noAnswer.SetTextColor(Resources.GetColor(Resource.Color.secondVisit));
                            lockRow(tr);
                        }
                        else if (i == 3)
                        {
                            noAnswer.SetTextColor(Resources.GetColor(Resource.Color.thirdVisit));
                            noAnswer.Enabled      = false;
                            empty.Enabled         = false;
                            derelict.Enabled      = false;
                            postalRequest.Enabled = false;
                            delivered.Enabled     = false;
                            //residents.Enabled = false;
                        }
                    }
                    tr.SetBackgroundColor(Resources.GetColor(Resource.Color.highlight));
                    NetworkCalls.SendStatus(DataController.token, "VNA", uprn, DataController.canvassID);
                }
                else
                {
                    noAnswer.Checked = false;
                    showNetworkError();
                }
            }
            else if (!noAnswer.Checked)
            {
                if (checkNetwork())
                {
                    int i = 0;
                    uprn = noAnswer.Tag.ToString();
                    if (noAnswer.Text != "")
                    {
                        if (Convert.ToInt32(noAnswer.Text) > 0)
                        {
                            i = Convert.ToInt32(noAnswer.Text);
                            i--;
                            noAnswer.Text = i.ToString();
                            if (i == 0)
                            {
                                noAnswer.Text = "";
                            }
                            else if (i == 1)
                            {
                                noAnswer.SetTextColor(Resources.GetColor(Resource.Color.tableText));
                            }
                            else if (i == 2)
                            {
                                noAnswer.SetTextColor(Resources.GetColor(Resource.Color.secondVisit));
                                noAnswer.Enabled = true;
                            }
                        }
                    }
                    TableRow tr = (TableRow)View.FindViewWithTag(uprn);
                    if (tr.Id % 2 == 0)
                    {
                        tr.SetBackgroundColor(Resources.GetColor(Resource.Color.even));
                    }
                    else
                    {
                        tr.SetBackgroundColor(Resources.GetColor(Resource.Color.odd));
                    }
                    //Console.WriteLine("no answer is working");
                    NetworkCalls.SendStatus(DataController.token, "NV", uprn, DataController.canvassID);
                    //Console.WriteLine ("No Answer: " + noAnswer.Tag);
                }
                else
                {
                    noAnswer.Checked = true;
                    showNetworkError();
                }
            }
        }