Ejemplo n.º 1
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            if (txtClEvento.Text != "" && txtDsEvento.Text != "")
            {
                if (dtpInicial.SelectedDate.HasValue && dtpFinal.SelectedDate.HasValue)
                {
                    E_EVENTO evento = new E_EVENTO();
                    EventoCapacitacionNegocio neg = new EventoCapacitacionNegocio();

                    if (vIdEvento != null)
                    {
                        vClOperacion = E_TIPO_OPERACION_DB.A;
                    }
                    else
                    {
                        vClOperacion = E_TIPO_OPERACION_DB.I;
                    }

                    if (vIdEvento != null)
                    {
                        evento.ID_EVENTO = (int)vIdEvento;
                    }

                    evento.CL_EVENTO               = txtClEvento.Text;
                    evento.NB_EVENTO               = txtDsEvento.Text;
                    evento.DS_EVENTO               = txtDsEvento.Text;
                    evento.FE_INICIO               = dtpInicial.SelectedDate.Value;
                    evento.FE_TERMINO              = dtpFinal.SelectedDate.Value;
                    evento.CL_TIPO_CURSO           = cmbTipo.SelectedValue;
                    evento.CL_ESTADO               = "CALENDARIZADO";
                    evento.MN_COSTO_DIRECTO        = 0;
                    evento.MN_COSTO_INDIRECTO      = 0;
                    evento.FG_INCLUIR_EN_PLANTILLA = false;
                    evento.CL_TOKEN  = quitarCararcteresNoAlfanumericos(Membership.GeneratePassword(8, 0));
                    evento.FL_EVENTO = Guid.NewGuid();

                    E_RESULTADO msj      = neg.InsertaActualizaEvento(vClOperacion.ToString(), evento, vClUsuario, vNbPrograma);
                    string      vMensaje = msj.MENSAJE.Where(w => w.CL_IDIOMA.Equals(vClIdioma.ToString())).FirstOrDefault().DS_MENSAJE;

                    if (vClOperacion == E_TIPO_OPERACION_DB.A)
                    {
                        UtilMensajes.MensajeResultadoDB(rwmEvento, vMensaje, msj.CL_TIPO_ERROR, pCallBackFunction: "ReturnDataToParentEdit");
                    }
                    else
                    {
                        UtilMensajes.MensajeResultadoDB(rwmEvento, vMensaje, msj.CL_TIPO_ERROR, pCallBackFunction: "ReturnDataToParent");
                    }
                }
                else
                {
                    UtilMensajes.MensajeResultadoDB(rwmEvento, "Los campos evento, descripción, fecha de inicio y fecha de término son obligatorios.", E_TIPO_RESPUESTA_DB.ERROR, 400, 150, pCallBackFunction: "");
                }
            }
            else
            {
                UtilMensajes.MensajeResultadoDB(rwmEvento, "Los campos evento, descripción, fecha de inicio y fecha de término son obligatorios.", E_TIPO_RESPUESTA_DB.ERROR, 400, 150, pCallBackFunction: "");
            }
        }
Ejemplo n.º 2
0
        private void guardarEvento()
        {
            E_EVENTO evento = new E_EVENTO();
            EventoCapacitacionNegocio neg = new EventoCapacitacionNegocio();

            if (validarControles())
            {
                XElement vXmlCA = GeneralXmlAdicionales();

                evento.CL_EVENTO = txtClave.Text;
                evento.DS_EVENTO = txtNombre.Text;

                evento.CL_ESTADO              = cmbEstado.SelectedValue;
                evento.CL_TIPO_CURSO          = cmbTipo.SelectedValue;
                evento.DS_LUGAR               = txtLugarEvento.Text;
                evento.DS_REFRIGERIO          = txtRefrigerio.Text;
                evento.XML_CAMPOS_ADICIONALES = vXmlCA.ToString();

                if (dtpEvaluacion.SelectedDate.HasValue)
                {
                    evento.FE_EVALUACION = dtpEvaluacion.SelectedDate.Value;
                }

                evento.FE_INICIO  = dtpInicial.SelectedDate.Value;
                evento.FE_TERMINO = dtpFinal.SelectedDate.Value;
                evento.FG_INCLUIR_EN_PLANTILLA = chkIncluirResultados.Checked.Value;

                if (rlbCurso.Items[0].Value != "")
                {
                    evento.ID_CURSO = int.Parse(rlbCurso.Items[0].Value);
                    evento.NB_CURSO = rlbCurso.Items[0].Text;
                }

                if (rlbEvaluador.Items[0].Value != "")
                {
                    evento.ID_EMPLEADO_EVALUADOR = int.Parse(rlbEvaluador.Items[0].Value);
                }

                if (rlbInstructor.Items[0].Value != "" && rlbInstructor.Items[0].Text != "No Seleccionado")
                {
                    evento.ID_INSTRUCTOR = int.Parse(rlbInstructor.Items[0].Value);
                    evento.NB_INSTRUCTOR = rlbInstructor.Items[0].Text;
                }

                if (rbVinculado.Checked)
                {
                    evento.ID_PROGRAMA = int.Parse(rlbPrograma.Items[0].Value);
                }

                evento.MN_COSTO_DIRECTO   = decimal.Parse(txtCostoDirecto.Value.ToString());
                evento.MN_COSTO_INDIRECTO = decimal.Parse(txtCostoIndirecto.Value.ToString());
                evento.NB_EVENTO          = txtNombre.Text;
                evento.XML_PARTICIPANTES  = vXmlEmpleadosAgregados;
                evento.XML_CALENDARIO     = convertCalendarioToXml();

                if (vClOperacion == E_TIPO_OPERACION_DB.A)
                {
                    evento.ID_EVENTO = vIdEvento;
                }
                else
                {
                    evento.CL_TOKEN  = quitarCararcteresNoAlfanumericos(Membership.GeneratePassword(8, 0));
                    evento.FL_EVENTO = Guid.NewGuid();
                }

                E_RESULTADO msj      = neg.InsertaActualizaEvento(vClOperacion.ToString(), evento, vClUsuario, vNbPrograma);
                string      vMensaje = msj.MENSAJE.Where(w => w.CL_IDIOMA.Equals(vClIdioma.ToString())).FirstOrDefault().DS_MENSAJE;

                if (vClOperacion == E_TIPO_OPERACION_DB.A)
                {
                    UtilMensajes.MensajeResultadoDB(rwmEvento, vMensaje, msj.CL_TIPO_ERROR, pCallBackFunction: "ReturnDataToParentEdit");
                }
                else
                {
                    UtilMensajes.MensajeResultadoDB(rwmEvento, vMensaje, msj.CL_TIPO_ERROR, pCallBackFunction: "ReturnDataToParent");
                }
            }
        }