Ejemplo n.º 1
0
    protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
    {
        Calendar1.SelectedDates.Clear();

        try
        {
            iCom_BusinessEntity.Calendario oBE = new iCom_BusinessEntity.Calendario();
            iCom_BusinessLogic.Calendario  oBL = new iCom_BusinessLogic.Calendario();
            dtDatos = oBL.Consultar(oBE);

            foreach (DataRow row in dtDatos.Rows)
            {
                if (row[1].ToString().Contains(e.Day.Date.ToString()) == true)
                {
                    Label lbl = new Label();
                    lbl.Text = "<br/>" + row[2].ToString();
                    e.Cell.Controls.Add(lbl);
                }
            }
        }
        catch (Exception ex)
        {
            ResgitraLog(ex.Message);
            return;
        }
    }
Ejemplo n.º 2
0
    protected void btnGuardar_Click(object sender, EventArgs e)
    {
        try
        {
            if (Valida())
            {
                iCom_BusinessEntity.Calendario oBE = new iCom_BusinessEntity.Calendario();
                oBE.idcalendario = int.Parse(Application["idcalendario"].ToString());

                // Fecha
                string   sFecha = ddlAnio.SelectedItem.ToString() + "-" + ddlMes.SelectedItem.ToString() + "-" + ddlDia.SelectedItem.ToString();
                DateTime fecha  = Convert.ToDateTime(sFecha + " 00:00:00.000", CultureInfo.InvariantCulture);
                oBE.fecha = fecha;

                oBE.evento = txtEvento.Text.Trim();
                if (chkActivo.Checked == true)
                {
                    oBE.activo = true;
                }
                else
                {
                    oBE.activo = false;
                }

                iCom_BusinessLogic.Calendario oBL = new iCom_BusinessLogic.Calendario();

                if (oBE.idcalendario == 0)
                {
                    dtDatos = oBL.Insertar(oBE);
                }
                else
                {
                    dtDatos = oBL.Actualizar(oBE);
                }

                ResgitraLog("Datos guardados");
                Calendar1.SelectedDate      = DateTime.Now.Date;
                Application["idcalendario"] = "0";
                return;
            }
        }
        catch (Exception ex)
        {
            ResgitraLog(ex.Message);
            return;
        }
    }