private void CargarAcreedor()
        {
            LogicaNegocio Ln = new LogicaNegocio();
            var           dt = Ln.CRUDAcreedores(5, "", 0, "", "", 0, 0, 0, 0, "");

            util.CargaDDL(ddlAcreedor, dt, "Nombre", "IdAcreedor");
        }
Example #2
0
        private void CargarAcreedores()
        {
            LogicaNegocio Ln = new LogicaNegocio();
            DataTable     dt = new DataTable();

            dt = Ln.CRUDAcreedores(5, "", 0, "", "", 0, 0, 0, 0, "");
            util.CargaDDL(ddlbanco, dt, "Nombre", "IdAcreedor");
        }
        private void CargarAcreedores(string NombreAcreedor, string rutAcreedor)
        {
            LogicaNegocio ln = new LogicaNegocio();
            var           dt = ln.CRUDAcreedores(1, rutAcreedor, 0, NombreAcreedor, "", 0, 0, 0, 0, "");

            Page.Session["gvAcreedores"] = dt;
            gvAcreedores.DataSource      = dt;
            gvAcreedores.DataBind();
        }
Example #4
0
        private void CargarAcreedor()
        {
            LogicaNegocio ln = new LogicaNegocio();
            var           dt = ln.CRUDAcreedores(5, "", 0, "", "", 0, 0, 0, 0, "");

            util.CargaDDL(ddlAcreedor, dt, "Nombre", "IdAcreedor");

            //SPWeb app = SPContext.Current.Web;
            //app.AllowUnsafeUpdates = true;

            ////Banco
            //SPList items = app.Lists["Acreedores"];
            //SPQuery query = new SPQuery();
            //query.Query = "<Where><Eq><FieldRef Name='TipoAcreedor'/><Value Type='Text'>Banco</Value></Eq></Where>";
            //SPListItemCollection collListItems = items.GetItems(query);
            //util.CargaDDL(ddlAcreedor, collListItems.GetDataTable(), "Nombre", "ID");
        }
