public bool validarDocumento(FileUpload fuDocumento) { // Funcion que valida el documento adjuntado bool vretorno = true; //Variable flag string msje = CENConstante.g_const_vacio; //variable de mensaje CADCliente consulta = new CADCliente(); if (fuDocumento.FileContent.Length == CENConstante.g_const_0) { msje = consulta.SeleccionarConcepto(CENConstante.g_const_1, CENConstante.g_const_10, CENConstante.g_const_1); MostrarMensaje(CENConstante.g_const_2, msje); return(false); } return(vretorno); }
public string obtenerDescripcionConcepto(int flag, int prefijo, int correlativo) { //DESCRIPCION:Obtener descripcion concepto por correlativo String mensaje; CADCliente CADCliente = new CADCliente(); try { mensaje = CADCliente.SeleccionarConcepto(flag, prefijo, correlativo); } catch (Exception ex) { throw ex; } return(mensaje); }
private bool validartipoDocumento(FileUpload fuDocumento) { // Funcion que valida el documento adjuntado sea excel bool vretorno = true; //Variable flag string msje = CENConstante.g_const_vacio; //variable de mensaje CADCliente consulta = new CADCliente(); string[] cExtension = null; //Variable de extension de archivo cExtension = fuDocumento.FileName.Split('.'); if (cExtension[cExtension.Length - CENConstante.g_const_1].ToLower() != CENConstante.g_extension_xls & cExtension[cExtension.Length - CENConstante.g_const_1].ToLower() != CENConstante.g_extension_xlsx) { msje = consulta.SeleccionarConcepto(CENConstante.g_const_1, CENConstante.g_const_10, CENConstante.g_const_2); MostrarMensaje(CENConstante.g_const_2, msje); return(false); } return(vretorno); }
private bool DocumentoCarga(DataTable dt) { //DESCRIPCION: Permite validar data correcta de la carga masiva bool val = true; string msje = string.Empty; CLNConcepto concepto = new CLNConcepto(); CADCliente consulta = new CADCliente(); List <CENConcepto> lista = new List <CENConcepto>(); CLNProducto producto = new CLNProducto(); int i = CENConstante.g_const_0; int fila = CENConstante.g_const_0; //Fila bool flag = true; try { lista = concepto.ListarConceptos(10); if (dt.Columns.Count != lista.Count()) { msje = consulta.SeleccionarConcepto(CENConstante.g_const_1, CENConstante.g_const_10, CENConstante.g_const_4); MostrarMensaje(CENConstante.g_const_1, msje); val = false; return(val); } else { val = true; } foreach (DataColumn Col in dt.Columns) { if (val) { string col = dt.Columns[i].ColumnName; if (Col.Caption.ToUpper().Trim() != lista[i].descripcion.ToUpper().Trim()) { msje = consulta.SeleccionarConcepto(CENConstante.g_const_1, CENConstante.g_const_10, CENConstante.g_const_5); MostrarMensaje(CENConstante.g_const_1, msje); val = false; return(val); } } else { break; } i++; } if (dt.Rows.Count == CENConstante.g_const_0) { msje = consulta.SeleccionarConcepto(CENConstante.g_const_1, CENConstante.g_const_10, CENConstante.g_const_6); MostrarMensaje(CENConstante.g_const_1, msje); val = false; return(val); } for (var r = CENConstante.g_const_0; r < dt.Rows.Count; r++) { int xcant = producto.ObtenerCantidad(dt.Rows[r][CENConstante.g_const_0].ToString()); if (xcant == CENConstante.g_const_0) { fila = r + CENConstante.g_const_2; msje = consulta.SeleccionarConcepto(CENConstante.g_const_1, CENConstante.g_const_10, CENConstante.g_const_8); msje = msje + dt.Rows[r][CENConstante.g_const_0].ToString(); MostrarMensaje(CENConstante.g_const_1, msje); val = false; return(val); } } for (var m = CENConstante.g_const_0; m < dt.Rows.Count; m++) { for (var j = CENConstante.g_const_0; j < dt.Columns.Count; j++) { if (j == CENConstante.g_const_0) { string data = dt.Rows[m][j].ToString(); if (data is null || data.Trim() == CENConstante.g_const_vacio || data.Length == CENConstante.g_const_0) { fila = m + CENConstante.g_const_2; msje = consulta.SeleccionarConcepto(CENConstante.g_const_1, CENConstante.g_const_10, CENConstante.g_const_7); msje = msje + fila; MostrarMensaje(CENConstante.g_const_1, msje); val = false; return(val); } else { if (m >= CENConstante.g_const_1) { for (var k = CENConstante.g_const_0; k < dt.Rows.Count; k++) { if (data.Equals(dt.Rows[k][CENConstante.g_const_0].ToString().Trim()) && k != m) { fila = m + CENConstante.g_const_2; msje = consulta.SeleccionarConcepto(CENConstante.g_const_1, CENConstante.g_const_10, CENConstante.g_const_7); msje = msje + fila; MostrarMensaje(CENConstante.g_const_1, msje); val = false; flag = false; break; } } } if (!flag) { break; } } } else if (j > CENConstante.g_const_1) { string datafila = dt.Rows[m][j].ToString(); if (datafila is null || datafila.Trim() == CENConstante.g_const_vacio) { fila = m + CENConstante.g_const_2; msje = consulta.SeleccionarConcepto(CENConstante.g_const_1, CENConstante.g_const_10, CENConstante.g_const_7); msje = msje + fila; MostrarMensaje(CENConstante.g_const_1, msje); val = false; return(val); } else { int numero = CENConstante.g_const_0; if (!int.TryParse(dt.Rows[m][j].ToString(), out numero)) { fila = m + CENConstante.g_const_2; msje = consulta.SeleccionarConcepto(CENConstante.g_const_1, CENConstante.g_const_10, CENConstante.g_const_9); msje = msje + fila; MostrarMensaje(CENConstante.g_const_1, msje); val = false; return(val); } int datat = Convert.ToInt32(dt.Rows[m][j].ToString()); if (datat < CENConstante.g_const_0) { fila = m + CENConstante.g_const_2; msje = consulta.SeleccionarConcepto(CENConstante.g_const_1, CENConstante.g_const_10, CENConstante.g_const_7); msje = msje + fila; MostrarMensaje(CENConstante.g_const_1, msje); val = false; return(val); } } }