示例#1
0
        public List <v_ManteNotaAbono> ListarAbono(int usuario)
        {
            string cnx = db.Database.Connection.ConnectionString;

            con = new SqlConnection(cnx);
            string findAll = "select*from v_ManteNotaAbono where Id_Vendedor='" + usuario + "' ORDER BY Numero_Abono asc";

            try
            {
                comando = new SqlCommand(findAll, con);
                con.Open();
                reader = comando.ExecuteReader();
                List <v_ManteNotaAbono> mer = new List <v_ManteNotaAbono>();
                while (reader.Read())
                {
                    v_ManteNotaAbono merca = new v_ManteNotaAbono();
                    merca.Id_Abono     = Convert.ToInt32(reader[0].ToString());
                    merca.Direccion    = reader[3].ToString();
                    merca.Monto        = Convert.ToDecimal(reader[4].ToString());
                    merca.Numero_Abono = reader[1].ToString();
                    merca.RazonSocial  = reader[15].ToString();
                    merca.Fecha        = Convert.ToDateTime(reader[5]).ToString("dd-MM-yyyy");
                    mer.Add(merca);
                }
                return(mer);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
示例#2
0
        public List <v_ManteNotaAbono> BuscarNotaAbonoxfecha(string fi, string ff, string id)
        {
            string cnx = db.Database.Connection.ConnectionString;

            con = new SqlConnection(cnx);
            string findAll = "";

            if (id != "0")
            {
                findAll = "select * from v_ManteNotaAbono where Fecha between '" + fi + "'and '" + ff + "' and Id_Cliente ='" + id + "'ORDER BY Numero_Abono asc";
            }
            else
            {
                findAll = "select * from v_ManteNotaAbono where Fecha between '" + fi + "'and '" + ff + "'ORDER BY Numero_Abono asc";
            }
            try
            {
                comando = new SqlCommand(findAll, con);
                con.Open();
                reader = comando.ExecuteReader();
                List <v_ManteNotaAbono> mer = new List <v_ManteNotaAbono>();
                while (reader.Read())
                {
                    v_ManteNotaAbono merca = new v_ManteNotaAbono();
                    merca.Id_Abono     = Convert.ToInt32(reader[0].ToString());
                    merca.Direccion    = reader[3].ToString();
                    merca.Monto        = Convert.ToDecimal(reader[4].ToString());
                    merca.Numero_Abono = reader[1].ToString();
                    merca.RazonSocial  = reader[15].ToString();
                    merca.Fecha        = Convert.ToDateTime(reader[5]).ToString("dd-MM-yyyy");
                    merca.Nombres      = reader[10].ToString();
                    string ide = reader[14].ToString();
                    if (ide == "3")
                    {
                        merca.estado = reader[12].ToString() + " " + reader[13].ToString();
                    }
                    else
                    {
                        merca.estado = reader[12].ToString();
                    }
                    mer.Add(merca);
                }
                return(mer);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }