private void OpenDirectoryProperties(DirectoryViewModel directory, FileExplorerViewModel context) { context.Window.Show <PropertiesViewModel>(null, window => { window.Title = Tx.T("FileExplorer:Properties.Title", "name", directory.Name); }, viewModel => viewModel.Initialize(directory), out _); }
public ActionResult Create(DirectoryViewModel directory) { var model = Directory.CreateModel(directory); _directoryRepository.CreateDirectory(model); return(ReturnToDetails(directory.ParentId)); }
public async Task <IActionResult> Post([FromBody] DirectoryViewModel model) { DirectoryInformation k = await _context.Directory .FirstOrDefaultAsync(l => l.Course == model.Course && l.NameLesson == model.NameLesson); if (k != null) { return(BadRequest("Папка з такою назвою, курсом і факультетом вже існує")); } DirectoryInformation directory = new DirectoryInformation() { Name = model.NameLesson, Course = model.Course, NameLesson = model.NameLesson, Faculty = model.Faculty }; var d = _context.Directory.Add(directory); await _context.SaveChangesAsync(); var pathDir = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", d.Entity.Id.ToString()); if (!Directory.Exists(pathDir)) { Directory.CreateDirectory(pathDir); } return(Ok(d.Entity)); }
private void Open_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.DefaultExt = ".txt"; dlg.Filter = "Text Files (*.txt)|*.txt"; Nullable<bool> result = dlg.ShowDialog(); string filename = ""; // Get the selected file name and display in a TextBox if (result == true) { // Open document filename = dlg.FileName.Replace("list.txt", null); try { Gryffi.SCurrentDirectory = filename; Gryffi.GryffiPatchlist = null; GryffiLib.Gryffi.DeserializePatchlist(); DataContext = new DirectoryViewModel(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
public MainWindow() { InitializeComponent(); // Always needs to happen first // Triggers the font family and size to update to what is defined in the xaml window style StyleProperty.OverrideMetadata(typeof(Window), new FrameworkPropertyMetadata { DefaultValue = FindResource(typeof(Window)) }); // Set up the favorites section ListBoxFavorites.ItemsSource = FavoritesViewModel.Default.FavoriteDirectories; // Set up the opening directory var newWindowPath = Settings.Default.NewWindowPath.ToNormalizedPath(); if (string.IsNullOrWhiteSpace(newWindowPath) || !Directory.Exists(newWindowPath)) { newWindowPath = FileUtil.GetUserProfilePath(); Settings.Default.NewWindowPath = newWindowPath; Settings.Default.Save(); } // Show the opening directory PushPane(DirectoryViewModel.Get(Settings.Default.NewWindowPath.ToNormalizedPath())); UpdateTitleAndStatus(); }
public void Update(DirectoryViewModel model) { var objToEdit = ent.tblDirectoryItems.Where(x => x.DirectoryItemId == model.DirectoryItemId).FirstOrDefault(); objToEdit.DirectoryItemName = model.DirectoryItemName; objToEdit.DirectoryCategoryId = model.DirectoryCategoryId; objToEdit.DirectorySubCategoryId = model.DirectorySubCategoryId; objToEdit.IssueDate = model.IssueDate; objToEdit.Status = model.Status; objToEdit.Specification = model.Specification; ent.Entry(objToEdit).State = System.Data.Entity.EntityState.Modified; ent.SaveChanges(); var editDetail = ent.tblDirectoryDetails.Where(x => x.DirectoryItemId == model.DirectoryItemId).FirstOrDefault(); editDetail.AddressState = model.AddressState; editDetail.AddressDistrict = model.AddressDistrict; editDetail.AddressPalika = model.AddressPalika; editDetail.AddressWard = model.AddressWard; editDetail.DirectoryPhone = model.DirectoryPhone; editDetail.PAN = model.PAN; editDetail.VAT = model.VAT; editDetail.DirectoryPhone = model.DirectoryPhone; editDetail.ContactPersonName = model.ContactPersonName; editDetail.ContactPersonPhone = model.ContactPersonPhone; editDetail.Details = model.Details; editDetail.Email = model.Email; editDetail.PhotoLogo = model.PhotoLogo; ent.Entry(editDetail).State = System.Data.Entity.EntityState.Modified; ent.SaveChanges(); }
public IHttpActionResult GetDirectorPath(int RefrenceId, string Decription) { DirectoryViewModel _cviewModel = new DirectoryViewModel(); try { _cviewModel = db.DirectoryTables.Where(d => d.RefrenceId == RefrenceId && d.Decription.ToLower() == Decription.ToLower()).Select(D => new DirectoryViewModel { DirectoryPath = D.DirectoryPath }).FirstOrDefault(); if (_cviewModel != null) { return(Ok(_cviewModel)); } else { return(NotFound()); } } catch (Exception ex) { return(NotFound()); throw ex; } }
private void GenerateGrammar() { DirectoryViewModel vm = this.DataContext as DirectoryViewModel; if (vm != null) { Choices employeeNames = new Choices(); foreach (SubDirectoryViewModel subDirectory in vm.SubDirectories) { foreach (DirectoryEntryModel employee in subDirectory.Entries) { employeeNames.Add(new SemanticResultValue(employee.FullName, employee.FullName)); employeeNames.Add(new SemanticResultValue(employee.FirstName, employee.FullName)); employeeNames.Add(new SemanticResultValue(employee.LastName, employee.FullName)); if (employee.Nickname != "") { employeeNames.Add(new SemanticResultValue(employee.Nickname, employee.FullName)); } } } GrammarBuilder gb = new GrammarBuilder(); gb.Append(employeeNames); directoryGrammar = new Grammar(gb); } }
public ActionResult DirectoryDetail(int id) { var model = new DirectoryViewModel(); model = _proCommon.GetDirectoryData(id); return(PartialView("VUC_Details", model)); }
public void Initialize(DirectoryViewModel directoryViewModel) { var properties = GeneralPropertyViewModel.CreatDirectoryProperties(directoryViewModel).ToList(); GeneralProperties = CreateGeneralProperties(properties); Entry = directoryViewModel; }
public ActionResult InsertDirectory(DirectoryViewModel model, HttpPostedFileBase PhotoLogo) { if (PhotoLogo != null) { try { var supportedType = new[] { "jpg", "jpeg", "png" }; var fileExtn = System.IO.Path.GetExtension(PhotoLogo.FileName).Substring(1); if (!supportedType.Contains(fileExtn)) { ViewBag.message = "invalid file extension"; } else { var fileName = Path.GetFileName(PhotoLogo.FileName); var path = Path.Combine(Server.MapPath("~/DirectoryLogo/"), fileName); PhotoLogo.SaveAs(path); model.PhotoLogo = fileName; } } catch (Exception) { throw; } } if (ModelState.IsValid) { _proCommon.Insert(model); TempData["SuccessMessage"] = "Saved Successfully"; return(RedirectToAction("DirectoryList")); } return(View(model)); }
public override void SpeechRecognized(SpeechRecognizedEventArgs e) { string command = e.Result.Semantics.Value.ToString(); DirectoryViewModel vm = this.DataContext as DirectoryViewModel; if (vm != null) { SubDirectoryViewModel allMatches = vm.SubDirectories.FirstOrDefault(sub => sub.Letter == "All Matches"); if (allMatches != null) { allMatches.Entries.Clear(); foreach (RecognizedPhrase match in e.Result.Alternates) { System.Diagnostics.Debug.WriteLine(match.Confidence + " " + match.Text); string matchText = match.Semantics.Value != null?match.Semantics.Value.ToString() : match.Text; SubDirectoryViewModel matchModel = vm.SubDirectories.FirstOrDefault(sd => sd.Entries.Any(entry => entry.FullName == matchText)); if (matchModel != null) { DirectoryEntryModel matchEntry = matchModel.Entries.First(entry => entry.FullName == matchText); if (matchEntry != null) { allMatches.Entries.Add(matchEntry); } } } this.AlphaList.SelectedValue = allMatches; } } }
public ActionResult InsertDirectory() { var model = new DirectoryViewModel(); model.Status = true; return(View(model)); }
public ActionResult CreateFolder(DirectoryViewModel directoryModel) { List <ExplorerViewModel> explorerObjects; if (directoryModel == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } string path = directoryModel.ParentDirectoryPath + directoryModel.Name; if (directoryService.IsExist(path)) { return(Json(new { Status = "Exist" }, JsonRequestBehavior.AllowGet)); } if (ModelState.IsValid) { try { directoryService.CreateDirectory(path); var dirListModel = directoryService.GetAllDirectories(directoryModel.ParentDirectoryPath).Select(d => d.ToExplorerObject()); var fileListModel = fileService.GetAllFiles(directoryModel.ParentDirectoryPath).Select(f => f.ToExplorerObject()); explorerObjects = new List <ExplorerViewModel>(); foreach (var obj in dirListModel) { explorerObjects.Add(obj); } foreach (var obj in fileListModel) { explorerObjects.Add(obj); } } catch (UnauthorizedAccessException e) { return(Json(new { Status = "NotAcceptable" }, JsonRequestBehavior.AllowGet)); } path = directoryModel.ParentDirectoryPath.Remove(1, 1); if (path.Last() != '\\') { path = path + "\\"; } path = path.Replace("\\", "\\\\"); ViewBag.LastPath = path; return(PartialView("GetExplorerTable", explorerObjects)); } if (Request.IsAjaxRequest()) { return(PartialView(directoryModel)); } return(View(directoryModel)); }
public DirectoryViewModel GetDirectoryData(int Id) { DirectoryViewModel result = (from a in ent.tblDirectoryItems join b in ent.tblDirectoryDetails on a.DirectoryItemId equals b.DirectoryItemId where a.DirectoryItemId == Id select new DirectoryViewModel { DirectoryItemId = a.DirectoryItemId, DirectoryItemName = a.DirectoryItemName, DirectoryCategoryId = a.DirectoryCategoryId, DirectorySubCategoryId = a.DirectorySubCategoryId, IssueDate = a.IssueDate, Status = a.Status, Specification = a.Specification, DirectoryDetailsId = b.DirectoryDetailsId, MapDirectoryItemId = (int)b.DirectoryItemId, AddressState = b.AddressState, AddressDistrict = b.AddressDistrict, AddressPalika = b.AddressPalika, AddressWard = b.AddressWard, DirectoryPhone = b.DirectoryPhone, PAN = b.PAN, VAT = b.VAT, ContactPersonName = b.ContactPersonName, ContactPersonPhone = b.ContactPersonPhone, Details = b.Details, Email = b.Email, PhotoLogo = b.PhotoLogo }).SingleOrDefault(); return(result); }
public IHttpActionResult DeleteDirectory(DirectoryViewModel directory) { if (!ModelState.IsValid) { return(this.BadRequestError(ModelState)); } DataSet data = new DataSet(); if (directory.isReport == 1) { data = DBConnection.GetQuery("delete [ReportServer].[dbo].[Urls] where id = " + directory.id); data = DBConnection.GetQuery("delete [ReportServer].[dbo].[Report] where id = " + directory.reportId); } else { data = DBConnection.GetQuery(@"SELECT [id] ,[url] ,[isReport] ,[reportId] FROM [ReportServer].[dbo].[Urls] where [url] like '" + directory.url + "/%'"); foreach (DataRow row in data.Tables[0].Rows) { data = DBConnection.GetQuery("delete [ReportServer].[dbo].[Urls] where id = " + row[0]); if (row[3].ToString() != "") { data = DBConnection.GetQuery("delete [ReportServer].[dbo].[Report] where id = " + row[3]); } } data = DBConnection.GetQuery("delete [ReportServer].[dbo].[Urls] where id = " + directory.id); } return(Ok()); }
private async void TreeView_DropAsync(object sender, DragEventArgs e) { string[] filenameList = (string[])e.Data.GetData(DataFormats.FileDrop); if (filenameList is null || filenameList.Length.Equals(0)) { return; } // If the luser is dragging a file, in direct opposition of the name // of the app, then go directly to the File Checksum page. if (DirectoryViewModel.IsItemFile(filenameList[0])) { FileInfo fileInfo = new FileInfo(filenameList[0]); m_ViewModel.ShowNextPage(PageControl.FileChecksum, additionalData: new DirectoryItem(fileInfo), transitionType: PageTransitionType.SlideAndFade); return; } await LoadDirectoryAsync(filenameList[0]); // This is a bit of a hack. Setting the focus makes the application // reevaluate the XXX_CanExecute methods. Otherwise, the "Export" // menu option is not enabled after parsing the directory. This only // occurs with the drag and drop. Using the browse command every- // thing works as expected. treeView.Focus(); }
public IActionResult Directory(string path = "") { path = path.TrimStart('/').TrimStart('\\'); var model = new DirectoryViewModel { DirectoryPath = Path.Combine(_appSettings.RootDirectoryPath, path), Files = new List <EntryViewModel>() }; model.IsRootDirectory = model.DirectoryPath == _appSettings.RootDirectoryPath; var directory = new DirectoryInfo(model.DirectoryPath); if (directory.Parent != null) { model.ParentDirectoryPath = directory.Parent.FullName.Replace(_appSettings.RootDirectoryPath, ""); } else { model.ParentDirectoryPath = directory.FullName.Replace(_appSettings.RootDirectoryPath, ""); } #region List directory entries // List all directories directory.GetDirectories().ToList().ForEach(file => { var fileModel = new EntryViewModel { LastModifyTime = file.LastWriteTimeUtc, Name = file.Name, Size = new FileSize { Byte = 0 }, IsDirectory = true }; model.Files.Add(fileModel); }); // List all files directory.GetFiles().ToList().ForEach(file => { var fileModel = new EntryViewModel { LastModifyTime = file.LastWriteTimeUtc, Name = file.Name, Size = new FileSize { Byte = file.Length }, IsDirectory = false }; model.Files.Add(fileModel); }); #endregion return(base.View(model)); }
public ActionResult UpdateDirectory(int id) { var model = new DirectoryViewModel(); model = _proCommon.GetDirectoryData(id); return(View(model)); }
private void FilesDataGrid_OnSelectedCellsChanged(object _sender, SelectedCellsChangedEventArgs _e) { DirectoryViewModel directory = DataContext as DirectoryViewModel; Debug.Assert(directory != null); UpdateStatusBar(directory); }
public DirectoryViewModel SaveDirectoryToDb(DirectoryViewModel directoryViewModel) { var _dir = directoryViewModel.Directory; DataManager.Directorys.SaveDirectory(_dir); directoryViewModel.Directory = _dir; return(directoryViewModel); }
public static DirectoryEntity ToBllDirectory(this DirectoryViewModel directory) { return(new DirectoryEntity { Name = directory.Name, LastAccessTime = directory.LastAccessTime }); }
public DirectoryView(MainWindowViewModel viewModel) : base(viewModel) { InitializeComponent(); m_ViewModel = new DirectoryViewModel(viewModel); DataContext = m_ViewModel; }
public IHttpActionResult SaveDirectory(DirectoryViewModel model) { model.CreatedBy = User.Identity.GetUserId <long>(); model.UpdatedBy = User.Identity.GetUserId <long>(); var responseId = _directoryService.DirectoryInsert(model.ToModel()); return(Ok(responseId.SuccessResponse("Directory save successfully"))); }
private void Directory_OnUpdated(object _sender, EventArgs _eventArgs) { DirectoryViewModel viewModel = _sender as DirectoryViewModel; Debug.Assert(viewModel != null); UpdateFiles(viewModel); }
public DirectoryViewModel SetRoot(string path) { var rootDirectory = new DirectoryInfo(path); var root = new DirectoryViewModel(rootDirectory.FullName); root.Children = getChildren(root); return(root); }
private void SetTitle(DirectoryViewModel directory) { var newTitle = string.IsNullOrWhiteSpace(directory.DisplayName) ? "Winder" : directory.DisplayName; TextBlockTitle.Text = newTitle; ImageTitle.Source = directory.Icon; }
public async Task <IActionResult> Directory(string id, [FromQuery] bool isPrivate = false, StorageSortType sortType = StorageSortType.DateDescending) { directoryViewModel = ((DirectoryViewModel) new DirectoryViewModel(await storageManager.ListDirectory(id, sortType: sortType)) .WithError().WithAlert()).SetPrivate(isPrivate); return(directoryViewModel.Directory != null ? (IActionResult)View(directoryViewModel) : this.AccessDeniedPage()); }
public void Constructor_Should_Create_Empty_Files_And_ChildFolders() { // Arrange + Act DirectoryViewModel model = new DirectoryViewModel("", ""); // Assert Assert.That(model.Files.Count, Is.EqualTo(0)); Assert.That(model.ChildFolders.Count, Is.EqualTo(0)); }
public DirectoryViewModel GetDirectories([FromRoute] int id) { var vm = new DirectoryViewModel(); vm.Directories = _context.Directories.Where(directory => directory.ParentID == id).ToList(); vm.Indicators = _context.Indicators.Where(indicator => indicator.Parent.ID == id).ToList(); return(vm); }
public IHttpActionResult DeleteDirectory(long id) { DirectoryViewModel model = new DirectoryViewModel(); model.Id = id; model.IsDeleted = true; _directoryService.DirectoryUpdate(model.ToModel()); return(Ok("Directory Deleted successfully".SuccessResponse())); }
public MainWindow() { InitializeComponent(); try { GryffiLib.Gryffi.DeserializePatchlist(); } catch (Exception) { MessageBox.Show("list.txt could not be found."); } DataContext = new DirectoryViewModel(); }