예제 #1
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao, string colunaSort)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(UnidadeGestoraGestor));

            dicionario.Add("DSC_NOME", "DscNome");
            dicionario.Add("NUM_CPF", "DscCpf");
            dicionario.Add("COD_UNIDADE_GESTORA", "DscCodigo");
            dicionario.Add("DSC_UNIDADE_GESTORA", "DscGestora");
            dicionario.Add("DSC_SIGLA", "DscOrgao");
            dicionario.Add("DSC_ATIVO", "DscAtivo");

            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }
            lstParametros.Add(new Parameter(colunaSort, null, OperationTypes.Null, direcao));

            return(this.oDao.Select(lstParametros, "platinium", "VI_UNIDADE_GESTORA_GESTOR_UNGG", dicionario));
        }
예제 #2
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao, string colunaSort)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(GrauInstrucao));


            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }
            lstParametros.Add(new Parameter(colunaSort, null, OperationTypes.Null, direcao));

            return(this.oDao.Select(lstParametros, "plutonium", "TB_GRAU_INSTRUCAO_GRIN", dicionario));
        }
예제 #3
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(Secretaria));

            dicionario.Add("DSC_PODER", "DescricaoPoder");
            dicionario.Add("DSC_ATIVO", "DscAtivo");
            dicionario.Add("DSC_TIPO_ENTIDADE", "DscTipoEntidade");

            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }
            return(this.oDao.Select(lstParametros, "platinium", "VI_SECRETARIA_SECR", dicionario));
        }
예제 #4
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(AgentePublico));

            dicionario.Add("DSC_NOME", "DscPessoal");
            dicionario.Add("NUM_CPF", "DscCpf");
            dicionario.Add("DSC_FORMA_INGRESSO", "DscFormaIngresso");
            dicionario.Add("DSC_TIPO_EXPEDIENTE", "DscTipoExpediente");
            dicionario.Add("DSC_SIGLA", "DscOrgao");

            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }
            return(this.oDao.Select(lstParametros, "plutonium", "VI_AGENTE_PUBLICO_AGPU", dicionario));
        }
예제 #5
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(UnidadeGestora));

            dicionario.Add("DSC_SIGLA", "DscSigla");
            dicionario.Add("DSC_Ativo", "DscAtivo");

            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }
            return(this.oDao.Select(lstParametros, "platinium", "VI_UNIDADE_GESTORA_UNGE", dicionario));
        }
예제 #6
0
        static void ShowListParameters()
        {
            List <int> numbers = new List <int>()
            {
                1,
                30,
                4
            };

            List <string> words = new List <string>()
            {
                "wather",
                "wine",
                "soda"
            };

            List <bool> tests = new List <bool>()
            {
                true,
                false,
                true
            };

            ClassFunctions.ShowItemFromList(numbers);
            ClassFunctions.ShowItemFromList(words);
            ClassFunctions.ShowItemFromList(tests);
        }
예제 #7
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(Especie));

            dicionario.Add("dsc_ativo", "DscAtivo");
            dicionario.Add("dsc_cat_economica_rece", "DscCatEconomicaRece");
            dicionario.Add("dsc_origem", "DscOrigem");

            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }
            return(this.oDao.Select(lstParametros, "platinium", "VI_ESPECIE_ESPE", dicionario));
        }
예제 #8
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao, string colunaSort)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(OrigemReceita));

            dicionario.Add("dsc_cat_economica_rece", "DescricaoCategoria");
            dicionario.Add("dsc_ativo", "DescricaoAtivo");

            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }
            lstParametros.Add(new Parameter(colunaSort, null, OperationTypes.Null, direcao));

            return(this.oDao.Select(lstParametros, "platinium", "VI_ORIGEM_ORIG", dicionario));
        }
예제 #9
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(FolhaPagamento));

            dicionario.Add("DSC_UNIDADE_ORCAMENTARIA", "DscUnidadeOrcamentaria");
            dicionario.Add("DSC_ORGAO", "DscOrgao");
            dicionario.Add("DSC_TIPO_FOLHA_PAGAMENTO", "DscTipoFolha");

            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }
            return(this.oDao.Select(lstParametros, "plutonium", "VI_FOLHA_PAGAMENTO_FOPA", dicionario));
        }
