Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="batchRunUserId"></param>
        /// <param name="selectedProtocols"></param>
        /// <param name="selectedProtocolIDs"></param>
        /// <param name="sampleIDs"></param>
        /// <param name="sampleVolumes"></param>
        /// <param name="protocolReagentLotIds"></param>
        /// <param name="isSharing"></param>
        /// <param name="sharedSectorsTranslation"></param>
        /// <param name="sharedSectorsProtocolIndex"></param>
        /// <returns></returns>
        public TimeSpan StartRun(string batchRunUserId, IProtocol[] selectedProtocols,
                                 int[] selectedProtocolIDs, int[] sampleIDs, double[] sampleVolumes,
                                 ReagentLotIdentifiers[][] protocolReagentLotIds,
                                 bool isSharing, int[] sharedSectorsTranslation, int[] sharedSectorsProtocolIndex)
        {
            for (int numIDs = 0; numIDs < sampleIDs.Length; numIDs++)
            {
                string ReportIDs = string.Format("**************** Sample IDs          : {0}", sampleIDs[numIDs]);
                System.Diagnostics.Debug.WriteLine(ReportIDs);
            }

            TimeSpan estimatedTimeToCompletion = TimeSpan.Zero;

            try
            {
                if (IsConnectionEnabled)
                {
                    // Prepare samples info
                    XmlRpcSample[] samples = PrepareSampleInformation(selectedProtocols,
                                                                      selectedProtocolIDs, sampleIDs, sampleVolumes, protocolReagentLotIds);

                    // Start the run/calculate updated ETC
                    LogFile.AddMessage(TraceLevel.Verbose, "Requesting ETC update (StartRun)");
                    DateTime estimatedTimeOfCompletion = myXmlRpcProxy.StartRun(samples, batchRunUserId,
                                                                                isSharing, sharedSectorsTranslation, sharedSectorsProtocolIndex);

                    // Log the ETC
                    DateTimeFormatInfo currentDateTimeFormatInfo = DateTimeFormatInfo.CurrentInfo;
                    LogFile.AddMessage(TraceLevel.Verbose,
                                       string.Format("ETC update: {0}",
                                                     estimatedTimeOfCompletion.ToString(currentDateTimeFormatInfo.SortableDateTimePattern)));

                    // Calculate and report the time remaining (time to completion)
                    CalculateEstimatedTimeToCompletion(estimatedTimeOfCompletion,
                                                       ref estimatedTimeToCompletion);
                }
            }
            catch (Exception ex)
            {
                // Log the details of the exception
                LogException(ex, "StartRun");
            }
            return(estimatedTimeToCompletion);
        }