示例#1
0
        public bool ValidateSuite(object sender, int iFromBackButton)
        {
            if(gbSuppressSecondCheck)
            {
                return true;
            }

            if(iFromBackButton == 1)
            {
                gbSuppressSecondCheck = true;
            }

            UITextField txtSuite = (UITextField)sender;
            string sSuite = txtSuite.Text;
            sSuite = sSuite.ToUpper();
            txtSuite.Text = sSuite;
            clsTabletDB.ITPValidHierarchy ITPValidHierarchy = new clsTabletDB.ITPValidHierarchy();
            bool bSuiteCheck = ITPValidHierarchy.IsValidItem(sSuite, 2);
            int iTagId = txtSuite.Tag;
            int iPwrIdRow =  iTagId/ iEquipmentSuiteTagId;
            int iStringRow = iTagId - (iPwrIdRow * iEquipmentSuiteTagId);
            int iHiddenBankId =  iEquipmentSuiteHiddenTagId * iPwrIdRow + iStringRow;
            UILabel hfHiddenSuite = (UILabel)View.ViewWithTag (iHiddenBankId);
            string sOldSuite = hfHiddenSuite.Text;

            if (!bSuiteCheck && sSuite != "")
            {
                iUtils.AlertBox alert = new iUtils.AlertBox ();
                alert.CreateErrorAlertDialog ("Please enter a valid suite or search from the list by using the button underneath");
                txtSuite.Text = hfHiddenSuite.Text;
                txtSuite.ResignFirstResponder();
                txtSuite.BecomeFirstResponder();
                m_bSuppressMove = true;
                return false;
            }
            else
            {
                if(sOldSuite != sSuite) //Only do something if there has been a chnage
                {
                    hfHiddenSuite.Text = txtSuite.Text;
                    UILabel hfRowStatus = (UILabel)View.ViewWithTag(iEquipmentRowStatusTagId * iPwrIdRow + iStringRow);
                    hfRowStatus.Text = "1";

                    SetSectionValueChanged(m_iEquipmentSectionCounter + 1);
                    SetAnyValueChanged(sender, null);

                    //Ask the question
                    if(iFromBackButton == 0)
                    {
                        int iSectionTagId = iEquipmentRowSectionCounterTagId * iPwrIdRow + iStringRow;
                        UILabel hfSectionId = (UILabel)View.ViewWithTag (iSectionTagId);
                        int iSectionId = Convert.ToInt32(hfSectionId.Text);

                        int iPwrIdTagId = iEquipmentRowPwrIdTagId * iPwrIdRow + iStringRow;
                        UILabel hfPwrId = (UILabel)View.ViewWithTag (iPwrIdTagId);
                        string sPwrId = hfPwrId.Text;

                        int iFloorId =  iEquipmentFloorTagId * iPwrIdRow + iStringRow;
                        UITextField txtFloor = (UITextField)View.ViewWithTag (iFloorId);
                        string sFloor = txtFloor.Text;

                        if(sOldSuite != sSuite)
                        {
                            if(CheckSameSuiteExists(sFloor, sOldSuite,iSectionId, iPwrIdRow, sPwrId, iStringRow))
                            {
                                iUtils.AlertBox alert2 = new iUtils.AlertBox();
                                alert2.CreateAlertYesNoDialog();
                                alert2.SetAlertMessage("Do you wish to change all other items on PwrId " + sPwrId + " on the floor " +
                                                       sFloor + " and the suite " + sOldSuite + " to suite " +  sSuite + " ?");
                                alert2.ShowAlertBox();

                                UIAlertView alert3 = alert2.GetAlertDialog();
                                alert3.Clicked += (sender2, e2)  => {
                                    CheckSuiteChangesQuestion(sender2, e2, e2.ButtonIndex, iStringRow, sPwrId, sFloor,
                                                              sSuite, sOldSuite, iSectionId, iPwrIdRow);
                                };
                            }
                        }
                    }
                }
                return true;
            }
        }
        void UploadITPQuestion(object sender, EventArgs e, int iMarkUploadType)
        {
            UIButton btnClicked = (UIButton)sender;
            int iClicked = btnClicked.Tag;
            UILabel projId = (UILabel)View.ViewWithTag (iClicked/iUploadBtnTagId*iProjectIdTagId);
            string sId = projId.Text;
            int iOpenBtnId = -1;
            if(iMarkUploadType == 1)
            {
                iOpenBtnId = iClicked/iUploadBtnTagId*iOpenBtnTagId;
            }
            else
            {
                iOpenBtnId = iClicked/iBackupBtnTagId*iOpenBtnTagId;
            }

            var bConnStatus = GetConnectionStatus ();

            if (!bConnStatus)
            {
                iUtils.AlertBox alert = new iUtils.AlertBox();
                alert.CreateAlertDialog();
                alert.SetAlertMessage("The is no network coverage so you cannot upload at this stage");
                alert.ShowAlertBox();
                return;
            }
            else
            {
                //Has the project been made available online again and if so you cannot upload
                clsITPFramework ITPFwrk = new clsITPFramework();
                object[] objUploadable = ITPFwrk.IsITPUploadable(m_sSessionId, m_sUser, sId);
                if (objUploadable[0].ToString() != "Success")
                {
                    iUtils.AlertBox alert4 = new iUtils.AlertBox();
                    alert4.CreateErrorAlertDialog(objUploadable[1].ToString());
                    return;
                }
            }

            if(iMarkUploadType == 1)
            {
                iUtils.AlertBox alert2 = new iUtils.AlertBox();
                alert2.CreateAlertYesNoDialog();
                alert2.SetAlertMessage("This will upload ITP info for Project " + sId + " and lock you out from any further changes. Do you wish to continue?");
                alert2.ShowAlertBox();
                UIAlertView alert3 = alert2.GetAlertDialog();
                alert3.Clicked += (sender2, e2)  => {CheckUploadQuestion(sender2, e2, e2.ButtonIndex, sId, iOpenBtnId, 0);};
            }
            else
            {
                iUtils.AlertBox alert2 = new iUtils.AlertBox();
                alert2.CreateAlertYesNoDialog();
                alert2.SetAlertMessage("This will backup ITP info for Project " + sId + " and allow you to make further changes once complete. Do you wish to continue?");
                alert2.ShowAlertBox();
                UIAlertView alert3 = alert2.GetAlertDialog();
                alert3.Clicked += (sender2, e2)  => {CheckUploadQuestion(sender2, e2, e2.ButtonIndex, sId, iOpenBtnId, 1);};
            }

            return;
        }