private void CarregaDadosPartic() { ParticipanteBLL bll_p = new ParticipanteBLL(); PARTICIPANTE part = bll_p.GetParticipanteBy(Util.String2Short(txtCodEmpresa.Text) ?? 0, Util.String2Int32(txtMatricula.Text) ?? 0, Util.String2Int32(hidNUM_IDNTF_RPTANT.Value) ?? 0, true); if (part != null) { if (String.IsNullOrEmpty(txtDigito.Text)) { txtDigito.Text = part.NUM_DIGVR_EMPRG.ToString(); } if (String.IsNullOrEmpty(txtCpf.Text)) { txtCpf.Text = part.NUM_CPF_EMPRG.ToString(); } if (String.IsNullOrEmpty(txtNome.Text)) { txtNome.Text = part.NOM_EMPRG.ToUpper(); } if (String.IsNullOrEmpty(lblEnd1.Text) || String.IsNullOrEmpty(lblEnd2.Text)) { lblEnd1.Text = part.DCR_ENDER_EMPRG.Trim() + ", " + part.NUM_ENDER_EMPRG; lblEnd2.Text = part.COD_CEP_EMPRG + " " + part.NOM_BAIRRO_EMPRG.Trim() + " " + part.NOM_CIDRS_EMPRG + "-" + part.COD_UNDFD_EMPRG; } //if (String.IsNullOrEmpty(lblEnd2.Text)) //{ // lblEnd2.Text = part.COD_CEP_EMPRG + " " + part.NOM_BAIRRO_EMPRG + " " + part.NOM_CIDRS_EMPRG + "-" + part.COD_UNDFD_EMPRG; //} } }
protected void proyectoSeleccionado_SelectedIndexChanged(object sender, EventArgs e) { var idParticipante = Convert.ToInt32(proyectoSeleccionado.SelectedValue); PARTICIPANTE participanteModificado = ParticipanteControlador.BuscarParticipantePorID(idParticipante); if (participanteModificado.num_participantes != null) { Repeater1.DataSource = new int[(int)participanteModificado.num_participantes]; Repeater1.DataBind(); } }
public static void InsertarParticipante(PARTICIPANTE newParticipante) { try { ///Crea un nuevo Participante ParticipanteModelo.InsertarParticipante(newParticipante); } catch (Exception ex) { throw new Exception("Hubo un error en la capa del Modelo: " + ex.Message.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ///Despliega en las casillas los datos del objeto registrados en la base de datos var idParticipantes = Convert.ToInt32(Request.QueryString["ID"]); PARTICIPANTE participantes = ParticipanteModelo.BuscarParticipantePorID(idParticipantes); txbNombreProyecto.Text = participantes.nombreProyecto.ToString(); txbNumParticipantes.Text = participantes.num_participantes.ToString(); txtSemestre.Text = participantes.semestre; for (int i = participantes.PARTICIPANTE_CARRERA.Count; i < participantes.num_participantes; i++) { participantes.PARTICIPANTE_CARRERA.Add(new PARTICIPANTE_CARRERA()); } Repeater1.DataSource = participantes.PARTICIPANTE_CARRERA; Repeater1.DataBind(); } }
protected void btnGuardar_Click(object sender, EventArgs e) { try { ///Agrega los datos registrados a los objetos creados var idParticipantes = Convert.ToInt32(Request.QueryString["ID"]); PARTICIPANTE participanteModificado = ParticipanteControlador.BuscarParticipantePorID(idParticipantes); CONVENIO convenio = ConvenioControlador.BuscarConvenioPorNumero(Convert.ToInt32(participanteModificado.num_convenio)); if (participanteModificado.num_participantes == convenio.num_participantes) { convenio.num_participantes = 0; } else { convenio.num_participantes = convenio.num_participantes - participanteModificado.num_participantes; } participanteModificado.num_participantes = Convert.ToInt32(txbNumParticipantes.Text); participanteModificado.semestre = txtSemestre.Text; participanteModificado.PARTICIPANTE_CARRERA.Clear(); foreach (RepeaterItem item in Repeater1.Items) { TextBox txtNombre = item.FindControl("Nombre") as TextBox; DropDownList ddlCarrera = item.FindControl("CarreraDDL") as DropDownList; HiddenField idParticipanteCarrera = item.FindControl("hiddenID") as HiddenField; PARTICIPANTE_CARRERA pc = new PARTICIPANTE_CARRERA() { idParticipanteCarrera = Convert.ToInt32(idParticipanteCarrera.Value), nombreAlumno = txtNombre.Text, nombreCarrera = ddlCarrera.SelectedValue }; participanteModificado.PARTICIPANTE_CARRERA.Add(pc); } ParticipanteControlador.ModificarParticipante(participanteModificado); convenio.num_participantes = convenio.num_participantes + participanteModificado.num_participantes; ConvenioControlador.ModificarConvenio(convenio); mensaje.Visible = true; string javaScript = "OcultarMensaje();"; ScriptManager.RegisterStartupScript(this, this.GetType(), "script", javaScript, true); Response.Redirect("ParticipantesRegistrados.aspx"); } catch (Exception ex) { throw ex; } }
public static void ModificarParticipante(PARTICIPANTE participanteModificado) { try { ///Verifica que sea un PArticipante válido y que los campos no estne vacios if (participanteModificado.idTablaParticipante > 0 && participanteModificado.nombreProyecto != string.Empty) { ParticipanteModelo.ModificarParticipante(participanteModificado); } else { throw new Exception("Hubo un error"); } } catch (Exception ex) { throw new Exception("Hubo un error en la capa del Modelo: " + ex.Message.ToString()); } }
protected void btnGuardar_Click(object sender, EventArgs e) { try { if (Convert.ToInt32(proyectoSeleccionado.SelectedValue) == 1) { } else { ///Agrega los datos registrados al objeto creado var numCon = Convert.ToInt32(Request.QueryString["NUM"]); var idParticipante = Convert.ToInt32(proyectoSeleccionado.SelectedValue); PARTICIPANTE participanteModificado = ParticipanteControlador.BuscarParticipantePorID(idParticipante); int num_participantes = Convert.ToInt32(participanteModificado.num_participantes); CONVENIO convenio = ConvenioControlador.BuscarConvenioPorNumero(Convert.ToInt32(numCon)); convenio.num_participantes = convenio.num_participantes + num_participantes; ConvenioControlador.ModificarConvenio(convenio); participanteModificado.num_convenio = Convert.ToInt32(numCon); foreach (RepeaterItem item in Repeater1.Items) { TextBox txtNombre = item.FindControl("Nombre") as TextBox; DropDownList ddlCarrera = item.FindControl("CarreraDDL") as DropDownList; PARTICIPANTE_CARRERA participante = new PARTICIPANTE_CARRERA() { nombreAlumno = txtNombre.Text, nombreCarrera = ddlCarrera.SelectedValue }; participanteModificado.PARTICIPANTE_CARRERA.Add(participante); } ParticipanteControlador.ModificarParticipante(participanteModificado); mensaje.Visible = true; string javaScript = "OcultarMensaje();"; ScriptManager.RegisterStartupScript(this, this.GetType(), "script", javaScript, true); } Response.Redirect("Participantes.aspx"); } catch (Exception ex) { throw ex; } }
protected void btnGuardar_Click(object sender, EventArgs e) { try { var newparticipante = new PARTICIPANTE() { nombreProyecto = txbNombreProyecto.Text, num_participantes = Convert.ToInt32(txbNumParticipantes.Text), semestre = txtSemestre.Text }; ParticipanteModelo.InsertarParticipante(newparticipante); mensaje.Visible = true; string javaScript = "OcultarMensaje();"; ScriptManager.RegisterStartupScript(this, this.GetType(), "script", javaScript, true); Response.Redirect("Participantes.aspx"); } catch (Exception ex) { var datos = "<script> alert('" + ex.Message + "') </script>"; Response.Write(datos); } }
protected void Page_Load(object sender, EventArgs e) { string COD_EMPRS = Request.QueryString["nEmpr"]; string NUM_RGTRO_EMPRG = Request.QueryString["nReg"]; string NUM_DIVR_EMPRG = Request.QueryString["nDigReg"]; string NUM_IDNTF_RPTANT = Request.QueryString["nrepr"]; //string NUM_DEPEND = Request.QueryString["ndep"]; string NOM_EMPR = Request.QueryString["cPart"]; string End1 = Request.QueryString["cEnd1"]; string End2 = Request.QueryString["cEnd2"]; string COD_TIPO_BOLETO = Request.QueryString["nIdBol"]; string PARTICIPANTEEMAIL = Request.QueryString["ParticipanteEmail"]; ScriptManager.RegisterStartupScript(UpdatePanel, UpdatePanel.GetType(), "script", "_client_side_script()", true); Page.Form.DefaultButton = btnPesquisar.UniqueID; lblMensagem.Visible = false; lblMensagemNovo.Visible = false; if (!IsPostBack) { grdBoleto.Sort("DT_PROCESSAMENTO", SortDirection.Ascending); CarregarDropDown(); if (!String.IsNullOrEmpty(COD_EMPRS) && !String.IsNullOrEmpty(NUM_RGTRO_EMPRG)) { ParticipanteBLL bll_p = new ParticipanteBLL(); PARTICIPANTE part = bll_p.GetParticipanteBy(Util.String2Short(COD_EMPRS) ?? 0, Util.String2Int32(NUM_RGTRO_EMPRG) ?? 0, Util.String2Int32(NUM_IDNTF_RPTANT) ?? 0, true); txtPesqCodEmpresa.Text = COD_EMPRS; txtPesqMatricula.Text = NUM_RGTRO_EMPRG; txtPesqNome.Text = NOM_EMPR; hidPesqNUM_IDNTF_RPTANT.Value = NUM_IDNTF_RPTANT; ddlPesqTipoBoleto.SelectedValue = COD_TIPO_BOLETO; if (part != null) { txtPesqDigito.Text = part.NUM_DIGVR_EMPRG.ToString(); txtPesqCpf.Text = part.NUM_CPF_EMPRG.ToString(); txtEMail.Text = part.COD_EMAIL_EMPRG; lblPesqEnd1.Text = part.DCR_ENDER_EMPRG + ", " + part.NUM_ENDER_EMPRG; lblPesqEnd2.Text = part.COD_CEP_EMPRG + " " + part.NOM_BAIRRO_EMPRG + " " + part.NOM_CIDRS_EMPRG + "-" + part.COD_UNDFD_EMPRG; } if (!String.IsNullOrEmpty(PARTICIPANTEEMAIL) && PARTICIPANTEEMAIL != "undefined") { txtEMail.Text = PARTICIPANTEEMAIL; } if (!String.IsNullOrEmpty(NUM_DIVR_EMPRG) && End2 != "undefined") { txtPesqDigito.Text = NUM_DIVR_EMPRG; } if (!String.IsNullOrEmpty(End1) && End1 != "undefined") { lblPesqEnd1.Text = End1; } if (!String.IsNullOrEmpty(End2) && End2 != "undefined") { lblPesqEnd2.Text = End2; } BoletoBLL bll = new BoletoBLL(); AAT_TBL_BOLETO_TIPO BOLETO_TIPO = bll.GetBoletoTipo(Util.String2Short(COD_TIPO_BOLETO) ?? 0); if (BOLETO_TIPO != null) { txtInstrucoes.Text = BOLETO_TIPO.DCR_OBSERVACAO; } //ReportCrystal.Visible = false; //txtCodEmpresa.Text = COD_EMPRS; //txtMatricula.Text = NUM_RGTRO_EMPRG; //txtDigito.Text = NUM_DIVR_EMPRG; //txtCpf.Text = part.NUM_CPF_EMPRG.ToString(); //txtNome.Text = NOM_EMPR; //ddlTipoBoleto.SelectedValue = COD_TIPO_BOLETO; //lblEnd1.Text = End1; //lblEnd2.Text = End2; //if (ValidarCampos()) //{ //txtEMail.Enabled = true; //btnEmail.Enabled = true; //} } } }