Exemplo n.º 1
0
 public void WhenICommitTheBatch(Table batchRows)
 {
     try
     {
         if (batchRows.RowCount != 1)
         {
             throw new ArgumentException("Only provide one row to select.");
         }
         BBCRMHomePage.OpenRevenueFA();    //Open revenue functional area
         RevenueFunctionalArea.BatchEntry();
         var batchRow = batchRows.Rows[0]; // select only the first row of the batch
         if (batchRow.ContainsKey("Description") && batchRow["Description"] != null &&
             batchRow["Description"] != string.Empty)
         {
             batchRow["Description"] += uniqueStamp;           //The unique stamp is a series of numbers to keep constituents different from each other
         }
         BatchEntryPanel.SelectUncommittedBatch(batchRow);     //select uncommitted batch according to the table parameter
         if (BatchEntryPanel.UncommittedBatchExists(batchRow)) // if the selected batch exists
         {
             System.Threading.Thread.Sleep(2000);              //pause because otherwise the code runs so rapidly that the next line is not invoked in time
             BatchEntryPanel.SelectSectionDatalistRow(batchRow, "Uncommitted batches");
             BatchEntryPanel.CommitSelectedBatch();            //commit the batch
         }
         else
         {
             throw new ArgumentException(String.Format("Uncommitted batch '{0}' does not exist", batchRow.Values));
         }
     }
     catch (Exception ex)
     {
         throw new Exception("Error: could not commit the batch. " + ex.Message);
     }
 }
Exemplo n.º 2
0
 public void ThenABatchExists(Table batches)
 {
     foreach (var batch in batches.Rows)
     {
         if (batch.Keys.Contains("Description") && batch["Description"] != null &&
             batch["Description"] != string.Empty)
         {
             batch["Description"] += uniqueStamp;
         }
         if (!BatchEntryPanel.UncommittedBatchExists(batch))
         {
             throw new ArgumentException(String.Format("Uncommitted batch '{0}' does not exist", batch.Values));
         }
     }
 }