예제 #1
0
        public string GerarFiltros(DateTime datainicio, DateTime datafim, string setor, string loja)
        {
            string filtros = "";

            if (datainicio != null && datainicio != DateTime.MinValue)
            {
                if (filtros == "")
                {
                    filtros += "Data Inicial: " + Globalization.DataCurtaBR(datainicio);
                }
                else
                {
                    filtros += ", Data Inicial: " + Globalization.DataCurtaBR(datainicio);
                }
            }

            if (datafim != null && datafim != DateTime.MaxValue)
            {
                if (filtros == "")
                {
                    filtros += "Data Final: " + Globalization.DataCurtaBR(datafim);
                }
                else
                {
                    filtros += ", Data Final: " + Globalization.DataCurtaBR(datafim);
                }
            }

            if (setor != null && setor != "0")
            {
                Setor nome_setor = _db.Int_DP_Setores.Find(int.Parse(setor));

                if (filtros == "")
                {
                    filtros += "Setor: " + nome_setor.Nome;
                }
                else
                {
                    filtros += ", Setor: " + nome_setor.Nome;
                }
            }
            else
            {
                if (filtros == "")
                {
                    filtros += "Setor: Todos";
                }
                else
                {
                    filtros += ", Setor: Todos";
                }
            }

            if (loja != null && loja != "0")
            {
                Loja nome_loja = _db.Int_DP_Lojas.Find(int.Parse(loja));

                if (filtros == "")
                {
                    filtros += "Loja: " + nome_loja.Nome;
                }
                else
                {
                    filtros += ", Loja: " + nome_loja.Nome;
                }
            }
            else
            {
                if (filtros == "")
                {
                    filtros += "Loja: Todas";
                }
                else
                {
                    filtros += ", Loja: Todas";
                }
            }

            return(filtros);
        }