示例#1
0
        public ActionResult Detail(int ID)
        {
            var content = ContentBLL.GetContentByID(ID);

            ViewBag.Tags = TagBLL.GetAllTag(ID);
            return(View(content));
        }
示例#2
0
        public static void InitializeTagsFromFile(string filePath)
        {
            var lines     = File.ReadAllLines(filePath);
            var tagsSoFar = new List <string>();

            foreach (var line in lines)
            {
                var lineSplit   = line.Split('|');
                var category    = lineSplit[0];
                var subcategory = lineSplit[1];
                var cardName    = lineSplit[2];

                if (!tagsSoFar.Contains(category))
                {
                    TagBLL.AddTag(category);
                    tagsSoFar.Add(category);
                }
                TagBLL.AddTagToCard(cardName, category);

                if (subcategory != "")
                {
                    if (!tagsSoFar.Contains(subcategory))
                    {
                        TagBLL.AddTag(subcategory);
                        tagsSoFar.Add(subcategory);
                    }
                    TagBLL.AddTagToCard(cardName, subcategory);
                }
            }
        }
示例#3
0
        public void showData()
        {
            var Tags = TagBLL.Search(pageIndex, pageSize, sortBy, sortOrder, keyword);

            dgTag.ItemsSource = Tags.Items;
            pageCount         = Tags.PageCount;
        }
示例#4
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            var op = TagBLL.Add(new Tag()
            {
                Title = txtTitle.Text,
                Price = txtPrice.Text,
            });

            if (op.Code != "200")
            {
                MessageBox.Show("Error : " + op.Message);
            }
            else
            {
                MessageBox.Show("Tag is Succesfully added to table");
            }
            myParentWindow.showData();
            this.Close();
        }
示例#5
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            var op = TagBLL.Update(new Tag()
            {
                Title    = txtTitle.Text,
                FeedBack = thisTag.FeedBack,
                Price    = txtPrice.Text
            });

            if (op.Code != "200")
            {
                MessageBox.Show("Error : " + op.Message);
            }
            else
            {
                MessageBox.Show("Succesfully Update");
            }
            myParentWindow.showData();
            this.Close();
        }
示例#6
0
        public ActionResult Tag(string tagId, int page = 1, int pageSize = 10)
        {
            var model       = ContentBLL.ListAllByTag(tagId, page, pageSize);
            int totalRecord = 0;

            ViewBag.Total = totalRecord;
            ViewBag.Page  = page;

            ViewBag.Tag = TagBLL.GetTag(tagId);
            int maxPage   = 5;
            int totalPage = 0;

            totalPage         = (int)Math.Ceiling((double)(totalRecord / pageSize));
            ViewBag.TotalPage = totalPage;
            ViewBag.MaxPage   = maxPage;
            ViewBag.First     = 1;
            ViewBag.Last      = totalPage;
            ViewBag.Next      = page + 1;
            ViewBag.Prev      = page - 1;
            return(View(model));
        }
示例#7
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            Tag tags = ((FrameworkElement)sender).DataContext as Tag;

            if (MessageBox.Show("Are you sure you want to delete " + tags.Title + "?",
                                "Are you sure?", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                var op = TagBLL.Delete(tags.Title);

                if (op.Code != "200")
                {
                    MessageBox.Show("Error : " + op.Message);
                }
                else
                {
                    MessageBox.Show("Tag is successfully deleted from table");
                    showData();
                }
            }
            ;
        }
 public static void FindCards(string cardName, string tag)
 {
     TagBLL.AddTagToCard(cardName, tag);
 }
 public static void FindCards(string tag)
 {
     TagBLL.AddTag(tag);
 }
