private void PopulateDataGridCompletedCO(ArrayList coDoc) { Console.WriteLine("PopulateDataGridCompletedCO called"); //CodataGridView. PrintedCOdataGrid.Rows.Clear(); PrintedCOdataGrid.Refresh(); if (coDoc.Count == 0) { return; } foreach (String doc in coDoc) { char[] sep = { ':' }; String[] arrcoDocNo = doc.Split(sep); //Search in the CodataGridView and invalidate the row //Removed below foreach (DataGridViewRow row in CodataGridView.Rows) { Console.WriteLine("Removing the row for " + arrcoDocNo); if (row.Cells[0].Value.ToString().Equals(arrcoDocNo[0])) { Console.WriteLine("Found yah!"); //int rowIndex = row.Index; CodataGridView.Rows.Remove(row); CodataGridView.Refresh(); break; } } int n = PrintedCOdataGrid.Rows.Add(); PrintedCOdataGrid.Rows[n].Cells[0].Value = arrcoDocNo[0]; PrintedCOdataGrid.Rows[n].Cells[1].Value = arrcoDocNo[1]; PrintedCOdataGrid.Rows[n].Cells[2].Value = arrcoDocNo[2]; PrintedCOdataGrid.Rows[n].Cells[3].Value = arrcoDocNo[3]; PrintedCOdataGrid.Rows[n].Cells[4].Value = arrcoDocNo[4]; } }
/** * <summary> * Does the call to web service API for listing all the CO's that are in Printing state and the print media is * one of the selected printMedias. * </summary> * <returns>The next CO to be printed or null if CO list is empty</returns> */ private async Task <String> GetCOListingAsync() { try { //Retrieves the lists of COs based on the print media selected. ArrayList coDocNosList = await restProxy.DoCOListAsync(this.printerConfiguration.PrintMediaSelected); //this.lstCOQueue.Items.Clear(); CodataGridView.Rows.Clear(); CodataGridView.Refresh(); //Make sure there is coDocNosList retrieved if (coDocNosList != null && coDocNosList.Count > 0) { //populate the data grid with the lists of COs retrieved and sets the "currCoPrinting" //check if the currCOPrinting is in the coDocNosList and remove it PopulateDataGridQueueCO(coDocNosList); Console.WriteLine("Current CO for printing is " + currCoPrinting); //If currCoPrinting has value? //if (!String.IsNullOrEmpty(currCoPrinting)) //{ //if coDocNosList size is zero or it contains texts similar to currCoPrinting? // if (coDocNosList.Contains(currCoPrinting)) // { //If isPrintInitiated is false and isPrintSuccess is true // if (!isPrintInitiated && isPrintSuccess) // { // printCompletedCo.Add(currCoPrinting); // PopulateDataGridCompletedCO(printCompletedCo); // } // } //} /* if (!(coDocNos.Contains(currCoPrinting)) || coDocNos.Count == 0) * { * if (currCoPrinting != null) * { * printCompletedCo.Add(currCoPrinting); * PopulateDataGridCompletedCO(printCompletedCo); * } * * }*/ return(currCoPrinting); } //else if(coDocNosList.Count == 0 && String.IsNullOrEmpty(currCoPrinting)) //{ // currCoPrinting = null; // Alert("Please select document(s) for currCoPrinting via SmarteCO Portal."); // } //else if(coDocNosList.Count == 0 && !String.IsNullOrEmpty(currCoPrinting)) //else //{ // currCoPrinting = null; // timer.Stop(); // Alert("Please collect printed documents from printer."); //} } catch (Exception ex) { LogException(ex); } return(null); }