示例#1
0
        public static int ActualizarGanancias(Ganancias pGanancias)
        {
            int R = -1;

            using (SqlConnection conexion = DBcomun.ObetenerConexion())
            {
                SqlCommand comando = new SqlCommand(string.Format("update Ganancias set Ingresos = {0} where ID = {1}", pGanancias.Ganancia, pGanancias.ID), conexion);
                R = comando.ExecuteNonQuery();
                conexion.Close();
            }
            return(R);
        }
示例#2
0
        public static int RegistrarGanancias(Ganancias pGanancias)
        {
            int Retorno = -1;

            using (SqlConnection conexion = DBcomun.ObetenerConexion())
            {
                SqlCommand comando = new SqlCommand(string.Format("Insert into Ganancias (Fecha_Ganancias, Ingresos) values ('{0}', {1})", pGanancias.Fecha_Ganancia, pGanancias.Ganancia), conexion);
                Retorno = comando.ExecuteNonQuery();
                conexion.Close();
            }
            return(Retorno);
        }
示例#3
0
        public static List <Ganancias> Buscar(string fecha)
        {
            List <Ganancias> list = new List <Ganancias>();

            using (SqlConnection con = DBcomun.ObetenerConexion())
            {
                SqlCommand    comand = new SqlCommand(string.Format("select * from Ganancias where Fecha_Ganancias like '{0}%'", fecha), con);
                SqlDataReader re     = comand.ExecuteReader();
                while (re.Read())
                {
                    Ganancias g = new Ganancias();
                    g.Fecha_Ganancia = Convert.ToDateTime(re["Fecha_Ganancias"]).ToString("dd-MM-yyyy");
                    g.Ganancia       = Convert.ToDouble(re["Ingresos"]);
                    g.ID             = Convert.ToInt32(re["ID"]);
                    list.Add(g);
                }
                con.Close();
            }
            return(list);
        }