Beispiel #1
0
        public DExisteTarea existeTarea(int idMateria, int idEvento, string sTarea)
        {
            DBCAJDataContext ADB = new DBCAJDataContext(LogicaCC.ConnectionString.DbMPYSJDB);

            DExisteTarea iIdTarea = null;

            var vId = ADB.ADMSPS_EXISTE_TAREA(idMateria, idEvento, sTarea);

            try
            {
                foreach (var i in vId)
                {
                    iIdTarea = new DExisteTarea(int.Parse(i.IdTarea.ToString()));
                }

                return(iIdTarea);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (tipo == 0)
            {
                DSDetalleServicio addEvento = new DSDetalleServicio();

                iEventoR = 0;

                idEventoExis = addEvento.existeEvento(iIdMateria, iIdSolicitudTipo, txtAdd.Text.ToUpper());

                if (idEventoExis == null)
                {
                    DialogResult reg = MessageBox.Show(string.Format("{0} {1} {2}", "¿Estás seguro agregar el evento ", txtAdd.Text.ToUpper(), "?"), "Mensaje", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (reg == DialogResult.Yes)
                    {
                        try
                        {
                            iEventoR = addEvento.agregarEvento(iIdMateria, iIdSolicitudTipo, txtAdd.Text.ToUpper());

                            pnlAdd.Visible = false;
                            lblNombre.Text = string.Empty;
                            txtAdd.Clear();
                            EstadoControles(true);
                            //FRREventos_Load(sender, e);
                            /*Carga de eventos en el combobox*/
                            DatosEventos AEvento = new DatosEventos();
                            LEventos = AEvento.ListaEventos(iIdMateria, iIdSolicitudTipo);
                            this.cmbEvento.DataSource    = LEventos;
                            this.cmbEvento.ValueMember   = "sIdEvento";
                            this.cmbEvento.DisplayMember = "sEvento";
                            this.cmbEvento.SelectedIndex = -1;

                            if (iEventoR != 0)
                            {
                                this.cmbEvento.SelectedValue = iEventoR.ToString();
                            }
                        }
                        catch (Exception)
                        {
                            throw;
                        }
                    }
                }
                else
                {
                    MessageBox.Show(string.Format("{0} {1} {2}", "El evento: ", txtAdd.Text.ToUpper(), " ya se encuentra registrado"), "Atención!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }
            else if (tipo == 1)
            {
                DSDetalleServicio addTarea = new DSDetalleServicio();

                iTareaR = 0;

                idTareaExis = addTarea.existeTarea(iIdMateria, idEvento, txtAdd.Text.ToUpper());

                if (idTareaExis == null)
                {
                    DialogResult reg = MessageBox.Show(string.Format("{0} {1} {2} {3} {4}", "¿Estás seguro agregar la tarea ", txtAdd.Text.ToUpper(), " al evento: ", cmbEvento.Text, "?"), "Mensaje", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (reg == DialogResult.Yes)
                    {
                        try
                        {
                            iTareaR = addTarea.agregarTarea(iIdMateria, idEvento, txtAdd.Text.ToUpper());

                            pnlAdd.Visible = false;
                            lblNombre.Text = string.Empty;
                            txtAdd.Clear();
                            EstadoControles(true);
                            cmbEvento_SelectionChangeCommitted(sender, e);
                        }
                        catch (Exception)
                        {
                            throw;
                        }
                    }
                }
                else
                {
                    MessageBox.Show(string.Format("{0} {1} {2}", "La tarea: ", txtAdd.Text.ToUpper(), " ya se encuentra registrada"), "Atención!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }
        }