예제 #10
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(AgenteItem));

            dicionario.Add("DSC_ITEM_REMUNERATORIO", "DscItem");
            dicionario.Add("DSC_TIPO_EXPEDIENTE", "DscTipoExpediente");
            dicionario.Add("DSC_TIPO_ITEM_REMUNERATORIO", "DscTipoItem");

            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }
            return(this.oDao.Select(lstParametros, "plutonium", "VI_AGENTE_ITEM_REMUNERATORIO_AGIR", dicionario));
        }
예제 #11
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(Localidade));

            dicionario.Add("DSC_ATIVO", "DescricaoAtivo");
            dicionario.Add("DSC_REGIAO", "DescricaoRegiao");


            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }
            return(this.oDao.Select(lstParametros, "platinium", "VI_LOCALIDADE_LOCA", dicionario));
        }
예제 #12
0
        public void SalvarItens(List <string> ListaIds, Dictionary <string, object> dictionary, string AgentePublico)
        {
            CampoNuloOuInvalidoException ex = new CampoNuloOuInvalidoException();
            AgenteItem oAgenteItem          = new AgenteItem(oDao);

            oAgenteItem.Ativo = oAgenteItem.DataExpedienteSuspensao == null;
            foreach (string id in ListaIds)
            {
                ClassFunctions.SetProperties(oAgenteItem, dictionary);
                oAgenteItem.AgentePublico     = new AgentePublico(Convert.ToInt32(AgentePublico), oDao);
                oAgenteItem.ItemRemuneratorio = new ItemRemuneratorio(Convert.ToInt32(id), oDao);
                if (oAgenteItem.ValidarItensCadastrados("S"))
                {
                    ex.Mensagens.Add(oAgenteItem.ItemRemuneratorio.Descricao, oAgenteItem.ItemRemuneratorio.Descricao + " , já cadastrado para este agente!");
                }
            }
            if (ex.Mensagens.Count > 0)
            {
                throw ex;
            }
            else
            {
                foreach (string id in ListaIds)
                {
                    ClassFunctions.SetProperties(oAgenteItem, dictionary);
                    oAgenteItem.AgentePublico     = new AgentePublico(Convert.ToInt32(AgentePublico), oDao);
                    oAgenteItem.ItemRemuneratorio = new ItemRemuneratorio(Convert.ToInt32(id), oDao);
                    oAgenteItem.Salvar();
                }
                oAgenteItem.ValidarExterno();
            }
        }
예제 #13
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(FonteIduso));

            dicionario.Add("DSC_IDUSO", "DscIduso");
            dicionario.Add("COD_IDUSO", "CodIduso");

            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }
            return(this.oDao.Select(lstParametros, "platinium", "VI_FONTE_IDUSO", dicionario));
        }
예제 #14
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(Fonte));

            dicionario.Add("dsc_ativo", "DscAtivo");
            dicionario.Add("cod_grupo_fonte", "CodGrpFonte");
            dicionario.Add("dsc_grupo_fonte", "DscGrpFonte");
            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }
            return(this.oDao.Select(lstParametros, "platinium", "vi_fonte_font", dicionario));
        }
예제 #15
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(GrupoPrograma));

            dicionario.Add("dsc_ativo", "DscAtivo");
            dicionario.Add("dsc_tipo_programa", "descricaoPrograma");

            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }
            return(this.oDao.Select(lstParametros, "platinium", "VI_GRUPO_PROGRAMA_GRPR", dicionario));
        }
예제 #16
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao, string colunaSort)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(UnidadeGestoraOrcamentaria));

            dicionario.Add("dsc_entidade", "DscUnidadeOrcamentaria");

            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }

            return(this.oDao.Select(lstParametros, "platinium", "VI_UNIDADE_GESTORA_ORCAMENTARIA_UNGO", dicionario));
        }
