예제 #1
0
        public string ExportSearch([FromBody] string args)
        {
            ResetTimeout();
            try
            {
                string[] separatedArgs = args.Split(' ');

                if (separatedArgs.Length <= 0)
                {
                    throw (new Exception("Oopsie"));
                }

                var clientArray = new List <Client>();
                foreach (var ID in separatedArgs)
                {
                    var currentClient = DatabaseConnection.GetClientByIdFull(ID);
                    if (currentClient != null)
                    {
                        clientArray.Add(currentClient);
                    }
                }

                string fileName;
                ExportFile.CreateExcelFile(clientArray, out fileName);

                // Test guest parking template letter if placed in template folder in c:\users\public\documents\templates
                // Using opening and closing tokens < > and search fields defined in spec document such as <firstname> and <lastname>
                //List<string> templateNames = Merge.getTemplateNames();
                //string zipfile;
                //if (templateNames.Count>=1)
                //Merge.merge(clientArray, templateNames[0], out zipfile);
                //TODO: return value should describe whether or not the process worked to the client.
                //  The below line is meaningless until then.
                var json = JsonConvert.SerializeObject(fileName);
                return(json);
            }
            catch (Exception e)
            {
                throw e;
                //return "FAAAAAILLL";
            }
        }