Esempio n. 1
0
 public Negocio(Caja c1, Caja c2)
 {
     this.caja     = new Caja[2];
     this.clientes = new List <string>();
     this.caja[0]  = c1;
     this.caja[1]  = c2;
 }
Esempio n. 2
0
 public Negocio(Caja caja1, Caja caja2)
 {
     this.caja1    = caja1;
     this.caja2    = caja2;
     this.clientes = new List <string>();
     this.clientes.Add("Cliente A");
     this.clientes.Add("Cliente B");
     this.clientes.Add("Cliente C");
     this.clientes.Add("Cliente D");
 }
Esempio n. 3
0
        private static Caja mapearCajaNueva(DataRow row)
        {
            Caja c = new Caja();

            c.Idcaja                = Convert.ToInt32(row["idcaja"]);
            c.Descripcion           = row["descripcion"].ToString();
            c.Fecha                 = Convert.ToDateTime(row["fecha"]);
            c.FechaCierre           = row["fecha_cierre"] as DateTime?;
            c.Idusuario             = Convert.ToInt32(row["idusuario"]);
            c.FondoInicial          = Convert.ToDecimal(row["fondo_inicial"]);
            c.FondoFinal            = Convert.ToInt32(row["fondo_final"]);
            c.Usuario               = new Usuario();
            c.Usuario.Idusuario     = c.Idusuario;
            c.Usuario.NombreUsuario = row["nombre_usuario"].ToString();
            return(c);
        }
Esempio n. 4
0
        public static void Reabrir(int idCaja)
        {
            Caja ca = new Caja(idCaja);

            if (ca.FechaCierre == null)
            {
                throw new Exception("La caja ya se encuentra abierta");
            }
            string sql = @"UPDATE caja
                            SET	
	                            fecha_cierre = null
                            WHERE idcaja = :p5";

            using (Connection conn = new Connection())
            {
                conn.Open();
                conn.Execute(sql, idCaja);
            }
        }
Esempio n. 5
0
        public static List <Caja> BuscarListCajas(DateTime fechaDesde, DateTime fechaHasta, int idUsuario)
        {
            string    sql = "SELECT c.*, u.nombre_usuario FROM caja c INNER JOIN usuario u ON u.idusuario = c.idusuario WHERE c.fecha BETWEEN :p1 AND :p2 ORDER BY c.fecha";
            DataTable dt;

            using (Connection conn = new Connection())
            {
                dt = conn.GetDT(sql, fechaDesde, fechaHasta);
            }
            List <Caja> listC = null;

            if (dt.Rows.Count > 0)
            {
                listC = new List <Caja>();
                foreach (DataRow row in dt.Rows)
                {
                    Caja c = mapearCajaNueva(row);
                    listC.Add(c);
                }
            }
            return(listC);
        }
Esempio n. 6
0
        public void Cerrar()
        {
            Caja ca = new Caja(Idcaja);

            if (ca.FechaCierre != null)
            {
                throw new Exception("La caja ya se encuentra cerrada");
            }
            string sql = @"UPDATE caja
                            SET	
	                            descripcion = :p1,
	                            fondo_inicial = :p2,
	                            fecha_cierre = :p3,
	                            fondo_final = :p4
                            WHERE idcaja = :p5";

            using (Connection conn = new Connection())
            {
                conn.Open();
                conn.Execute(sql, Descripcion, FondoInicial, DateTime.Now, FondoFinal, Idcaja);
            }
        }
Esempio n. 7
0
        public static bool ImprimirTicket(Caja <T> caja)
        {
            bool retorno = true;

            string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "tickets.log");

            try
            {
                using (StreamWriter sw = new StreamWriter(path, true))
                {
                    sw.Write("Fecha y hora: ");
                    sw.WriteLine(DateTime.Now);
                    sw.Write("Precio total de la caja: ");
                    sw.WriteLine(caja.PrecioTotal.ToString());
                }
            }
            catch (Exception)
            {
                retorno = false;
            }

            return(retorno);
        }
Esempio n. 8
0
 public Negocio(Caja c1, Caja c2)
 {
     this.caja1 = c1;
     this.caja2 = c2;
 }
Esempio n. 9
0
 public Negocio(Caja caja1, Caja caja2)
 {
     this.caja1    = caja1;
     this.caja2    = caja2;
     this.clientes = new List <string>();
 }
Esempio n. 10
0
 public Negocio(Caja c1, Caja c2)
 {
     this.clientes = new List <string>();
     this.caja1    = c1;
     this.caja2    = c2;
 }