예제 #17
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                string         filename   = context.Request.Form.Get("filename");
                HttpPostedFile postedFile = context.Request.Files[0];
                if (postedFile.ContentLength == 0)
                {
                    throw new Exception("Empty file received");
                }

                byte[] bytes;

                using (Stream stream = postedFile.InputStream)
                {
                    using (BinaryReader binaryReader = new BinaryReader(stream))
                    {
                        bytes = binaryReader.ReadBytes((int)stream.Length);
                    }

                    string contentType = postedFile.ContentType;

                    Image image = ClassFunctions.UploadImage(bytes, contentType, filename);

                    context.Response.ContentType = contentType;
                    context.Response.Write(image.ImageID);
                }
            }
            catch (Exception ex)
            {
                context.Response.StatusCode = 500;
                context.Response.Write("Error occurred on server " +
                                       ex.Message);
            }
        }
        public void Admins()
        {
            DataSet      adminDataSet = ClassFunctions.GetAdmins();
            List <Admin> adminList    = new List <Admin>();

            for (int i = 0; i < adminDataSet.Tables[0].Rows.Count; i++)
            {
                DataRow dataRow = adminDataSet.Tables[0].Rows[i];

                Admin admin = new Admin
                {
                    AdminID = Convert.ToInt32(dataRow["AdminID"]),
                    TUID    = Convert.ToString(dataRow["TUID"]),
                    FName   = Convert.ToString(dataRow["FName"]),
                    LName   = Convert.ToString(dataRow["LName"]),
                    Email   = Convert.ToString(dataRow["Email"]),
                    Active  = Convert.ToBoolean(dataRow["Active"])
                };

                adminList.Add(admin);
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            Context.Response.Write(js.Serialize(adminList));
        }
예제 #19
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(ItemRemuneratorio));

            dicionario.Add("COD_ITEM_REMUNERATORIO", "CodigoItemremuneratorio");
            dicionario.Add("DSC_ITEM_REMUNERATORIO", "DscItemRemuneratorio");
            dicionario.Add("NUM_AMPARO_LEGAL_ORIGINOU", "NumAmparoLegal");
            dicionario.Add("DSC_TIPO_ITEM_REMUNERATORIO", "DscTipoItem");
            dicionario.Add("DAT_AMPARO_LEGAL_ORIGINOU", "DataAmparoLegal");
            dicionario.Add("DSC_TIPO_AMPARO_LEGAL", "DscTipoAmparo");

            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }
            return(this.oDao.Select(lstParametros, "plutonium", "VI_ITEM_REMUNERATORIO_ITRE", dicionario));
        }
        public void ReadAllWatersheds()
        {
            DataSet          watershedDataSet = ClassFunctions.GetWatersheds();
            List <Watershed> result           = new List <Watershed>();

            for (int i = 0; i < watershedDataSet.Tables[0].Rows.Count; i++)
            {
                DataRow dataRow = watershedDataSet.Tables[0].Rows[i];

                Watershed watershed = new Watershed
                {
                    WatershedID   = Convert.ToInt32(dataRow["WatershedID"]),
                    WatershedName = Convert.ToString(dataRow["WatershedName"])
                };

                result.Add(watershed);
            }

            if (result != null)
            {
                BuildResponse(200, result);
            }
            else
            {
                BuildResponse(500, null);
            }
        }
