Esempio n. 1
0
        public IActionResult MetaDataCSV(string file)
        {
            // Extract file name from whatever was posted by browser
            var fileName = file;

            CSVRead       cs    = new CSVRead();
            List <string> listA = cs.readCSV(file);

            ViewBag.Message = "View Meta-data Definition for Current File: " + fileName;

            ViewBag.List = listA;

            return(View());
        }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        pointList = CSVRead.Read(inputFile);
        List <string> columnList = new List <string>(pointList[1].Keys);

        xName = columnList[columnX];
        yName = columnList[columnY];
        zName = columnList[columnZ];
        ill   = columnList[column4];

        for (var i = 0; i < pointList.Count; i++)
        {
            float      x     = System.Convert.ToSingle(pointList[i][xName]) / 20;
            float      y     = System.Convert.ToSingle(pointList[i][yName]) / 50;
            float      z     = System.Convert.ToSingle(pointList[i][zName]) / 20;
            GameObject point = Instantiate(PointPrefab, new Vector3(x, y, z), Quaternion.identity);

            point.transform.parent = PointHolder.transform;
            point.transform.name   = "Weight: " + pointList[i][xName] + " Height: " +
                                     pointList[i][yName] + " Age: " + pointList[i][zName];
            Color colour;
            switch ((int)pointList[i][ill])
            {
            case 0:
                colour = new Color(0, 255, 0);
                break;

            case 1:
                colour = new Color(1, 0, 0);
                break;

            case 2:
                colour = new Color(255, 0, 0);
                break;

            case 3:
                colour = new Color(0, 0, 0);
                break;

            default:
                colour = new Color(255, 255, 255);
                break;
            }
            point.GetComponent <Renderer>().material.color = colour;
            point.AddComponent <CollisionScript>();
            point.GetComponent <CollisionScript>().FloatingText = FloatingText;
        }
    }
Esempio n. 3
0
        public ActionResult Create(Collection collection)
        {
            //Use Namespace called :  System.IO
            string FileName = Path.GetFileNameWithoutExtension(collection.TemplateFile.FileName);

            //To Get File Extension
            string FileExtension = Path.GetExtension(collection.TemplateFile.FileName);

            FileName = DateTime.Now.ToString("yyyyMMdd") + "-" + FileName.Trim() + FileExtension;

            // If file with same name exists delete it
            if (System.IO.File.Exists(FileName))
            {
                System.IO.File.Delete(FileName);
            }

            //Get Upload path from Web.Config file AppSettings.
            string UploadPath = ConfigurationManager.AppSettings["UserImagePath"].ToString();

            //Its Create complete path to store in server.
            collection.FilePath = UploadPath + FileName;

            //To copy and save file into server.
            collection.TemplateFile.SaveAs(collection.FilePath);

            collection.Authorised = 0;

            _context.Collection.Add(collection);
            _context.SaveChanges();

            CSVRead csv = new CSVRead();

            List <string> headers = csv.readCSV(collection.FilePath);

            TempData["message"] = "This Collection Has Been Created From Uploaded File: " + FileName + " If you do not click submit to save Collection Points before exiting this screen they will be lost";

            return(RedirectToAction("Collection", new RouteValueDictionary(
                                        new { controller = "Collection", action = "Collection", newCollectionList = JsonConvert.SerializeObject(headers.ToList()), id = collection.Id })));
        }
Esempio n. 4
0
        public ActionResult CreateXML(Submission submission)
        {
            _context.Submission.Add(submission);
            _context.SaveChanges();

            //Use Namespace called :  System.IO
            string FileName = Path.GetFileNameWithoutExtension(submission.TemplateFile.FileName);

            //To Get File Extension
            string FileExtension = Path.GetExtension(submission.TemplateFile.FileName);

            FileName = DateTime.Now.ToString("yyyyMMdd") + "-" + FileName.Trim() + FileExtension;

            // If file with same name exists delete it
            if (System.IO.File.Exists(FileName))
            {
                System.IO.File.Delete(FileName);
            }

            //Get Upload path from Web.Config file AppSettings.
            string UploadPath = ConfigurationManager.AppSettings["UserImagePath"].ToString();

            System.IO.Directory.CreateDirectory(UploadPath + "Submissions\\" + submission.Id + "\\Definition\\");

            //Its Create complete path to store in server.
            submission.FilePath = UploadPath + "Submissions\\" + submission.Id + "\\Definition\\" + FileName;

            Debug.WriteLine(submission.FilePath);

            //To copy and save file into server.
            submission.TemplateFile.SaveAs(submission.FilePath);

            submission.Authorised = 0;


            List <string> headers = new List <string>();

            if (submission.CollectionFileTypeId == 3)
            {
                CSVRead csv = new CSVRead();

                headers = csv.readCSV(submission.FilePath);

                foreach (var temp in headers)
                {
                    TempData["message"] = TempData["message"] + "||" + temp;
                }
            }
            else if (submission.CollectionFileTypeId == 4)
            {
                XMLRead xml = new XMLRead();

                headers = xml.readXML(submission.FilePath);
            }

            TempData["message"] = "This Submission Has Been Created From Uploaded File: " + FileName + " If you do not click submit to save Submission Points before exiting this screen they will be lost";

            _context.SaveChanges();

            return(RedirectToAction("Submission", new RouteValueDictionary(
                                        new { controller = "Submission", action = "Submission", newSubmissionList = JsonConvert.SerializeObject(headers.ToList()), id = submission.Id })));
        }