public void Update__WithCorrectData__UpdatesRecord()
        {
            Folder folder = new Folder();

            folder.Name           = "Test Folder";
            folder.ParentFolderId = -1;
            folder.IsActive       = true;
            folder.CreatedBy      = 1;
            folder.CreatedOn      = DateTime.Now.Truncate(TimeSpan.FromSeconds(1));

            folder.Id = dao.Insert(folder);

            var dbFolder = dao.GetById(folder.Id);

            dbFolder.IsActive = false;

            var count         = dao.Update(dbFolder);
            var updatedFolder = dao.GetById(dbFolder.Id);

            Assert.AreEqual(1, count);
            Assert.AreEqual(false, updatedFolder.IsActive);
        }
Example #2
0
        public static int Update(this Folder Folder)
        {
            FolderDAO dao = new FolderDAO();

            return(dao.Update(Folder));
        }
 public int UpdateFolder(Folder folder)
 {
     return(_folderDAO.Update(folder));
 }
Example #4
0
        private void LockFolderCommandExecute(FolderInfo folderInfo)
        {
            if (!VersionHelper.CheckPaidFeature())
            {
                return;
            }

            bool   isLocking = false;
            string title     = string.Empty;

            if (string.IsNullOrEmpty(folderInfo.Passcode))
            {
                isLocking = false;
                title     = ResourceLoader.GetForCurrentView().GetString("Message/Confirm/Create/Password");
            }
            else
            {
                isLocking = true;
                title     = ResourceLoader.GetForCurrentView().GetString("Message/Confirm/Remove/Password");
            }

            StackPanel contentPanel = new StackPanel();

            contentPanel.Children.Add(new TextBlock
            {
                Text         = title,
                TextWrapping = TextWrapping.Wrap,
                Margin       = new Thickness(0, 12, 0, 12)
            });

            PasswordBox pbox = new PasswordBox
            {
                MaxLength = 8,
                Margin    = new Thickness(0, 12, 0, 12)
            };

            contentPanel.Children.Add(pbox);

            ContentDialog contentDlg = new ContentDialog
            {
                Content = contentPanel,
                IsPrimaryButtonEnabled = false,
                PrimaryButtonText      = ResourceLoader.GetForCurrentView().GetString("Ok"),
                SecondaryButtonText    = ResourceLoader.GetForCurrentView().GetString("Cancel")
            };

            pbox.PasswordChanged += (sender, args) =>
            {
                if (isLocking)
                {
                    contentDlg.IsPrimaryButtonEnabled = folderInfo.Passcode == pbox.Password;
                }
                else
                {
                    contentDlg.IsPrimaryButtonEnabled = !string.IsNullOrEmpty(pbox.Password);
                }
            };

            //메세지 창 출력
            App.ContentDlgOp = contentDlg.ShowAsync();

            //후처리기 등록
            App.ContentDlgOp.Completed = new AsyncOperationCompletedHandler <ContentDialogResult>(async(op, status) =>
            {
                var result = await op;
                if (result == ContentDialogResult.Primary)
                {
                    if (isLocking)
                    {
                        if (folderInfo.Passcode == pbox.Password)
                        {
                            //잠금 해제
                            folderInfo.Passcode = string.Empty;
                            folderDAO.Update(folderInfo);

                            //전체 비디오에서 추가 요청
                            MessengerInstance.Send <Message>(new Message("FolderAdded", folderInfo), AllVideoViewModel.NAME);
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(pbox.Password))
                        {
                            //잠금 설정
                            folderInfo.Passcode = pbox.Password;
                            folderDAO.Update(folderInfo);

                            //전체 비디오에서 삭제 요청
                            MessengerInstance.Send <Message>(new Message("FolderDeleted", folderInfo), AllVideoViewModel.NAME);
                            //재생 목록에서 삭제 요청
                            MessengerInstance.Send <Message>(new Message("FolderDeleted", folderInfo), PlaylistViewModel.NAME);
                        }
                    }
                }
                App.ContentDlgOp = null;
            });
        }