예제 #21
0
        public CrudActionTypes SalvarComUc(Dictionary <string, object> valoresUC, int idAgente)
        {
            try
            {
                oDao.StartTransactionMode();
                PrepararInclusao();
                ClassFunctions.SetProperties(oDesligamento, valoresUC);
                AgentePublico oAgente = new AgentePublico(idAgente, oDao);
                oAgente.Ativo = false;
                oAgente.Salvar();
                oDesligamento.AgentePublico = oAgente;

                CampoNuloOuInvalidoException ex = oDesligamento.ValidarExterno();
                if (ex.Mensagens.Count > 0)
                {
                    throw ex;
                }

                CrudActionTypes evento = oDesligamento.Salvar();
                oDao.Commit();
                return(evento);
            }
            catch
            {
                oDao.RollBack();
                throw;
            }
        }
        public void AllLocations()
        {
            DataSet         locationsDataSet = ClassFunctions.GetLocations();
            List <Location> locationList     = new List <Location>();

            for (int i = 0; i < locationsDataSet.Tables[0].Rows.Count; i++)
            {
                DataRow dataRow = locationsDataSet.Tables[0].Rows[i];

                Location location = new Location
                {
                    Latitude    = Convert.ToDouble(dataRow["Latitude"]),
                    Longitude   = Convert.ToDouble(dataRow["Longitude"]),
                    WatershedID = Convert.ToInt32(dataRow["WatershedID"]),
                    SensorName  = Convert.ToString(dataRow["SensorName"]),
                    LocationID  = Convert.ToInt32(dataRow["LocationID"])
                };

                locationList.Add(location);
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            Context.Response.Write(js.Serialize(locationList));
        }
예제 #23
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(RubricaReceita));

            dicionario.Add("DSC_ESPECIE", "DescricaoEspecie");
            dicionario.Add("COD_ESPECIE", "CodEspecie");
            dicionario.Add("DSC_ORIGEM", "DescricaoOrigem");
            dicionario.Add("COD_ORIGEM", "CodOrigem");
            dicionario.Add("COD_CAT_ECONOMICA_RECE", "CodCatEconomica");
            dicionario.Add("DSC_CAT_ECONOMICA_RECE", "DescricaoCategoria");
            dicionario.Add("DSC_ATIVO", "DescricaoAtivo");

            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }
            return(this.oDao.Select(lstParametros, "platinium", "VI_RUBRICA_RUBI", dicionario));
        }
        public void AllLocationTemperaturesCsv()
        {
            string csvFileName = $"Temperatures-{DateTime.Now.ToString("MMddyyyy")}.csv";

            DataSet temperatureDataset = ClassFunctions.GetAllTemperatures();

            List <Temperature> temperatureList = new List <Temperature>();

            for (int i = 0; i < temperatureDataset.Tables[0].Rows.Count; i++)
            {
                DataRow dataRow = temperatureDataset.Tables[0].Rows[i];

                Temperature t = new Temperature();
                t.Id         = Convert.ToInt32(dataRow["TempID"]);
                t.Timestamp  = Convert.ToDateTime(dataRow["Timestamp"]);
                t.Celsius    = Convert.IsDBNull(dataRow["TempC"]) ? double.NaN : Convert.ToDouble(dataRow["TempC"]);
                t.Fahrenheit = Convert.IsDBNull(dataRow["TempC"]) ? double.NaN : Convert.ToDouble(dataRow["TempF"]);
                t.Location   = Convert.ToString(dataRow["SensorName"]);
                temperatureList.Add(t);
            }

            byte[] allTempDataBytes = DataProcessor.CreateCsvAsBytes(temperatureList);

            Context.Response.Clear();
            Context.Response.ContentType = "application/force-download";
            Context.Response.AddHeader("content-disposition", "attachment; filename=" + csvFileName);
            Context.Response.BinaryWrite(allTempDataBytes);
            Context.Response.End();
        }