示例#10
0
        protected override bool salvar(object sender, EventArgs e)
        {
            bool layoutOtica = Convert.ToBoolean(Parametro.GetParametro("layoutOtica"));

            if (layoutOtica)
            {
                epValidaDados.SetObrigatorio(txtCNPJCPF, false);
            }

            bool Retorno = epValidaDados.Validar(true);

            if (Retorno)
            {
                Retorno = ValidaDadosEspecifico();
            }

            if (Retorno)
            {
                try
                {
                    ClienteBLL = new ClienteBLL();
                    ClienteBLL.UsuarioLogado = Program.usuario_logado;

                    ClienteProxy proxy = new ClienteProxy();

                    proxy.usuario = Program.usuario_logado;

                    bool intOmie           = Convert.ToBoolean(Parametro.GetParametro("intOmie"));
                    bool updateClienteOmie = Convert.ToBoolean(Parametro.GetParametro("updateFornecedorOmie"));

                    Cliente Cliente = LoadFromControls();
                    Cliente.sincronizar = "S";

                    if (Id != null)
                    {
                        ClienteBLL.AlterarCliente(Cliente);
                    }
                    else
                    {
                        Cliente.codigo_cliente_integracao = Sequence.GetNextVal("sq_cliente_sequence").ToString();
                        TagBLL tagBLL = new TagBLL();
                        Tag    tg     = tagBLL.getTag("Fornecedor").FirstOrDefault();
                        Cliente.cliente_tag.Add(new Cliente_Tag {
                            Id_tag = tg.Id, tag = tg.tag1
                        });

                        ClienteBLL.AdicionarCliente(Cliente);
                    }

                    if ((intOmie) & (updateClienteOmie))
                    {
                        if (Cliente.codigo_cliente_omie <= 0)
                        {
                            proxy.IncluirClientes(Cliente);
                        }
                        else
                        {
                            proxy.AlterarClientes(Cliente);
                        }
                    }

                    if (Cliente.Id != 0)
                    {
                        Id         = Cliente.Id;
                        txtId.Text = Cliente.Id.ToString();
                    }

                    SalvarImagem(Cliente.Id);

                    Retorno = true;
                }
                catch (Exception ex)
                {
                    Retorno = false;
                    throw ex;
                }
            }
            return(Retorno);
        }
示例#11
0
        private Cliente toCliente(clientes_cadastro p, Cliente cliente = null)
        {
            if (cliente == null)
            {
                cliente = new Cliente();
            }


            //Campos "chave"
            cliente.codigo_cliente_integracao = p.codigo_cliente_integracao;
            cliente.codigo_cliente_omie       = Convert.ToInt64(p.codigo_cliente_omie);
            //Campos de identificação
            cliente.cnpj_cpf      = p.cnpj_cpf;
            cliente.razao_social  = p.razao_social;
            cliente.nome_fantasia = p.nome_fantasia;
            //Campos de Endereço
            cliente.logradouro      = p.logradouro;
            cliente.endereco        = p.endereco;
            cliente.endereco_numero = p.endereco_numero;
            cliente.complemento     = p.complemento;
            cliente.bairro          = p.bairro;
            cliente.cidade          = p.cidade;
            cliente.estado          = p.estado;
            cliente.cep             = p.cep;
            cliente.codigo_pais     = p.codigo_pais;
            //Contatos
            cliente.contato                  = p.contato;
            cliente.telefone1_ddd            = p.telefone1_ddd;
            cliente.telefone1_numero         = p.telefone1_numero;
            cliente.telefone2_ddd            = p.telefone2_ddd;
            cliente.telefone2_numero         = p.telefone2_numero;
            cliente.fax_ddd                  = p.fax_ddd;
            cliente.fax_numero               = p.fax_numero;
            cliente.email                    = p.email;
            cliente.homepage                 = p.homepage;
            cliente.observacao               = p.observacao;
            cliente.inscricao_municipal      = p.inscricao_municipal;
            cliente.inscricao_estadual       = p.inscricao_estadual;
            cliente.inscricao_suframa        = p.inscricao_suframa;
            cliente.pessoa_fisica            = p.pessoa_fisica;
            cliente.optante_simples_nacional = p.optante_simples_nacional;
            cliente.bloqueado                = p.bloqueado;
            cliente.importado_api            = p.importado_api;

            TagBLL tagBLL = new TagBLL();

            foreach (var item in p.tags)
            {
                Tag tg = tagBLL.getTag(item.tag.Trim()).FirstOrDefault();
                if (tg != null)
                {
                    if (cliente.cliente_tag.Where(c => c.tag == tg.tag1).Count() <= 0)
                    {
                        Cliente_Tag ct = new Cliente_Tag();
                        //ct.Id_cliente = cliente.Id;
                        ct.Id_tag = tg.Id;
                        ct.tag    = tg.tag1;
                        cliente.cliente_tag.Add(ct);
                    }
                }
            }

            return(cliente);
        }