Esempio n. 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;
            }
        }
Esempio n. 2
0
        public void CheckUnsaved()
        {
            //First of all validate anything required
            switch(m_iValidateType)
            {
                case 1: //Floor
                    if(!ValidateFloor(m_sender, 1))
                    {
                        gbSuppressSecondCheck = false;
                        return;
                    }
                    break;
                case 2: //Suite
                    if(!ValidateSuite(m_sender, 1))
                    {
                        gbSuppressSecondCheck = false;
                        return;
                    }
                    break;
                case 3: //Rack
                    if(!ValidateRack(m_sender, 1))
                    {
                        gbSuppressSecondCheck = false;
                        return;
                    }
                    break;
                case 4: //SubRack
                    if(!ValidateSubRack(m_sender, 1))
                    {
                        gbSuppressSecondCheck = false;
                        return;
                    }
                    break;
                case 5: //Position
                    if(!ValidatePosition(m_sender, 1))
                    {
                        gbSuppressSecondCheck = false;
                        return;
                    }
                    break;
                case 6: //Solar String
                    if(!ValidateBankNo(m_sender, 2, 1))
                    {
                        gbSuppressSecondCheck = false;
                        return;
                    }
                    break;
                case 7: //DOM
                    if(!ValidateDOM(m_sender, 1))
                    {
                        gbSuppressSecondCheck = false;
                        return;
                    }
                    break;
                case 8: //Serial No
                    if(!ValidateSerialNo(m_sender, 1))
                    {
                        gbSuppressSecondCheck = false;
                        return;
                    }
                    break;
                case 9: //Maximo Asset Id
                    if(!ValidateMaximoAssetId(m_sender, 1))
                    {
                        gbSuppressSecondCheck = false;
                        return;
                    }
                    break;
            }

            UILabel txtEditStatus = (UILabel)View.ViewWithTag (80);
            int iStatus = Convert.ToInt32 (txtEditStatus.Text);
            if (iStatus == 0)
            {
                ProjectITPage QuestionsScreen = new ProjectITPage ();
                QuestionsScreen = GetProjectITPPage ();
                this.NavigationController.PopToViewController (QuestionsScreen, true);
            }
            else
            {
                //Ask the question
                iUtils.AlertBox alert2 = new iUtils.AlertBox();
                alert2.CreateAlertYesNoCancelDialog();
                alert2.SetAlertMessage("You have unsaved changes. Do you wish to save these changes before going back to the downloaded screen?");
                alert2.ShowAlertBox();

                UIAlertView alert3 = alert2.GetAlertDialog();
                alert3.Clicked += (sender2, e2)  => {CheckSaveChangesQuestion(sender2, e2, e2.ButtonIndex);};

            }
        }
        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;
        }
Esempio n. 4
0
        public void AddNewEquipment(object sender, EventArgs e)
        {
            UIButton btnAddNew = (UIButton)sender;
            int iTagId = btnAddNew.Tag;
            int iPwrIdRow = iTagId /(m_iEquipmentSectionCounter+1)  - iPwrIdNewBtnTagId; //This is 1 based

            iUtils.AlertBox alert2 = new iUtils.AlertBox();
            alert2.CreateAlertRackSubRackPositionStringDialog();
            alert2.SetAlertMessage("Are you adding a rack, subrack, position item or solar panel string?");
            alert2.ShowAlertBox();

            UIAlertView alert3 = alert2.GetAlertDialog();
            alert3.Clicked += (sender2, e2)  => {AddNewItem(sender2, e2, e2.ButtonIndex, iPwrIdRow);};
        }
Esempio n. 5
0
        public void CheckUnsaved()
        {
            //First of all validate anything required
            switch(m_iValidateType)
            {
                case 9: //Cutover Load
                    if(!ValidateCutoverLoad(m_sender, 1))
                    {
                        gbSuppressSecondCheck = false;
                        return;
                    }
                    break;
                case 10: //Cutover Date
                    if(!ValidateCutoverDate(m_sender, 1))
                    {
                        gbSuppressSecondCheck = false;
                        return;
                    }
                    break;
            }

            UILabel txtEditStatus = (UILabel)View.ViewWithTag (80);
            int iStatus = Convert.ToInt32 (txtEditStatus.Text);
            if (iStatus == 0)
            {
                DownloadedITPsScreen downloadScreen = new DownloadedITPsScreen ();
                downloadScreen = GetDownloadedITPsScreen ();
                this.NavigationController.PopToViewController (downloadScreen, true);
            }
            else
            {
                //Ask the question
                iUtils.AlertBox alert2 = new iUtils.AlertBox();
                alert2.CreateAlertYesNoCancelDialog();
                alert2.SetAlertMessage("You have unsaved changes. Only chnages to questions will be saved. RFU changes must be committed using the buttons. Do you wish to save these changes before going back to the downloaded screen?");
                alert2.ShowAlertBox();

                UIAlertView alert3 = alert2.GetAlertDialog();
                alert3.Clicked += (sender2, e2)  => {CheckSaveChangesQuestion(sender2, e2, e2.ButtonIndex);};

            }
        }