Example #1
0
        /// <summary>
        /// Adds a YieldProphet job to the APSIM cloud. Job is zipped.
        /// </summary>
        /// <param name="job">The job bytes.</param>
        /// <returns>The unique job name.</returns>
        public string AddAsZIP(byte[] job)
        {
            string newJobName = DateTime.Now.ToString("yyyy-MM-dd (HH-mm-ss)");

            string tempZipFile = Path.GetTempFileName() + ".zip";

            File.WriteAllBytes(tempZipFile, job);
            YieldProphet yieldProphet = YieldProphetUtility.YieldProphetFromFile(tempZipFile);
            string       xml          = YieldProphetUtility.YieldProphetToXML(yieldProphet);

            AddAsXML(newJobName, xml);
            return(newJobName);
        }
Example #2
0
        /// <summary>
        /// Adds the job to the APSIM cloud.
        /// </summary>
        /// <param name="yieldProphet">The job specification.</param>
        /// <returns>The unique job name.</returns>
        public string Add(YieldProphet yieldProphet)
        {
            DateTime nowDate = DateTime.Now;

            if (yieldProphet.Paddock.Count > 0 && yieldProphet.Paddock[0].NowDate != DateTime.MinValue)
            {
                nowDate = yieldProphet.Paddock[0].NowDate;
            }

            foreach (Paddock paddock in yieldProphet.Paddock)
            {
                paddock.NowDate = nowDate;
            }
            string newJobName = DateTime.Now.ToString("yyyy-MM-dd (HH-mm-ss) ") + yieldProphet.ReportName;

            string xml = YieldProphetUtility.YieldProphetToXML(yieldProphet);

            AddAsXML(newJobName, xml);
            return(newJobName);
        }