public bool PowerConversionPwrIdComplete(string sPwrId) { clsTabletDB.ITPDocumentSection DBQ = new clsTabletDB.ITPDocumentSection(); return DBQ.ProjectSection10PwrIdPowerConversionComplete(m_sPassedId, sPwrId); }
public bool RFUPwrIdCommitted(string sPwrId) { clsTabletDB.ITPDocumentSection DBQ = new clsTabletDB.ITPDocumentSection(); return DBQ.ProjectSectionRFUPwrIdCommitted(m_sPassedId, sPwrId); }
public void DrawOpeningPage() { try { int iColNo = 0; int iSectionId = 0; string sId = m_sPassedId; float iVert = 0f; float iPwrIdRowVertInner = 0f; float iSectionHdrRowHeight = 40f; float iQuestionRowHeight = 30f; float iTotalHeight = 0f; float iHeightToAdd = iQuestionRowHeight; bool bHideComplete = true; bool bHideSectionComplete = true; bool bFullyCommitted = false; bool bRFUPwrIdCommitted = false; UIView[] arrItems4 = new UIView[8]; UIView[] arrItems5 = new UIView[8]; //Get some static data for dropdowns only once so we don't reprocess unecessarily clsTabletDB.ITPInventory ITPInventory = new clsTabletDB.ITPInventory(); string[] sRackMakes = ITPInventory.GetRackMakes(); m_sRackMakes = sRackMakes; string[] sSubRackMakes = ITPInventory.GetSubRackMakes(); m_sSubRackMakes = sSubRackMakes; string[] sPositionMakes = ITPInventory.GetPositionMakes(); m_sPositionMakes = sPositionMakes; string[] sSolarStringMakes = ITPInventory.GetSolarStringMakes(); m_sSolarStringMakes = sSolarStringMakes; UIScrollView layout = new UIScrollView(); layout.Frame = new RectangleF(0f,35f,1000f,620f); layout.Tag = 2; clsTabletDB.ITPDocumentSection ITPSection = new clsTabletDB.ITPDocumentSection(); //******************************************************************************************// // SECTION 10 (EQUIPMENT) // //******************************************************************************************// //Get all the PwrId's for this project from ITPSection10 DataSet arrITPSectionEquipmentPwrIds = ITPSection.GetLocalITPSectionEquipmentPwrIds(sId); if (arrITPSectionEquipmentPwrIds.Tables.Count > 0) { int iii = m_iSections; m_iSections++; //Add an extra one for the batteries section m_iEquipmentSectionCounter = iii; int iPwrIdRows = arrITPSectionEquipmentPwrIds.Tables[0].Rows.Count; //Add in the section title and buttons for each section header UIView SectionEquipmentRow = new UIView(); float iSectionEquipmentRowVertTop = iVert; SectionEquipmentRow.Frame = new RectangleF(0f,iSectionEquipmentRowVertTop,1000f,iSectionHdrRowHeight); iSectionId = iSectionTagId * (iii+1); SectionEquipmentRow.Tag = iSectionId; layout.AddSubview(SectionEquipmentRow); UILabel hfSectionEquipment = new UILabel(); hfSectionEquipment.Text = "10"; hfSectionEquipment.Tag = iSectionDBIdTagId * (iii+1); hfSectionEquipment.Hidden = true; SectionEquipmentRow.AddSubview(hfSectionEquipment); iUtils.CreateFormGridItem SectionEquipment = new iUtils.CreateFormGridItem(); UIView SectionEquipmentVw = new UIView(); SectionEquipment.SetDimensions(0f,0f, 400f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); SectionEquipment.SetLabelText("POWER CONVERSION"); SectionEquipment.SetBorderWidth(0.0f); SectionEquipment.SetFontName("Verdana-Bold"); SectionEquipment.SetTextColour("White"); SectionEquipment.SetFontSize(12f); SectionEquipment.SetCellColour("DarkSlateGrey"); SectionEquipment.SetTag(iSectionDescTagId * (iii+1)); SectionEquipmentVw = SectionEquipment.GetLabelCell(); arrItems4[0] = SectionEquipmentVw; if(PowerConversionFullyCommitted()) { bFullyCommitted = true; bHideComplete = false; } else { bFullyCommitted = false; if(PowerConversionFullyComplete()) { bHideComplete = false; } else { bHideComplete = true; } } iUtils.CreateFormGridItem SectionCompleteLabel = new iUtils.CreateFormGridItem(); UIView SectionCompleteLabelVw = new UIView(); SectionCompleteLabel.SetDimensions(400f,0f, 150f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); if(bFullyCommitted) { SectionCompleteLabel.SetLabelText("COMMITTED"); } else { SectionCompleteLabel.SetLabelText("COMPLETED"); } SectionCompleteLabel.SetBorderWidth(0.0f); SectionCompleteLabel.SetFontName("Verdana-Bold"); SectionCompleteLabel.SetTextColour("Bright Yellow"); SectionCompleteLabel.SetFontSize(12f); SectionCompleteLabel.SetCellColour("DarkSlateGrey"); SectionCompleteLabel.SetTag(iSectionCompleteLabelTagId * (iii+1)); SectionCompleteLabel.SetHidden(bHideComplete); SectionCompleteLabelVw = SectionCompleteLabel.GetLabelCell(); arrItems4[1] = SectionCompleteLabelVw; iUtils.CreateFormGridItem btnSaveEquipment = new iUtils.CreateFormGridItem(); UIView btnSaveEquipmentVw = new UIView(); btnSaveEquipment.SetDimensions(550f,0f, 150f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnSaveEquipment.SetLabelText("Save Section"); btnSaveEquipment.SetBorderWidth(0.0f); btnSaveEquipment.SetFontName("Verdana"); btnSaveEquipment.SetFontSize(12f); btnSaveEquipment.SetHidden(true); btnSaveEquipment.SetTag(iSaveSectionBtnTagId * (iii+1)); btnSaveEquipment.SetCellColour("DarkSlateGrey"); btnSaveEquipmentVw = btnSaveEquipment.GetButtonCell(); UIButton btnSaveEquipmentButton = new UIButton(); btnSaveEquipmentButton = btnSaveEquipment.GetButton(); btnSaveEquipmentButton.TouchUpInside += (sender,e) => {SaveThisSection(sender, e);}; arrItems4[2] = btnSaveEquipmentVw; iUtils.CreateFormGridItem btnExpandEquipment = new iUtils.CreateFormGridItem(); UIView btnExpandEquipmentVw = new UIView(); btnExpandEquipment.SetDimensions(700f,0f, 50f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnExpandEquipment.SetLabelText("+"); btnExpandEquipment.SetBorderWidth(0.0f); btnExpandEquipment.SetFontName("Verdana"); btnExpandEquipment.SetFontSize(12f); btnExpandEquipment.SetTag(iExpandSectionBtnTagId * (iii+1)); btnExpandEquipment.SetCellColour("DarkSlateGrey"); btnExpandEquipmentVw = btnExpandEquipment.GetButtonCell(); UIButton btnExpandEquipmentButton = new UIButton(); btnExpandEquipmentButton = btnExpandEquipment.GetButton(); btnExpandEquipmentButton.Enabled = false; btnExpandEquipmentButton.TouchUpInside += (sender,e) => {ExpandSection(sender, e);}; arrItems4[3] = btnExpandEquipmentVw; iUtils.CreateFormGridItem btnContractEquipment = new iUtils.CreateFormGridItem(); UIView btnContractEquipmentVw = new UIView(); btnContractEquipment.SetDimensions(750f,0f, 50f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnContractEquipment.SetLabelText("-"); btnContractEquipment.SetBorderWidth(0.0f); btnContractEquipment.SetFontName("Verdana"); btnContractEquipment.SetFontSize(12f); btnContractEquipment.SetTag(iContractSectionBtnTagId * (iii+1)); btnContractEquipment.SetCellColour("DarkSlateGrey"); btnContractEquipmentVw = btnContractEquipment.GetButtonCell(); UIButton btnContractEquipmentButton = new UIButton(); btnContractEquipmentButton = btnContractEquipment.GetButton(); btnContractEquipmentButton.TouchUpInside += (sender,e) => {ContractSection(sender, e);}; arrItems4[4] = btnContractEquipmentVw; UILabel hfSectionEquipmentHeight = new UILabel(); hfSectionEquipmentHeight.Tag = iSectionHeightTagId * (iii+1); hfSectionEquipmentHeight.Hidden = true; hfSectionEquipmentHeight.Text = "0"; arrItems4[5] = hfSectionEquipmentHeight; UILabel hfSectionEquipmentRows = new UILabel(); hfSectionEquipmentRows.Tag = iSectionRowsTagId * (iii+1); hfSectionEquipmentRows.Hidden = true; hfSectionEquipmentRows.Text = iPwrIdRows.ToString(); arrItems4[6] = hfSectionEquipmentRows; UILabel hfSectionEquipmentStatus = new UILabel(); hfSectionEquipmentStatus.Tag = iSectionStatusTagId * (iii+1); hfSectionEquipmentStatus.Hidden = true; hfSectionEquipmentStatus.Text = "0"; arrItems4[7] = hfSectionEquipmentStatus; SectionEquipmentRow.AddSubviews(arrItems4); iVert += iSectionHdrRowHeight; //Now add a new view to this view to hold another view containing all the pwrid info for this section 10 UIView PwrIdTableRow = new UIView(); PwrIdTableRow.Frame = new RectangleF(0f,iVert,1000f,iSectionHdrRowHeight); iSectionId = iContainerSectionTagId * (iii+1); PwrIdTableRow.Tag = iSectionId; layout.AddSubview(PwrIdTableRow); float iPwrIdRowVert = 0.0f; float iSectionPwrIdHeight = 0.0f; float iPwrIdRowVertTop = iVert; float iPwrIdRowInnerTop = 0.0f; float iPwrIdRowInnerTop2 = 0.0f; m_iEquipmentPwrIds = iPwrIdRows; for (int jj = 0; jj < iPwrIdRows; jj++) { iPwrIdRowInnerTop2 = 0.0f; UIView vwPwrInternalRowId = new UIView(); vwPwrInternalRowId.Frame = new RectangleF(0f,iPwrIdRowVert,1000f,200f); //This will be resized later on vwPwrInternalRowId.Tag = (iPwrIdSectionTagId + (jj+1)) * (iii+1); UILabel hfRow10Status = new UILabel(); hfRow10Status.Text = "0"; hfRow10Status.Tag = (ihfRow10StatusTagId + (jj+1)) * (iii+1); hfRow10Status.Hidden = true; arrItems5[0] = hfRow10Status; //Put in the PwrId Label iUtils.CreateFormGridItem rowPwrIdLabel = new iUtils.CreateFormGridItem(); UIView rowPwrIdLabelVw = new UIView(); iColNo = arrITPSectionEquipmentPwrIds.Tables[0].Columns["PwrId"].Ordinal; string sPwrId = arrITPSectionEquipmentPwrIds.Tables[0].Rows[jj].ItemArray[iColNo].ToString(); rowPwrIdLabel.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowPwrIdLabel.SetDimensions(0f,iPwrIdRowVert, 200f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowPwrIdLabel.SetLabelText(sPwrId); rowPwrIdLabel.SetBorderWidth(0.0f); rowPwrIdLabel.SetFontName("Verdana-Bold"); rowPwrIdLabel.SetFontSize(18f); rowPwrIdLabel.SetTag((iPwrIdRowLabelTagId + (jj+1)) * (iii+1)); if (jj % 2 == 0) { rowPwrIdLabel.SetCellColour("Pale Yellow"); } else { rowPwrIdLabel.SetCellColour("Pale Orange"); } rowPwrIdLabelVw = rowPwrIdLabel.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems5[1] = rowPwrIdLabelVw; bRFUPwrIdCommitted = RFUPwrIdCommitted(sPwrId); iUtils.CreateFormGridItem btnNewEquipment = new iUtils.CreateFormGridItem(); UIView btnNewEquipmentVw = new UIView(); btnNewEquipment.SetDimensions(200f,iPwrIdRowVert, 200f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnNewEquipment.SetLabelText("New Item"); btnNewEquipment.SetBorderWidth(0.0f); btnNewEquipment.SetFontName("Verdana"); btnNewEquipment.SetFontSize(12f); btnNewEquipment.SetTag((iPwrIdNewBtnTagId + (jj+1)) * (iii+1)); if (jj % 2 == 0) { btnNewEquipment.SetCellColour("Pale Yellow"); } else { btnNewEquipment.SetCellColour("Pale Orange"); } btnNewEquipmentVw = btnNewEquipment.GetButtonCell(); UIButton btnNewEquipmentButton = new UIButton(); btnNewEquipmentButton = btnNewEquipment.GetButton(); btnNewEquipmentButton.TouchUpInside += (sender,e) => {AddNewEquipment(sender, e);}; if(bRFUPwrIdCommitted) { btnNewEquipmentButton.Enabled = false; } arrItems5[2] = btnNewEquipmentVw; if(PowerConversionPwrIdComplete(sPwrId)) { bHideSectionComplete = false; } else { bHideSectionComplete = true; } iUtils.CreateFormGridItem PwrIdCompleteLabel = new iUtils.CreateFormGridItem(); UIView PwrIdCompleteLabelVw = new UIView(); PwrIdCompleteLabel.SetDimensions(400f,0f, 150f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); if(bRFUPwrIdCommitted) { PwrIdCompleteLabel.SetLabelText("COMMITTED"); bHideSectionComplete = false; } else { PwrIdCompleteLabel.SetLabelText("COMPLETED"); } PwrIdCompleteLabel.SetBorderWidth(0.0f); PwrIdCompleteLabel.SetFontName("Verdana-Bold"); PwrIdCompleteLabel.SetTextColour("Royal Blue"); PwrIdCompleteLabel.SetFontSize(14f); if (jj % 2 == 0) { PwrIdCompleteLabel.SetCellColour("Pale Yellow"); } else { PwrIdCompleteLabel.SetCellColour("Pale Orange"); } PwrIdCompleteLabel.SetTag((iPwrIdSectionCompleteLabelTagId + (jj+1)) * (iii+1)); PwrIdCompleteLabel.SetHidden(bHideSectionComplete); PwrIdCompleteLabelVw = PwrIdCompleteLabel.GetLabelCell(); arrItems5[3] = PwrIdCompleteLabelVw; iUtils.CreateFormGridItem rowPwrIdBlank = new iUtils.CreateFormGridItem(); UIView rowPwrIdBlankVw = new UIView(); rowPwrIdBlank.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowPwrIdBlank.SetDimensions(550f,iPwrIdRowVert, 350f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowPwrIdBlank.SetLabelText(""); rowPwrIdBlank.SetBorderWidth(0.0f); rowPwrIdBlank.SetFontName("Verdana"); rowPwrIdBlank.SetFontSize(12f); rowPwrIdBlank.SetTag((iPwrIdRowLabelTagId + (jj+1)) * (iii+1)); if (jj % 2 == 0) { rowPwrIdBlank.SetCellColour("Pale Yellow"); } else { rowPwrIdBlank.SetCellColour("Pale Orange"); } rowPwrIdBlankVw = rowPwrIdBlank.GetLabelCell(); arrItems5[4] = rowPwrIdBlankVw; iUtils.CreateFormGridItem btnExpandPwrId = new iUtils.CreateFormGridItem(); UIView btnExpandPwrIdVw = new UIView(); btnExpandPwrId.SetDimensions(900f,0f, 50f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnExpandPwrId.SetLabelText("+"); btnExpandPwrId.SetBorderWidth(0.0f); btnExpandPwrId.SetFontName("Verdana"); btnExpandPwrId.SetFontSize(12f); btnExpandPwrId.SetTag((iPwrIdExpandTagId + (jj+1)) * (iii+1)); if (jj % 2 == 0) { btnExpandPwrId.SetCellColour("Pale Yellow"); } else { btnExpandPwrId.SetCellColour("Pale Orange"); } btnExpandPwrIdVw = btnExpandPwrId.GetButtonCell(); UIButton btnExpandPwrIdButton = new UIButton(); btnExpandPwrIdButton = btnExpandPwrId.GetButton(); btnExpandPwrIdButton.Enabled = false; btnExpandPwrIdButton.TouchUpInside += (sender,e) => {ExpandPwrId(sender, e, 2);}; arrItems5[5] = btnExpandPwrIdVw; iUtils.CreateFormGridItem btnContractPwrId = new iUtils.CreateFormGridItem(); UIView btnContractPwrIdVw = new UIView(); btnContractPwrId.SetDimensions(950f,0f, 50f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnContractPwrId.SetLabelText("-"); btnContractPwrId.SetBorderWidth(0.0f); btnContractPwrId.SetFontName("Verdana"); btnContractPwrId.SetFontSize(12f); btnContractPwrId.SetTag((iPwrIdContractTagId + (jj+1)) * (iii+1)); if (jj % 2 == 0) { btnContractPwrId.SetCellColour("Pale Yellow"); } else { btnContractPwrId.SetCellColour("Pale Orange"); } btnContractPwrIdVw = btnContractPwrId.GetButtonCell(); UIButton btnContractPwrIdButton = new UIButton(); btnContractPwrIdButton = btnContractPwrId.GetButton(); btnContractPwrIdButton.TouchUpInside += (sender,e) => {ContractPwrId(sender, e, 2);}; arrItems5[6] = btnContractPwrIdVw; UILabel hfPwrIdSectionHeight = new UILabel(); hfPwrIdSectionHeight.Tag = (iPwrIdHeightTagId + (jj+1)) * (iii+1); hfPwrIdSectionHeight.Hidden = true; hfPwrIdSectionHeight.Text = "0"; arrItems5[7] = hfPwrIdSectionHeight; iHeightToAdd = iSectionHdrRowHeight; //Now add the row details into the view vwPwrInternalRowId.AddSubviews(arrItems5); iSectionPwrIdHeight += iHeightToAdd; iPwrIdRowVert += iHeightToAdd; iVert += iHeightToAdd; iPwrIdRowInnerTop2 += iHeightToAdd; iPwrIdRowVertInner = 0f; UIView vwPwrInternalRowIdInnner = new UIView(); vwPwrInternalRowIdInnner.Tag = (iPwrIdSectionInnerTagId + (jj+1)) * (iii+1); vwPwrInternalRowIdInnner.Frame = new RectangleF(0f,iPwrIdRowVertInner,1000f,200f); //This will be resized later on // vwPwrInternalRowIdInnner.Hidden = true; UIView PwrIdHdr = BuildEquipmentHeader(jj, ref iHeightToAdd); PwrIdHdr.Frame = new RectangleF(0f, iPwrIdRowVertInner, 1000f, iHeightToAdd); vwPwrInternalRowIdInnner.AddSubview(PwrIdHdr); vwPwrInternalRowId.AddSubview(vwPwrInternalRowIdInnner); iSectionPwrIdHeight += iHeightToAdd; iPwrIdRowVert += iHeightToAdd; iPwrIdRowVertInner += iHeightToAdd; iVert += iHeightToAdd; //Now for each PwrId get the details for each string DataSet arrITPSection10PwrIdItems = ITPSection.GetLocalITPSection10PwrIdEquipmentDetails(sId, sPwrId); if (arrITPSection10PwrIdItems.Tables.Count > 0) { int iPwrIdItemRows = arrITPSection10PwrIdItems.Tables[0].Rows.Count; //Add the rows to a hidden field so we know how many rows are in each PwrId battery block UILabel hfPwrIdStringRows = new UILabel(); hfPwrIdStringRows.Text = iPwrIdItemRows.ToString(); hfPwrIdStringRows.Tag = (ihfPwrIdStringRowsTagId + (jj+1)) * (iii+1); hfPwrIdStringRows.Hidden = true; vwPwrInternalRowIdInnner.AddSubview(hfPwrIdStringRows); for (var kk = 0; kk < iPwrIdItemRows; kk++) { iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["AutoId"].Ordinal; int iAutoId = Convert.ToInt32(arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo]); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["BankNo"].Ordinal; string sBankNo = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["Make"].Ordinal; string sMake = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["Model"].Ordinal; string sModel = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["SPN"].Ordinal; string sSPN = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["DOM"].Ordinal; string sDOM = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["Floor"].Ordinal; string sFloor = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["Suite"].Ordinal; string sSuite = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["Rack"].Ordinal; string sRack = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["SubRack"].Ordinal; string sSubRack = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["Position"].Ordinal; string sPosition = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["Equipment_Condition"].Ordinal; string sEquipType = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["SerialBatch"].Ordinal; string sSerialNo = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["tblMaximoPSA_ID"].Ordinal; string sMaximoPSAId = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["tblMaximoTransfer_Eqnum"].Ordinal; string sMaximoTransferId = arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo].ToString(); if(sMaximoPSAId == "" || sMaximoPSAId == "0") { sMaximoPSAId = "-1"; } if(sMaximoTransferId == "" || sMaximoTransferId == "0") { sMaximoTransferId = "-1"; } int iMaximoPSAId = Convert.ToInt32(sMaximoPSAId); int iMaximoTransferId = Convert.ToInt32(sMaximoTransferId); int iMaximoAssetId = -1; if(iMaximoPSAId > 0) { iMaximoAssetId = iMaximoPSAId; } else if(iMaximoTransferId > 0 || sMaximoTransferId == "0000000000") { iMaximoAssetId = iMaximoTransferId; } else { iMaximoAssetId = -1; } iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["Equipment_Type"].Ordinal; int iEquipmentType = Convert.ToInt32(arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo]); iColNo = arrITPSection10PwrIdItems.Tables[0].Columns["Duplicate"].Ordinal; int iDuplicate = Convert.ToInt32(arrITPSection10PwrIdItems.Tables[0].Rows[kk].ItemArray[iColNo]); //Add in the row UIView EquipmentItemRow = BuildEquipmentItemRowDetails(iii, jj, kk, sPwrId, iAutoId, iMaximoAssetId, sBankNo, sMake, sModel, sSPN, sDOM, sFloor, sSuite, sRack, sSubRack, sPosition, sEquipType, sSerialNo, iEquipmentType, iDuplicate, false, bRFUPwrIdCommitted,ref iHeightToAdd); EquipmentItemRow.Frame = new RectangleF(0f, iPwrIdRowVertInner, 1000f, iHeightToAdd); EquipmentItemRow.Tag = iEquipmentFullRowTagId * (jj + 1) + (kk + 1); vwPwrInternalRowIdInnner.AddSubview(EquipmentItemRow); m_iEquipmentRowHeight = iHeightToAdd; iSectionPwrIdHeight += iHeightToAdd; iPwrIdRowVert += iHeightToAdd; iPwrIdRowVertInner += iHeightToAdd; iVert += iHeightToAdd; } hfPwrIdSectionHeight.Text = iPwrIdRowVertInner.ToString(); vwPwrInternalRowIdInnner.Frame = new RectangleF(0f, iPwrIdRowInnerTop2, 1000f, iPwrIdRowVertInner); vwPwrInternalRowId.Frame = new RectangleF(0f, iPwrIdRowInnerTop, 1000f, iPwrIdRowVert); PwrIdTableRow.AddSubview(vwPwrInternalRowId); iPwrIdRowInnerTop += iPwrIdRowVert; //iPwrIdRowInnerTop2 += iPwrIdRowVertInner; iPwrIdRowVert = 0f; } } //Now resize the UIView that is effectively the container for the battery info for this section //And also store this height in a hidden field for use in the contract and expand functions PwrIdTableRow.Frame = new RectangleF(0f,iPwrIdRowVertTop,1000f,iSectionPwrIdHeight); hfSectionEquipmentHeight.Text = iSectionPwrIdHeight.ToString(); } iTotalHeight = iVert + 280f; SizeF layoutSize = new SizeF(1000f, iTotalHeight); layout.ContentSize = layoutSize; UILabel hfScrollContentHeight = new UILabel(); hfScrollContentHeight.Text = iTotalHeight.ToString(); hfScrollContentHeight.Tag = 3; hfScrollContentHeight.Hidden = true; layout.AddSubview(hfScrollContentHeight); View.AddSubview(layout); //Contract all the power conversion PwrIds for(int iiii=0;iiii< m_iEquipmentPwrIds; iiii++) { UIButton btnContract = (UIButton)View.ViewWithTag ((iPwrIdContractTagId + (iiii+1)) * (m_iEquipmentSectionCounter+1)); ContractPwrId(btnContract, null, 2); } } catch (Exception except) { string sTest = except.Message.ToString(); iUtils.AlertBox alert = new iUtils.AlertBox (); alert.CreateErrorAlertDialog (sTest); } }
public bool PowerConversionFullyComplete() { clsTabletDB.ITPDocumentSection DBQ = new clsTabletDB.ITPDocumentSection(); return DBQ.ProjectSection10PowerConversionComplete(m_sPassedId); }
public bool RFUFullyCommitted() { clsTabletDB.ITPDocumentSection DBQ = new clsTabletDB.ITPDocumentSection(); return DBQ.ProjectSectionRFUFullyCommitted(m_sPassedId); }
public void DeleteEquipmentRow(object sender, EventArgs e) { string sRtnMsg = ""; clsTabletDB.ITPDocumentSection DBQ = new clsTabletDB.ITPDocumentSection(); UIButton btnDelete = (UIButton)sender; int iTagId = btnDelete.Tag; int iPwrIdRow = iTagId / iEquipmentDeleteBtnTagId; int iStringRow = iTagId - (iPwrIdRow * iEquipmentDeleteBtnTagId); UILabel hfRowStatus = (UILabel)View.ViewWithTag(iEquipmentRowStatusTagId * (iPwrIdRow) + (iStringRow)); int iRowStatus = Convert.ToInt32(hfRowStatus.Text); UILabel hfAutoId = (UILabel)View.ViewWithTag(iEquipmentRowAutoIdTagId * (iPwrIdRow) + (iStringRow)); int iAutoId = Convert.ToInt32(hfAutoId.Text); UILabel hfMaximoAssetId = (UILabel)View.ViewWithTag(iEquipmentRowMaximoAssetIdTagId * (iPwrIdRow) + (iStringRow)); string sMaximoId = hfMaximoAssetId.Text; if (sMaximoId == "" || sMaximoId == "0") { sMaximoId = "-1"; } int iMaximoAssetId = Convert.ToInt32(sMaximoId); UILabel hfPwrId = (UILabel)View.ViewWithTag(iEquipmentRowPwrIdTagId * (iPwrIdRow) + (iStringRow)); string sPwrId = hfPwrId.Text; UILabel hfEquipmentType = (UILabel)View.ViewWithTag(iEquipmentTypeTagId * (iPwrIdRow) + (iStringRow)); int iEquipmentType = Convert.ToInt32(hfEquipmentType.Text); string sRack = ""; string sSubRack = ""; string sPosition = ""; string sString = ""; string sMessage = ""; UITextField txtFloor = (UITextField)View.ViewWithTag(iEquipmentFloorTagId * (iPwrIdRow) + (iStringRow)); string sFloor = txtFloor.Text; UITextField txtSuite = (UITextField)View.ViewWithTag(iEquipmentSuiteTagId * (iPwrIdRow) + (iStringRow)); string sSuite = txtSuite.Text; switch(iEquipmentType) { case 3: //Rack UITextField txtRack = (UITextField)View.ViewWithTag(iEquipmentRackTagId * (iPwrIdRow) + (iStringRow)); sRack = txtRack.Text; sMessage = ", Floor " + sFloor + ", Suite " + sSuite + " and Rack " + sRack; break; case 4: //SubRack UITextField txtRack1 = (UITextField)View.ViewWithTag(iEquipmentRackTagId * (iPwrIdRow) + (iStringRow)); sRack = txtRack1.Text; UITextField txtSubRack1 = (UITextField)View.ViewWithTag(iEquipmentSubRackTagId * (iPwrIdRow) + (iStringRow)); sSubRack = txtSubRack1.Text; sMessage = ", Floor " + sFloor + ", Suite " + sSuite + ", Rack " + sRack + " and SubRack " + sSubRack; break; case 5: //Position UITextField txtRack2 = (UITextField)View.ViewWithTag(iEquipmentRackTagId * (iPwrIdRow) + (iStringRow)); sRack = txtRack2.Text; UITextField txtSubRack2 = (UITextField)View.ViewWithTag(iEquipmentSubRackTagId * (iPwrIdRow) + (iStringRow)); sSubRack = txtSubRack2.Text; UITextField txtPosition2 = (UITextField)View.ViewWithTag(iEquipmentPositionTagId * (iPwrIdRow) + (iStringRow)); sPosition = txtPosition2.Text; sMessage = ", Floor " + sFloor + ", Suite " + sSuite + ", Rack " + sRack + " ,SubRack " + sSubRack + " and Position " + sPosition; break; case 7: //String UITextField txtRack3 = (UITextField)View.ViewWithTag(iEquipmentRackTagId * (iPwrIdRow) + (iStringRow)); sRack = txtRack3.Text; UITextField txtSubRack3 = (UITextField)View.ViewWithTag(iEquipmentSubRackTagId * (iPwrIdRow) + (iStringRow)); sSubRack = txtSubRack3.Text; UITextField txtPosition3 = (UITextField)View.ViewWithTag(iEquipmentPositionTagId * (iPwrIdRow) + (iStringRow)); sPosition = txtPosition3.Text; UITextField txtString3 = (UITextField)View.ViewWithTag(iEquipmentStringTagId * (iPwrIdRow) + (iStringRow)); sString = txtString3.Text; sMessage = ", Floor " + sFloor + ", Suite " + sSuite + ", Rack " + sRack + " ,SubRack " + sSubRack + " ,Position " + sPosition + " and Solar String " + sString; break; } //You can only delete an item you have added and these have iMaximoAssetId = -1 if (iMaximoAssetId < 0) { //This means the current row is either not changed or has been updated, so it has to be removed from the DB if (iRowStatus == 0 || iRowStatus == 1) { //Don't actaully delete at this stage, just mark as deleted. Delete on the upload success. if(!DBQ.ITPProjectSectionDeleteSection10Item(m_sPassedId, iAutoId, false, ref sRtnMsg)) { iUtils.AlertBox alert = new iUtils.AlertBox(); alert.CreateErrorAlertDialog("Could not delete power conversion item on project " + m_sPassedId + ", Power Id " + sPwrId + sMessage); return; } } //Remove the line from the page (well hide it really so all the loops still work) UIView vwStringRow = (UIView)View.ViewWithTag(iEquipmentFullRowTagId * (iPwrIdRow) + (iStringRow)); vwStringRow.Hidden = true; hfRowStatus.Text = "3"; //Means deleted, so no save required ReduceHeightAfter(m_iEquipmentRowHeight, iPwrIdRow, iStringRow, 2); UIView vwPwrInternalRowId = (UIView)View.ViewWithTag((iPwrIdSectionInnerTagId + (iPwrIdRow)) * (m_iEquipmentSectionCounter+1)); RectangleF frame1 = vwPwrInternalRowId.Frame; frame1.Height -= m_iEquipmentRowHeight; vwPwrInternalRowId.Frame = frame1; //Now increase the view height for this new row (The whole section height is handled in the ReduceHeightAfter function) UILabel hfPwrIdSectionHeight = (UILabel)View.ViewWithTag((iPwrIdHeightTagId + iPwrIdRow ) * (m_iEquipmentSectionCounter + 1)); int iPwrIdHeight = Convert.ToInt32(hfPwrIdSectionHeight.Text); hfPwrIdSectionHeight.Text = (iPwrIdHeight - m_iEquipmentRowHeight).ToString(); //Set the unsaved tags on (do this even though the record is removed for consistency) SetSectionValueChanged(m_iEquipmentSectionCounter + 1); SetAnyValueChanged(sender, null); } return; }
public bool BatteryFullyComplete() { clsTabletDB.ITPDocumentSection DBQ = new clsTabletDB.ITPDocumentSection(); return DBQ.ProjectSection10BatteryComplete(m_sPassedId); }
public bool FillITPDocumentSectionMainTable(string sSessionId, string sUser, ref string sRtnMsg) { try { clsTabletDB.ITPStaticTable Static = new clsTabletDB.ITPStaticTable(); clsTabletDB.ITPDocumentSection ITPDocSection = new clsTabletDB.ITPDocumentSection(); LocalDB DB = new LocalDB(); string sITPDocumentSectionTableName = ITPDocSection.sITPDocumentSectionTableName; double dNewVersionNumber = 0.0; DateTime dtLastVersionDate; //Only do all of this if the version has changed. So get the local version umber and compare to that on the DB. If different do all of this. - WRITE LATER as a general function bool bNewVersion = Static.IsNewVersionOfTable(sSessionId, sUser, sITPDocumentSectionTableName, ref dNewVersionNumber, ref dtLastVersionDate); if (!DB.TableExists(sITPDocumentSectionTableName) || bNewVersion) { clsLocalUtils util = new clsLocalUtils(); string sURL = util.GetEnvironment_wbsURL("wbsITP_External"); wbsITP_External ws = new wbsITP_External(); ws.Url = sURL; object[] objQuestions = ws.GetITPFullDocumentSectionInfo(sSessionId, sUser); if (objQuestions[0].ToString() == "Success") { if (ITPDocSection.TableITPDocumentSectionDeleteAllRecords(ref sRtnMsg)) { string sITPDocumentQuestionnaireInfo = objQuestions[1].ToString(); string[] sHeaderInfo = sITPDocumentQuestionnaireInfo.Split('~'); if (sHeaderInfo[0] == "ITPDocumentSectionInfo") { string[] delimiters = new string[] { "||" }; string[] sDocSectionItems = sHeaderInfo[1].Split(delimiters, StringSplitOptions.RemoveEmptyEntries); int iQuestionCount = sDocSectionItems.Length; if (iQuestionCount > 0) { this.InvokeOnMainThread(() => { progBarSectionsVw.ShowProgressBar(iQuestionCount); }); //First check if the ITPType table exists and if not create it if (ITPDocSection.CheckFullDocumentSectionTable()) { for (int i = 0; i < iQuestionCount; i++) { string[] delimiters2 = new string[] { "^" }; string[] sQuestionItems = sDocSectionItems[i].Split(delimiters2, StringSplitOptions.None); ITPDocSection.TableITPDocumentSectionAddRecord(sQuestionItems); this.InvokeOnMainThread(() => { progBarSectionsVw.UpdateProgressBar(i + 1); }); } } } } } //Update the version number locally Static.UpdateVersionNumber(sITPDocumentSectionTableName, dNewVersionNumber); this.InvokeOnMainThread(() => { progBarSectionsVw.CloseProgressBar(); }); return true; } else { sRtnMsg = objQuestions[1].ToString(); return false; } } else { //This means you don't have to fill this static table return true; } } catch (Exception ex) { sRtnMsg = "Failure" + ex.Message.ToString(); return false; } }
public void DrawOpeningPage() { try { DateClass dt = new DateClass(); int iColNo = 0; int iSectionId = 0; bool bYes; bool bNo; bool bNA; string sId = m_sPassedId; float iVert = 0f; float iSectionHdrRowHeight = 40f; float iQuestionHdrRowHeight = 20f; float iQuestionRowHeight = 30f; float iQuestionRowVert = 0f; float iTotalHeight = 0f; float iHeightToAdd = iQuestionRowHeight; float iHeightToAdd2 = iHeightToAdd; bool bDisableRow = false; bool bFullyCommitted = false; bool bHideComplete = true; bool[] bHideSections = new bool[1]; UIView[] arrItems = new UIView[5]; UIView[] arrItems2 = new UIView[6]; UIView[] arrItems3 = new UIView[5]; UIView[] arrItems4 = new UIView[6]; UIView[] arrItems6 = new UIView[11]; UIView[] arrItems7 = new UIView[7]; UIView[] arrItems14 = new UIView[8]; UIScrollView layout = new UIScrollView(); layout.Frame = new RectangleF(0f,35f,1000f,620f); layout.Tag = 2; clsTabletDB.ITPDocumentSection ITPSection = new clsTabletDB.ITPDocumentSection(); //Get all the sections and place a table layout for each one DataSet arrITPSections = ITPSection.GetLocalITPSections(sId); if (arrITPSections.Tables.Count > 0) { int iRows = arrITPSections.Tables[0].Rows.Count; m_iSections = iRows; m_iQuestionSections = iRows; Array.Resize<bool>(ref bHideSections, iRows); for (int i = 0; i < iRows; i++) { bHideSections[i] = false; //Add in a view for each section. UIView SectionRow = new UIView(); iSectionId = iSectionTagId * (i+1); SectionRow.Tag = iSectionId; SectionRow.Frame = new RectangleF(0f,iVert,1000f,iSectionHdrRowHeight); layout.AddSubview(SectionRow); //Add in the section title and buttons for each section header UILabel hfSection = new UILabel(); iColNo = arrITPSections.Tables[0].Columns["SectionId"].Ordinal; hfSection.Text = arrITPSections.Tables[0].Rows[i].ItemArray[iColNo].ToString(); hfSection.Tag = iSectionDBIdTagId * (i+1); hfSection.Hidden = true; SectionRow.AddSubview(hfSection); iUtils.CreateFormGridItem Section = new iUtils.CreateFormGridItem(); UIView SectionVw = new UIView(); iColNo = arrITPSections.Tables[0].Columns["Name"].Ordinal; Section.SetDimensions(0f,0f, 300f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); Section.SetLabelText(arrITPSections.Tables[0].Rows[i].ItemArray[iColNo].ToString()); Section.SetBorderWidth(0.0f); Section.SetFontName("Verdana-Bold"); Section.SetTextColour("White"); Section.SetFontSize(12f); Section.SetCellColour("DarkSlateGrey"); Section.SetTag(iSectionDescTagId * (i+1)); SectionVw = Section.GetLabelCell(); arrItems[0] = SectionVw; bool bAnyCommitted = ITPSection.ProjectSectionRFUAnyPwrIdCommitted(m_sPassedId); if(bAnyCommitted) { bFullyCommitted = true; bHideComplete = false; } else { bFullyCommitted = false; bHideComplete = true; } iUtils.CreateFormGridItem SectionCompleteLabel = new iUtils.CreateFormGridItem(); UIView SectionCompleteLabelVw = new UIView(); SectionCompleteLabel.SetDimensions(300f,0f, 250f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); if(bFullyCommitted) { SectionCompleteLabel.SetLabelText("COMMITTED"); } else { SectionCompleteLabel.SetLabelText("COMPLETED"); } SectionCompleteLabel.SetBorderWidth(0.0f); SectionCompleteLabel.SetFontName("Verdana-Bold"); SectionCompleteLabel.SetTextColour("Bright Yellow"); SectionCompleteLabel.SetFontSize(14f); SectionCompleteLabel.SetCellColour("DarkSlateGrey"); SectionCompleteLabel.SetTag(iSectionCompleteLabelTagId * (i+1)); SectionCompleteLabel.SetHidden(bHideComplete); SectionCompleteLabelVw = SectionCompleteLabel.GetLabelCell(); arrItems[1] = SectionCompleteLabelVw; iUtils.CreateFormGridItem btnSave = new iUtils.CreateFormGridItem(); UIView btnSaveVw = new UIView(); btnSave.SetDimensions(550f,0f, 150f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnSave.SetLabelText("Save Section"); btnSave.SetBorderWidth(0.0f); btnSave.SetFontName("Verdana"); btnSave.SetFontSize(12f); btnSave.SetTag(iSaveSectionBtnTagId * (i+1)); btnSave.SetCellColour("DarkSlateGrey"); btnSaveVw = btnSave.GetButtonCell(); UIButton btnSaveButton = new UIButton(); btnSaveButton = btnSave.GetButton(); btnSaveButton.TouchUpInside += (sender,e) => {SaveThisSection(sender, e);}; arrItems[2] = btnSaveVw; iUtils.CreateFormGridItem btnExpand = new iUtils.CreateFormGridItem(); UIView btnExpandVw = new UIView(); btnExpand.SetDimensions(700f,0f, 50f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnExpand.SetLabelText("+"); btnExpand.SetBorderWidth(0.0f); btnExpand.SetFontName("Verdana"); btnExpand.SetFontSize(12f); btnExpand.SetTag(iExpandSectionBtnTagId * (i+1)); btnExpand.SetCellColour("DarkSlateGrey"); btnExpandVw = btnExpand.GetButtonCell(); UIButton btnExpandButton = new UIButton(); btnExpandButton = btnExpand.GetButton(); btnExpandButton.Enabled = false; btnExpandButton.TouchUpInside += (sender,e) => {ExpandSection(sender, e);}; arrItems[3] = btnExpandVw; iUtils.CreateFormGridItem btnContract = new iUtils.CreateFormGridItem(); UIView btnContractVw = new UIView(); btnContract.SetDimensions(750f,0f, 50f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnContract.SetLabelText("-"); btnContract.SetBorderWidth(0.0f); btnContract.SetFontName("Verdana"); btnContract.SetFontSize(12f); btnContract.SetTag(iContractSectionBtnTagId * (i+1)); btnContract.SetCellColour("DarkSlateGrey"); btnContractVw = btnContract.GetButtonCell(); UIButton btnContractButton = new UIButton(); btnContractButton = btnContract.GetButton(); btnContractButton.TouchUpInside += (sender,e) => {ContractSection(sender, e);}; arrItems[4] = btnContractVw; SectionRow.AddSubviews(arrItems); iVert += iSectionHdrRowHeight; //Now add a new view to this view to hold another view containing all the questions for this section UIView QuestionsTableRow = new UIView(); float iQuestionRowVertTop = iVert; QuestionsTableRow.Frame = new RectangleF(0f,iQuestionRowVertTop,1000f,iQuestionHdrRowHeight); iSectionId = iContainerSectionTagId * (i+1); QuestionsTableRow.Tag = iSectionId; layout.AddSubview(QuestionsTableRow); //Get all the questions in this section and place a row for each one iColNo = arrITPSections.Tables[0].Columns["SectionId"].Ordinal; int iDBSectionId = Convert.ToInt32( arrITPSections.Tables[0].Rows[i].ItemArray[iColNo]); iColNo = arrITPSections.Tables[0].Columns["QuestionType"].Ordinal; int iQuestionTypes = Convert.ToInt32(arrITPSections.Tables[0].Rows[i].ItemArray[iColNo]); DataSet arrITPSectionQuestions = ITPSection.GetLocalITPSectionQuestions(sId, iDBSectionId); if (arrITPSectionQuestions.Tables.Count > 0) { int iQuestionRows = arrITPSectionQuestions.Tables[0].Rows.Count; //Put in the header row iUtils.CreateFormGridItem lblQuestionHdr = new iUtils.CreateFormGridItem(); UIView lblQuestionHdrVw = new UIView(); lblQuestionHdr.SetDimensions(0f,0f, 400f, iQuestionHdrRowHeight, 4f, 1f, 4f, 1f); lblQuestionHdr.SetLabelText("Question"); lblQuestionHdr.SetBorderWidth(0.0f); lblQuestionHdr.SetFontName("Verdana-Bold"); lblQuestionHdr.SetTextAlignment("Centre"); lblQuestionHdr.SetFontSize(12f); lblQuestionHdr.SetCellColour("Pale Yellow"); lblQuestionHdr.SetTag(iQuestionHdrTagId * (i+1)); lblQuestionHdrVw = lblQuestionHdr.GetLabelCell(); arrItems2[0] = lblQuestionHdrVw; iUtils.CreateFormGridItem lblAnswerHdr = new iUtils.CreateFormGridItem(); UIView lblAnswerHdrVw = new UIView(); lblAnswerHdr.SetDimensions(400f,0f, 200f, iQuestionHdrRowHeight, 4f, 1f, 4f, 1f); lblAnswerHdr.SetLabelText("Answer"); lblAnswerHdr.SetBorderWidth(0.0f); lblAnswerHdr.SetFontName("Verdana-Bold"); lblAnswerHdr.SetTextAlignment("Centre"); lblAnswerHdr.SetFontSize(12f); lblAnswerHdr.SetCellColour("Pale Yellow"); lblAnswerHdr.SetTag(iAnswerHdrTagId * (i+1)); lblAnswerHdrVw = lblAnswerHdr.GetLabelCell(); arrItems2[1] = lblAnswerHdrVw; iUtils.CreateFormGridItem lblCommentsHdr = new iUtils.CreateFormGridItem(); UIView lblCommentsHdrVw = new UIView(); lblCommentsHdr.SetDimensions(600f,0f, 200f, iQuestionHdrRowHeight, 4f, 1f, 4f, 1f); lblCommentsHdr.SetLabelText("Comments"); lblCommentsHdr.SetBorderWidth(0.0f); lblCommentsHdr.SetFontName("Verdana-Bold"); lblCommentsHdr.SetTextAlignment("Centre"); lblCommentsHdr.SetFontSize(12f); lblCommentsHdr.SetCellColour("Pale Yellow"); lblCommentsHdr.SetTag(iCommentsHdrTagId * (i+1)); lblCommentsHdrVw = lblCommentsHdr.GetLabelCell(); arrItems2[2] = lblCommentsHdrVw; layout.AddSubview(QuestionsTableRow); float iSectionQuestionsHeight = iQuestionHdrRowHeight; UILabel hfSectionHeight = new UILabel(); hfSectionHeight.Tag = iSectionHeightTagId * (i+1); hfSectionHeight.Hidden = true; arrItems2[3] = hfSectionHeight; UILabel hfSectionRows = new UILabel(); hfSectionRows.Tag = iSectionRowsTagId * (i+1); hfSectionRows.Hidden = true; hfSectionRows.Text = iQuestionRows.ToString(); arrItems2[4] = hfSectionRows; UILabel hfSectionStatus = new UILabel(); hfSectionStatus.Tag = iSectionStatusTagId * (i+1); hfSectionStatus.Hidden = true; hfSectionStatus.Text = "0"; arrItems2[5] = hfSectionStatus; QuestionsTableRow.AddSubviews(arrItems2); iVert += iQuestionHdrRowHeight; iQuestionRowVert = iQuestionHdrRowHeight; bool bSectionFullyCompleted = true; for (int j = 0; j < iQuestionRows; j++) { UILabel hfRowStatus = new UILabel(); hfRowStatus.Text = "0"; hfRowStatus.Tag = (ihfRowStatusTagId + (j+1)) * (i+1); hfRowStatus.Hidden = true; arrItems3[0] = hfRowStatus; iColNo = arrITPSectionQuestions.Tables[0].Columns["AutoId"].Ordinal; string sAutoId = arrITPSectionQuestions.Tables[0].Rows[j].ItemArray[iColNo].ToString(); iColNo = arrITPSectionQuestions.Tables[0].Columns["Question"].Ordinal; string sQuestion = arrITPSectionQuestions.Tables[0].Rows[j].ItemArray[iColNo].ToString(); UILabel hfAutoId = new UILabel(); hfAutoId.Text = sAutoId; hfAutoId.Tag = (ihfAutoRowTagId + (j+1)) * (i+1); hfAutoId.Hidden = true; arrItems3[1] = hfAutoId; //Put in the question iUtils.CreateFormGridItem rowQuestion = new iUtils.CreateFormGridItem(); UIView rowQuestionVw = new UIView(); rowQuestion.SetLabelWrap(1); //This means the text will be wrapped in the label rowQuestion.SetDimensions(0f,iQuestionRowVert, 400f, iQuestionRowHeight, 2f, 2.5f, 2f, 2.5f); rowQuestion.SetLabelText(sQuestion); rowQuestion.SetBorderWidth(0.0f); rowQuestion.SetFontName("Verdana"); rowQuestion.SetFontSize(12f); rowQuestion.SetTag((iQuestionRowTagId + (j+1)) * (i+1)); if (j % 2 == 0) { rowQuestion.SetCellColour("Pale Blue"); } else { rowQuestion.SetCellColour("Sky Blue"); } rowQuestionVw = rowQuestion.GetLabelCell(); iHeightToAdd = rowQuestion.GetCellHeight(); //Put in the answer iColNo = arrITPSectionQuestions.Tables[0].Columns["Yes"].Ordinal; bYes = Convert.ToBoolean(arrITPSectionQuestions.Tables[0].Rows[j].ItemArray[iColNo]); iColNo = arrITPSectionQuestions.Tables[0].Columns["No"].Ordinal; bNo = Convert.ToBoolean(arrITPSectionQuestions.Tables[0].Rows[j].ItemArray[iColNo]); iColNo = arrITPSectionQuestions.Tables[0].Columns["NA"].Ordinal; bNA = Convert.ToBoolean(arrITPSectionQuestions.Tables[0].Rows[j].ItemArray[iColNo]); iUtils.CreateFormGridItem radGrp = new iUtils.CreateFormGridItem(); UIView radGrpVw = new UIView(); radGrp.SetDimensions(400f,iQuestionRowVert, 200f, iQuestionRowHeight, 2f, 2.5f, 2f, 2.5f); radGrp.SetFontName("Verdana"); radGrp.SetFontSize(12f); radGrp.SetTag((iAnswerGroupTagId + (j+1)) * (i+1)); if (j % 2 == 0) { radGrp.SetCellColour("Pale Blue"); } else { radGrp.SetCellColour("Sky Blue"); } radGrpVw = radGrp.GetRadioButtonCell(); UISegmentedControl radGrpRadio = new UISegmentedControl(); radGrpRadio = radGrp.GetRadioGroup(); radGrpRadio.TouchUpInside += (sender,e) => {SetRowRadioChanged(sender, e);}; radGrpRadio.ValueChanged += (sender,e) => {SetRowRadioChanged(sender, e);}; QuestionsBitMask mask = (QuestionsBitMask)iQuestionTypes; int iPos = 0; bool bQuestionSet = false; if ((mask & QuestionsBitMask.Yes) == QuestionsBitMask.Yes) { radGrpRadio.InsertSegment("Yes", iPos,false); if(bYes) { radGrpRadio.SelectedSegment = iPos; bQuestionSet= true; } iPos++; } if ((mask & QuestionsBitMask.No) == QuestionsBitMask.No) { radGrpRadio.InsertSegment("No", iPos,false); if(bNo) { radGrpRadio.SelectedSegment = iPos; bQuestionSet= true; } iPos++; } if ((mask & QuestionsBitMask.NA) == QuestionsBitMask.NA) { radGrpRadio.InsertSegment("N/A", iPos,false); if(bNA) { radGrpRadio.SelectedSegment = iPos; bQuestionSet= true; } } if(bQuestionSet) { radGrpRadio.Enabled = false; } else { bSectionFullyCompleted = false; } //Put in the comments iUtils.CreateFormGridItem rowComments = new iUtils.CreateFormGridItem(); UIView rowCommentsVw = new UIView(); iColNo = arrITPSectionQuestions.Tables[0].Columns["Comments"].Ordinal; rowComments.SetLabelWrap(1); //This means the text will be wrapped in the label rowComments.SetDimensions(600f,iQuestionRowVert, 200f, iQuestionRowHeight, 2f, 2.5f, 2f, 2.5f); rowComments.SetLabelText(arrITPSectionQuestions.Tables[0].Rows[j].ItemArray[iColNo].ToString()); rowComments.SetBorderWidth(0.0f); rowComments.SetFontName("Verdana"); rowComments.SetFontSize(12f); rowComments.SetTag((iCommentsTagId + (j+1)) * (i+1)); // if (j % 2 == 0) { rowComments.SetCellColour("Pale Blue"); } else { rowComments.SetCellColour("Sky Blue"); } rowCommentsVw = rowComments.GetTextCell(); iHeightToAdd2 = rowComments.GetCellHeight(); UITextView rowCommentsTextVw = new UITextView(); rowCommentsTextVw = rowComments.GetTextView(); rowCommentsTextVw.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 11);}; rowCommentsTextVw.Changed += (sender,e) => {SetRowEditTextChanged(sender, e);}; if(bQuestionSet) { rowCommentsTextVw.Editable = false; } if(iHeightToAdd2 > iHeightToAdd) { rowQuestion.SetDimensions(0f,iQuestionRowVert, 400f, iHeightToAdd2, 2f, 2.5f, 2f, 2.5f); rowQuestion.ResetCellViewDimensions(rowQuestionVw); radGrp.SetDimensions(400f,iQuestionRowVert, 200f, iHeightToAdd2, 2f, 2.5f, 2f, 2.5f); radGrp.ResetCellViewDimensions(radGrpVw); } else { radGrp.SetDimensions(400f,iQuestionRowVert, 200f, iHeightToAdd, 2f, 2.5f, 2f, 2.5f); radGrp.ResetCellViewDimensions(radGrpVw); rowComments.SetDimensions(600f,iQuestionRowVert, 200f, iHeightToAdd, 2f, 2.5f, 2f, 2.5f); rowComments.ResetCellViewDimensions(rowCommentsVw); rowComments.ResetCellTextViewDimensions(rowCommentsTextVw); } arrItems3[2] = rowQuestionVw; arrItems3[3] = radGrpVw; arrItems3[4] = rowCommentsVw; QuestionsTableRow.AddSubviews(arrItems3); iSectionQuestionsHeight += iHeightToAdd; iQuestionRowVert += iHeightToAdd; iVert += iHeightToAdd; } //Now resize the UIView that is effectively the container for the questions for this section //And also store this height in a hidden field for use in the contract and expand functions QuestionsTableRow.Frame = new RectangleF(0f,iQuestionRowVertTop,1000f,iSectionQuestionsHeight); hfSectionHeight.Text = iSectionQuestionsHeight.ToString(); if(bSectionFullyCompleted) { bHideSections[i] = true; } } } } //******************************************************************************************// // SECTION 10 (BATTERIES) // //******************************************************************************************// //Get all the PwrId's for this project from ITPSection10 DataSet arrITPSection10PwrIds = ITPSection.GetLocalITPSection10PwrIds(sId, 6); if (arrITPSection10PwrIds.Tables.Count > 0) { int ii = arrITPSections.Tables[0].Rows.Count; m_iSections++; //Add an extra one for the batteries section m_iBatterySectionCounter = ii; int iPwrIdRows = arrITPSection10PwrIds.Tables[0].Rows.Count; //Add in the section title and buttons for each section header UIView Section10Row = new UIView(); float iSection10RowVertTop = iVert; Section10Row.Frame = new RectangleF(0f,iSection10RowVertTop,1000f,iSectionHdrRowHeight); iSectionId = iSectionTagId * (ii+1); Section10Row.Tag = iSectionId; layout.AddSubview(Section10Row); UILabel hfSection10 = new UILabel(); hfSection10.Text = "10"; hfSection10.Tag = iSectionDBIdTagId * (ii+1); hfSection10.Hidden = true; Section10Row.AddSubview(hfSection10); iUtils.CreateFormGridItem Section10 = new iUtils.CreateFormGridItem(); UIView Section10Vw = new UIView(); Section10.SetDimensions(0f,0f, 300f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); Section10.SetLabelText("BATTERIES"); Section10.SetBorderWidth(0.0f); Section10.SetFontName("Verdana-Bold"); Section10.SetTextColour("White"); Section10.SetFontSize(12f); Section10.SetCellColour("DarkSlateGrey"); Section10.SetTag(iSectionDescTagId * (ii+1)); Section10Vw = Section10.GetLabelCell(); arrItems4[0] = Section10Vw; if(RFUFullyCommitted()) { bFullyCommitted = true; bHideComplete = false; } else { if(BatteryFullyCommitted()) { bFullyCommitted = true; bHideComplete = false; } else { bFullyCommitted = false; if(BatteryFullyComplete()) { bHideComplete = false; } else { bHideComplete = true; } } } iUtils.CreateFormGridItem SectionCompleteLabel = new iUtils.CreateFormGridItem(); UIView SectionCompleteLabelVw = new UIView(); SectionCompleteLabel.SetDimensions(300f,0f, 150f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); if(bFullyCommitted) { SectionCompleteLabel.SetLabelText("COMMITTED"); } else { SectionCompleteLabel.SetLabelText("COMPLETED"); } SectionCompleteLabel.SetBorderWidth(0.0f); SectionCompleteLabel.SetFontName("Verdana-Bold"); SectionCompleteLabel.SetTextColour("Bright Yellow"); SectionCompleteLabel.SetFontSize(14f); SectionCompleteLabel.SetCellColour("DarkSlateGrey"); SectionCompleteLabel.SetTag(iSectionCompleteLabelTagId * (ii+1)); SectionCompleteLabel.SetHidden(bHideComplete); SectionCompleteLabelVw = SectionCompleteLabel.GetLabelCell(); arrItems4[1] = SectionCompleteLabelVw; iUtils.CreateFormGridItem btnSave10 = new iUtils.CreateFormGridItem(); UIView btnSave10Vw = new UIView(); btnSave10.SetDimensions(450f,0f, 350f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnSave10.SetLabelText("Open Battery Details Screen"); btnSave10.SetBorderWidth(0.0f); btnSave10.SetFontName("Verdana"); btnSave10.SetFontSize(12f); btnSave10.SetTag(iSaveSectionBtnTagId * (ii+1)); btnSave10.SetCellColour("DarkSlateGrey"); btnSave10Vw = btnSave10.GetButtonCell(); UIButton btnSave10Button = new UIButton(); btnSave10Button = btnSave10.GetButton(); btnSave10Button.TouchUpInside += (sender,e) => {OpenBatteries(sender, e);}; arrItems4[2] = btnSave10Vw; UILabel hfSectionHeight = new UILabel(); hfSectionHeight.Tag = iSectionHeightTagId * (ii+1); hfSectionHeight.Hidden = true; hfSectionHeight.Text = "0"; arrItems4[3] = hfSectionHeight; UILabel hfSectionRows = new UILabel(); hfSectionRows.Tag = iSectionRowsTagId * (ii+1); hfSectionRows.Hidden = true; hfSectionRows.Text = iPwrIdRows.ToString(); arrItems4[4] = hfSectionRows; UILabel hfSectionStatus = new UILabel(); hfSectionStatus.Tag = iSectionStatusTagId * (ii+1); hfSectionStatus.Hidden = true; hfSectionStatus.Text = "0"; arrItems4[5] = hfSectionStatus; Section10Row.AddSubviews(arrItems4); iVert += iSectionHdrRowHeight; //Now add a new view to this view to hold another view containing all the pwrid info for this section 10 UIView PwrIdTableRow = new UIView(); PwrIdTableRow.Frame = new RectangleF(0f,iVert,1000f,0f); iSectionId = iContainerSectionTagId * (ii+1); PwrIdTableRow.Tag = iSectionId; layout.AddSubview(PwrIdTableRow); } //******************************************************************************************// // SECTION 10 (EQUIPMENT) // //******************************************************************************************// //Get all the PwrId's for this project from ITPSection10 DataSet arrITPSectionEquipmentPwrIds = ITPSection.GetLocalITPSectionEquipmentPwrIds(sId); if (arrITPSectionEquipmentPwrIds.Tables.Count > 0) { int iii = m_iSections; m_iSections++; //Add an extra one for the equipment section m_iEquipmentSectionCounter = iii; int iPwrIdRows = arrITPSectionEquipmentPwrIds.Tables[0].Rows.Count; //Add in the section title and buttons for each section header UIView SectionEquipmentRow = new UIView(); float iSectionEquipmentRowVertTop = iVert; SectionEquipmentRow.Frame = new RectangleF(0f,iSectionEquipmentRowVertTop,1000f,iSectionHdrRowHeight); iSectionId = iSectionTagId * (iii+1); SectionEquipmentRow.Tag = iSectionId; layout.AddSubview(SectionEquipmentRow); UILabel hfSectionEquipment = new UILabel(); hfSectionEquipment.Text = "10"; hfSectionEquipment.Tag = iSectionDBIdTagId * (iii+1); hfSectionEquipment.Hidden = true; SectionEquipmentRow.AddSubview(hfSectionEquipment); iUtils.CreateFormGridItem SectionEquipment = new iUtils.CreateFormGridItem(); UIView SectionEquipmentVw = new UIView(); SectionEquipment.SetDimensions(0f,0f, 300f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); SectionEquipment.SetLabelText("POWER CONVERSION EQUIPMENT"); SectionEquipment.SetBorderWidth(0.0f); SectionEquipment.SetFontName("Verdana-Bold"); SectionEquipment.SetTextColour("White"); SectionEquipment.SetFontSize(12f); SectionEquipment.SetCellColour("DarkSlateGrey"); SectionEquipment.SetTag(iSectionDescTagId * (iii+1)); SectionEquipmentVw = SectionEquipment.GetLabelCell(); arrItems4[0] = SectionEquipmentVw; if(RFUFullyCommitted()) { bFullyCommitted = true; bHideComplete = false; } else { if(PowerConversionFullyCommitted()) { bFullyCommitted = true; bHideComplete = false; } else { bFullyCommitted = false; if(PowerConversionFullyComplete()) { bHideComplete = false; } else { bHideComplete = true; } } } iUtils.CreateFormGridItem SectionCompleteLabel = new iUtils.CreateFormGridItem(); UIView SectionCompleteLabelVw = new UIView(); SectionCompleteLabel.SetDimensions(300f,0f, 150f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); if(bFullyCommitted) { SectionCompleteLabel.SetLabelText("COMMITTED"); } else { SectionCompleteLabel.SetLabelText("COMPLETED"); } SectionCompleteLabel.SetBorderWidth(0.0f); SectionCompleteLabel.SetFontName("Verdana-Bold"); SectionCompleteLabel.SetTextColour("Bright Yellow"); SectionCompleteLabel.SetFontSize(14f); SectionCompleteLabel.SetCellColour("DarkSlateGrey"); SectionCompleteLabel.SetTag(iSectionCompleteLabelTagId * (iii+1)); SectionCompleteLabel.SetHidden(bHideComplete); SectionCompleteLabelVw = SectionCompleteLabel.GetLabelCell(); arrItems4[1] = SectionCompleteLabelVw; iUtils.CreateFormGridItem btnSaveEquipment = new iUtils.CreateFormGridItem(); UIView btnSaveEquipmentVw = new UIView(); btnSaveEquipment.SetDimensions(450f,0f, 350f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnSaveEquipment.SetLabelText("Open Power Conversion Equipment Screen"); btnSaveEquipment.SetBorderWidth(0.0f); btnSaveEquipment.SetFontName("Verdana"); btnSaveEquipment.SetFontSize(12f); btnSaveEquipment.SetTag(iSaveSectionBtnTagId * (iii+1)); btnSaveEquipment.SetCellColour("DarkSlateGrey"); btnSaveEquipmentVw = btnSaveEquipment.GetButtonCell(); UIButton btnSaveEquipmentButton = new UIButton(); btnSaveEquipmentButton = btnSaveEquipment.GetButton(); btnSaveEquipmentButton.TouchUpInside += (sender,e) => {OpenPowerConversion(sender, e);}; arrItems4[2] = btnSaveEquipmentVw; UILabel hfSectionEquipmentHeight = new UILabel(); hfSectionEquipmentHeight.Tag = iSectionHeightTagId * (iii+1); hfSectionEquipmentHeight.Hidden = true; hfSectionEquipmentHeight.Text = "0"; arrItems4[3] = hfSectionEquipmentHeight; UILabel hfSectionEquipmentRows = new UILabel(); hfSectionEquipmentRows.Tag = iSectionRowsTagId * (iii+1); hfSectionEquipmentRows.Hidden = true; hfSectionEquipmentRows.Text = iPwrIdRows.ToString(); arrItems4[4] = hfSectionEquipmentRows; UILabel hfSectionEquipmentStatus = new UILabel(); hfSectionEquipmentStatus.Tag = iSectionStatusTagId * (iii+1); hfSectionEquipmentStatus.Hidden = true; hfSectionEquipmentStatus.Text = "0"; arrItems4[5] = hfSectionEquipmentStatus; SectionEquipmentRow.AddSubviews(arrItems4); iVert += iSectionHdrRowHeight; //Now add a new view to this view to hold another view containing all the pwrid info for this section 10 UIView PwrIdTableRow = new UIView(); PwrIdTableRow.Frame = new RectangleF(0f,iVert,1000f,0f); iSectionId = iContainerSectionTagId * (iii+1); PwrIdTableRow.Tag = iSectionId; layout.AddSubview(PwrIdTableRow); } //******************************************************************************************// // SECTION RFU // //******************************************************************************************// //Get all the PwrId's for this project from ITPRFU DataSet arrITPRFUs = ITPSection.GetLocalITPRFUPwrIds(sId); if (arrITPRFUs.Tables.Count > 0) { float iRFURowVert = 0.0f; float iSectionRFUHeight = 0.0f; float iRFURowVertTop = iVert; float iRFURowInnerTop = 0.0f; int ii = m_iSections; m_iSections++; //Add an extra one for the RFU section m_iRFUSectionCounter = ii; //Here ii and m_iSections are different by 1. If we add more sections after this it will be different later on int iPwrIdRowsRFU = arrITPRFUs.Tables[0].Rows.Count; //Add in the section title and buttons for each section header UIView SectionRFURow = new UIView(); float iSection10RowVertTop = iVert; SectionRFURow.Frame = new RectangleF(0f,iSection10RowVertTop,1000f,iSectionHdrRowHeight); iSectionId = iSectionTagId * (ii+1); SectionRFURow.Tag = iSectionId; layout.AddSubview(SectionRFURow); UILabel hfSectionRFU = new UILabel(); hfSectionRFU.Text = "RFU"; hfSectionRFU.Tag = iSectionDBIdTagId * (ii+1); hfSectionRFU.Hidden = true; SectionRFURow.AddSubview(hfSectionRFU); iUtils.CreateFormGridItem SectionRFU = new iUtils.CreateFormGridItem(); UIView SectionRFUVw = new UIView(); SectionRFU.SetDimensions(0f,0f, 300f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); SectionRFU.SetLabelText("READY FOR USE (RFU)"); SectionRFU.SetBorderWidth(0.0f); SectionRFU.SetFontName("Verdana-Bold"); SectionRFU.SetTextColour("White"); SectionRFU.SetFontSize(12f); SectionRFU.SetCellColour("DarkSlateGrey"); SectionRFU.SetTag(iSectionDescTagId * (ii+1)); SectionRFUVw = SectionRFU.GetLabelCell(); arrItems14[0] = SectionRFUVw; if(RFUFullyCommitted()) { bFullyCommitted = false; } else { bFullyCommitted = true; } iUtils.CreateFormGridItem SectionCompleteLabel = new iUtils.CreateFormGridItem(); UIView SectionCompleteLabelVw = new UIView(); SectionCompleteLabel.SetDimensions(300f,0f, 250f, iSectionHdrRowHeight, 4f, 7.5f, 4f, 7.5f); SectionCompleteLabel.SetLabelText("COMMITTED"); SectionCompleteLabel.SetBorderWidth(0.0f); SectionCompleteLabel.SetFontName("Verdana-Bold"); SectionCompleteLabel.SetTextColour("Bright Yellow"); SectionCompleteLabel.SetFontSize(14f); SectionCompleteLabel.SetCellColour("DarkSlateGrey"); SectionCompleteLabel.SetTag(iSectionCompleteLabelTagId * (ii+1)); SectionCompleteLabel.SetHidden(bFullyCommitted); SectionCompleteLabelVw = SectionCompleteLabel.GetLabelCell(); arrItems14[1] = SectionCompleteLabelVw; iUtils.CreateFormGridItem btnSaveRFU = new iUtils.CreateFormGridItem(); UIView btnSaveRFUVw = new UIView(); btnSaveRFU.SetDimensions(550f,0f, 150f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnSaveRFU.SetLabelText("Save Section"); btnSaveRFU.SetBorderWidth(0.0f); btnSaveRFU.SetFontName("Verdana"); btnSaveRFU.SetFontSize(12f); btnSaveRFU.SetTag(iSaveSectionBtnTagId * (ii+1)); btnSaveRFU.SetCellColour("DarkSlateGrey"); btnSaveRFUVw = btnSaveRFU.GetButtonCell(); UIButton btnSaveRFUButton = new UIButton(); btnSaveRFUButton = btnSaveRFU.GetButton(); btnSaveRFUButton.TouchUpInside += (sender,e) => {SaveThisSection(sender, e);}; btnSaveRFUButton.Hidden = true; arrItems14[2] = btnSaveRFUVw; iUtils.CreateFormGridItem btnExpandRFU = new iUtils.CreateFormGridItem(); UIView btnExpandRFUVw = new UIView(); btnExpandRFU.SetDimensions(700f,0f, 50f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnExpandRFU.SetLabelText("+"); btnExpandRFU.SetBorderWidth(0.0f); btnExpandRFU.SetFontName("Verdana"); btnExpandRFU.SetFontSize(12f); btnExpandRFU.SetTag(iExpandSectionBtnTagId * (ii+1)); btnExpandRFU.SetCellColour("DarkSlateGrey"); btnExpandRFUVw = btnExpandRFU.GetButtonCell(); UIButton btnExpandRFUButton = new UIButton(); btnExpandRFUButton = btnExpandRFU.GetButton(); btnExpandRFUButton.Enabled = false; btnExpandRFUButton.TouchUpInside += (sender,e) => {ExpandSection(sender, e);}; arrItems14[3] = btnExpandRFUVw; iUtils.CreateFormGridItem btnContractRFU = new iUtils.CreateFormGridItem(); UIView btnContractRFUVw = new UIView(); btnContractRFU.SetDimensions(750f,0f, 50f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); btnContractRFU.SetLabelText("-"); btnContractRFU.SetBorderWidth(0.0f); btnContractRFU.SetFontName("Verdana"); btnContractRFU.SetFontSize(12f); btnContractRFU.SetTag(iContractSectionBtnTagId * (ii+1)); btnContractRFU.SetCellColour("DarkSlateGrey"); btnContractRFUVw = btnContractRFU.GetButtonCell(); UIButton btnContractRFUButton = new UIButton(); btnContractRFUButton = btnContractRFU.GetButton(); btnContractRFUButton.TouchUpInside += (sender,e) => {ContractSection(sender, e);}; arrItems14[4] = btnContractRFUVw; UILabel hfSectionHeight = new UILabel(); hfSectionHeight.Tag = iSectionHeightTagId * (ii+1); hfSectionHeight.Hidden = true; hfSectionHeight.Text = "0"; arrItems14[5] = hfSectionHeight; UILabel hfSectionRows = new UILabel(); hfSectionRows.Tag = iSectionRowsTagId * (ii+1); hfSectionRows.Hidden = true; hfSectionRows.Text = iPwrIdRowsRFU.ToString(); arrItems14[6] = hfSectionRows; UILabel hfSectionStatus = new UILabel(); hfSectionStatus.Tag = iSectionStatusTagId * (ii+1); hfSectionStatus.Hidden = true; hfSectionStatus.Text = "0"; arrItems14[7] = hfSectionStatus; SectionRFURow.AddSubviews(arrItems14); iVert += iSectionHdrRowHeight; iRFURowVertTop += iSectionHdrRowHeight; //Now add a new view to this view to hold another view containing all the pwrid info for this RFU section UIView RFUTableRow = new UIView(); RFUTableRow.Frame = new RectangleF(0f,iRFURowVertTop,1000f,iSectionHdrRowHeight); iSectionId = iContainerSectionTagId * (ii+1); RFUTableRow.Tag = iSectionId; layout.AddSubview(RFUTableRow); //Put in the header UIView vwPwrHdrInternalRowId = new UIView(); vwPwrHdrInternalRowId.Frame = new RectangleF(0f,iRFURowVert,1000f,iSectionHdrRowHeight); //This will be resized later on iUtils.CreateFormGridItem rowPwrIdHdrLbl = new iUtils.CreateFormGridItem(); UIView rowPwrIdHdrLblVw = new UIView(); rowPwrIdHdrLbl.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowPwrIdHdrLbl.SetDimensions(0f,iRFURowVert, 100f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowPwrIdHdrLbl.SetLabelText("Power Id"); rowPwrIdHdrLbl.SetTextAlignment("centre"); rowPwrIdHdrLbl.SetBorderWidth(0.0f); rowPwrIdHdrLbl.SetFontName("Verdana-Bold"); rowPwrIdHdrLbl.SetFontSize(14f); rowPwrIdHdrLbl.SetTag((iRFUPwrIdHdrLabelTagId) * (ii+1)); rowPwrIdHdrLbl.SetCellColour("Pale Yellow"); rowPwrIdHdrLblVw = rowPwrIdHdrLbl.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems7[0] = rowPwrIdHdrLblVw; iUtils.CreateFormGridItem rowDesignLoadHdrLbl = new iUtils.CreateFormGridItem(); UIView rowDesignLoadHdrLblVw = new UIView(); rowDesignLoadHdrLbl.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowDesignLoadHdrLbl.SetDimensions(100f,iRFURowVert, 100f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowDesignLoadHdrLbl.SetLabelText("Design Load"); rowDesignLoadHdrLbl.SetTextAlignment("centre"); rowDesignLoadHdrLbl.SetBorderWidth(0.0f); rowDesignLoadHdrLbl.SetFontName("Verdana-Bold"); rowDesignLoadHdrLbl.SetFontSize(14f); rowDesignLoadHdrLbl.SetTag((iRFUDesignLoadHdrLabelTagId) * (ii+1)); rowDesignLoadHdrLbl.SetCellColour("Pale Yellow"); rowDesignLoadHdrLblVw = rowDesignLoadHdrLbl.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems7[1] = rowDesignLoadHdrLblVw; iUtils.CreateFormGridItem rowCutoverLoadHdrLbl = new iUtils.CreateFormGridItem(); UIView rowCutoverLoadHdrLblVw = new UIView(); rowCutoverLoadHdrLbl.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowCutoverLoadHdrLbl.SetDimensions(200f,iRFURowVert, 100f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowCutoverLoadHdrLbl.SetLabelText("Cutover Load"); rowCutoverLoadHdrLbl.SetTextAlignment("centre"); rowCutoverLoadHdrLbl.SetBorderWidth(0.0f); rowCutoverLoadHdrLbl.SetFontName("Verdana-Bold"); rowCutoverLoadHdrLbl.SetFontSize(14f); rowCutoverLoadHdrLbl.SetTag((iRFUCutoverLoadHdrLabelTagId) * (ii+1)); rowCutoverLoadHdrLbl.SetCellColour("Pale Yellow"); rowCutoverLoadHdrLblVw = rowCutoverLoadHdrLbl.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems7[2] = rowCutoverLoadHdrLblVw; iUtils.CreateFormGridItem rowCutoverDateHdrLbl = new iUtils.CreateFormGridItem(); UIView rowCutoverDateHdrLblVw = new UIView(); rowCutoverDateHdrLbl.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowCutoverDateHdrLbl.SetDimensions(300f,iRFURowVert, 100f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowCutoverDateHdrLbl.SetLabelText("Cutover Date"); rowCutoverDateHdrLbl.SetTextAlignment("centre"); rowCutoverDateHdrLbl.SetBorderWidth(0.0f); rowCutoverDateHdrLbl.SetFontName("Verdana-Bold"); rowCutoverDateHdrLbl.SetFontSize(14f); rowCutoverDateHdrLbl.SetTag((iRFUCutoverDateHdrLabelTagId) * (ii+1)); rowCutoverDateHdrLbl.SetCellColour("Pale Yellow"); rowCutoverDateHdrLblVw = rowCutoverDateHdrLbl.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems7[3] = rowCutoverDateHdrLblVw; iUtils.CreateFormGridItem rowDecommissionedHdrLbl = new iUtils.CreateFormGridItem(); UIView rowDecommissionedHdrLblVw = new UIView(); rowDecommissionedHdrLbl.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowDecommissionedHdrLbl.SetDimensions(400f,iRFURowVert, 150f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowDecommissionedHdrLbl.SetLabelText("Decommissioned"); rowDecommissionedHdrLbl.SetTextAlignment("centre"); rowDecommissionedHdrLbl.SetBorderWidth(0.0f); rowDecommissionedHdrLbl.SetFontName("Verdana-Bold"); rowDecommissionedHdrLbl.SetFontSize(14f); rowDecommissionedHdrLbl.SetTag((iRFUDecommissionedHdrLabelTagId) * (ii+1)); rowDecommissionedHdrLbl.SetCellColour("Pale Yellow"); rowDecommissionedHdrLblVw = rowDecommissionedHdrLbl.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems7[4] = rowDecommissionedHdrLblVw; iUtils.CreateFormGridItem rowCommissionedHdrLbl = new iUtils.CreateFormGridItem(); UIView rowCommissionedHdrLblVw = new UIView(); rowCommissionedHdrLbl.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowCommissionedHdrLbl.SetDimensions(550f,iRFURowVert, 150f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowCommissionedHdrLbl.SetLabelText("Commissioned"); rowCommissionedHdrLbl.SetTextAlignment("centre"); rowCommissionedHdrLbl.SetBorderWidth(0.0f); rowCommissionedHdrLbl.SetFontName("Verdana-Bold"); rowCommissionedHdrLbl.SetFontSize(14f); rowCommissionedHdrLbl.SetTag((iRFUCommissionedHdrLabelTagId) * (ii+1)); rowCommissionedHdrLbl.SetCellColour("Pale Yellow"); rowCommissionedHdrLblVw = rowCommissionedHdrLbl.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems7[5] = rowCommissionedHdrLblVw; iUtils.CreateFormGridItem rowSaveRFUHdrLbl = new iUtils.CreateFormGridItem(); UIView rowSaveRFUHdrLblVw = new UIView(); rowSaveRFUHdrLbl.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowSaveRFUHdrLbl.SetDimensions(700f,iRFURowVert, 130f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowSaveRFUHdrLbl.SetLabelText("Commit RFU"); rowSaveRFUHdrLbl.SetTextAlignment("centre"); rowSaveRFUHdrLbl.SetBorderWidth(0.0f); rowSaveRFUHdrLbl.SetFontName("Verdana-Bold"); rowSaveRFUHdrLbl.SetFontSize(14f); rowSaveRFUHdrLbl.SetTag((iRFUSaveRFUHdrLabelTagId) * (ii+1)); rowSaveRFUHdrLbl.SetCellColour("Pale Yellow"); rowSaveRFUHdrLblVw = rowSaveRFUHdrLbl.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems7[6] = rowSaveRFUHdrLblVw; //Now add the row details into the view vwPwrHdrInternalRowId.AddSubviews(arrItems7); iSectionRFUHeight += iHeightToAdd; iRFURowVert += iHeightToAdd; iVert += iHeightToAdd; vwPwrHdrInternalRowId.Frame = new RectangleF(0f, iRFURowInnerTop, 1000f, iRFURowVert); RFUTableRow.AddSubview(vwPwrHdrInternalRowId); iRFURowInnerTop += iRFURowVert; iRFURowVert = 0f; for (var j = 0; j < iPwrIdRowsRFU; j++) { UIView vwPwrInternalRowId = new UIView(); vwPwrInternalRowId.Frame = new RectangleF(0f,iRFURowVert,1000f,200f); //This will be resized later on vwPwrInternalRowId.Tag = (iPwrIdSectionTagId + (j+1)) * (ii+1); iColNo = arrITPRFUs.Tables[0].Columns["PwrId"].Ordinal; string sPwrId = arrITPRFUs.Tables[0].Rows[j].ItemArray[iColNo].ToString(); iColNo = arrITPRFUs.Tables[0].Columns["CutoverLoad"].Ordinal; string sCutoverLoad = arrITPRFUs.Tables[0].Rows[j].ItemArray[iColNo].ToString(); iColNo = arrITPRFUs.Tables[0].Columns["CutoverDate"].Ordinal; string sCutoverDate = arrITPRFUs.Tables[0].Rows[j].ItemArray[iColNo].ToString(); iColNo = arrITPRFUs.Tables[0].Columns["Decommission"].Ordinal; int iDecommission = Convert.ToInt32(arrITPRFUs.Tables[0].Rows[j].ItemArray[iColNo]); iColNo = arrITPRFUs.Tables[0].Columns["Commission"].Ordinal; int iCommission = Convert.ToInt32(arrITPRFUs.Tables[0].Rows[j].ItemArray[iColNo]); bDisableRow = RFUPwrIdCommitted(sPwrId); UILabel hfRowRFUStatus = new UILabel(); hfRowRFUStatus.Text = "0"; hfRowRFUStatus.Tag = (ihfRowRFUStatusTagId + (j+1)) * (ii+1); hfRowRFUStatus.Hidden = true; arrItems6[0] = hfRowRFUStatus; //Put in the PwrId Label iUtils.CreateFormGridItem rowPwrIdLabel = new iUtils.CreateFormGridItem(); UIView rowPwrIdLabelVw = new UIView(); rowPwrIdLabel.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowPwrIdLabel.SetDimensions(0f,iRFURowVert, 100f, iSectionHdrRowHeight, 2f, 2.5f, 2f, 2.5f); rowPwrIdLabel.SetLabelText(sPwrId); rowPwrIdLabel.SetBorderWidth(0.0f); rowPwrIdLabel.SetFontName("Verdana"); rowPwrIdLabel.SetFontSize(14f); rowPwrIdLabel.SetTag((iRFUPwrIdRowLabelTagId + (j+1)) * (ii+1)); if (j % 2 == 0) { rowPwrIdLabel.SetCellColour("Pale Blue"); } else { rowPwrIdLabel.SetCellColour("Sky Blue"); } rowPwrIdLabelVw = rowPwrIdLabel.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems6[1] = rowPwrIdLabelVw; //Put in the PwrId Label iUtils.CreateFormGridItem rowDesignLoadLabel = new iUtils.CreateFormGridItem(); UIView rowDesignLoadLabelVw = new UIView(); iColNo = arrITPRFUs.Tables[0].Columns["DesignLoad"].Ordinal; string sDesignLoad = arrITPRFUs.Tables[0].Rows[j].ItemArray[iColNo].ToString(); rowDesignLoadLabel.SetLabelWrap(0); //This means the text will NOT be wrapped in the label rowDesignLoadLabel.SetDimensions(100f,iRFURowVert, 100f, iSectionHdrRowHeight, 20f, 2.5f, 20f, 2.5f); rowDesignLoadLabel.SetLabelText(sDesignLoad); rowDesignLoadLabel.SetTextAlignment("right"); rowDesignLoadLabel.SetBorderWidth(0.0f); rowDesignLoadLabel.SetFontName("Verdana"); rowDesignLoadLabel.SetFontSize(14f); rowDesignLoadLabel.SetTag((iRFUDesignLoadRowLabelTagId + (j+1)) * (ii+1)); if (j % 2 == 0) { rowDesignLoadLabel.SetCellColour("Pale Blue"); } else { rowDesignLoadLabel.SetCellColour("Sky Blue"); } rowDesignLoadLabelVw = rowDesignLoadLabel.GetLabelCell(); iHeightToAdd = iSectionHdrRowHeight; arrItems6[2] = rowDesignLoadLabelVw; iUtils.CreateFormGridItem txtCutoverLoad = new iUtils.CreateFormGridItem(); UIView txtCutoverLoadVw = new UIView(); txtCutoverLoad.SetDimensions(200f,iRFURowVert, 100f, iSectionHdrRowHeight, 15f, 2.5f, 15f, 2.5f); txtCutoverLoad.SetLabelText(sCutoverLoad); txtCutoverLoad.SetTextAlignment("right"); txtCutoverLoad.SetBorderWidth(0.0f); txtCutoverLoad.SetFontName("Verdana"); txtCutoverLoad.SetFontSize(14f); txtCutoverLoad.SetTag((iRFUCutoverLoadRowLabelTagId + (j+1)) * (ii+1)); if (j % 2 == 0) { txtCutoverLoad.SetCellColour("Pale Blue"); } else { txtCutoverLoad.SetCellColour("Sky Blue"); } txtCutoverLoadVw = txtCutoverLoad.GetTextFieldCell(); UITextField txtCutoverLoadView = txtCutoverLoad.GetTextFieldView(); txtCutoverLoadView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtCutoverLoadView.ReturnKeyType = UIReturnKeyType.Next; txtCutoverLoadView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 9);}; txtCutoverLoadView.ShouldEndEditing += (sender) => { return ValidateCutoverLoad(sender, 0);}; txtCutoverLoadView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 9);}; if(bDisableRow) { txtCutoverLoadView.Enabled = false; } arrItems6[3] = txtCutoverLoadVw; UILabel hfCurrentCutoverLoad = new UILabel(); hfCurrentCutoverLoad.Text = sCutoverLoad; hfCurrentCutoverLoad.Tag = (ihfCutoverLoadRowLabelTagId + (j + 1)) * (ii + 1); hfCurrentCutoverLoad.Hidden = true; arrItems6 [4] = hfCurrentCutoverLoad; iUtils.CreateFormGridItem txtCutoverDate = new iUtils.CreateFormGridItem(); UIView txtCutoverDateVw = new UIView(); txtCutoverDate.SetDimensions(300f,iRFURowVert, 100f, iSectionHdrRowHeight, 8f, 2.5f, 8f, 2.5f); if (sCutoverDate == "" || sCutoverDate == "0") { sCutoverDate = "01/01/1900"; } DateTime dtCutover = Convert.ToDateTime(sCutoverDate); string sCutoverDisplay = dt.Get_Date_String(dtCutover, "dd/mm/yy"); txtCutoverDate.SetLabelText(sCutoverDisplay); txtCutoverDate.SetTextAlignment("right"); txtCutoverDate.SetBorderWidth(0.0f); txtCutoverDate.SetFontName("Verdana"); txtCutoverDate.SetFontSize(14f); txtCutoverDate.SetTag((iRFUCutoverDateRowLabelTagId + (j+1)) * (ii+1)); if (j % 2 == 0) { txtCutoverDate.SetCellColour("Pale Blue"); } else { txtCutoverDate.SetCellColour("Sky Blue"); } txtCutoverDateVw = txtCutoverDate.GetTextFieldCell(); UITextField txtCutoverDateView = txtCutoverDate.GetTextFieldView(); txtCutoverDateView.KeyboardType = UIKeyboardType.NumbersAndPunctuation; txtCutoverDateView.ReturnKeyType = UIReturnKeyType.Next; txtCutoverDateView.ShouldBeginEditing += (sender) => { return SetGlobalEditItems(sender, 10);}; txtCutoverDateView.ShouldEndEditing += (sender) => { return ValidateCutoverDate(sender, 0);}; txtCutoverDateView.ShouldReturn += (sender) => { return MoveNextTextField(sender, 10);}; if(bDisableRow) { txtCutoverDateView.Enabled = false; } arrItems6[5] = txtCutoverDateVw; UILabel hfCurrentCutoverDate = new UILabel(); hfCurrentCutoverDate.Text = sCutoverDisplay; hfCurrentCutoverDate.Tag = (ihfCutoverDateRowLabelTagId + (j + 1)) * (ii + 1); hfCurrentCutoverDate.Hidden = true; arrItems6[6] = hfCurrentCutoverDate; iUtils.CreateFormGridItem chkDecommission = new iUtils.CreateFormGridItem(); UIView chkDecommissionVw = new UIView(); chkDecommission.SetDimensions(400f,iRFURowVert, 150f, iSectionHdrRowHeight, 30f, 2.5f, 30f, 2.5f); bool bDecommission = false; if (iDecommission > 0) { bDecommission = true; } chkDecommission.SetCheckboxOnOff(bDecommission); chkDecommission.SetBorderWidth(0.0f); chkDecommission.SetSwitchType(2); chkDecommission.SetTag((iRFUDecommissionRowCheckTagId + (j+1)) * (ii+1)); if (j % 2 == 0) { chkDecommission.SetCellColour("Pale Blue"); } else { chkDecommission.SetCellColour("Sky Blue"); } chkDecommissionVw = chkDecommission.GetCheckboxCell(); UISwitch chkDecommissionCheck = chkDecommission.GetCheckbox(); chkDecommissionCheck.ValueChanged += (sender,e) => {CheckboxChanged(sender, e, 1);}; if(bDisableRow) { chkDecommissionCheck.Enabled = false; } arrItems6[7] = chkDecommissionVw; iUtils.CreateFormGridItem chkCommission = new iUtils.CreateFormGridItem(); UIView chkCommissionVw = new UIView(); chkCommission.SetDimensions(550f,iRFURowVert, 150f, iSectionHdrRowHeight, 30f, 2.5f, 30f, 2.5f); bool bCommission = false; if (iCommission > 0) { bCommission = true; } chkCommission.SetCheckboxOnOff(bCommission); chkCommission.SetBorderWidth(0.0f); chkCommission.SetSwitchType(2); chkCommission.SetTag((iRFUCommissionRowCheckTagId + (j+1)) * (ii+1)); if (j % 2 == 0) { chkCommission.SetCellColour("Pale Blue"); } else { chkCommission.SetCellColour("Sky Blue"); } chkCommissionVw = chkCommission.GetCheckboxCell(); UISwitch chkCommissionCheck = chkCommission.GetCheckbox(); chkCommissionCheck.ValueChanged += (sender,e) => {CheckboxChanged(sender, e, 2);}; if(bDisableRow) { chkCommissionCheck.Enabled = false; } arrItems6[8] = chkCommissionVw; iUtils.CreateFormGridItem btnRFU = new iUtils.CreateFormGridItem(); UIView btnRFUVw = new UIView(); btnRFU.SetDimensions(700f,iRFURowVert, 130f, iSectionHdrRowHeight, 8f, 4f, 8f, 4f); if(bDisableRow) { btnRFU.SetLabelText("Committed"); } else { btnRFU.SetLabelText("Commit RFU"); } btnRFU.SetBorderWidth(0.0f); btnRFU.SetFontName("Verdana"); btnRFU.SetFontSize(14f); btnRFU.SetTag((iRFUButtonSaveTagId + (j+1)) * (ii+1)); if (j % 2 == 0) { btnRFU.SetCellColour("Pale Blue"); } else { btnRFU.SetCellColour("Sky Blue"); } btnRFUVw = btnRFU.GetButtonCell(); UIButton btnRFUButton = new UIButton(); btnRFUButton = btnRFU.GetButton(); btnRFUButton.TouchUpInside += (sender,e) => {CommitRFU(sender, e);}; if(bDisableRow) { btnRFUButton.Enabled = false; } arrItems6[9] = btnRFUVw; iColNo = arrITPRFUs.Tables[0].Columns["BatteryCapacity"].Ordinal; string sBatteryCapacity = arrITPRFUs.Tables[0].Rows[j].ItemArray[iColNo].ToString(); UILabel hfRFUBatteryCapacity = new UILabel(); hfRFUBatteryCapacity.Text = sBatteryCapacity; hfRFUBatteryCapacity.Tag = (ihfRowRFUBatteryCapacityTagId + (j+1)) * (ii+1); hfRFUBatteryCapacity.Hidden = true; arrItems6[10] = hfRFUBatteryCapacity; //Now add the row details into the view vwPwrInternalRowId.AddSubviews(arrItems6); iSectionRFUHeight += iHeightToAdd; iRFURowVert += iHeightToAdd; iVert += iHeightToAdd; vwPwrInternalRowId.Frame = new RectangleF(0f, iRFURowInnerTop, 1000f, iRFURowVert); RFUTableRow.AddSubview(vwPwrInternalRowId); iRFURowInnerTop += iRFURowVert; iRFURowVert = 0f; } //Now resize the UIView that is effectively the container for the RFU info for this section //And also store this height in a hidden field for use in the contract and expand functions RFUTableRow.Frame = new RectangleF(0f,iRFURowVertTop,1000f,iSectionRFUHeight); hfSectionHeight.Text = iSectionRFUHeight.ToString(); } iTotalHeight = iVert + 380f; SizeF layoutSize = new SizeF(1000f, iTotalHeight); layout.ContentSize = layoutSize; UILabel hfScrollContentHeight = new UILabel(); hfScrollContentHeight.Text = iTotalHeight.ToString(); hfScrollContentHeight.Tag = 3; hfScrollContentHeight.Hidden = true; layout.AddSubview(hfScrollContentHeight); View.AddSubview(layout); //Now determine what is to be contrated by default for(int iiii=0;iiii< m_iQuestionSections; iiii++) { if(bHideSections[iiii]) { UIButton btnContract = (UIButton)View.ViewWithTag (iContractSectionBtnTagId * (iiii+1)); ContractSection(btnContract, null); //Also display the completed item UILabel lblComplete = (UILabel)View.ViewWithTag(iSectionCompleteLabelTagId * (iiii+1)); lblComplete.Hidden = false; } } } catch (Exception except) { string sTest = except.Message.ToString(); iUtils.AlertBox alert = new iUtils.AlertBox(); alert.CreateErrorAlertDialog(sTest); } }
public void DeleteBatteryString(object sender, EventArgs e) { string sRtnMsg = ""; clsTabletDB.ITPDocumentSection DBQ = new clsTabletDB.ITPDocumentSection(); UIButton btnDelete = (UIButton)sender; int iTagId = btnDelete.Tag; int iPwrIdRow = iTagId / iDeleteBatteryStringBtnTagId; int iStringRow = iTagId - (iPwrIdRow * iDeleteBatteryStringBtnTagId); UILabel hfRowStatus = (UILabel)View.ViewWithTag(iStringRowStatusTagId * (iPwrIdRow) + (iStringRow)); int iRowStatus = Convert.ToInt32(hfRowStatus.Text); UILabel hfAutoId = (UILabel)View.ViewWithTag(iStringRowAutoIdTagId * (iPwrIdRow) + (iStringRow)); int iAutoId = Convert.ToInt32(hfAutoId.Text); UILabel hfMaximoAssetId = (UILabel)View.ViewWithTag(iStringRowMaximoAssetIdTagId * (iPwrIdRow) + (iStringRow)); string sMaximoId = hfMaximoAssetId.Text; if (sMaximoId == "" || sMaximoId == "0") { sMaximoId = "-1"; } int iMaximoAssetId = Convert.ToInt32(sMaximoId); UILabel hfPwrId = (UILabel)View.ViewWithTag(iStringRowPwrIdTagId * (iPwrIdRow) + (iStringRow)); string sPwrId = hfPwrId.Text; UITextField txtBankNo = (UITextField)View.ViewWithTag(iBankNoTagId * (iPwrIdRow) + (iStringRow)); string sBankNo = txtBankNo.Text; if (sBankNo == "") { sBankNo = "0"; } int iBankNo = Convert.ToInt32(sBankNo); //You can only delete an item you have added and these have iMaximoAssetId = -1 if (iMaximoAssetId < 0) { //This means the current row is either not changed or has been updated, so it has to be removed from the DB if (iRowStatus == 0 || iRowStatus == 1) { //Don't actaully delete at this stage, just mark as deleted. Delete on the upload success. if(!DBQ.ITPProjectSectionDeleteSection10Item(m_sPassedId, iAutoId, false, ref sRtnMsg)) { iUtils.AlertBox alert = new iUtils.AlertBox(); alert.CreateErrorAlertDialog("Could not delete battery string record on project " + m_sPassedId + ", Power Id " + sPwrId + " and bank number " + iBankNo.ToString()); return; } } //Remove the line from the page (well hide it really so all the loops still work) UIView vwStringRow = (UIView)View.ViewWithTag(iStringFullRowTagId * (iPwrIdRow) + (iStringRow)); vwStringRow.Hidden = true; hfRowStatus.Text = "3"; //Means deleted, so no save required ReduceHeightAfter(m_iBatteryRowHeight, iPwrIdRow, iStringRow, 1); UIView vwPwrInternalRowId = (UIView)View.ViewWithTag((iPwrIdSectionInnerTagId + (iPwrIdRow)) * (m_iBatterySectionCounter+1)); RectangleF frame1 = vwPwrInternalRowId.Frame; frame1.Height -= m_iBatteryRowHeight; vwPwrInternalRowId.Frame = frame1; //Now increase the view height for this new row (The whole section height is handled in the ReduceHeightAfter function) UILabel hfPwrIdSectionHeight = (UILabel)View.ViewWithTag((iPwrIdHeightTagId + iPwrIdRow ) * (m_iBatterySectionCounter + 1)); int iPwrIdHeight = Convert.ToInt32(hfPwrIdSectionHeight.Text); hfPwrIdSectionHeight.Text = (iPwrIdHeight - m_iBatteryRowHeight).ToString(); //Set the unsaved tags on (do this even though the record is removed for consistency) SetSectionValueChanged(m_iBatterySectionCounter + 1); SetAnyValueChanged(sender, null); } return; }
public void ShowCompletedLabels() { int i; int iQuestionSections = m_iQuestionSections; clsTabletDB.ITPDocumentSection DBQ = new clsTabletDB.ITPDocumentSection(); int iThisSectionDBTagId; bool bAnyCommitted = DBQ.ProjectSectionRFUAnyPwrIdCommitted(m_sPassedId); bool bAllCommittted = DBQ.ProjectSectionRFUFullyCommitted(m_sPassedId); for(i=0;i<iQuestionSections;i++) { UILabel hfSectionDBId = (UILabel)View.ViewWithTag (iSectionDBIdTagId * (i+1)); iThisSectionDBTagId = Convert.ToInt32(hfSectionDBId.Text); UILabel lblSectionComplete = (UILabel)View.ViewWithTag (iSectionCompleteLabelTagId * (i+1)); if(bAnyCommitted) { lblSectionComplete.Text = "COMMITTED"; } else { lblSectionComplete.Text = "COMPLETED"; } if(DBQ.ProjectQuestionsSectionFullyAnswered(m_sPassedId, iThisSectionDBTagId)) { lblSectionComplete.Hidden = false; } else { lblSectionComplete.Hidden = true; } } UILabel lblCompletedBatt = (UILabel)View.ViewWithTag (iSectionCompleteLabelTagId * (m_iBatterySectionCounter + 1)); if(BatteryFullyComplete()) { if(bAllCommittted) { lblCompletedBatt.Text = "COMMITTED"; } else { if(BatteryFullyCommitted()) { lblCompletedBatt.Text = "COMMITTED"; } else { lblCompletedBatt.Text = "COMPLETED"; } } lblCompletedBatt.Hidden = false; } else { lblCompletedBatt.Hidden = true; } UILabel lblCompletedPwrConv = (UILabel)View.ViewWithTag (iSectionCompleteLabelTagId * (m_iEquipmentSectionCounter+1)); if(PowerConversionFullyComplete()) { if(bAllCommittted) { lblCompletedPwrConv.Text = "COMMITTED"; } else { if(PowerConversionFullyCommitted()) { lblCompletedPwrConv.Text = "COMMITTED"; } else { lblCompletedPwrConv.Text = "COMPLETED"; } } lblCompletedPwrConv.Hidden = false; } else { lblCompletedPwrConv.Hidden = true; } UILabel lblCompletedRFU = (UILabel)View.ViewWithTag (iSectionCompleteLabelTagId * (m_iRFUSectionCounter+1)); if(RFUFullyCommitted()) { lblCompletedRFU.Text = "COMMITTED"; lblCompletedRFU.Hidden = false; } }
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; }
public bool SaveRFURow(string sId, int iRow, bool bCheckSectionStatus, bool bSaveOnly) { clsTabletDB.ITPDocumentSection DB = new clsTabletDB.ITPDocumentSection(); string[] sItemValues = new string[9]; int i; UILabel hfRFURowStatus = (UILabel)View.ViewWithTag((ihfRowRFUStatusTagId + (iRow + 1)) * (m_iRFUSectionCounter + 1)); UILabel lblPwrId = (UILabel)View.ViewWithTag((iRFUPwrIdRowLabelTagId + (iRow + 1)) * (m_iRFUSectionCounter + 1)); string sPwrId = lblPwrId.Text; UILabel lblDesignLoad = (UILabel)View.ViewWithTag((iRFUDesignLoadRowLabelTagId + (iRow + 1)) * (m_iRFUSectionCounter + 1)); string sDesignLoad = lblDesignLoad.Text; UITextField txtCutoverLoad = (UITextField)View.ViewWithTag((iRFUCutoverLoadRowLabelTagId + (iRow + 1)) * (m_iRFUSectionCounter + 1)); string sCutoverLoad = txtCutoverLoad.Text; UITextField txtCutoverDate = (UITextField)View.ViewWithTag((iRFUCutoverDateRowLabelTagId + (iRow + 1)) * (m_iRFUSectionCounter + 1)); string sCutoverDate = txtCutoverDate.Text; UISwitch chkDecommission = (UISwitch)View.ViewWithTag((iRFUDecommissionRowCheckTagId + (iRow + 1)) * (m_iRFUSectionCounter + 1)); bool bDecommission = chkDecommission.On; int iDecommission; if (bDecommission) { iDecommission = 1; } else { iDecommission = 0; } UISwitch chkCommission = (UISwitch)View.ViewWithTag((iRFUCommissionRowCheckTagId + (iRow + 1)) * (m_iRFUSectionCounter + 1)); bool bCommission = chkCommission.On; int iCommission; if (bCommission) { iCommission = 1; } else { iCommission = 0; } string sCurrentDateAndTime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); UILabel hfBatteryCapacity = (UILabel)View.ViewWithTag((ihfRowRFUBatteryCapacityTagId + (iRow + 1)) * (m_iRFUSectionCounter + 1)); string sBatteryCapacity = hfBatteryCapacity.Text; //Get all the info for this RFU row sItemValues [0] = sId; sItemValues [1] = sPwrId; sItemValues [2] = sDesignLoad; sItemValues [3] = sCutoverLoad; sItemValues [4] = sCutoverDate; sItemValues [5] = iDecommission.ToString(); sItemValues [6] = iCommission.ToString(); sItemValues [7] = sCurrentDateAndTime; sItemValues [8] = sBatteryCapacity; if (sCutoverLoad == "" || sCutoverDate == "" || (iDecommission == 0 && iCommission == 0) || (iDecommission == 1 && iCommission == 1)) { iUtils.AlertBox alert = new iUtils.AlertBox(); alert.CreateAlertDialog(); alert.SetAlertMessage("The Power Id " + sPwrId + " RFU info is not complete. You cannot commit the RFU at this stage."); alert.ShowAlertBox(); return false; } //Update or insert into the local DB if (DB.ITPRFUSetRecord(sId, sPwrId, sItemValues)) { //Update the row status hfRFURowStatus.Text = "0"; if(!bSaveOnly) { UIButton btnRFU = (UIButton)View.ViewWithTag((iRFUButtonSaveTagId + (iRow+1)) * (m_iRFUSectionCounter+1)); btnRFU.SetTitle("Committed", UIControlState.Normal); } } else { return false; } //Now check to see if the section should be marked as complete and ultimately the whole page if (bCheckSectionStatus) { UILabel hfSectionPwrIds = (UILabel)View.ViewWithTag(iSectionRowsTagId * (m_iRFUSectionCounter + 1)); int iTotalPwrIds = Convert.ToInt32(hfSectionPwrIds.Text); bool bResetSectionFlag = true; for (i=0; i<iTotalPwrIds; i++) { UILabel hfRFURowStatus1 = (UILabel)View.ViewWithTag((ihfRowRFUStatusTagId + (i + 1)) * (m_iRFUSectionCounter + 1)); int iRowStatus1 = Convert.ToInt32(hfRFURowStatus1.Text); if(iRowStatus1 == 1) { bResetSectionFlag = false; break; } } if(bResetSectionFlag) { UILabel hfSectionStatus = (UILabel)View.ViewWithTag(iSectionStatusTagId * (m_iRFUSectionCounter + 1)); hfSectionStatus.Text = "0"; SetAnyValueChangedOff(false); return true; } } return true; }
public bool SavePowerConvSection(int iBtnId) { int i; int j; int iAutoId; string sId = m_sPassedId; clsTabletDB.ITPDocumentSection DB = new clsTabletDB.ITPDocumentSection(); string[] sItemValues = new string[24]; string sString = ""; string sSubRack = ""; string sPosition = ""; bool bTransferIdBad = false; //Get the number of PwrId's UILabel hfSectionPwrIds = (UILabel)View.ViewWithTag(iSectionRowsTagId * (m_iEquipmentSectionCounter + 1)); int iTotalPwrIds = Convert.ToInt32(hfSectionPwrIds.Text); bool bResetSectionFlag = true; for (i=0; i<iTotalPwrIds; i++) { //For each battery string block in this PwrId save it if necessary UILabel hfThisPwrIdStringRows = (UILabel)View.ViewWithTag((ihfPwrIdStringRowsTagId + (i + 1)) * (m_iEquipmentSectionCounter + 1)); int iTotalStrings = Convert.ToInt32(hfThisPwrIdStringRows.Text); for (j=0; j<iTotalStrings; j++) { UILabel hfRowStatus = (UILabel)View.ViewWithTag(iEquipmentRowStatusTagId * (i + 1) + (j + 1)); int iRowStatus = Convert.ToInt32(hfRowStatus.Text); if (iRowStatus == 1 || iRowStatus == 2 || iRowStatus == 3) { UILabel hfAutoId = (UILabel)View.ViewWithTag(iEquipmentRowAutoIdTagId * (i + 1) + (j + 1)); string sAutoId = hfAutoId.Text; if (sAutoId == "") { iAutoId = -1; } else { iAutoId = Convert.ToInt32(sAutoId); } //Get the type so that we only look at the right level of hierarchy UILabel hfEquipmentType = (UILabel)View.ViewWithTag(iEquipmentTypeTagId * (i + 1) + (j + 1)); int iEquipType = Convert.ToInt32(hfEquipmentType.Text); UILabel lblPwrId = (UILabel)View.ViewWithTag(iEquipmentRowPwrIdTagId * (i + 1) + (j + 1)); string sPwrId = lblPwrId.Text; UITextField txtFloor = (UITextField)View.ViewWithTag(iEquipmentFloorTagId * (i + 1) + (j + 1)); string sFloor = txtFloor.Text; UITextField txtSuite = (UITextField)View.ViewWithTag(iEquipmentSuiteTagId * (i + 1) + (j + 1)); string sSuite = txtSuite.Text; UITextField txtRack = (UITextField)View.ViewWithTag(iEquipmentRackTagId * (i + 1) + (j + 1)); string sRack = txtRack.Text; if(iEquipType >= 4) { UITextField txtSubRack = (UITextField)View.ViewWithTag(iEquipmentSubRackTagId * (i + 1) + (j + 1)); sSubRack = txtSubRack.Text; } if(iEquipType >= 5) { UITextField txtPosition = (UITextField)View.ViewWithTag(iEquipmentPositionTagId * (i + 1) + (j + 1)); sPosition = txtPosition.Text; } if(iEquipType >= 6) { UITextField txtString = (UITextField)View.ViewWithTag(iEquipmentStringTagId * (i + 1) + (j + 1)); sString = txtString.Text; } UILabel lblMake = (UILabel)View.ViewWithTag(iEquipmentMakeTagId * (i + 1) + (j + 1)); string sMake = lblMake.Text; UILabel lblModel = (UILabel)View.ViewWithTag(iEquipmentModelTagId * (i + 1) + (j + 1)); string sModel = lblModel.Text; UILabel lblSPN = (UILabel)View.ViewWithTag(iEquipmentSPNHiddenTagId * (i + 1) + (j + 1)); string sSPN = lblSPN.Text; UITextField txtSerialNo = (UITextField)View.ViewWithTag(iEquipmentSerialNoTagId * (i + 1) + (j + 1)); string sSerialNo = txtSerialNo.Text; UITextField txtDOM = (UITextField)View.ViewWithTag(iEquipmentDOMTagId * (i + 1) + (j + 1)); string sDOM = txtDOM.Text; if (txtDOM.Text == "" || txtDOM.Text == "0") { sDOM = "01/01/1900"; } string sFuseOrCB = ""; string sRating = "0"; string sLinkTest = "0"; string s20MinTest = "0"; UISegmentedControl radGrp = (UISegmentedControl)View.ViewWithTag(iEquipmentEquipTypeTagId * (i + 1) + (j + 1)); int iAnswerIndex = radGrp.SelectedSegment; string sAnswer = ""; string sEquipType = ""; UILabel hfMaximoAssetId = (UILabel)View.ViewWithTag(iEquipmentMaximoAssetHiddenTagId * (i + 1) + (j + 1)); string sMaximoAssetId = hfMaximoAssetId.Text; string sTransferAssetId = ""; string sPSAAssetId = ""; UILabel hfDuplicate = (UILabel)View.ViewWithTag(iDuplicateTagId * (i + 1) + (j + 1)); string sDuplicate = hfDuplicate.Text; if (s20MinTest == "") { s20MinTest = "0"; } if (iAnswerIndex >= 0) { sAnswer = radGrp.TitleAt(iAnswerIndex); } else { sAnswer = ""; } bTransferIdBad = false; switch (sAnswer) { case "New": sEquipType = "N"; sTransferAssetId = ""; sPSAAssetId = sMaximoAssetId; if (sPSAAssetId == "-1") { sDuplicate = "-1"; } break; case "Used": sEquipType = "U"; sTransferAssetId = sMaximoAssetId; if(sTransferAssetId == "-1") { bTransferIdBad= true; } sPSAAssetId = ""; break; default: sEquipType = "N"; sTransferAssetId = ""; sPSAAssetId = sMaximoAssetId; if (sPSAAssetId == "-1") { sDuplicate = "-1"; } break; } string sCurrentDateAndTime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); //Get all the info for this string sItemValues [0] = sId; sItemValues [1] = sPwrId; sItemValues [2] = sString; //This comes first because it was set up for battery strings initially sItemValues [3] = sFloor; sItemValues [4] = sSuite; sItemValues [5] = sRack; sItemValues [6] = sSubRack; sItemValues [7] = sPosition; //There is no position for a battery string but of course there could be for a power conversion item sItemValues [8] = sMake; sItemValues [9] = sModel; sItemValues [10] = sSerialNo; sItemValues [11] = sDOM; sItemValues [12] = sFuseOrCB; sItemValues [13] = sRating; sItemValues [14] = sLinkTest; sItemValues [15] = s20MinTest; sItemValues [16] = sCurrentDateAndTime; sItemValues [17] = sTransferAssetId; sItemValues [18] = sPSAAssetId; sItemValues [19] = sEquipType; sItemValues [20] = sSPN; sItemValues [21] = sDuplicate; sItemValues [22] = iEquipType.ToString(); sItemValues [23] = iRowStatus.ToString(); if (sMake == "" || sModel == "" || sEquipType == "" || iEquipType == -1 || bTransferIdBad) { bResetSectionFlag = false; iUtils.AlertBox alert = new iUtils.AlertBox(); alert.CreateAlertDialog(); if(bTransferIdBad) { alert.SetAlertMessage("An item in PwrId " + sPwrId + " is not fully filled out. You must provide an Asset Id for used equipment typically " + "found from Structure Builder. If you do not know the asset id, please provide a number between 0 and 10 " + "(it will be padded with zeros to make a 10 character id) and the " + "relevant asset id will be determined at final RFU submission stage. " + "The system cannot save this item."); } else { alert.SetAlertMessage("An item in PwrId " + sPwrId + " is not fully filled out. The system cannot save this item."); } alert.ShowAlertBox(); } else { //Update or insert into the local DB if (DB.ITPSection10SetRecord(sId, ref iAutoId, sItemValues)) { //Update the row status and the autoid hfAutoId.Text = iAutoId.ToString(); hfRowStatus.Text = "0"; } } } } } //Reset the section flag if (bResetSectionFlag) { UILabel hfSectionStatus = (UILabel)View.ViewWithTag(iSectionStatusTagId * (m_iEquipmentSectionCounter + 1)); hfSectionStatus.Text = "0"; SetAnyValueChangedOff(); gbSuppressSecondCheck = false; return true; } else { gbSuppressSecondCheck = false; return false; } }
public bool BatteryPwrIdComplete(string sPwrId) { clsTabletDB.ITPDocumentSection DBQ = new clsTabletDB.ITPDocumentSection(); return DBQ.ProjectSection10BatteryPwrIdComplete(m_sPassedId, sPwrId); }
public override void ViewDidLoad() { string sRtnMsg = ""; base.ViewDidLoad (); UIBarButtonItem mybackbtn = new UIBarButtonItem("Back", UIBarButtonItemStyle.Plain, delegate (object sender, EventArgs e) {CheckUnsaved();}); NavigationItem.SetHidesBackButton(true, true); NavigationItem.SetLeftBarButtonItem(mybackbtn, true); // Perform any additional setup after loading the view, typically from a nib. DrawMenu(); //Load up the data for each section should it not exist clsTabletDB.ITPDocumentSection ITPSection = new clsTabletDB.ITPDocumentSection(); if(!ITPSection.FillLocalITPSections(m_sPassedId, ref sRtnMsg)) { iUtils.AlertBox alert = new iUtils.AlertBox(); alert.CreateAlertDialog(); alert.SetAlertMessage(sRtnMsg); alert.ShowAlertBox(); } try { DrawOpeningPage(); } catch (Exception ex) { iUtils.AlertBox alert = new iUtils.AlertBox(); alert.CreateAlertDialog(); alert.SetAlertMessage(ex.Message.ToString()); alert.ShowAlertBox(); } }
public bool SaveBatterySection(int iBtnId) { int i; int j; int iAutoId; string sId = m_sPassedId; clsTabletDB.ITPDocumentSection DB = new clsTabletDB.ITPDocumentSection(); string[] sItemValues = new string[24]; //Get the number of PwrId's UILabel hfSectionPwrIds = (UILabel)View.ViewWithTag(iSectionRowsTagId * (m_iBatterySectionCounter + 1)); int iTotalPwrIds = Convert.ToInt32(hfSectionPwrIds.Text); bool bResetSectionFlag = true; for (i=0; i<iTotalPwrIds; i++) { //For each battery string block in this PwrId save it if necessary UILabel hfThisPwrIdStringRows = (UILabel)View.ViewWithTag((ihfPwrIdStringRowsTagId + (i + 1)) * (m_iBatterySectionCounter + 1)); int iTotalStrings = Convert.ToInt32(hfThisPwrIdStringRows.Text); for (j=0; j<iTotalStrings; j++) { UILabel hfRowStatus = (UILabel)View.ViewWithTag(iStringRowStatusTagId * (i + 1) + (j + 1)); int iRowStatus = Convert.ToInt32(hfRowStatus.Text); if (iRowStatus == 1 || iRowStatus == 2 || iRowStatus == 3) { UILabel hfAutoId = (UILabel)View.ViewWithTag(iStringRowAutoIdTagId * (i + 1) + (j + 1)); string sAutoId = hfAutoId.Text; if (sAutoId == "") { iAutoId = -1; } else { iAutoId = Convert.ToInt32(sAutoId); } UILabel lblPwrId = (UILabel)View.ViewWithTag(iStringRowPwrIdTagId * (i + 1) + (j + 1)); string sPwrId = lblPwrId.Text; UITextField txtBankNo = (UITextField)View.ViewWithTag(iBankNoTagId * (i + 1) + (j + 1)); string sBankNo = txtBankNo.Text; UITextField txtFloor = (UITextField)View.ViewWithTag(iFloorTagId * (i + 1) + (j + 1)); string sFloor = txtFloor.Text; UITextField txtSuite = (UITextField)View.ViewWithTag(iSuiteTagId * (i + 1) + (j + 1)); string sSuite = txtSuite.Text; UITextField txtRack = (UITextField)View.ViewWithTag(iRackTagId * (i + 1) + (j + 1)); string sRack = txtRack.Text; UITextField txtSubRack = (UITextField)View.ViewWithTag(iSubRackTagId * (i + 1) + (j + 1)); string sSubRack = txtSubRack.Text; UILabel lblMake = (UILabel)View.ViewWithTag(iBankMakeTagId * (i + 1) + (j + 1)); string sMake = lblMake.Text; UILabel lblModel = (UILabel)View.ViewWithTag(iBankModelTagId * (i + 1) + (j + 1)); string sModel = lblModel.Text; UILabel lblSPN = (UILabel)View.ViewWithTag(iSPNHiddenTagId * (i + 1) + (j + 1)); string sSPN = lblSPN.Text; UITextField txtSerialNo = (UITextField)View.ViewWithTag(iSerialNoTagId * (i + 1) + (j + 1)); string sSerialNo = txtSerialNo.Text; UITextField txtDOM = (UITextField)View.ViewWithTag(iBankDOMTagId * (i + 1) + (j + 1)); string sDOM = txtDOM.Text; if (txtDOM.Text == "0") { sDOM = "01/01/1900"; } UILabel lblFuseOrCB = (UILabel)View.ViewWithTag(iBankFuseOrCBTagId * (i + 1) + (j + 1)); string sFuseOrCB = lblFuseOrCB.Text; UITextField txtRating = (UITextField)View.ViewWithTag(iBankRatingTagId * (i + 1) + (j + 1)); string sRating = txtRating.Text; if (txtRating.Text == "") { sRating = "0"; } UILabel hfLinkTestStatus = (UILabel)View.ViewWithTag(iLinkTestHiddenTagId * (i + 1) + (j + 1)); string sLinkTest = hfLinkTestStatus.Text; if (sLinkTest == "") { sLinkTest = "0"; } UILabel hf20MinTestStatus = (UILabel)View.ViewWithTag(i20MinTestHiddenTagId * (i + 1) + (j + 1)); string s20MinTest = hf20MinTestStatus.Text; if (s20MinTest == "") { s20MinTest = "0"; } UISegmentedControl radGrp = (UISegmentedControl)View.ViewWithTag(iEquipTypeTagId * (i + 1) + (j + 1)); int iAnswerIndex = radGrp.SelectedSegment; string sAnswer = ""; string sEquipType = ""; UILabel hfMaximoAssetId = (UILabel)View.ViewWithTag(iStringRowMaximoAssetIdTagId * (i + 1) + (j + 1)); string sMaximoAssetId = hfMaximoAssetId.Text; string sTransferAssetId = ""; string sPSAAssetId = ""; string sDuplicate = "0"; if (s20MinTest == "") { s20MinTest = "0"; } if (iAnswerIndex >= 0) { sAnswer = radGrp.TitleAt(iAnswerIndex); } else { sAnswer = ""; } switch (sAnswer) { case "New": sEquipType = "N"; sTransferAssetId = ""; sPSAAssetId = sMaximoAssetId; if (sPSAAssetId == "-1") { sDuplicate = "-1"; } break; case "Used": sEquipType = "U"; sTransferAssetId = sMaximoAssetId; sPSAAssetId = ""; break; default: sEquipType = "N"; sTransferAssetId = ""; sPSAAssetId = sMaximoAssetId; if (sPSAAssetId == "-1") { sDuplicate = "-1"; } break; } string sCurrentDateAndTime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); //Get all the info for this string sItemValues [0] = sId; sItemValues [1] = sPwrId; sItemValues [2] = sBankNo; sItemValues [3] = sFloor; sItemValues [4] = sSuite; sItemValues [5] = sRack; sItemValues [6] = sSubRack; sItemValues [7] = ""; //There is no position for a battery string sItemValues [8] = sMake; sItemValues [9] = sModel; sItemValues [10] = sSerialNo; sItemValues [11] = sDOM; sItemValues [12] = sFuseOrCB; sItemValues [13] = sRating; sItemValues [14] = sLinkTest; sItemValues [15] = s20MinTest; sItemValues [16] = sCurrentDateAndTime; sItemValues [17] = sTransferAssetId; sItemValues [18] = sPSAAssetId; sItemValues [19] = sEquipType; sItemValues [20] = sSPN; sItemValues [21] = sDuplicate; sItemValues [22] = "6"; //The equipemnt type is 6 for a battery string sItemValues [23] = iRowStatus.ToString(); if (sMake == "" || sModel == "" || sBankNo == "" || sEquipType == "") { bResetSectionFlag = false; iUtils.AlertBox alert = new iUtils.AlertBox(); alert.CreateAlertDialog(); alert.SetAlertMessage("An item in PwrId " + sPwrId + " is not fully filled out. The system cannot save this item."); alert.ShowAlertBox(); } else { //Update or insert into the local DB if (DB.ITPSection10SetRecord(sId, ref iAutoId, sItemValues)) { //Update the row status and the autoid hfAutoId.Text = iAutoId.ToString(); hfRowStatus.Text = "0"; } } } } } //Reset the section flag if (bResetSectionFlag) { UILabel hfSectionStatus = (UILabel)View.ViewWithTag(iSectionStatusTagId * (m_iBatterySectionCounter + 1)); hfSectionStatus.Text = "0"; SetAnyValueChangedOff(); gbSuppressSecondCheck = false; return true; } else { gbSuppressSecondCheck = false; return false; } }
public bool DownloadProjectITPInfo(string sId, string sDescription, string sUser, string sSessionId) { // var txtName = (UILabel)View.ViewWithTag (20); // string sUser = txtName.Text; // var hfSessionId = (UILabel)View.ViewWithTag (70); // string sSessionId = hfSessionId.Text; //First get all the static info if (DownloadStaticTables(sUser, sSessionId)) { clsITPFramework csITP = new clsITPFramework(); clsTabletDB.ITPHeaderTable clsTabDB = new clsTabletDB.ITPHeaderTable(); clsTabletDB.ITPDocumentSection clsITPSection = new clsTabletDB.ITPDocumentSection(); string sRtnMsg = ""; //****************************************************************************************// // DOCUMENT HEADER // //****************************************************************************************// object[] objListITPs = csITP.DownloadITPInfo(sSessionId, sUser, sId); if (objListITPs[0].ToString() == "Success") { //Get the header info from the website version. This has to exist before you can download. if (clsTabDB.TableHeaderDeleteAllRecords(sId, ref sRtnMsg)) { string sITPDocumentHeaderInfo = objListITPs[1].ToString(); string[] sHeaderInfo = sITPDocumentHeaderInfo.Split('~'); if (sHeaderInfo[0] == "ITPDocumentHeaderInfo") { string[] delimiters = new string[] { "||" }; string[] sHeaderItems = sHeaderInfo[1].Split(delimiters, StringSplitOptions.RemoveEmptyEntries); int iHeaderCount = sHeaderItems.Length; if (iHeaderCount > 0) { //First check if the header table exists and if not create it clsTabletDB.ITPHeaderTable ITPDB = new clsTabletDB.ITPHeaderTable(); if (ITPDB.CheckHeaderTable()) { this.InvokeOnMainThread(() => { progBarProjITPHeaderVw.SetProgressBarTitle("Downloading ITP header info for project " + sId); progBarProjITPHeaderVw.ShowProgressBar(iHeaderCount); }); for (int i = 0; i < iHeaderCount; i++) { string[] delimiters2 = new string[] { "^" }; string[] sHeaderSplitItems = sHeaderItems[i].Split(delimiters2, StringSplitOptions.None); Array.Resize<string>(ref sHeaderSplitItems, sHeaderSplitItems.Length + 1); sHeaderSplitItems[sHeaderSplitItems.Length - 1] = sDescription; ITPDB.TableHeaderAddRecord(sHeaderSplitItems); this.InvokeOnMainThread(() => { progBarProjITPHeaderVw.UpdateProgressBar(i + 1); }); } this.InvokeOnMainThread(() => { progBarProjITPHeaderVw.CloseProgressBar(); }); } } } //return true; } else { this.InvokeOnMainThread(() => { iUtils.AlertBox alert = new iUtils.AlertBox(); alert.SetAlertMessage(sRtnMsg); alert.ShowAlertBox(); }); return false; } //****************************************************************************************// // QUESTIONNAIRE MASTER // //****************************************************************************************// object[] objITPQuestions = csITP.DownloadProjectITPQuestions(sSessionId, sUser, sId); //Get any questions already raised on the website version into the local DB if (objITPQuestions[0].ToString() == "Success") { if (clsITPSection.ITPProjectSectionDeleteAllQuestions(sId, ref sRtnMsg)) { string sITPProjectQuesitonsInfo = objITPQuestions[1].ToString(); string[] sProjQuestionInfo = sITPProjectQuesitonsInfo.Split('~'); if (sProjQuestionInfo[0] == "ITPProjectQuestionnaireInfo") { string[] delimiters3 = new string[] { "||" }; string[] sProjectQuestions = sProjQuestionInfo[1].Split(delimiters3, StringSplitOptions.RemoveEmptyEntries); int iHeaderCount3 = sProjectQuestions.Length; if (iHeaderCount3 > 0) { //First check if the question master table exists and if not create it clsTabletDB.ITPDocumentSection ITPQuest = new clsTabletDB.ITPDocumentSection(); if (ITPQuest.CheckQuestionTableMst()) { this.InvokeOnMainThread(() => { progBarProjITPQuestionsVw.SetProgressBarTitle("Downloading ITP questions for project " + sId); progBarProjITPQuestionsVw.ShowProgressBar(iHeaderCount3); }); for (int i = 0; i < iHeaderCount3; i++) { string[] delimiters4 = new string[] { "^" }; string[] sProjectQuestionItems = sProjectQuestions[i].Split(delimiters4, StringSplitOptions.None); ITPQuest.ITPProjectQuestionAddRecord(sProjectQuestionItems); this.InvokeOnMainThread(() => { progBarProjITPQuestionsVw.UpdateProgressBar(i + 1); }); } this.InvokeOnMainThread(() => { progBarProjITPQuestionsVw.CloseProgressBar(); }); } } } } else { this.InvokeOnMainThread(() => { iUtils.AlertBox alert = new iUtils.AlertBox(); alert.SetAlertMessage(sRtnMsg); alert.ShowAlertBox(); }); return false; } } else { return false; } //Close the if block for success on project ITP questions //****************************************************************************************// // SECTION 10 // //****************************************************************************************// object[] objITPSection10Info = csITP.DownloadProjectITPSection10(sSessionId, sUser, sId); //Get any section 10 info already raised on the website version into the local DB if (objITPSection10Info[0].ToString() == "Success") { if (clsITPSection.ITPProjectSectionDeleteAllSection10Items(sId, ref sRtnMsg)) { string sITPProjectSection10Info = objITPSection10Info[1].ToString(); string[] sProjSection10Info = sITPProjectSection10Info.Split('~'); if (sProjSection10Info[0] == "ITPProjectSection10Info") { string[] delimiters5 = new string[] { "||" }; string[] sProjectSection10Items = sProjSection10Info[1].Split(delimiters5, StringSplitOptions.RemoveEmptyEntries); int iHeaderCount5 = sProjectSection10Items.Length; if (iHeaderCount5 > 0) { //First check if the section 10 table exists and if not create it clsTabletDB.ITPDocumentSection ITPSection10 = new clsTabletDB.ITPDocumentSection(); if (ITPSection10.CheckSection10Table()) { this.InvokeOnMainThread(() => { progBarProjITPSection10Vw.SetProgressBarTitle("Downloading ITP section 10 items for project " + sId); progBarProjITPSection10Vw.ShowProgressBar(iHeaderCount5); }); for (int i = 0; i < iHeaderCount5; i++) { string[] delimiters6 = new string[] { "^" }; string[] sProjectSection10ItemArray = sProjectSection10Items[i].Split(delimiters6, StringSplitOptions.None); ITPSection10.ITPSection10AddRecord(sProjectSection10ItemArray); this.InvokeOnMainThread(() => { progBarProjITPSection10Vw.UpdateProgressBar(i + 1); }); } this.InvokeOnMainThread(() => { progBarProjITPSection10Vw.CloseProgressBar(); }); } } } } else { this.InvokeOnMainThread(() => { iUtils.AlertBox alert = new iUtils.AlertBox(); alert.SetAlertMessage(sRtnMsg); alert.ShowAlertBox(); }); return false; } } else { return false; } //Close the if block for success on project ITP section 10 //****************************************************************************************// // RFU HEADER INFO // //****************************************************************************************// object[] objITPRFUInfo = csITP.DownloadProjectITPRFU(sSessionId, sUser, sId); //Get any RFU info already raised on the website version into the local DB if (objITPRFUInfo[0].ToString() == "Success") { if (clsITPSection.ITPProjectSectionDeleteAllRFUItems(sId, ref sRtnMsg)) { string sITPProjectRFUInfo = objITPRFUInfo[1].ToString(); string[] sProjRFUInfo = sITPProjectRFUInfo.Split('~'); if (sProjRFUInfo[0] == "ITPProjectRFUInfo") { string[] delimiters5 = new string[] { "||" }; string[] sProjectRFUItems = sProjRFUInfo[1].Split(delimiters5, StringSplitOptions.RemoveEmptyEntries); int iHeaderCount5 = sProjectRFUItems.Length; if (iHeaderCount5 > 0) { //First check if the RFU table exists and if not create it clsTabletDB.ITPDocumentSection ITPRFU = new clsTabletDB.ITPDocumentSection(); if (ITPRFU.CheckRFUTable()) { this.InvokeOnMainThread(() => { progBarProjITPRFUVw.SetProgressBarTitle("Downloading ITP RFU PwrId items for project " + sId); progBarProjITPRFUVw.ShowProgressBar(iHeaderCount5); }); for (int i = 0; i < iHeaderCount5; i++) { string[] delimiters6 = new string[] { "^" }; string[] sProjectRFUItemArray = sProjectRFUItems[i].Split(delimiters6, StringSplitOptions.None); ITPRFU.ITPRFUAddRecord(sProjectRFUItemArray); this.InvokeOnMainThread(() => { progBarProjITPRFUVw.UpdateProgressBar(i + 1); }); } this.InvokeOnMainThread(() => { progBarProjITPRFUVw.CloseProgressBar(); }); } } } return true; } else { this.InvokeOnMainThread(() => { iUtils.AlertBox alert = new iUtils.AlertBox(); alert.SetAlertMessage(sRtnMsg); alert.ShowAlertBox(); }); return false; } } else { return false; } //Close the if block for success on project ITP section 10 } else { return false; } //Close the if block for success on project ITP document header } else { return false; } //Close the if block for success on downlaod of static tables }
public bool QuestionsComplete() { clsTabletDB.ITPDocumentSection DBQ = new clsTabletDB.ITPDocumentSection(); return DBQ.ProjectQuestionsFullyAnswered(m_sPassedId); }