private void SelecionarFoto_bt_Click(object sender, RoutedEventArgs e) { try { Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog(); openFileDialog.Multiselect = false; openFileDialog.Filter = "Imagem files (*.jpg)|*.jpg|All Files (*.*)|*.*"; openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); if (openFileDialog.ShowDialog() == true) { BitmapImage _img = new BitmapImage(new Uri(openFileDialog.FileName)); string _imgstr = Conversores.IMGtoSTR(_img); var fileLength = new FileInfo(openFileDialog.FileName).Length; //limitar o tamanho futuro Foto_im.Source = _img; ((ClasseColaboradores.Colaborador)ListaColaboradores_lv.SelectedItem).Foto = _imgstr; //Conversores.IMGtoSTR(new BitmapImage(new Uri(arquivoLogo.FileName))); //ListaEmpresas_lv.Items.Refresh(); //BindingExpression be = BindingOperations.GetBindingExpression(Logo_im, Image.SourceProperty); //be.UpdateTarget(); //_imgstr = null; } } catch (Exception ex) { } }
public static IConversor ObterConversor(Conversores conversor) { return(conversor switch { Conversores.MedidasDeComprimento => new ConversorMedidasDeComprimento(), _ => throw new NotImplementedException($"Conversor Nao Implementado. Tipo de conversor: {conversor}"), });
private void SelecionarLogo_bt_Click(object sender, RoutedEventArgs e) { try { Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog(); openFileDialog.Multiselect = false; openFileDialog.Filter = "Images (*.BMP;*.JPG;*.GIF,*.PNG,*.TIFF)|*.BMP;*.JPG;*.GIF;*.PNG;*.TIFF|" + "All files (*.*)|*.*"; openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); if (openFileDialog.ShowDialog() == true) { BitmapImage _img = new BitmapImage(new Uri(openFileDialog.FileName)); string _imgstr = Conversores.IMGtoSTR(_img); Logo_im.Source = _img; ((ClasseEmpresas.Empresa)ListaEmpresas_lv.SelectedItem).Logo = _imgstr; //Conversores.IMGtoSTR(new BitmapImage(new Uri(arquivoLogo.FileName))); //ListaEmpresas_lv.Items.Refresh(); //BindingExpression be = BindingOperations.GetBindingExpression(Logo_im, Image.SourceProperty); //be.UpdateTarget(); //_imgstr = null; } } catch (Exception ex) { } }
public ActionResult NovaDespesa(FormCollection form, HttpPostedFileBase file) { try { Despesa _despesa = new Despesa { Valor = Convert.ToDecimal(form["valor"]), AccountId = AccountRepositorio.RetornaIdUsuarioLogado(), ContaId = Convert.ToInt32(form["conta"]), TipoDespesaId = Convert.ToInt32(form["tipodespesa"]), TipoPagamentoId = Convert.ToInt32(form["pagamento"]), DataCadastro = Convert.ToDateTime(form["data"]), Descricao = Convert.ToString(form["descricao"]), Arquivo = file != null?Conversores.ConverToBytes(file) : null, IsParcelado = false, QtdeParcela = 0, ValorParcela = 0, IsAtivo = true }; _repositorio.Salvar(_despesa); @ViewBag.sucesso = "Despesa criada com sucesso."; InicializarDadosTelaNovaDespesa(); return(View()); } catch (Exception e) { @ViewBag.erro = e.Message; return(View()); } }
public void OnBuscarArquivoCommand() { try { System.Windows.Forms.OpenFileDialog _arquivoPDF = new System.Windows.Forms.OpenFileDialog(); string _nomecompletodoarquivo; string _arquivoSTR; _arquivoPDF.InitialDirectory = "c:\\\\"; _arquivoPDF.Filter = "Imagem files (*.pdf)|*.pdf|All Files (*.*)|*.*"; _arquivoPDF.RestoreDirectory = true; _arquivoPDF.ShowDialog(); _nomecompletodoarquivo = _arquivoPDF.SafeFileName; _arquivoSTR = Conversores.PDFtoString(_arquivoPDF.FileName); _ColaboradorAnexoTemp.NomeArquivo = _nomecompletodoarquivo; _ColaboradorAnexoTemp.Arquivo = _arquivoSTR; if (ColaboradoresAnexos != null) { ColaboradoresAnexos[0].NomeArquivo = _nomecompletodoarquivo; } } catch (Exception ex) { } }
public void OnBuscarArquivoCommand() { try { System.Windows.Forms.OpenFileDialog _arquivoPDF = new System.Windows.Forms.OpenFileDialog(); string _sql; string _nomecompletodoarquivo; string _arquivoSTR; _arquivoPDF.InitialDirectory = "c:\\\\"; _arquivoPDF.Filter = "Imagem files (*.pdf)|*.pdf|All Files (*.*)|*.*"; _arquivoPDF.RestoreDirectory = true; _arquivoPDF.ShowDialog(); //if (_arquivoPDF.ShowDialog()) //System.Windows.Forms.DialogResult.Yes //{ _nomecompletodoarquivo = _arquivoPDF.SafeFileName; _arquivoSTR = Conversores.PDFtoString(_arquivoPDF.FileName); _seguroTemp.NomeArquivo = _nomecompletodoarquivo; _seguroTemp.Arquivo = _arquivoSTR; if (Seguros != null) { Seguros[0].NomeArquivo = _nomecompletodoarquivo; } //InsereArquivoBD(Convert.ToInt32(veiculoID), _nomecompletodoarquivo, _arquivoSTR); //AtualizaListaAnexos(_resp); //} } catch (Exception ex) { } }
public PopupPdfViewer(string _PDF) { InitializeComponent(); MouseDown += Window_MouseDown; _ArquivoPDF = _PDF; byte[] buffer = Conversores.StringToPDF(_ArquivoPDF); _ArquivoPDF = System.IO.Path.GetRandomFileName(); _ArquivoPDF = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\" + _ArquivoPDF; _ArquivoPDF = System.IO.Path.ChangeExtension(_ArquivoPDF, ".pdf"); System.IO.File.WriteAllBytes(_ArquivoPDF, buffer); pdfWebViewer.Navigate(new Uri(_ArquivoPDF)); }
public async Task <IList <BuscaVideosViewModel> > BuscarAsync(string busca) { try { var youtubeService = new YouTubeService(new BaseClientService.Initializer() { ApplicationName = _appSettings.ApplicationName, //"Hiring", ApiKey = _appSettings.ApiKey //"AIzaSyD7h-uHD6L8SUhIIrhxxy0cLBzBjZ-Xq1E" }); var searchListRequest = youtubeService.Search.List(_appSettings.Parth); searchListRequest.Q = busca; searchListRequest.Order = SearchResource.ListRequest.OrderEnum.Date; searchListRequest.MaxResults = 25; var searchListResponse = await searchListRequest.ExecuteAsync(); var videos = new List <BuscaVideosViewModel>(); var guidBusca = Guid.NewGuid(); foreach (var searchResult in searchListResponse.Items) { var video = new BuscaVideosViewModel { TermoBusca = busca, BuscaGuid = guidBusca, ImagemCapa = searchResult.Snippet.Thumbnails.Medium.Url, DataBusca = DateTime.Now, VideoId = searchResult.Id.VideoId, CanalId = searchResult.Snippet.ChannelId, CanalTitulo = searchResult.Snippet.ChannelTitle, Descricao = searchResult.Snippet.Description, Tag = searchResult.ETag, DataPublicacao = searchResult.Snippet.PublishedAt, Titulo = searchResult.Snippet.Title, Tipo = Conversores.ParseDescriptionToEnum <TipoVideo>(searchResult.Id.Kind) }; videos.Add(video); } //inserindo no banco e retornando a lista com o id return(_mapper.Map <List <BuscaVideosViewModel> >(_repositorio.InsertMany(_mapper.Map <List <BuscaVideos> >(videos)))); } catch (Exception e) { Console.WriteLine(e); throw; } }
private void CapturarFoto_bt_Click(object sender, RoutedEventArgs e) { try { PopupWebCam _PopupWebCam = new PopupWebCam(); _PopupWebCam.ShowDialog(); BitmapSource _img = _PopupWebCam.Captura; if (_img != null) { string _imgstr = Conversores.IMGtoSTR(_img); Foto_im.Source = _img; ((ClasseColaboradores.Colaborador)ListaColaboradores_lv.SelectedItem).Foto = _imgstr; } } catch (Exception ex) { } }
public void OnBuscarArquivoCommand() { try { System.Windows.Forms.OpenFileDialog _arquivoPDF = new System.Windows.Forms.OpenFileDialog(); string _sql; string _nomecompletodoarquivo; string _arquivoSTR; _arquivoPDF.InitialDirectory = "c:\\\\"; _arquivoPDF.Filter = "(*.pdf)|*.pdf|All Files (*.*)|*.*"; _arquivoPDF.RestoreDirectory = true; _arquivoPDF.ShowDialog(); //if (_arquivoPDF.ShowDialog()) //System.Windows.Forms.DialogResult.Yes //{ _nomecompletodoarquivo = _arquivoPDF.SafeFileName; _arquivoSTR = Conversores.PDFtoString(_arquivoPDF.FileName); _signatarioTemp.Assinatura = _arquivoSTR; } catch (Exception ex) { } }
public string Literal_Post([FromHeader] int numero) { return(Conversores.NumeroALetras(numero)); }
public string Literal_Get(int numero) { return(Conversores.NumeroALetras(numero)); }
public MapeamentoTabela(Tabela tabelaDaFonte, Tabela tabelaDoDestino) { Nome = tabelaDaFonte.Nome; Colunas = tabelaDaFonte.Colunas.Join(tabelaDoDestino.Colunas, c => c.Nome, c => c.Nome, (colunaFonte, colunaDestino) => Tuple.Create(colunaFonte.Nome, colunaDestino.DataType, Conversores.RecuperarConversor(colunaFonte.DataType, colunaDestino.DataType))).ToList(); Customizada = Colunas.Any(c => c.Item3 != null); }
public string LiteralPost([FromHeader] int numero) //COn el Post siempre FromHeader { return(Conversores.NumeroALetras(numero)); }
public string Literalget(int numero) { return Conversores.NumeroALetras(numero); }
public string literal(int numero) { string cadena = Conversores.ToText(numero); return(cadena); }
public string literal1([FromHeader] int numero) { string cadena = Conversores.ToText(numero);; return(cadena); }
public static void GetDocumentoFromMove(int moveId) { MySqlConnection connection = null; connection = new MySqlConnection(ConnectionConfig.connectionString); Console.WriteLine(ConnectionConfig.connectionString); MySqlCommand command = connection.CreateCommand(); command.CommandText = "SELECT " + "it_tmove.Docu_type_ID AS 'TipoDocumento', " + //Receptor "fl_tcustomer.TaxExemptNo, " + "fl_tcustomer.SS_NO, " + "idtypes.Codigo AS 'Tipo_Doc_Receptor', " + "Company_Name, " + "Cust_name, " + "it_tmove.Move_wic_Value, " + "it_tmove.Money_Conv, " + "it_tmove.Ticket_count AS 'IdDocumento', " + "it_tmove.Move_Date AS 'FechaEmision', " + "SUM(it_tdetamove.Move_Deta_Tax_Value) AS 'TotalIgv', " + "SUM(it_tdetamove.Move_Deta_Tax2_Value) AS 'TotalIsc', " + "SUM((it_tdetamove.Move_Deta_Q * it_tdetamove.Move_Deta_price)) AS 'TotalVenta' " + "FROM it_tmove " + "LEFT JOIN fl_tcustomer ON it_tmove.Cust_Id = fl_tcustomer.Cust_ID " + "INNER JOIN it_tdetamove ON it_tdetamove.Move_Deta_Move_ID = it_tmove.Move_ID " + "LEFT JOIN idtypes ON idtypes.TYPE_ID = fl_tcustomer.IDType " + "WHERE it_tmove.Move_ID = " + moveId + " " + "GROUP BY NULL;"; MySqlDataReader Reader; Console.WriteLine(command.CommandText); connection.Open(); Reader = command.ExecuteReader(); int i = 0; while (Reader.Read()) { string TipoDocumento = HelpersDatabase.GetString(Reader, "TipoDocumento"); string TaxExemptNo = HelpersDatabase.GetString(Reader, "TaxExemptNo"); string SS_NO = HelpersDatabase.GetString(Reader, "SS_NO"); string Tipo_Doc_Receptor = HelpersDatabase.GetString(Reader, "Tipo_Doc_Receptor"); string Company_Name = HelpersDatabase.GetString(Reader, "Company_Name"); string Cust_name = HelpersDatabase.GetString(Reader, "Cust_name"); decimal PrecioUnitario = HelpersDatabase.GetInt(Reader, "Move_wic_Value"); decimal Money_Conv = HelpersDatabase.GetInt(Reader, "Money_Conv"); string IdDocumento = HelpersDatabase.GetString(Reader, "IdDocumento"); string FechaEmision = HelpersDatabase.GetDate(Reader, "FechaEmision"); string HoraEmision = HelpersDatabase.GetTime(Reader, "FechaEmision"); decimal TotalIgv = Reader.GetInt32("TotalIgv"); decimal TotalIsc = Reader.GetInt32("TotalIsc"); decimal TotalVenta = Reader.GetInt32("TotalVenta"); string NombreLegal; string NroDocumento; DetasPlusTaxes detasPlusTaxes = GetDETFromMove(moveId); if (string.IsNullOrEmpty(Company_Name) && string.IsNullOrEmpty(TaxExemptNo)) { NombreLegal = Cust_name; NroDocumento = SS_NO; } else { NombreLegal = Company_Name; NroDocumento = TaxExemptNo; } string Moneda; if (PrecioUnitario == 0 && Money_Conv == 0) { Moneda = "PEN"; } else { Moneda = "USD"; } IDE iDE = new IDE() { numeracion = IdDocumento, fechaEmision = FechaEmision, horaEmision = HoraEmision, codTipoDocumento = TipoDocumento, tipoMoneda = Moneda, //numeroOrdenCompra = "", //fechaVencimiento = "", }; EMI eMI = new EMI() { //codigoPais = "", //correoElectronico = "", tipoDocId = "6",//falta departamento = Settings.Default.emDepartamento, direccion = Settings.Default.emDireccion, distrito = Settings.Default.emDistrito, nombreComercial = Settings.Default.emNombreComercial, numeroDocId = Settings.Default.emRUC, provincia = Settings.Default.emProvincia, razonSocial = Settings.Default.emNombreLegal, //telefono = "", ubigeo = Settings.Default.emUbigeo, urbanizacion = Settings.Default.emUrbanizacion, }; DRF dRF = new DRF() { numeroDocRelacionado = "", tipoDocRelacionado = "", }; CAB cAB = new CAB() { gravadas = new Gravadas() { codigo = "1002", totalVentas = "" }, inafectas = new Inafectas() { codigo = "1004", totalVentas = "" }, importeTotal = TotalVenta.ToString(), leyenda = new List <Leyenda>() { new Leyenda() { codigo = "1000", descripcion = Conversores.NumeroALetras(TotalVenta) } }, tipoOperacion = "01", totalImpuestos = new List <TotalImpuesto>() { new TotalImpuesto() { idImpuesto = "1000", montoImpuesto = TotalIgv.ToString() }, //IGV new TotalImpuesto() { idImpuesto = "2000", montoImpuesto = TotalIsc.ToString() } //ISC } }; REC rEC = new REC() { //codigoPais = "", //correoElectronico = "", //departamento = "", //direccion = "", //distrito = "", numeroDocId = NroDocumento, //provincia = "", razonSocial = NombreLegal, //telefono = "", tipoDocId = Tipo_Doc_Receptor, }; //GetDETFromMove(moveId), string output; if (TipoDocumento == "1") { Factura fac = new Factura() { IDE = iDE, EMI = eMI, REC = rEC, //DRF = , CAB = cAB, DET = GetDETFromMove(moveId).DET, //ADI }; output = JsonConvert.SerializeObject(fac, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); } else { Boleta bol = new Boleta() { IDE = iDE, EMI = eMI, REC = rEC, //DRF = , CAB = cAB, DET = GetDETFromMove(moveId).DET, //ADI }; output = JsonConvert.SerializeObject(bol, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, }); } Console.WriteLine(output); } Reader.Close(); }
public string literal1([FromHeader] int numero) { string cadena = Conversores.NumeroALetras(numero); return(cadena); }