protected void btnEliminar_Click(object sender, EventArgs e)
        {
            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                if (ListBox2.SelectedIndex >= 0)
                {
                    cAptMonitorMensaje oAptMonitorMensaje = new cAptMonitorMensaje(ref oConn);
                    for (int i = 0; i < ListBox2.Items.Count; i++)
                    {
                        if (ListBox2.Items[i].Selected)
                        {
                            oAptMonitorMensaje.CodMensaje = CodMensaje.Value;
                            oAptMonitorMensaje.CodMonitor = ListBox2.Items[i].Value;
                            oAptMonitorMensaje.Accion     = "ELIMINAR";
                            oAptMonitorMensaje.Put();
                        }
                    }
                    ListBox1.Items.Clear();
                    ListBox2.Items.Clear();
                    Load_ListBox();
                }
                oConn.Close();
            }
        }
        protected void Load_ListBox()
        {
            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                cAptMonitorMensaje oAptMonitorMensaje = new cAptMonitorMensaje(ref oConn);
                oAptMonitorMensaje.CodMensaje = CodMensaje.Value;
                oAptMonitorMensaje.NotIn      = true;
                DataTable dtMonitor = oAptMonitorMensaje.GetMonitorByMsj();
                if (dtMonitor != null)
                {
                    foreach (DataRow oRow in dtMonitor.Rows)
                    {
                        ListBox1.Items.Add(new ListItem(oRow["desc_monitor_view"].ToString(), oRow["cod_monitor"].ToString()));
                    }
                }
                dtMonitor = null;

                oAptMonitorMensaje.NotIn = false;
                dtMonitor = oAptMonitorMensaje.GetMonitorByMsj();
                if (dtMonitor != null)
                {
                    foreach (DataRow oRow in dtMonitor.Rows)
                    {
                        ListBox2.Items.Add(new ListItem(oRow["desc_monitor_view"].ToString(), oRow["cod_monitor"].ToString()));
                    }
                }
                dtMonitor = null;
                oConn.Close();
            }
        }
Exemple #3
0
        protected void gridMensajes_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            try
            {
                DBConn oConn = new DBConn();
                if (oConn.Open())
                {
                    string pCodMensaje = gridMensajes.DataKeys[e.RowIndex].Value.ToString();

                    cAptMonitorMensaje oAptMonitorMensaje = new cAptMonitorMensaje(ref oConn);
                    oAptMonitorMensaje.CodMensaje = pCodMensaje;
                    oAptMonitorMensaje.Accion     = "ELIMINAR";
                    oAptMonitorMensaje.Put();

                    if (!string.IsNullOrEmpty(oAptMonitorMensaje.Error))
                    {
                        Response.Write(oAptMonitorMensaje.Error);
                        Response.End();
                    }

                    cAppMensaje oAppMensaje = new cAppMensaje(ref oConn);
                    oAppMensaje.CodMensaje = pCodMensaje;
                    oAppMensaje.Accion     = "ELIMINAR";
                    oAppMensaje.Put();

                    if (!string.IsNullOrEmpty(oAppMensaje.Error))
                    {
                        Response.Write(oAppMensaje.Error);
                        Response.End();
                    }

                    oConn.Close();
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message + "; " + ex.InnerException.ToString());
            }
            LoadGrid();
        }
Exemple #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DBConn oConn        = new DBConn();
            Web    oWeb         = new Web();
            string pCodMonitor  = oWeb.GetData("codmonitor");
            string pCodUsuario  = oWeb.GetData("codusuario");
            string pOrderPage   = oWeb.GetData("order");
            string pCodCliente  = string.Empty;
            string pTipoUsuario = string.Empty;
            int    maxdt        = (new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1)).Day;

            firtDay.InnerText = "01-" + DateTime.Now.ToString("MM-yyyy");
            lastDay.InnerText = maxdt.ToString() + "-" + DateTime.Now.ToString("MM-yyyy");

            if (!IsPostBack)
            {
                if (oConn.Open())
                {
                    cAptMonitorPages oAptMonitorPages = new cAptMonitorPages(ref oConn);
                    oAptMonitorPages.CodMonitor = pCodMonitor;
                    oAptMonitorPages.OrderPage  = pOrderPage;
                    DataTable dtMPage = oAptMonitorPages.Get();

                    if (dtMPage != null)
                    {
                        if (dtMPage.Rows.Count > 0)
                        {
                            pTipoUsuario = dtMPage.Rows[0]["tipo_usuario"].ToString();
                            if (!string.IsNullOrEmpty(dtMPage.Rows[0]["cod_cliente"].ToString()))
                            {
                                pCodCliente = dtMPage.Rows[0]["cod_cliente"].ToString();
                            }
                            else if (!string.IsNullOrEmpty(dtMPage.Rows[0]["cod_holding"].ToString()))
                            {
                                pCodCliente  = dtMPage.Rows[0]["cod_holding"].ToString();
                                pTipoUsuario = "H";
                            }
                        }
                    }
                    dtMPage = null;

                    cAptMonitorMensaje oAptMonitorMensaje = new cAptMonitorMensaje(ref oConn);
                    oAptMonitorMensaje.CodMonitor = pCodMonitor;
                    DataTable dtMntMsj = oAptMonitorMensaje.GeMensajesByMonitor();
                    if (dtMntMsj != null)
                    {
                        if (dtMntMsj.Rows.Count > 0)
                        {
                            Label oLabel;
                            foreach (DataRow oRow in dtMntMsj.Rows)
                            {
                                oLabel          = new Label();
                                oLabel.Text     = oRow["texto_mensaje"].ToString();
                                oLabel.CssClass = "styleMensaje";
                                idMarque.Controls.Add(oLabel);
                                idMarque.Controls.Add(new LiteralControl("<br><br><br>"));
                            }
                        }
                    }
                    dtMntMsj = null;


                    oCmbTipoConsulta.Value = pTipoUsuario;
                    oCmbCliente.Value      = pCodCliente;
                    imglogo.ImageUrl       = "images/logos/logo.jpg";
                }
                oConn.Close();
            }
        }