예제 #1
0
        public Ent_Info_Devolucion ListarDevolucion(decimal bas_id, ref string _mensaje)
        {
            String              sqlquery = "USP_GET_DEVOLUCION_PERSONA";
            DataTable           dt       = null;
            Ent_Info_Devolucion listar   = null;

            try
            {
                listar = new Ent_Info_Devolucion();
                using (SqlConnection cn = new SqlConnection(Ent_Conexion.conexion))
                {
                    using (SqlCommand cmd = new SqlCommand(sqlquery, cn))
                    {
                        cmd.CommandTimeout = 0;
                        cmd.CommandType    = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@BAS_ID", bas_id);
                        using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                        {
                            dt = new DataTable();
                            da.Fill(dt);
                            List <Ent_Documentos_Dev> listardoc = new List <Ent_Documentos_Dev>();
                            listardoc = (from DataRow fila in dt.Rows
                                         select new Ent_Documentos_Dev()
                            {
                                TIPODOC = fila["TIPODOC"].ToString(),
                                NDOC = fila["NDOC"].ToString(),
                                FDOC = fila["FDOC"].ToString(),
                                SUBTOTAL = Convert.ToDecimal(fila["SUBTOTAL"]),
                                IGV = Convert.ToDecimal(fila["IGV"]),
                                TOTAL = Convert.ToDecimal(fila["TOTAL"]),
                            }
                                         ).ToList();
                            listar.documentosDev = listardoc;
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                listar   = null;
                _mensaje = exc.Message;
            }
            return(listar);
        }
        public ActionResult GET_INFO_PERSONA_DEVOLUCION(string codigo)
        {
            try
            {
                Ent_Persona         info     = datPersona.GET_INFO_PERSONA(codigo);
                string              _mensaje = "";
                Ent_Info_Devolucion infoGeneralDevolucion = dat_dev.ListarDevolucion(Convert.ToDecimal(codigo), ref _mensaje);
                Session[_session_listDocDev_private] = infoGeneralDevolucion.documentosDev;
                //Session[_session_list_NotaCredito] = infoGeneralPedidos.notaCredito;
                //Session[_session_list_consignaciones] = infoGeneralPedidos.consignaciones;
                //Session[_session_list_saldos] = infoGeneralPedidos.saldos;

                return(Json(new { estado = 0, info = info, mensaje = _mensaje }));
            }
            catch (Exception ex)
            {
                return(Json(new { estado = 2, mensaje = ex.Message }));
            }
        }