private bool saveListFile(List <string> list, string fileName, string fileType, string type)
        {
            StrList strlist;

            if ((MessageBox.Show("Deseja salvar o arquivo " + type + " '" + fileName + "' ?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.OK))
            {
                strlist = ListController.CreateList(list, fileName, fileType);
                if (strlist.exists())
                {
                    DialogResult dialogResult = MessageBox.Show("Uma lista com este nome já existe.\nDeseja sobrescrevê-la?", "", MessageBoxButtons.OKCancel);
                    if (dialogResult == DialogResult.Cancel)
                    {
                        MessageBox.Show("A lista não será salva");
                        return(false);
                    }
                }
                if (strlist.save())
                {
                    MessageBox.Show("A lista '" + fileName + "' foi salva com sucesso");
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
        private bool saveListFile(List <string> list, string fileName, string fileType, string type)
        {
            if ((MessageBox.Show(LocRM.GetString("wishToSave", currentCulture) + type + " '" + fileName + "' ?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.OK))
            {
                StrList strlist = ListController.CreateList(list, fileName, fileType);

                if (strlist.exists())
                {
                    DialogResult dialogResult = MessageBox.Show(LocRM.GetString("listExists", currentCulture), "", MessageBoxButtons.OKCancel);
                    if (dialogResult == DialogResult.Cancel)
                    {
                        MessageBox.Show(LocRM.GetString("listNotSaved", currentCulture));
                        return(false);
                    }
                }
                if (strlist.save())
                {
                    MessageBox.Show(LocRM.GetString("list", currentCulture) + fileName + LocRM.GetString("listSaveSuccess", currentCulture));
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
        public async Task UserGetLists_Success()
        {
            var uc = GetController();
            var lc = new ListController(_serviceProvider.GetRequiredService <IPartitionedKeyValueDictionary>(),
                                        _serviceProvider.GetRequiredService <ILogger>(),
                                        _serviceProvider.GetRequiredService <IUserAuthenticator>()
                                        );

            lc.ControllerContext.HttpContext = new DefaultHttpContext();

            TestHelper.SetupUser(uc);
            TestHelper.SetupUser(lc);
            var list = await lc.CreateList();

            Assert.True(lc.HttpContext.Response.StatusCode == 200);

            var user = _serviceProvider.GetRequiredService <IUserAuthenticator>().AuthenticateUser(uc);
            var ul   = await uc.UserLists(user.UserId);

            Assert.True(uc.HttpContext.Response.StatusCode == 200);
            Assert.True(ul.Contains(list.Id));

            await lc.DeleteList(list.Id);

            Assert.True(uc.HttpContext.Response.StatusCode == 200);
            var ul2 = await uc.UserLists(user.UserId);

            Assert.True(uc.HttpContext.Response.StatusCode == 200);
            Assert.True(!ul2.Contains(list.Id));
        }