Example #5
0
        protected void UpSubirMasivo_FileUploadComplete(object sender, FileUploadCompleteEventArgs e)
        {
            try
            {
                if (e.IsValid)
                {
                    int           validarExiste = 0;
                    LogicaNegocio ln            = new LogicaNegocio();
                    DataTable     dtMotivo      = new DataTable("dtMotivo");
                    DataTable     dtCausa       = new DataTable("dtCausa");
                    DataTable     dtAcreedores  = new DataTable("dtAcreedores");

                    dtMotivo     = ln.ListarMotivos();
                    dtCausa      = ln.ListarCausas();
                    dtAcreedores = ln.CRUDAcreedores(1, "", 0, "", "", 0, 0, 0, 0, "");
                    int BuscarMotivo   = 0;
                    int BuscarCausa    = 0;
                    int BuscarBanco    = 0;
                    int BuscarAcreedor = 0;

                    var dtCsv = util.CSVtoDataTable(e.UploadedFile, ";");

                    for (var i = 0; i < dtCsv.Rows.Count - 1; i++)
                    {
                        var NroCertificado = dtCsv.Rows[i]["NCertificado"].ToString().Trim();
                        if (string.IsNullOrEmpty(NroCertificado.ToString()))
                        {
                            throw new Exception("El numero de certificado no puede estar vacio, linea " + (i + 1));
                        }

                        //validar si existe nro certificado en tabla operacion
                        validarExiste = ln.CP_VerificarCertificado(NroCertificado);
                        if (validarExiste == 0)
                        {
                            throw new Exception("El número de certificado no esta registrado, linea " + (i + 1));
                        }

                        //result = dt.Select("IdCalendario = '" + idCalendario.ToString() + "'");
                        var Motivo = dtCsv.Rows[i]["Motivo"].ToString().Trim();
                        if (string.IsNullOrEmpty(Motivo.ToString()))
                        {
                            throw new Exception("El Motivo ingresado no puede estar vacío, linea " + (i + 1));
                        }

                        //string MotivoExiste = string.Format("{0}{1}", "DescMotivo = ", Motivo.ToString());
                        BuscarMotivo = dtMotivo.Select("DescMotivo = '" + Motivo.ToString() + "'").Length;
                        if (BuscarMotivo <= 0)
                        {
                            throw new Exception("El motivo no existe en la parametrización, linea " + (i + 1));
                        }

                        var Causa = dtCsv.Rows[i]["Causa"].ToString().Trim();
                        if (string.IsNullOrEmpty(Causa.ToString()))
                        {
                            throw new Exception("La causa ingresada no puede estar vacía, linea " + (i + 1));
                        }

                        string CausaExiste = string.Format("{0}", "DescCausa = '" + Causa + "'");
                        BuscarCausa = dtCausa.Select(CausaExiste).Length;
                        if (BuscarCausa <= 0)
                        {
                            throw new Exception("La causa no existe en la parametrización, linea " + (i + 1));
                        }

                        var FechaCobro = dtCsv.Rows[i]["FechaCobro"].ToString().Trim();
                        if (string.IsNullOrEmpty(FechaCobro.ToString()))
                        {
                            throw new Exception("La fecha de cobro no puede estar vacia, linea " + (i + 1));
                        }

                        var FechaPago = dtCsv.Rows[i]["FechaPago"].ToString().Trim();
                        if (string.IsNullOrEmpty(FechaPago.ToString()))
                        {
                            throw new Exception("La Fecha de Pago no puede estar vacía, linea " + (i + 1));
                        }

                        var banco = dtCsv.Rows[i]["Banco"].ToString().Trim();
                        if (string.IsNullOrEmpty(banco))
                        {
                            throw new Exception("El banco no puede estar vacio o ser cero, linea " + (i + 1));
                        }

                        //var query = dtAcreedores.AsEnumerable().Where(r => r.Field<string>("NombreFinanzas").Contains(banco.ToUpper())).ToList();

                        string BancoExiste = string.Format("{0}", "NombreFinanzas = '" + banco.ToUpper() + "'");
                        BuscarBanco = dtAcreedores.Select(BancoExiste).Length;
                        if (BuscarBanco <= 0)
                        {
                            throw new Exception("El banco no existe en la parametrización, linea " + (i + 1));
                        }

                        var Monto = dtCsv.Rows[i]["Monto"].ToString().Trim();
                        if (string.IsNullOrEmpty(Monto.ToString()) || Monto.ToString() == "0")
                        {
                            throw new Exception("El Monto no puede estar vacio o ser cero, linea " + (i + 1));
                        }
                        dtCsv.Rows[i]["Monto"] = util.actualizaMilesSinDecimal(dtCsv.Rows[i]["Monto"].ToString());

                        var Acreedor = dtCsv.Rows[i]["Acreedor"].ToString().Trim();
                        if (string.IsNullOrEmpty(Acreedor.ToString()))
                        {
                            throw new Exception("El acreedor no puede estar vacio, linea " + (i + 1));
                        }

                        string AcreedorExiste = string.Format("{0}", "NombreFinanzas = '" + Acreedor.ToUpper() + "'");
                        BuscarAcreedor = dtAcreedores.Select(AcreedorExiste).Length;
                        if (BuscarAcreedor <= 0)
                        {
                            throw new Exception("El acreedor no existe en la parametrización, linea " + (i + 1));
                        }
                    }
                    Page.Session["dtArchivo"] = dtCsv;
                    e.CallbackData            = "OK";
                }
                else
                {
                    throw new Exception("Error de archivo");
                }
            }
            catch (Exception ex)
            {
                e.CallbackData = ex.Message;
            }
        }
        protected void UpSubirCC_FileUploadComplete(object sender, FileUploadCompleteEventArgs e)
        {
            try
            {
                if (e.IsValid)
                {
                    int           validarExiste = 0;
                    LogicaNegocio Ln            = new LogicaNegocio();
                    DataTable     dtMotivo      = new DataTable("dtMotivo");
                    DataTable     dtCausa       = new DataTable("dtCausa");
                    DataTable     dtAcreedores  = new DataTable("dtAcreedores");
                    DataTable     dtConceptos   = new DataTable("dtConceptos");

                    dtMotivo     = Ln.ListarMotivos();
                    dtCausa      = Ln.ListarCausas();
                    dtConceptos  = Ln.ListarConceptos();
                    dtAcreedores = Ln.CRUDAcreedores(1, "", 0, "", "", 0, 0, 0, 0, "");
                    int BuscarMotivo   = 0;
                    int BuscarCausa    = 0;
                    int BuscarBanco    = 0;
                    int BuscarAcreedor = 0;
                    int BuscarConcepto = 0;

                    DataTable dtCsv = util.CSVtoDataTable(e.UploadedFile, ";");
                    dtCsv.CaseSensitive = false;

                    foreach (DataColumn column in dtCsv.Columns)
                    {
                        column.ColumnName = column.ColumnName.ToLower().Trim();
                    }

                    for (var i = 0; i < dtCsv.Rows.Count - 1; i++)
                    {
                        //n° cf
                        string NroCertificado = dtCsv.Rows[i]["NCertificado"].ToString().Trim();
                        if (string.IsNullOrEmpty(NroCertificado))
                        {
                            throw new Exception("El numero de certificado no puede estar vacio, linea " + (i + 1));
                        }
                        validarExiste = Ln.CP_VerificarCertificado(NroCertificado);
                        if (validarExiste == 0)
                        {
                            throw new Exception("El número de certificado no esta registrado, cft " + NroCertificado);
                        }

                        //motivo
                        string Motivo = dtCsv.Rows[i]["Motivo"].ToString().Trim();
                        if (string.IsNullOrEmpty(Motivo))
                        {
                            throw new Exception("El Motivo ingresado no puede estar vacío, linea " + (i + 1));
                        }
                        BuscarMotivo = dtMotivo.Select("DescMotivo = '" + Motivo + "'").Length;
                        if (BuscarMotivo <= 0)
                        {
                            throw new Exception("El motivo no existe en la parametrización, linea " + (i + 1));
                        }

                        //causa
                        string Causa = dtCsv.Rows[i]["Causa"].ToString().Trim();
                        if (string.IsNullOrEmpty(Causa))
                        {
                            throw new Exception("La causa ingresada no puede estar vacía, linea " + (i + 1));
                        }
                        string CausaExiste = string.Format("{0}", "DescCausa = '" + Causa + "'");
                        BuscarCausa = dtCausa.Select(CausaExiste).Length;
                        if (BuscarCausa <= 0)
                        {
                            throw new Exception("La causa no existe en la parametrización, linea " + (i + 1));
                        }

                        //concepto
                        string Concepto = dtCsv.Rows[i]["Concepto"].ToString().Trim();
                        if (string.IsNullOrEmpty(Concepto))
                        {
                            throw new Exception("el concepto ingresado no puede estar vacío, linea " + (i + 1));
                        }
                        string ConceptoExiste = string.Format("{0}", "Concepto = '" + Concepto + "'");
                        BuscarConcepto = dtConceptos.Select(ConceptoExiste).Length;
                        if (BuscarConcepto <= 0)
                        {
                            throw new Exception("El concepto ingresado no existe en la parametrización de conceptos, linea " + (i + 1));
                        }

                        //fecha cobro
                        string FechaCobro = dtCsv.Rows[i]["FechaCobro"].ToString().Trim();
                        if (string.IsNullOrEmpty(FechaCobro))
                        {
                            throw new Exception("La fecha de cobro no puede estar vacia, linea " + (i + 1));
                        }

                        //fecha pago
                        string FechaPago = dtCsv.Rows[i]["FechaPago"].ToString().Trim();
                        if (string.IsNullOrEmpty(FechaPago))
                        {
                            throw new Exception("La Fecha de Pago no puede estar vacía, linea " + (i + 1));
                        }

                        //banco
                        string banco = System.Web.HttpUtility.HtmlDecode(dtCsv.Rows[i]["Banco"].ToString().Trim());
                        if (string.IsNullOrEmpty(banco))
                        {
                            throw new Exception("El banco no puede estar vacio o ser cero, linea " + (i + 1));
                        }

                        //string BancoExiste = string.Format("{0}", "NombreFinanzas = '" + banco.ToUpper() + "'");
                        //BuscarBanco = dtAcreedores.Select(BancoExiste).Length;
                        //if (BuscarBanco <= 0)
                        //    throw new Exception("El banco no existe en la parametrización, linea " + (i + 1));

                        //monto
                        string Monto = dtCsv.Rows[i]["Monto"].ToString().Trim();
                        if (string.IsNullOrEmpty(Monto) || Monto == "0")
                        {
                            throw new Exception("El Monto no puede estar vacio o ser cero, linea " + (i + 1));
                        }
                        dtCsv.Rows[i]["Monto"] = (dtCsv.Rows[i]["Monto"]).ToString().GetFormatearNumero(0);

                        //acreedor
                        string Acreedor = dtCsv.Rows[i]["Acreedor"].ToString().Trim();
                        if (string.IsNullOrEmpty(Acreedor))
                        {
                            throw new Exception("El acreedor no puede estar vacio, linea " + (i + 1));
                        }
                        string AcreedorExiste = string.Format("{0}", "NombreFinanzas = '" + Acreedor.ToUpper() + "'");
                        BuscarAcreedor = dtAcreedores.Select(AcreedorExiste).Length;
                        if (BuscarAcreedor <= 0)
                        {
                            throw new Exception("El acreedor no existe en la parametrización, linea " + (i + 1));
                        }
                    }
                    Page.Session["dtArchivo"] = dtCsv;
                    e.CallbackData            = "OK";
                }
                else
                {
                    throw new Exception("Error de archivo");
                }
            }
            catch (Exception ex)
            {
                e.CallbackData = ex.Message;
            }
        }
        protected void UpSubirMasivo_FileUploadComplete(object sender, FileUploadCompleteEventArgs e)
        {
            try
            {
                if (UpSubirMasivo.UploadedFiles != null && UpSubirMasivo.UploadedFiles.Length > 0)
                {
                    int           validarExiste = 0;
                    LogicaNegocio ln            = new LogicaNegocio();
                    DataTable     dtMotivo      = new DataTable("dtMotivo");
                    DataTable     dtCausa       = new DataTable("dtCausa");
                    DataTable     dtAcreedores  = new DataTable("dtAcreedores");

                    dtMotivo     = ln.ListarMotivos();
                    dtCausa      = ln.ListarCausas();
                    dtAcreedores = ln.CRUDAcreedores(1, "", 0, "", "", 0, 0, 0, 0, "");

                    var dtCsv = util.CSVtoDataTable(e.UploadedFile, ";");

                    for (var i = 0; i < dtCsv.Rows.Count - 1; i++)
                    {
                        var NroCertificado = dtCsv.Rows[i]["NCertificado"].ToString().Trim();
                        if (string.IsNullOrEmpty(NroCertificado.ToString()))
                        {
                            throw new Exception("El numero de certificado no puede estar vacio, linea " + i);
                        }

                        //validar si existe nro certificado en tabla operacion
                        validarExiste = ln.CP_VerificarCertificado(NroCertificado);
                        if (validarExiste == 0)
                        {
                            throw new Exception("El número de certificado no esta registrado, linea " + i);
                        }

                        var Motivo = dtCsv.Rows[i]["Motivo"].ToString().Trim();
                        if (string.IsNullOrEmpty(Motivo.ToString()))
                        {
                            throw new Exception("El Motivo ingresado no existe en la parametrización, linea " + i);
                        }

                        var Causa = dtCsv.Rows[i]["Causa"].ToString().Trim();
                        if (string.IsNullOrEmpty(Causa.ToString()))
                        {
                            throw new Exception("La causa ingresada no existe en la parametrización, linea " + i);
                        }

                        var Monto = dtCsv.Rows[i]["Monto"].ToString().Trim();
                        if (string.IsNullOrEmpty(Monto.ToString()) || Monto.ToString() == "0")
                        {
                            throw new Exception("El Monto no puede estar vacio o ser cero, linea " + i);
                        }

                        var FechaCobro = dtCsv.Rows[i]["FechaCobro"].ToString().Trim();
                        if (string.IsNullOrEmpty(FechaCobro.ToString()))
                        {
                            throw new Exception("La fecha de cobro no puede estar vacia, linea " + i);
                        }

                        var FechaPago = dtCsv.Rows[i]["FechaPago"].ToString().Trim();
                        if (string.IsNullOrEmpty(FechaPago.ToString()))
                        {
                            throw new Exception("La Fecha de Pago no puede estar vacía, linea " + i);
                        }

                        var Acreedor = dtCsv.Rows[i]["Acreedor"].ToString().Trim();
                        if (string.IsNullOrEmpty(Acreedor.ToString()))
                        {
                            throw new Exception("El acreedor no puede estar vacio, linea " + i);
                        }
                        //else
                        //    dtCsv.Rows[i]["Acreedor"] = System.Web.HttpUtility.HtmlEncode(dtCsv.Rows[i]["Acreedor"].ToString().Trim());
                    }
                    //System.Web.HttpUtility.HtmlDecode(
                    Page.Session["dtArchivo"] = dtCsv; //HtmlDecodeDataTable(dtCsv);
                    e.CallbackData            = "OK";
                }
            }
            catch (Exception ex)
            {
                e.CallbackData = ex.Message;
            }
        }