예제 #25
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(AreaAtuacao));

            dicionario.Add("DSC_EIXO", "DscEixo");
            dicionario.Add("DSC_ATIVO", "DscAtivo");

            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }
            return(this.oDao.Select(lstParametros, "platinium", "VI_AREA_ATUACAO_ARAT", dicionario));
        }
        public void LocationTemperaturesCsvStartEnd(int locationId, DateTime startDate, DateTime endDate)
        {
            Location  location  = ClassFunctions.ReadLocation(locationId);
            Watershed watershed = ClassFunctions.ReadWatershed(location.WatershedID);

            string formattedLocationName  = ClassFunctions.FormatForFileSystem(location.SensorName);
            string formattedWatershedName = ClassFunctions.FormatForFileSystem(watershed.WatershedName);

            string csvFileName = $"{formattedWatershedName}-{formattedLocationName}_{startDate.ToString("MMddyyyy")}-{endDate.ToString("MMddyyyy")}.csv";

            DataSet temperatureDataset = ClassFunctions.GetTemperaturesByLocationIdStartEnd(locationId, startDate, endDate);

            List <Temperature> temperatureList = new List <Temperature>();

            for (int i = 0; i < temperatureDataset.Tables[0].Rows.Count; i++)
            {
                DataRow dataRow = temperatureDataset.Tables[0].Rows[i];

                Temperature t = new Temperature();
                t.Timestamp  = Convert.ToDateTime(dataRow["Timestamp"]);
                t.Celsius    = Convert.IsDBNull(dataRow["TempC"]) ? double.NaN : Convert.ToDouble(dataRow["TempC"]);
                t.Fahrenheit = Convert.IsDBNull(dataRow["TempC"]) ? double.NaN : Convert.ToDouble(dataRow["TempF"]);

                temperatureList.Add(t);
            }

            byte[] allTempDataBytes = DataProcessor.CreateCsvAsBytesNoLocation(temperatureList);

            Context.Response.Clear();
            Context.Response.ContentType = "application/force-download";
            Context.Response.AddHeader("content-disposition", "attachment; filename=" + csvFileName);
            Context.Response.BinaryWrite(allTempDataBytes);
            Context.Response.End();
        }
        protected void btnsave_Click(object sender, EventArgs e)
        {
            if (FileUpload1.HasFile)
            {
                try
                {
                    if (ddlLocations.SelectedValue.Equals(""))
                    {
                        throw new Exception("Select a valid Location.");
                    }

                    Stream fileStream = FileUpload1.PostedFile.InputStream;
                    //turns it into a list here called temperatureList and is bound. need to save in database instead.
                    List <Temperature> temperatureList = DataProcessor.ReadCsvFile(fileStream);

                    int locationId = int.Parse(ddlLocations.SelectedValue);

                    ClassFunctions.BulkTemperatureDataInsert(temperatureList, locationId);

                    txtLocation.InnerText   = ddlLocations.SelectedItem.Text;
                    txtRowcount.InnerText   = temperatureList.Count.ToString();
                    feedbackSuccess.Visible = true;
                }
                catch (Exception ex)
                {
                    txtFail.InnerText      = ex.Message;
                    feedbackDanger.Visible = true;
                }
            }
        }
        public void Volunteers()
        {
            DataSet          volunteerDataSet = ClassFunctions.GetVolunteers();
            List <Volunteer> volunteerList    = new List <Volunteer>();

            for (int i = 0; i < volunteerDataSet.Tables[0].Rows.Count; i++)
            {
                DataRow dataRow = volunteerDataSet.Tables[0].Rows[i];

                Volunteer volunteer = new Volunteer
                {
                    VolunteerID   = Convert.ToInt32(dataRow["VolunteerID"]),
                    FirstName     = Convert.ToString(dataRow["FirstName"]),
                    LastName      = Convert.ToString(dataRow["LastName"]),
                    Email         = Convert.ToString(dataRow["Email"]),
                    Message       = Convert.ToString(dataRow["Message"]),
                    DateSubmitted = Convert.ToDateTime(dataRow["DateSubmitted"]),
                };

                volunteerList.Add(volunteer);
            }

            JavaScriptSerializer js = new JavaScriptSerializer();

            Context.Response.Clear();
            Context.Response.ContentType = "application/json";
            Context.Response.Write(js.Serialize(volunteerList));
        }
예제 #29
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao, string colunaSort)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(Taxa));

            dicionario.Add("DSC_ATIVO", "DscAtivo");
            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }
            lstParametros.Add(new Parameter(colunaSort, null, OperationTypes.Null, direcao));

            return(this.oDao.Select(lstParametros, "platinium", "VI_TAXA_TAXA", dicionario));
        }
예제 #30
0
        public DataTable Consultar(Dictionary <string, object> filtros, string direcao, string colunaSort)
        {
            Dictionary <string, string> dicionario = ClassFunctions.GetMap(typeof(UnidadeOrcamentaria));

            dicionario.Add("DSC_SECRETARIA_SIGLA", "DscSecretariaSigla");
            dicionario.Add("COD_ORGAO", "codOrgao");
            dicionario.Add("DSC_ORGAO_SIGLA", "dscOrgaoSigla");
            dicionario.Add("DSC_PODER", "dscPoder");
            dicionario.Add("COD_PODER", "codPoder");
            dicionario.Add("COD_TIPO_ENTIDADE", "codTipoEntidade");
            dicionario.Add("DSC_TIPO_ENTIDADE", "dscTipoEntidade");
            dicionario.Add("DSC_ATIVO", "DscAtivo");
            List <Parameter> lstParametros = new List <Parameter>();

            foreach (KeyValuePair <string, object> item in filtros)
            {
                if (item.Value != null)
                {
                    if (item.Value.GetType() == typeof(Int32))
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.EqualsTo));
                    }
                    else
                    {
                        lstParametros.Add(new Parameter(item.Key, item.Value, OperationTypes.Like));
                    }
                }
            }
            lstParametros.Add(new Parameter(colunaSort, null, OperationTypes.Null, direcao));

            return(this.oDao.Select(lstParametros, "platinium", "VI_UNIDADE_ORCAMENTARIA", dicionario));
        }