public ActionResult Index() { using (var db = new UploadDB()) { var items = db.Items.Where(x => x.UserId == HttpContext.User.Identity.Name); return(View(items.ToList())); } }
private void LoadDealers() { List <UploadDealerVehiclesList> listOfDealers = new List <UploadDealerVehiclesList> (); using (Connection sqlConn = new Connection(SQLiteBoostDB.GetDBPath())) listOfDealers = new UploadDB(sqlConn).GetDealersToUpload(UploadID); tvDealers.Delegate = new TableViewDelegate(this, listOfDealers); tvDealers.DataSource = new TableViewDataSource(this, listOfDealers); tvDealers.ReloadData(); }
public ActionResult Index(IEnumerable <HttpPostedFileBase> fileUpload) { var filePath = ""; var fileName = ""; var resultPath = ""; foreach (var file in fileUpload) { if (file == null) { continue; } var path = AppDomain.CurrentDomain.BaseDirectory + "UploadedFiles/"; fileName = Path.GetFileName(file.FileName); if (fileName == null) { continue; } filePath = (Path.Combine(path, Guid.NewGuid() + "_" + fileName)); resultPath = filePath.Substring(0, filePath.Length - 3) + "xml"; file.SaveAs(filePath); } var parse = new Parse(); var data = new UploadData() { ResultText = parse.ParseFile(filePath) }; using (var db = new UploadDB()) { var item = new Item { FileName = fileName, UploadDate = DateTime.Now, UserId = HttpContext.User.Identity.Name, ResultPath = resultPath, UploadPath = filePath }; db.Items.Add(item); db.SaveChanges(); } return(RedirectToAction("Index", "Result", data)); }
void UploadClick() { int selectedDealershipID = (int)NSUserDefaults.StandardUserDefaults.IntForKey("SelectedDealershipID"); if (assetsRequireDownload) { showAssetsDialog(); } else if (selectedDealershipID <= 0) { Controls.OkDialog("No Dealer Selected", "You must select a dealer before you can upload vehicles.", null); } else { int uploadID = 0; using (Connection sqlConn = new Connection(SQLiteBoostDB.GetDBPath())) uploadID = new UploadDB(sqlConn).CreateUpload(); NavigationController.PushViewController(new UploadList(uploadID, selectedDealershipID), true); } }
public ActionResult UpladText(string fileUpload) { var filePath = ""; var fileName = ""; var resultPath = ""; var path = AppDomain.CurrentDomain.BaseDirectory + "UploadedFiles/"; filePath = (Path.Combine(path, Guid.NewGuid() + "_" + fileName + ".txt")); resultPath = filePath.Substring(0, filePath.Length - 3) + "xml"; using (var sr = new StreamWriter(filePath)) { sr.Write(fileUpload); } var parse = new Parse(); var data = new UploadData() { ResultText = parse.ParseFile(filePath) }; using (var db = new UploadDB()) { var item = new Item { FileName = fileName, UploadDate = DateTime.Now, UserId = HttpContext.User.Identity.Name, ResultPath = resultPath, UploadPath = filePath }; db.Items.Add(item); db.SaveChanges(); } return(RedirectToAction("Index", "Result", data)); }