Пример #1
0
        public bool SaveSection(int iBtnId)
        {
            UILabel hfSectionsRows = (UILabel)View.ViewWithTag (iBtnId / iSaveSectionBtnTagId * iSectionRowsTagId);
            int iRows = Convert.ToInt32 (hfSectionsRows.Text);
            int i;
            int iAnswer = 2;
            int iAnswerIndex;
            string sAnswer;
            string sComments;
            int iSectionNo = iBtnId / iSaveSectionBtnTagId;

            if (iSectionNo == (m_iBatterySectionCounter + 1) || iSectionNo == (m_iEquipmentSectionCounter + 1)  || iSectionNo == (m_iRFUSectionCounter + 1) )
            {
                return true;
                //return SaveRFUSection(iBtnId);

            }

            clsTabletDB.ITPDocumentSection DBQ = new clsTabletDB.ITPDocumentSection();
            UILabel hfDBSectionId = (UILabel)View.ViewWithTag (iSectionDBIdTagId * iSectionNo);
            int iDBSectionId = Convert.ToInt32(hfDBSectionId.Text);

            for (i = 0; i < iRows; i++)
            {
                UILabel hfRowStatus = (UILabel)View.ViewWithTag ((ihfRowStatusTagId + (i+1)) * iSectionNo);
                int iRowStatus = Convert.ToInt32(hfRowStatus.Text);

                if (iRowStatus == 1)
                {
                    UISegmentedControl radGrp = (UISegmentedControl)View.ViewWithTag ((iAnswerGroupTagId + (i+1)) * iSectionNo);
                    iAnswerIndex = radGrp.SelectedSegment;
                    if(iAnswerIndex >=0)
                    {
                        sAnswer = radGrp.TitleAt(iAnswerIndex);
                    }
                    else
                    {
                        sAnswer = "";
                    }

                    switch(sAnswer)
                    {
                        case "Yes":
                            iAnswer = 0;
                            break;
                        case "No":
                            iAnswer = 1;
                            break;
                        case "N/A":
                            iAnswer = 2;
                            break;
                        default:
                            iAnswer = -1;
                            break;
                    }

                    UITextView txtComments = (UITextView)View.ViewWithTag ((iCommentsTagId + (i+1)) * iSectionNo);
                    sComments = txtComments.Text;
                    UILabel hfAutoId = (UILabel)View.ViewWithTag ((ihfAutoRowTagId + (i+1)) * iSectionNo);
                    int iAutoId = Convert.ToInt32(hfAutoId.Text);
                    DBQ.SetLocalITPSectionQuestion(iAutoId, m_sPassedId, iDBSectionId, iAnswer, sComments);
                    hfRowStatus.Text = "0";

                    //And now disable the row
                    radGrp.Enabled = false;
                    txtComments.Editable = false;
                }
            }

            UILabel hfSectionStatus = (UILabel)View.ViewWithTag (iSectionStatusTagId * iSectionNo);
            hfSectionStatus.Text = "0";
            SetAnyValueChangedOff(false);
            return true;
        }