protected DatosEmpresa ObtenerInforme1() { DataRow fila; //dr DataTable empresa = new DataTable(); //dt DatosEmpresa reporte = new DatosEmpresa(); //ci empresa = reporte.Tables["datosEmpresa"]; Usuario dao = new Usuario(); DataTable Intermedio = dao.obtenerEmpresa(_id_user); for (int i = 0; i < Intermedio.Rows.Count; i++) { fila = empresa.NewRow(); fila["img_empresa"] = CargarByte(Server.MapPath(Intermedio.Rows[i]["img_empresa"].ToString())); fila["empresa"] = Intermedio.Rows[i]["empresa"].ToString(); fila["direccion"] = Intermedio.Rows[i]["direccion"].ToString(); fila["telefono"] = Intermedio.Rows[i]["telefono"].ToString(); fila["nit"] = Intermedio.Rows[i]["nit"].ToString(); //fila["hyperlink"] = Intermedio.Rows[i]["archivo"].ToString(); //fila["hyperlinkk"] = Intermedio.Rows[i]["imagen"].ToString(); empresa.Rows.Add(fila); } return(reporte); }
public void Guardar() { if (spIdEmpresa.Value == 0) { try { DatosEmpresa emp = new DatosEmpresa(); rellenarEmpresa(ref emp); D_MetodosGenericos met = new D_MetodosGenericos(); if (met.AddOrUpdateObj(emp, new Software3Entities())) { MessageBox.Show("Se guardo correctamente", "Accion Correcta", MessageBoxButtons.OK, MessageBoxIcon.Information); spIdEmpresa.Value = D_Empresa.obtenerIdUltimaEmpresa(); } else { MessageBox.Show("Ocurrio un error al guardar", "Error en el metodo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception e) { MessageBox.Show("Ocurrio un error al guardar", "Mensaje Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void rellenarEmpresa(ref DatosEmpresa emp) { emp.Id = idEmpresa; emp.Nombre = txtNombreEmpresa.Text; emp.Proposito = txtPropositoEmpresa.Text; emp.Estatus = true; }
public async Task <IActionResult> Edit(int id, [Bind("DatosEmpresaID,TipoRegistro,TipoArchivo,Identificacion,Periodo,CodigoMoneda")] DatosEmpresa datosEmpresa) { if (id != datosEmpresa.DatosEmpresaID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(datosEmpresa); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DatosEmpresaExists(datosEmpresa.DatosEmpresaID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(datosEmpresa)); }
public ActionResult DeleteConfirmed(int id) { DatosEmpresa datosEmpresa = db.DatosEmpresa.Find(id); db.DatosEmpresa.Remove(datosEmpresa); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "DatosEmpresaID,TipoRegistro,TipoArchivo,Identificacion,Periodo")] DatosEmpresa datosEmpresa) { if (ModelState.IsValid) { db.Entry(datosEmpresa).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(datosEmpresa)); }
public ActionResult Create([Bind(Include = "DatosEmpresaID,TipoRegistro,TipoArchivo,Identificacion,Periodo")] DatosEmpresa datosEmpresa) { if (ModelState.IsValid) { db.DatosEmpresa.Add(datosEmpresa); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(datosEmpresa)); }
public async Task <IActionResult> Create([Bind("DatosEmpresaID,TipoRegistro,TipoArchivo,Identificacion,Periodo,CodigoMoneda")] DatosEmpresa datosEmpresa) { if (ModelState.IsValid) { _context.Add(datosEmpresa); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(datosEmpresa)); }
private void spIdEmpresa_EditValueChanged(object sender, EventArgs e) { idEmpresa = (int)spIdEmpresa.Value; DatosEmpresa emp = new DatosEmpresa(); emp = D_Empresa.obtenerEmpresaXId(idEmpresa); if (emp != null) { txtNombreEmpresa.Text = emp.Nombre; txtPropositoEmpresa.Text = emp.Proposito; } }
// GET: DatosEmpresas/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DatosEmpresa datosEmpresa = db.DatosEmpresa.Find(id); if (datosEmpresa == null) { return(HttpNotFound()); } return(View(datosEmpresa)); }
public Mensaje Post(DatosEmpresa json) { Data claseData = new Data(); Boolean validezConexion = claseData.validarConexionConClave(json.NombreEmpresa, json.ClaveGenerada); if (!validezConexion) { Mensaje msj = new Mensaje(); msj.Respuesta = "Conexión Inválida"; return(msj); } else { claseData.registrarProductos(json); Mensaje msj = new Mensaje(); msj.Respuesta = "Registro de productos exitoso."; return(msj); } }
public ActionResult enviarDatos(String Key) //recibimos la imagen como parametro en el metodo { String claveEncritpda = Encriptar(Key); DataProducto dataProducto = new DataProducto(); List <Producto> productos = dataProducto.obtenerTodos(); DatosEmpresa datosEmpresa = new DatosEmpresa(); datosEmpresa.ClaveGenerada = claveEncritpda; datosEmpresa.NombreEmpresa = this.nombre; datosEmpresa.Productos = productos; //enviar al api var datosenvio = JsonConvert.SerializeObject(datosEmpresa); //HttpContent contenido = new StringContent(datosenvio, Encoding.UTF8, "application/json"); ; HttpClient clienteHttp = new HttpClient(); clienteHttp.BaseAddress = new Uri(this.url); var request = clienteHttp.PostAsync("api/producto", datosEmpresa, new JsonMediaTypeFormatter()).Result; if (request.IsSuccessStatusCode)//consulta si la peticion es 200 es decir que estuvo bien { var resultString = request.Content.ReadAsStringAsync().Result; // var respuesta = JsonConvert.DeserializeObject <Mensaje>(resultString); ViewBag.mensaje = respuesta.Respuesta; return(View("Key")); } else { //Solicitud no se pudo realizar ViewBag.mensaje = "La solicitud no se pudo realizar"; return(View("Key")); } }