private void cmdAdd_Click(object sender, EventArgs e) { DataSet DSDevuelveID = new DataSet(); DataTable DTDevuelveID = new DataTable(); WSCFianza.WSCFianza WSCF = new WSCFianza.WSCFianza(); WSCF.Url = mdlGenerales.DireccionWS + "FazServices/WSCFianza.asmx"; if (MayorACero(txtValor.Text.ToString()) == false) { MessageBoxAdv.Show("El valor referencial debe de ser nùmerico y mayor que 0", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); txtValor.Focus(); return; } if (MayorACero(txtMonto.Text.ToString()) == false) { MessageBoxAdv.Show("El monto de la entrega a rendir debe de ser nùmerico y mayor que 0", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); txtMonto.Focus(); return; } string Sidproyecto = IDproyecto[Convert.ToInt32(cmbProyecto.SelectedIndex.ToString())].ToString(); string SNumeroRuc = RucEmpresa[Convert.ToInt32(cmbEmpresa.SelectedIndex.ToString())].ToString(); string SIDCartaFianza = "1"; string SDetalle = txtDetalle.Text.ToString(); string Svalor = txtValor.Text.ToString(); string SMonto = txtMonto.Text.ToString(); string SRuc = txtRucEmisor.Text.ToString(); string SEmisor = lblEmisor.Text.ToString(); string SDireccion = lblDireccion.Text.ToString(); DSDevuelveID = WSCF.ActualizaCFFC(mdlGenerales.Conexion, Sidproyecto, SIDCartaFianza, SDetalle, Svalor, SMonto, dtpFecha.Value.ToString("yyyy/MM/dd"), DTPVencimiento.Value.ToString("yyyy/MM/dd"), SNumeroRuc, SEmisor, SDireccion, mdlGenerales.STRUsuario); DTDevuelveID = DSDevuelveID.Tables[0]; String strResultado = ""; Int32 intResultado = 0; foreach (DataRow Row in DTDevuelveID.Rows) { intResultado = Convert.ToInt32(Row[0].ToString()); strResultado = Row[1].ToString(); } if (intResultado == 0) { MessageBoxAdv.Show(strResultado, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); Limpiar(); DevuelveDatosCFFC(); return; } else { MessageBoxAdv.Show("Ocurrio un error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void DevuelveDatosCFFC() { WSCFianza.WSCFianza WSCF = new WSCFianza.WSCFianza(); WSCF.Url = mdlGenerales.DireccionWS + "FazServices/WSCFianza.asmx"; DataSet DSDevuelve = new DataSet(); DataTable DTTipo = new DataTable(); Int32 I = 0; DSDevuelve = WSCF.DevuelveDatosCFFC(mdlGenerales.Conexion, IDproyecto[Convert.ToInt32(cmbProyecto.SelectedIndex.ToString())].ToString()); DTTipo = DSDevuelve.Tables[0]; foreach (DataRow Row in DTTipo.Rows) { txtDetalle.Text = Row[2].ToString(); txtValor.Text = Row[3].ToString(); txtMonto.Text = Row[4].ToString(); if (Row[5].ToString() != "") { dtpFecha.Value = Convert.ToDateTime(Row[5].ToString()); } txtRucEmisor.Text = Row[6].ToString(); lblEmisor.Text = Row[7].ToString(); if (Row[8].ToString() != "") { DTPVencimiento.Value = Convert.ToDateTime(Row[8].ToString()); } lblDireccion.Text = Row[9].ToString(); lblArchivo.Text = Row[10].ToString(); if (lblArchivo.Text != "") { cmdVisualiza.Enabled = true; } else { cmdVisualiza.Enabled = false; } } }
private void cmdSubirArchivo_Click(object sender, EventArgs e) { String strResultado = ""; Int32 intResultado = 0; DataSet DSDevuelveID = new DataSet(); DataTable DTDevuelveID = new DataTable(); WSCFianza.WSCFianza WSCF = new WSCFianza.WSCFianza(); WSCF.Url = mdlGenerales.DireccionWS + "FazServices/WSCFianza.asmx"; if (txtDetalle.Text.ToString() == "") { MessageBoxAdv.Show("Debe de ingresar previamente la carta fianza", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string NombreArchivo = string.Concat("CFFC_" + IDproyecto[Convert.ToInt32(cmbProyecto.SelectedIndex.ToString())].ToString()); NombreArchivo = NombreArchivo.Replace(" ", ""); string extension = ""; /************************* * Subiendo foto *************************/ var dlg = new OpenFileDialog { Filter = @"PDF files (*.pdf)|*.pdf", CheckFileExists = true, Title = @"Seleccione el archivo", Multiselect = false }; ; if (dlg.ShowDialog() == DialogResult.OK) // Test result. { FileInfo fi = new FileInfo(dlg.FileName); if (fi.Exists) { extension = fi.Extension.ToString(); fi.CopyTo(dlg.FileName.Replace(dlg.SafeFileName, "") + NombreArchivo + extension); } //aqui me quedo UploadFoto(dlg.FileName.Replace(dlg.SafeFileName, "") + NombreArchivo + extension, ""); File.Delete(dlg.FileName.Replace(dlg.SafeFileName, "") + NombreArchivo + extension); } else { MessageBoxAdv.Show("Se cancelo el registro", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } /************************************ * Registrando experiencia en BD ************************************/ DSDevuelveID = WSCF.ActualizaCFFC_Archivo(mdlGenerales.Conexion, IDproyecto[Convert.ToInt32(cmbProyecto.SelectedIndex.ToString())].ToString(), "1", NombreArchivo + extension, mdlGenerales.STRUsuario); DTDevuelveID = DSDevuelveID.Tables[0]; foreach (DataRow Row in DTDevuelveID.Rows) { intResultado = Convert.ToInt32(Row[0].ToString()); strResultado = Row[1].ToString(); } if (intResultado == 1) { MessageBoxAdv.Show(strResultado, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); Limpiar(); DevuelveDatosCFFC(); } else { MessageBoxAdv.Show("No se pudo grabar el archivo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cmdVisualiza.Enabled = false; } }