Пример #1
0
        public IActionResult AddDownload(ResourceForm resourceForm)
        {
            if (ModelState.IsValid)
            {
                if (_context.Resource.Any(m => m.Name == resourceForm.Name && m.Catalog.Id.ToString() == resourceForm.Catalog))
                {
                    return(JumpPage("该名称已存在"));
                }

                var resource = new Resource
                {
                    AbsolutePath = resourceForm.AbsolutePath,
                    Catalog      = _context.Catalog.Find(Guid.Parse(resourceForm.Catalog)),
                    Description  = resourceForm.Description,
                    Provider     = resourceForm.Provider,
                    Tag          = resourceForm.Provider,
                    CreatedTime  = DateTime.Now,
                    Id           = Guid.NewGuid(),
                    Imgurl       = resourceForm.IMGUrl,
                    Language     = resourceForm.Language,
                    Name         = resourceForm.Name,
                    Path         = resourceForm.Path,
                    Status       = 0,
                    Type         = resourceForm.Type,
                    UpdatedTime  = DateTime.Now
                };

                _context.Add(resource);
                _context.SaveChanges();
                return(RedirectToAction("Download"));
            }
            return(JumpPage());
        }
        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            ForceValidation();
            if (Validation.GetHasError(txtPasword) || Validation.GetHasError(txtuName))
            {
                MessageBox.Show("Error Some Data is Missing", "ERROR");
                return;
            }
            ResourceForm RFobj = new ResourceForm();
            LoginFactory obj   = new LoginFactory();
            Admin_Table  Aobj  = new Admin_Table();

            Aobj = obj.GetData(2);
            if (txtuName.Text == Aobj.A_UserName && txtPasword.Text == Aobj.A_Password)
            {
                this.Close();
                RFobj.ShowDialog();
            }
            else if (Aobj.A_UserName != txtuName.Text)
            {
                MessageBox.Show("User Name is Wrong Please Enter Again", "Error!");
            }
            else if (txtPasword.Text != Aobj.A_Password)
            {
                MessageBox.Show("Password is Wrong Please Enter Again", "Error!");
            }

            else
            {
                MessageBox.Show("Something is Wrong", "Error!");
            }
        }
Пример #3
0
        private void InitResourceForm()
        {
            ResourceForm form = new ResourceForm
            {
                DockPanel = this.m_MainForm.DockPanelInstance,
                DockState = DockState.DockRight
            };

            form.DockHandler.NotifyWindowStateChanged = new NotifyWindowStateChangeDelegate(this.NotifyWindowStateChanged);
            this.m_MainForm.ResourceCpuMemForm        = form;
        }
        public IActionResult Get(long id)
        {
            var resource = resourceRepository.Query().FirstOrDefault(x => x.Id == id);
            var model    = new ResourceForm
            {
                Id      = resource.Id,
                Key     = resource.Key,
                Value   = resource.Value,
                Culture = resource.Culture
            };

            return(Json(model));
        }
Пример #5
0
        public IActionResult Get(long id)
        {
            var resource = resourceRepository.Query().FirstOrDefault(x => x.Id == id);
            var model = new ResourceForm
            {
                Id = resource.Id,
                Key = resource.Key,
                Value = resource.Value,
                Culture = resource.Culture
            };

            return Json(model);
        }
        public IActionResult GetCadastroDeModelos()
        {
            var solicitacao = new SolicitacaoDeCadastroDeModelo
            {
                Codigo = Guid.NewGuid().ToString(),
                Nome   = "Modelo #"
            };

            var resource = new ResourceForm <SolicitacaoDeCadastroDeModelo>
            {
                Title  = "Cadastro de Modelos",
                HRef   = "/cadastro/modelos/cadastro-de-modelos",
                Data   = solicitacao,
                Method = "POST",
                Action = "/cadastro/modelos/cadastro-de-modelos",
                Links  = new Link[] { }
            };

            return(Ok(resource));
        }
        public IActionResult GetConsultaDeModelos()
        {
            var solicitacao = new SolicitacaoDeConsultaDeModelos
            {
                Nome            = null,
                PrimeiraPagina  = 1,
                TamanhoDaPagina = 10
            };

            var resource = new ResourceForm <SolicitacaoDeConsultaDeModelos>
            {
                Title  = "Consulta de Modelos",
                HRef   = "/cadastro/modelos/consulta-de-modelos",
                Data   = solicitacao,
                Method = "GET",
                Action = "/cadastro/modelos",
                Links  = new Link[] { }
            };

            return(Ok(resource));
        }
        public IActionResult GetAdicaoDeRecursos(string id)
        {
            var codigo = new CodigoDeModelo(id);

            var solicitacao = new SolicitacaoDeAdicaoDeRecursoDeModelo
            {
                Codigo    = id,
                Descricao = "Recurso #"
            };

            var resource = new ResourceForm <SolicitacaoDeAdicaoDeRecursoDeModelo>
            {
                Title  = "Adição de Recursos",
                HRef   = $"/cadastro/modelos/{codigo.Valor}/recursos/adicao-de-recursos",
                Data   = solicitacao,
                Method = "POST",
                Action = $"/cadastro/modelos/{codigo.Valor}/recursos/adicao-de-recursos",
                Links  = new Link[] { }
            };

            return(Ok(resource));
        }