/// <summary> /// Realiza la carga del archivo de pago de la declaración en el servidor /// </summary> /// <returns></returns> public bool UploadArchivoPago() { try { if (sEstadoPago == "Pagada") { if (!string.IsNullOrEmpty(openFileDialogDocumento.FileName)) { //VALIDA SI LOS DIRECTORIO EXISTEN, SI NO, SE CREAN LAS CARPETAS FTPServer.CreateDirectory(FTPCredentials.Path, FTPCredentials.User, FTPCredentials.Password, string.Format(@"{0}/04. Declaraciones, acuses y pagos de impuestos federales/Pagos/{1}/{2}/", _Editar.sClient, sDecTipoTx, DateTime.Now.ToString("dd-MM-yyyy"))); //CUENTA CUANTOS ARCHIVOS EXISTEN EN EL DIRECTORIO int i = FTPServer.CountFileList(FTPCredentials.Path, FTPCredentials.User, FTPCredentials.Password, string.Format(@"{0}/04. Declaraciones, acuses y pagos de impuestos federales/Pagos/{1}/{2}/", _Editar.sClient, sDecTipoTx, DateTime.Now.ToString("dd-MM-yyyy"))); //COPIA Y CAMBIA EL NOMBRE DE LOS ARCHIVO SELECCIONADOS EN EL CONTROL OPENFILEDIALOG foreach (string fileName in openFileDialogDocumento.FileNames) { //COPIA Y CAMBIO DE NOMBRE DEL ARCHIVO i++; string FullPath = string.Format("{0}/{1}/{2}/04. Declaraciones, acuses y pagos de impuestos federales/Pagos/{3}/{4}", FTPCredentials.Path, ConnectionString.FolderConnection, _Editar.sClient, sDecTipoTx, DateTime.Now.ToString("dd-MM-yyyy")); FTPServer.Upload(FullPath, FTPCredentials.User, FTPCredentials.Password, Path.GetFileName(fileName), fileName); FTPServer.RenameFile(FullPath, FTPCredentials.User, FTPCredentials.Password, Path.GetFileName(fileName), i.ToString() + DateTime.Now.ToString("ddMMyyyy") + Path.GetExtension(fileName)); //GUARDA UN REGISTRO DE LA RUTA DONDE SE GUARDO EL ARCHIVO new Adjunto().insertarAdjunto(new Adjunto() { iIdDeclaracion = _Editar.iIdStatement, iIdRegistroObligacion = int.Parse(cbDecTipo.SelectedValue.ToString()), iIdCliente = _Editar.iIdClient, sAdjunto = string.Format("{0}/{1}/{2}/04. Declaraciones, acuses y pagos de impuestos federales/Pagos/{3}/{4}/{5}", FTPCredentials.Path, ConnectionString.FolderConnection, _Editar.sClient, sDecTipoTx, DateTime.Now.ToString("dd-MM-yyyy"), i.ToString() + DateTime.Now.ToString("ddMMyyyy") + Path.GetExtension(fileName)) }); } } } return(true); } catch (Exception) { return(false); } }
/// <summary> /// Realiza la carga del archivo de pago de la declaración en el servidor /// </summary> public void cargarArchivos(int iIdDeclaracion) { //VALIDA SI ESTADO DE PAGO ESTA EN "PAGADA" if (iEstadoPago == 3) { try { // VALIDA SI LOS DIRECTORIO EXISTEN, SI NO, SE CREAN LAS CARPETAS FTPServer.CreateDirectory(FTPCredentials.Path, FTPCredentials.User, FTPCredentials.Password, string.Format(@"{0}/04. Declaraciones, acuses y pagos de impuestos federales/Pagos/{1}/{2}/", _AltaDeclaracion.Cliente.sCliente, sDecTipoTx, DateTime.Now.ToString("dd-MM-yyyy"))); //CUENTA CUANTOS ARCHIVOS EXISTEN EN EL DIRECTORIO int i = FTPServer.CountFileList(FTPCredentials.Path, FTPCredentials.User, FTPCredentials.Password, string.Format(@"{0}/04. Declaraciones, acuses y pagos de impuestos federales/Pagos/{1}/{2}/", _AltaDeclaracion.Cliente.sCliente, sDecTipoTx, DateTime.Now.ToString("dd-MM-yyyy"))); //COPIA Y CAMBIA EL NOMBRE DE LOS ARCHIVO SELECCIONADOS EN EL CONTROL OPENFILEDIALOG foreach (string fileName in openFileDialogDocumento.FileNames) { //COPIA Y CAMBIO DE NOMBRE DEL ARCHIVO i++; string FullPath = string.Format("{0}/{1}/{2}/04. Declaraciones, acuses y pagos de impuestos federales/Pagos/{3}/{4}", FTPCredentials.Path, ConnectionString.FolderConnection, _AltaDeclaracion.Cliente.sCliente, sDecTipoTx, DateTime.Now.ToString("dd-MM-yyyy")); FTPServer.Upload(FullPath, FTPCredentials.User, FTPCredentials.Password, Path.GetFileName(fileName), fileName); FTPServer.RenameFile(FullPath, FTPCredentials.User, FTPCredentials.Password, Path.GetFileName(fileName), i.ToString() + DateTime.Now.ToString("ddMMyyyy") + Path.GetExtension(fileName)); //GUARDA UN REGISTRO DE LA RUTA DONDE SE GUARDO EL ARCHIVO new Adjunto().insertarAdjunto(new Adjunto() { iIdDeclaracion = iIdDeclaracion, iIdRegistroObligacion = int.Parse(sDecTipo), iIdCliente = Cliente.iIdCliente, sAdjunto = string.Format("{0}/{1}/{2}/04. Declaraciones, acuses y pagos de impuestos federales/Pagos/{3}/{4}/{5}", FTPCredentials.Path, ConnectionString.FolderConnection, _AltaDeclaracion.Cliente.sCliente, sDecTipoTx, DateTime.Now.ToString("dd-MM-yyyy"), i.ToString() + DateTime.Now.ToString("ddMMyyyy") + Path.GetExtension(fileName)) }); } } catch (Exception) { } } }
/// <summary> /// Realiza la carga del archivo de pago de la declaración en el servidor /// </summary> public void cargarArchivos(int iIdDeclaracion) { //VALIDA SI ESTADO DE PAGO ESTA EN "PAGADA" if (iEstadoPago == 3) { try { // VALIDA SI LOS DIRECTORIO EXISTEN, SI NO, SE CREAN LAS CARPETAS FTPServer.CreateDirectory(FTPCredentials.Path, FTPCredentials.User, FTPCredentials.Password, string.Format(@"{0}/04. Declaraciones, acuses y pagos de impuestos federales/Pagos/{1}/{2}/", _EditarDeclaracion.Cliente.sCliente, sDecTipoTx, DateTime.Now.ToString("dd-MM-yyyy"))); //CUENTA CUANTOS ARCHIVOS EXISTEN EN EL DIRECTORIO int i = FTPServer.CountFileList(FTPCredentials.Path, FTPCredentials.User, FTPCredentials.Password, string.Format(@"{0}/04. Declaraciones, acuses y pagos de impuestos federales/Pagos/{1}/{2}/", _EditarDeclaracion.Cliente.sCliente, sDecTipoTx, DateTime.Now.ToString("dd-MM-yyyy"))); //COPIA Y CAMBIA EL NOMBRE DE LOS ARCHIVO SELECCIONADOS EN EL CONTROL OPENFILEDIALOG foreach (string fileName in openFileDialogDocumento.FileNames) { //COPIA Y CAMBIO DE NOMBRE DEL ARCHIVO i++; string FullPath = string.Format("{0}/{1}/{2}/04. Declaraciones, acuses y pagos de impuestos federales/Pagos/{3}/{4}", FTPCredentials.Path, ConnectionString.FolderConnection, _EditarDeclaracion.Cliente.sCliente, sDecTipoTx, DateTime.Now.ToString("dd-MM-yyyy")); FTPServer.Upload(FullPath, FTPCredentials.User, FTPCredentials.Password, Path.GetFileName(fileName), fileName); FTPServer.RenameFile(FullPath, FTPCredentials.User, FTPCredentials.Password, Path.GetFileName(fileName), i.ToString() + DateTime.Now.ToString("ddMMyyyy") + Path.GetExtension(fileName)); //GUARDA UN REGISTRO DE LA RUTA DONDE SE GUARDO EL ARCHIVO new Adjunto().insertarAdjunto(new Adjunto() { iIdDeclaracion = iIdDeclaracion, iIdRegistroObligacion = int.Parse(sDecTipo), iIdCliente = Cliente.iIdCliente, sAdjunto = string.Format("{0}/{1}/{2}/04. Declaraciones, acuses y pagos de impuestos federales/Pagos/{3}/{4}/{5}", FTPCredentials.Path, ConnectionString.FolderConnection, _EditarDeclaracion.Cliente.sCliente, sDecTipoTx, DateTime.Now.ToString("dd-MM-yyyy"), i.ToString() + DateTime.Now.ToString("ddMMyyyy") + Path.GetExtension(fileName)) }); } } catch (Exception) { } } // //VALIDA SI ESTADO DE PAGO ESTA EN "PAGADA" // if (iEstadoPago == 3) // { // try // { ////VALIDA SI LOS DIRECTORIO EXISTEN, SI NO, SE CREAN LAS CARPETAS //if (!Directory.Exists(@"\\192.168.1.34\\Documentos\\" + LogicaCC.ConnectionString.FolderConnection + "\\Documentos\\Clientes\\" + sCliente + "\\" + "Expediente en Linea\\04. Declaraciones, acuses y pagos de impuestos federales\\Pagos\\" + txtDecTipo.Text + "\\" + DateTime.Now.ToString("dd-MM-yyyy"))) // Directory.CreateDirectory(@"\\192.168.1.34\\Documentos\\" + LogicaCC.ConnectionString.FolderConnection + "\\Documentos\\Clientes\\" + sCliente + "\\" + "Expediente en Linea\\04. Declaraciones, acuses y pagos de impuestos federales\\Pagos\\" + txtDecTipo.Text + "\\" + DateTime.Now.ToString("dd-MM-yyyy")); // //CUENTA EL NÚMERO DE ARCHIVOS EN EL DIRECTORIO // var fileCount = (from file in Directory.EnumerateFiles(@"\\192.168.1.34\\Documentos\\" + LogicaCC.ConnectionString.FolderConnection + "\\Documentos\\Clientes\\" + iIdCliente + "\\" + "Declaraciones" + "\\" + txtDecTipo.Name + "\\" + DateTime.Now.ToString("dd-MM-yyyy")) select file).Count(); // int i = fileCount - 1; // //GUARDA LOS ARCHIVOS SELECCIONADOS EN EL CONTROL OPENFILEDIALOG // foreach (string fileName in openFileDialogDocumento.FileNames) // { // //COPIA Y CAMBIO DE NOMBRE DEL ARCHIVO // i++; // File.Copy(fileName, @"\\192.168.1.34\\Documentos\\" + LogicaCC.ConnectionString.FolderConnection + "\\Documentos\\Clientes\\" + sCliente + "\\" + "Expediente en Linea\\04. Declaraciones, acuses y pagos de impuestos federales\\Pagos\\" + txtDecTipo.Text + "\\" + DateTime.Now.ToString("dd-MM-yyyy") + "\\" + Path.GetFileName(fileName)); // File.Move(@"\\192.168.1.34\\Documentos\\" + LogicaCC.ConnectionString.FolderConnection + "\\Documentos\\Clientes\\" + sCliente + "\\" + "Expediente en Linea\\04. Declaraciones, acuses y pagos de impuestos federales\\Pagos\\" + txtDecTipo.Text + "\\" + DateTime.Now.ToString("dd-MM-yyyy") + "\\" + Path.GetFileName(fileName), @"\\192.168.1.34\\Documentos\\" + LogicaCC.ConnectionString.FolderConnection + "\\Documentos\\Clientes\\" + sCliente + "\\" + "Expediente en Linea\\04. Declaraciones, acuses y pagos de impuestos federales\\Pagos\\" + txtDecTipo.Text + "\\" + DateTime.Now.ToString("dd-MM-yyyy") + "\\" + i + DateTime.Now.ToString("ddMMyyyy") + Path.GetExtension(fileName)); // //SE GUARDA REGISTRO DEL ADJUNTO DEN LA BD // new Adjunto().insertarAdjunto(new Adjunto() // { // iIdDeclaracion = iIdDeclaracion, // iIdRegistroObligacion = int.Parse(txtDecTipo.Name.ToString()), // iIdCliente = iIdCliente, // sAdjunto = @"\\192.168.1.34\\Documentos\\" + LogicaCC.ConnectionString.FolderConnection + "\\Documentos\\Clientes\\" + iIdCliente + "\\" + "Declaraciones" + "\\" + txtDecTipo.Name + "\\" + DateTime.Now.ToString("dd-MM-yyyy") + "\\" + i + DateTime.Now.ToString("ddMMyyyy") + Path.GetExtension(fileName) // }); // } // //SE INICIALIZA AL APARTADO PARA SUBIR ARCHIVOS // txtRutaArchivo.Text = string.Empty; // openFileDialogDocumento.FileName = ""; // } // catch (Exception) // { // } // } }