예제 #1
0
        /// <summary>
        /// This method updates the excel for one person, based
        /// on the data saved on the person.
        /// </summary>
        /// <param name="person"></param>
        /// <returns></returns>
        public async Task <string> UpdateExcel(Person person)
        {
            await SetupLists();

            pyVar = new PythonVar(pplAmount.ToString(), days.Count.ToString());

            foreach (MetTimes mt in person.time)
            {
                CheckOneTime(person, mt.date, mt.time);
            }

            return(ApplyChanges());
        }
예제 #2
0
        /// <summary>
        /// This method calls the Python script which is edits the excel sheet
        /// based on different person, and when they met.
        /// </summary>
        /// <param name="path"></param>
        /// <param name="exePath"></param>
        /// <param name="py"></param>
        /// <returns></returns>
        public string Call(string path, string exePath, PythonVar py)
        {
            ProcessStartInfo start = new ProcessStartInfo();

            start.FileName               = exePath;
            start.Arguments              = string.Format("\"{0}\" \"{1}\" \"{2}\" \"{3}\" \"{4}\" \"{5}\"", path, Convert(py.date), Convert(py.value), Convert(py.person), py.amount_person, py.amount_day);
            start.UseShellExecute        = false;
            start.CreateNoWindow         = true;
            start.RedirectStandardOutput = true;
            start.RedirectStandardError  = true;
            using (Process process = Process.Start(start))
            {
                using (StreamReader reader = process.StandardOutput)
                {
                    string stderr = process.StandardError.ReadToEnd();
                    string result = reader.ReadToEnd();
                    return(stderr);
                }
            }
        }