protected void btnAgregarNegocio_Click(object sender, EventArgs e) { LogicaNegocio lgNegocio = new LogicaNegocio(); lgPath = new LogicaPath(); csUsuario usuario = (csUsuario)Session["Usuario"]; lgExtNegocio = new LogicaEstadoNegocio(); if (IsValid) { if ((uploadFile1.PostedFile != null) && (uploadFile1.PostedFile.ContentLength > 0)) { try { string fn = System.IO.Path.GetFileName(uploadFile1.PostedFile.FileName); string SaveLocation = Server.MapPath("media\\img") + "\\" + fn; csNegocio negocio = new csNegocio(0, txtNombre.Text, txtDescdrip.Text, txtTelefono.Text, usuario.id_usuario, uploadFile1.FileName, hdLonft.Value, txtUbicacion.Text, hdLatFt.Value); int codNegoc = int.Parse(lgNegocio.CrearNegocio(negocio)); if (codNegoc > 0) { uploadFile1.PostedFile.SaveAs(SaveLocation); foreach (ListItem item in chekListCategoria.Items) { if (item.Selected) { estNegocio = new csEstadoNegocio(0, int.Parse(item.Value.ToString()), codNegoc); lgExtNegocio.CrearEstadoNegocio(estNegocio); } } Button2_ModalPopupExtender.Show(); } else { ltRepuesta.Text = @"<div class='alert alert-danger'> <strong>Danger!</strong> no guardor el registro. </div>"; } } catch (Exception ex) { ltRepuesta.Text = @"<div class='alert alert-danger'> <strong>Advertencia</strong> " + ex.Message + "</div>"; } } else { ltRepuesta.Text = @"<div class='alert alert-danger'> <strong>Danger!</strong> No cargo la Foto. </div>"; } } }
protected void btnAgregarNegocio_Click(object sender, EventArgs e) { LogicaNegocio lgNegocio = new LogicaNegocio(); lgPath = new LogicaPath(); if ((uploadFile1.PostedFile != null) && (uploadFile1.PostedFile.ContentLength > 0)) { try { string fn = System.IO.Path.GetFileName(uploadFile1.PostedFile.FileName); string SaveLocation = Server.MapPath("media\\img") + "\\" + fn; csNegocio negocio = new csNegocio(0, txtNombre.Text, txtDescdrip.Text, txtTelefono.Text, int.Parse(Request.Params["perfil"]), uploadFile1.FileName, hdLonft.Value, txtUbicacion.Text, hdLatFt.Value); int codNegoc = int.Parse(lgNegocio.CrearNegocio(negocio)); if (codNegoc > 0) { uploadFile1.PostedFile.SaveAs(SaveLocation); Button2_ModalPopupExtender.Show(); } else { ltRepuesta.Text = @"<div class='alert alert-danger'> <strong>Danger!</strong> no guardor el registro. </div>"; } } catch (Exception ex) { ltRepuesta.Text = @"<div class='alert alert-danger'> <strong>Advertencia</strong> " + ex.Message + "</div>"; } } else { ltRepuesta.Text = @"<div class='alert alert-danger'> <strong>Danger!</strong> No cargo la Foto. </div>"; } }