Ejemplo n.º 1
0
        private void notificacionCorreo()
        {
            BLcccmex.BLEvento objbl   = new BLcccmex.BLEvento();
            Boolean           res     = false;
            CultureInfo       culture = new CultureInfo("en-US");
            int    resEnvio           = 0;
            string fechaHoy           = DateTime.Now.ToString("d", culture);

            try
            {
                List <capascccmex.metadatos.instalaciones> oCamposCat = new List <capascccmex.metadatos.instalaciones>();
                capascccmex.biz.instalaciones obj = new capascccmex.biz.instalaciones();
                oCamposCat = obj.GetInstalaciones();
                foreach (var item in oCamposCat)
                {
                    res = objbl.getEnvioNotificacion(fechaHoy, item.IdInst);
                    if (!res)
                    {
                        BLcccmex.BLEventoObjeto objEventoBL = new BLcccmex.BLEventoObjeto();
                        resEnvio = objEventoBL.EnviarCorreoEvento(item.IdInst, item.Nombre);
                        if (resEnvio >= 0)
                        {
                            objbl.AddEnvioNotificacion(fechaHoy, item.IdInst);
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        protected void btnHistorial_Click(object sender, EventArgs e)
        {
            int    resultado   = 0;
            string fechaactual = DateTime.Now.ToString();

            VentanaRad.RadPrompt("¿Fecha de Realización del Evento?", "promptCallBackFn", 350, 230, null, "Modificar Evento", fechaactual);

            BLcccmex.BLEvento objbl = new BLcccmex.BLEvento();
            resultado = objbl.AddEventoHistorico(1, 1, this.txtComentario.Text, 1);
        }
Ejemplo n.º 3
0
        protected void gridAlerta_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            //Inicializamos el evento actual
            Session["tempIdEvento"] = null;
            //Inicializamos el tipo de operaciòn
            Session["tempOpEvento"] = null;
            Int64?_idEvento = 0;

            //Operaciòn para actualizar
            if (e.CommandName == "DobleClick" || e.CommandName == "btnActualizar")
            {
                foreach (GridDataItem item in gridAlerta.MasterTableView.Items)
                {
                    if (item.Selected == true)
                    {
                        _idEvento = convertir.toNInt64(item.GetDataKeyValue("IdEvento"));

                        Session["tempIdEvento"] = _idEvento;
                        Session["tempOpEvento"] = "Actualizar";
                        string script = "function f(){AbrirRadWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);

                        return;
                    }
                }
                if (_idEvento < 1)
                {
                    ManejadorRadWindow.RadAlert("Por favor seleccione algun evento para </br> proceder con la operaciòn !", 350, 100, "Eventos - Informaciòn", null);
                    return;
                }
            }
            //Operaciòn para agregar
            if (e.CommandName == "btnAgregar")
            {
                Int64?_centro = convertir.toNInt64(cmbcentro.SelectedValue);

                Int64?_instalacion = convertir.toNInt64(cmbInstalacion.SelectedValue);

                Session["getIdCentroEvento"]      = _centro;
                Session["getIdInstalacionEvento"] = _instalacion;
                Session["tempOpEvento"]           = "Agregar";
                string script = "function f(){AbrirRadWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
                return;
            }
            //Operaciòn para eliminar
            if (e.CommandName == "btnEliminar")
            {
                foreach (GridDataItem item in gridAlerta.MasterTableView.Items)
                {
                    if (item.Selected == true)
                    {
                        idEvento = convertir.toNInt64(item.GetDataKeyValue("IdEvento"));

                        Session["tempIdEvento"] = idEvento;
                        ManejadorRadWindow.RadConfirm("Seguro que deseas eliminar este evento ? ", "confirmCallBackFn", 400, 120, null, "Confirmaciòn");
                        return;
                    }
                }
                if (_idEvento < 1)
                {
                    ManejadorRadWindow.RadAlert("Por favor seleccione algun evento para </br> proceder con la operaciòn !", 350, 100, "Eventos - Informaciòn", null);
                    return;
                }
            }
            //Operaciòn para agregar
            if (e.CommandName == "btnArchivar")
            {
                int   resultado = 0;
                Int64?_centro   = convertir.toNInt64(cmbcentro.SelectedValue);

                Int64?_instalacion = convertir.toNInt64(cmbInstalacion.SelectedValue);
                foreach (GridDataItem item in gridAlerta.MasterTableView.Items)
                {
                    if (item.Selected == true)
                    {
                        int               idEvento    = convertir.toInt32(item.GetDataKeyValue("IdEvento"));
                        int               idEquipo    = convertir.toInt32(item.GetDataKeyValue("IdEquipo"));
                        string            fechaevento = item["FechaEvento"].ToString();
                        BLcccmex.BLEvento objbl       = new BLcccmex.BLEvento();
                        resultado = objbl.AddEventoHistorico(idEvento, idEquipo, fechaevento, 1);

                        //string script = "function f(){AbrirRadWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                        //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
                        return;
                    }
                }
            }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            RequiredFieldsResumen.ValidationGroup = "get";
            Page.Validate("get");
            if (Page.IsValid)
            {
                BEcccmex.BEEvento objBE = new BEcccmex.BEEvento();
                objBE.evento      = this.txtEvento.Text;
                objBE.fechaEvento = this.txtFecha.SelectedDate.Value;
                objBE.idEquipo    = convertir.toNInt64(this.cmbEquipo.SelectedValue);
                objBE.tipoEvento  = this.cboTipoEvento.SelectedValue;
                objBE.vigencia    = this.txtVigencia.Text;
                objBE.prealarma   = Convert.ToInt16(this.txtPreAlarma.Text);
                objBE.postAlarma  = Convert.ToInt16(this.txtPostAlarma.Text);
                objBE.observacion = this.txtComentario.Text;
                BLcccmex.BLEvento objbl = new BLcccmex.BLEvento();

                int resultado = 0;

                if (Session["tempOpEvento"].ToString() == "Agregar")
                {
                    resultado = objbl.AddEvento(objBE);

                    if (resultado > 0)
                    {
                        VentanaRad.RadAlert("Nuevo evento registrado ! </br> Num. Evento : " + resultado, 400, 120, "Confirmación - Registro de Evento", "CloseAndRebind");
                        Session["tempIdEvento"] = null;
                        return;
                    }
                    else
                    {
                        VentanaRad.RadAlert("No se agrego ningun evento. Favor de contactar con su Administrador de sistemas", 450, 300, "Eventos - Informaciòn", null);
                        return;
                    }
                }

                if (Session["tempOpEvento"].ToString() == "Actualizar")
                {
                    objBE.idEvento = convertir.toNInt64(Session["tempIdEvento"]);
                    resultado      = objbl.UpdateEvento(convertir.toInt32(Session["tempIdEvento"]), convertir.toInt32(cmbEquipo.SelectedValue), txtEvento.Text, cboTipoEvento.Text, convertir.toInt32(txtPreAlarma.Text), (DateTime)txtFecha.SelectedDate, txtVigencia.Text,
                                                        convertir.toInt32(txtPostAlarma.Text), txtComentario.Text);

                    if (resultado > 0)
                    {
                        VentanaRad.RadAlert("Se actualizo correctamente el evento. ! </br> Num. Evento : " + Session["tempIdEvento"].ToString(), 400, 120, "Confirmación - Registro de Evento", "CloseAndRebind");
                        Session["tempIdEvento"] = null;
                        return;
                    }
                    else
                    {
                        VentanaRad.RadAlert("No se actualizo ningun evento. Favor de contactar con su Administrador de sistemas", 450, 300, "Eventos - Informaciòn", null);
                        return;
                    }
                }
            }
            else
            {
                MostrarCamposInvalidados();
                VentanaRad.RadAlert("Existen campos obligatorios, favor de verificar ", 400, 100, "Eventos - Validación", null);
            }
        }