示例#1
0
    // GET: S3Upload
    public ActionResult Index() {
      var fileStorageProvider = new AmazonS3FileStorageProvider();

      var fileUploadViewModel = new S3Upload (
        fileStorageProvider.PublicKey,
        fileStorageProvider.PrivateKey,
        fileStorageProvider.BucketName,
        Url.Action("complete", "home", null, Request.Url.Scheme)
      );

      fileUploadViewModel.SetPolicy (
        fileStorageProvider.GetPolicyString (
          fileUploadViewModel.FileId, 
          fileUploadViewModel.RedirectUrl
        )
      );


      ViewBag.FormAction = fileUploadViewModel.FormAction;
      ViewBag.FormMethod = fileUploadViewModel.FormMethod;
      ViewBag.FormEnclosureType = fileUploadViewModel.FormEnclosureType;
      ViewBag.AWSAccessKey = fileUploadViewModel.AWSAccessKey;
      ViewBag.Acl = fileUploadViewModel.Acl;
      ViewBag.Base64EncodedPolicy = fileUploadViewModel.Base64EncodedPolicy;
      ViewBag.Signature = fileUploadViewModel.Signature;

      var DroneDoc = new DroneDocument();
      return View(DroneDoc);

    }//ActionResult Index()
示例#2
0
 public String Upload(DroneDocument Doc) {
   //Doc.DocumentTitle = Doc.DocumentTitle.Trim();
   if(String.IsNullOrWhiteSpace(Doc.DocumentTitle)) {
     Doc.DocumentTitle = toTitle(Doc.S3Url);
   }
   if(String.IsNullOrEmpty(Doc.DocumentName)) {
     Doc.DocumentName = Doc.DocumentTitle;
   }
   String SQL = @"INSERT INTO [DroneDocuments] (
     [DroneID],
     [DocumentType],
     [DocumentName],
     [UploadedDate],
     [UploadedBy],
     [AccountID],
     [DocumentDate],
     [DocumentTitle],
     [DocumentDesc],
     [S3Url]
     ) VALUES (
     '" + Doc.DroneID.ToString() + @"',
     '" + Doc.DocumentType + @"',
     '" + Doc.DocumentName + @"',
     GETDATE(),
     '" + Util.getAccountID() + @"',
     '" + getDroneAccount(Doc.DroneID) + @"',
     '" + Util.toSQLDate(Doc.DocumentDate.ToString()) + @"',
     '" + Doc.DocumentTitle + @"',
     '" + Doc.DocumentDesc + @"',
     '" + Doc.S3Url + @"'
     )
   ";
   Doc.ID = Util.InsertSQL(SQL);
   return Url.Action("Document", "Drone", new { ID = Doc.ID });
 }
    public ActionResult GeoTag([Bind(Prefix = "ID")] int DroneID = 0) {
      //if (!exLogic.User.hasAccess("FLIGHT.GEOTAG")) return RedirectToAction("NoAccess", "Home");
      ExponentPortalEntities Db = new ExponentPortalEntities();
      ViewBag.DroneID = DroneID;
      List<DroneDocument> Docs = (from o in Db.DroneDocuments
                                  where o.DocumentType == "GEO Tag1" &&
                                  o.DroneID == DroneID
                                  select o).ToList();
      ViewBag.FirstRow = true;

      if (Docs.Count == 0) {
        DroneDocument DC = new DroneDocument();
        DC.DocsType = "Infrared";
        Docs.Add(DC);
      }
      return View(Docs);

    }//GeoTag