public IHttpActionResult Postreporte(reporte reporte)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.reportes.Add(reporte);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (reporteExists(reporte.id_reporte))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = reporte.id_reporte }, reporte));
        }
        // PUT api/Reports/5
        public IHttpActionResult Putreporte(int id, reporte reporte)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != reporte.id_reporte)
            {
                return(BadRequest());
            }

            db.Entry(reporte).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!reporteExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public override global::System.Data.DataSet Clone()
        {
            reporte cln = ((reporte)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            reporte reporte = db.reporte.Find(id);

            db.reporte.Remove(reporte);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult DetalleReporte(int reporteid)
        {
            List <detreportegallinas> listaReporte = db.detreportegallinas.Where(x => x.reporte_id == reporteid).ToList();
            reporte reporte = db.reporte.Where(x => x.id == reporteid).FirstOrDefault();

            ViewBag.Granjero = reporte.granjeros.Nombre + " " + reporte.granjeros.Apellidos;
            ViewBag.Folio    = reporte.Folio;
            ViewBag.Fecha    = reporte.Fecha;
            ViewBag.Granja   = reporte.granjeros.granjas.descripcion;
            return(View(listaReporte));
        }
 public ActionResult Edit([Bind(Include = "id,Fecha,Folio,Granjeros_Id")] reporte reporte)
 {
     if (ModelState.IsValid)
     {
         db.Entry(reporte).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Granjeros_Id = new SelectList(db.granjeros, "id", "Nombre", reporte.Granjeros_Id);
     return(View(reporte));
 }
        public IHttpActionResult Getreporte(int id)
        {
            reporte reporte = db.reportes.Find(id);

            if (reporte == null)
            {
                return(NotFound());
            }

            return(Ok(reporte));
        }
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            reporte ds = new reporte();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
        // GET: reportes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            reporte reporte = db.reporte.Find(id);

            if (reporte == null)
            {
                return(HttpNotFound());
            }
            return(View(reporte));
        }
        public IHttpActionResult Deletereporte(int id)
        {
            reporte reporte = db.reportes.Find(id);

            if (reporte == null)
            {
                return(NotFound());
            }

            db.reportes.Remove(reporte);
            db.SaveChanges();

            return(Ok(reporte));
        }
Exemplo n.º 11
0
        // GET: reportes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            reporte reporte = db.reporte.Find(id);

            if (reporte == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Granjeros_Id = new SelectList(db.granjeros, "id", "Nombre", reporte.Granjeros_Id);
            return(View(reporte));
        }
Exemplo n.º 12
0
        public ActionResult GuardarReporte(DetalleReporteVM[] detalleReporte)
        {
            var granjero          = db.granjeros.Where(x => x.AspNetUsers.Email.Equals(User.Identity.Name)).FirstOrDefault();
            int produccionxgranja = (db.reporte.Where(x => x.Folio.Contains(granjero.granjas.nomenclatura)).Count() + 1);

            reporte reporte = new reporte();

            reporte.Fecha        = DateTime.Now;
            reporte.Folio        = granjero.granjas.nomenclatura + "-RP-" + produccionxgranja;
            reporte.Granjeros_Id = granjero.id;

            db.reporte.Add(reporte);
            db.SaveChanges();

            AgregarDetalleReporte(detalleReporte, reporte.id);
            ActualizarEstadoGallinas(detalleReporte);

            return(Json(new { respuesta = true }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 13
0
        public IActionResult Calculo(reporte reporte)
        {
            Console.WriteLine("Calculo");

            Double precio = double.Parse(reporte.precio);
            Double precioT;

            if ((reporte.nacionalidad) == "Extranjera")
            {
                if ((reporte.categoria) == "Camioneta")
                {
                    precioT = precio * 1.35;
                }
                else
                {
                    precioT = precio * 1.33;
                }
            }
            else
            {
                if ((reporte.categoria) == "Camioneta")
                {
                    precioT = precio * 1.15;
                }
                else
                {
                    precioT = precio * 1.13;
                }
            }

            reporte.precioT = precioT;

            _context.Add(reporte);
            _context.SaveChanges();

            return(View(reporte));
        }
        public IActionResult Calculo(reporte reporte)
        {
            Console.WriteLine("Calculo");

            Random rdn = new Random();
            int    num = rdn.Next();

            reporte.numero = num;

            int precio   = int.Parse(reporte.producto);
            int cantidad = int.Parse(reporte.cantidad);
            int sub      = precio * cantidad;

            reporte.subTotal = sub;

            double total = sub * 1.18;

            reporte.total = total;

            _context.Add(reporte);
            _context.SaveChanges();

            return(View(reporte));
        }
Exemplo n.º 15
0
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                reporte ds = new reporte();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "productoDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }