コード例 #1
0
ファイル: Global.Master.cs プロジェクト: idelarom/portal_kpi
        private DataTable GetRecordsToday(string user)
        {
            RecordatoriosCOM recordatorios = new RecordatoriosCOM();
            DataTable        dt            = recordatorios.SelectToday(user);

            return(dt);
        }
コード例 #2
0
 protected void lnkcommandevent_Click(object sender, EventArgs e)
 {
     try
     {
         string     motivo                 = hdfmotivos.Value;
         LinkButton lnk                    = sender as LinkButton;
         string     comand                 = lnk.CommandName.ToLower();
         string     usuario                = Session["usuario"] as string;
         int        id_recordatorio        = Convert.ToInt32(lnk.CommandArgument);
         datos.Model.recordatorios entidad = new datos.Model.recordatorios();
         entidad.id_recordatorio     = id_recordatorio;
         entidad.comentarios_borrado = motivo;
         entidad.usuario_borrado     = usuario;
         RecordatoriosCOM recordatorio = new RecordatoriosCOM();
         string           vmensaje     = "";
         DataTable        dt_days      = recordatorio.Get(usuario.ToUpper());
         DataView         dv           = dt_days.DefaultView;
         dv.RowFilter = "id_recordatorio = " + id_recordatorio + "";
         if (dv.ToTable().Rows.Count > 0)
         {
             DataRow row           = dv.ToTable().Rows[0];
             bool    isAppointment = Convert.ToBoolean(row["appointment"]);
             if (isAppointment)
             {
                 String    password     = Session["contraseña"] as string;
                 string    username     = Session["usuario"] as string;
                 string    mail         = Session["mail"] as string;
                 string    mail_user    = username + mail.Replace(mail.Split('@')[0], "");
                 string    id           = row["key"].ToString();
                 EWSHelper appointments = new EWSHelper();
                 vmensaje = comand == "aceptar" ? appointments.AcceptAppointment(mail_user, password, id) : appointments.DeclineAppointment(mail_user, password, id, motivo);
                 if (comand == "rechazar" && vmensaje == "")
                 {
                     vmensaje = recordatorio.Eliminar(entidad);
                 }
             }
         }
         if (vmensaje == "")
         {
             ModalClose("#myModal");
             usuario = Session["usuario"] as string;
             ListaRecordatorios(usuario, Convert.ToDateTime(hdffecha.Value));
             LimpiarControles();
             IniciarCalendario();
             Toast.Success("Recordatorio respondido correctamente.", "Mensaje del sistema", this);
         }
         else
         {
             Toast.Error("Error al responder recordatorio: " + vmensaje, this);
         }
     }
     catch (Exception ex)
     {
         Toast.Error("Error al responder recordatorio: " + ex.Message, this);
     }
     finally {
         load_items.Style["display"] = "none";
     }
 }
コード例 #3
0
        private void Eliminar(int id_recordatorio, string motivo, string usuario)
        {
            try
            {
                datos.Model.recordatorios entidad = new datos.Model.recordatorios();
                entidad.id_recordatorio     = id_recordatorio;
                entidad.comentarios_borrado = motivo;
                entidad.usuario_borrado     = usuario;
                RecordatoriosCOM recordatorio = new RecordatoriosCOM();
                string           vmensaje     = "";
                DataTable        dt_days      = recordatorio.Get(usuario.ToUpper());
                DataView         dv           = dt_days.DefaultView;
                dv.RowFilter = "id_recordatorio = " + id_recordatorio + "";
                if (dv.ToTable().Rows.Count > 0)
                {
                    DataRow row           = dv.ToTable().Rows[0];
                    bool    isAppointment = Convert.ToBoolean(row["appointment"]);
                    if (isAppointment)
                    {
                        String    password     = Session["contraseña"] as string;
                        string    username     = Session["usuario"] as string;
                        string    mail         = Session["mail"] as string;
                        string    mail_user    = username + mail.Replace(mail.Split('@')[0], "");
                        string    id           = row["key"].ToString();
                        EWSHelper appointments = new EWSHelper();
                        vmensaje = appointments.CancelAppointment(mail_user, password, id, motivo);
                    }
                }
                if (vmensaje == "")
                {
                    vmensaje = recordatorio.Eliminar(entidad);
                }

                if (vmensaje == "")
                {
                    ModalClose("#myModal");
                    usuario = Session["usuario"] as string;
                    ListaRecordatorios(usuario, Convert.ToDateTime(hdffecha.Value));
                    LimpiarControles();
                    IniciarCalendario();
                    Toast.Success("Recordatorio eliminado correctamente.", "Mensaje del sistema", this);
                }
                else
                {
                    Toast.Error("Error al eliminar recordatorio: " + vmensaje, this);
                }
            }
            catch (Exception ex)
            {
                Toast.Error("Error al eliminar recordatorio: " + ex.Message, this);
            }
        }
コード例 #4
0
 public static String GetRecordsToday(string user)
 {
     try
     {
         RecordatoriosCOM recordatorios = new RecordatoriosCOM();
         DataTable        dt            = recordatorios.SelectToday(user);
         return(JsonConvert.SerializeObject(dt));
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(""));
     }
 }
コード例 #5
0
ファイル: Global.Master.cs プロジェクト: idelarom/portal_kpi
        protected void lnkcommand_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton       lnk             = sender as LinkButton;
                string           command         = lnk.CommandName.ToLower();
                int              id_recordatorio = Convert.ToInt32(lnk.CommandArgument);
                RecordatoriosCOM recordatorios   = new RecordatoriosCOM();
                string           usuario         = Session["usuario"] as string;
                string           mensaje         = "";
                switch (command)
                {
                case "todo":
                    DataTable dt_all_records = ViewState["dt_records_today"] as DataTable;
                    foreach (DataRow row in dt_all_records.Rows)
                    {
                        id_recordatorio = Convert.ToInt32(row["id_recordatorio"]);
                        recordatorios.Descartar(id_recordatorio, usuario);
                    }
                    break;

                case "descartar":
                    recordatorios.Descartar(id_recordatorio, usuario);
                    break;

                case "posponer":
                    int minutos = 15;
                    recordatorios.Posponer(id_recordatorio, minutos);
                    break;
                }
                string url = Request.Url.AbsoluteUri;
                if (mensaje == "")
                {
                    System.Web.UI.ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(),
                                                                      "AlertGO('Solicitud realizada correctamente','" + url + "');", true);
                }
                else
                {
                    Toast.Error("Error al procesar recordatorio con id(" + id_recordatorio + "),: " + mensaje, this.Page);
                }
            }
            catch (Exception ex)
            {
                Toast.Error("Error al procesar recodatorio: " + ex.Message, this.Page);
            }
        }
コード例 #6
0
 public static String GetRecords(string user)
 {
     try
     {
         RecordatoriosCOM recordatorios = new RecordatoriosCOM();
         DataTable        dt            = recordatorios.Get(user);
         List <Event>     eventos       = new List <Event>();
         foreach (DataRow row in dt.Rows)
         {
             row["fecha_end"] = row["fecha_end"] == DBNull.Value ? Convert.ToDateTime(row["fecha"]).AddMinutes(30) : row["fecha_end"];
             string color          = Convert.ToBoolean(row["appointment"]) ? "#1565c0 " : "#f56954";
             string day_           = Convert.ToDateTime(row["fecha"]).Day.ToString();
             string month_         = (Convert.ToDateTime(row["fecha"]).Month).ToString();
             string year_          = Convert.ToDateTime(row["fecha"]).Year.ToString();
             string minutes_       = (Convert.ToDateTime(row["fecha"]).Minute).ToString();
             string minutes_finish = (Convert.ToDateTime(row["fecha_end"]).Minute).ToString();
             string hours          = Convert.ToDateTime(row["fecha"]).Hour.ToString();
             string hours_         = Convert.ToDateTime(row["fecha_end"]).Hour.ToString();
             month_         = month_.Length == 1 ? "0" + month_ : month_;
             day_           = day_.Length == 1 ? "0" + day_ : day_;
             hours          = hours.Length == 1 ? "0" + hours : hours;
             minutes_       = minutes_.Length == 1 ? "0" + minutes_ : minutes_;
             minutes_finish = minutes_finish.Length == 1 ? "0" + minutes_finish : minutes_finish;
             eventos.Add(new Event(
                             row["titulo"].ToString(),
                             year_ + "-" + month_ + "-" + day_ + "T" + hours + ":" + minutes_ + ":00",
                             year_ + "-" + month_ + "-" + day_ + "T" + hours_ + ":" + minutes_finish + ":00",
                             color,
                             color,
                             row["organizer"] == null ? "" : row["organizer"].ToString(),
                             row["location"] == null ? "" : row["location"].ToString(),
                             row["descripcion"] == null ? "" : row["descripcion"].ToString(),
                             row["organizer_address"] == null ? "" : row["organizer_address"].ToString(),
                             Convert.ToBoolean(row["appointment"]),
                             Convert.ToDateTime(row["fecha"]).ToString("dddd dd MMMM, yyyy hh:mm tt", CultureInfo.CreateSpecificCulture("es-MX")),
                             Convert.ToDateTime(row["fecha_end"]).ToString("dddd dd MMMM, yyyy hh:mm tt", CultureInfo.CreateSpecificCulture("es-MX"))
                             ));
         }
         string ret = JsonConvert.SerializeObject(eventos);
         return(ret);
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(""));
     }
 }
コード例 #7
0
 protected void btnedit_Click(object sender, EventArgs e)
 {
     try
     {
         DateTime date_selected = Convert.ToDateTime(hdffecha.Value);
         string   usuario       = Session["usuario"] as string;
         txtid_recordatorio.Text = hdfid_rec.Value;
         ListaRecordatorios(usuario, date_selected);
         RecordatoriosCOM recordatorio = new RecordatoriosCOM();
         DataTable        dt_days      = recordatorio.Get(usuario.ToUpper());
         DataView         dv           = dt_days.DefaultView;
         int id_recordatorio           = Convert.ToInt32(hdfid_rec.Value == "" ? "0" : hdfid_rec.Value);
         dv.RowFilter = "id_recordatorio = " + id_recordatorio + "";
         if (dv.ToTable().Rows.Count > 0)
         {
             DataRow row = dv.ToTable().Rows[0];
             rtxttitulo.Text          = row["titulo"].ToString();
             rtxtdescripcion.Text     = row["descripcion"].ToString().Replace(Environment.NewLine, " ");
             txtfecharec.SelectedDate = Convert.ToDateTime(row["fecha"]);
             IniciarCalendario();
             Boolean isAppointment = Convert.ToBoolean(row["appointment"]);
             div_organizador.Visible = isAppointment;
             div_fecha_fin.Visible   = isAppointment;
             if (isAppointment)
             {
                 rtxtlugar.Text            = row["location"].ToString();
                 txtfechafin.SelectedDate  = Convert.ToDateTime(row["fecha_end"]);
                 rtxtorganizador.Text      = row["organizer"].ToString();
                 rtxtcorreorganizador.Text = row["organizer_address"].ToString();
             }
             ModalShow("#myModal");
         }
         else
         {
             Toast.Error("Error al cargar recordatorio: No se encuentra ningun recordatorio", this);
         }
     }
     catch (Exception ex)
     {
         Toast.Error("Error al cargar recordatorio: " + ex.Message, this);
     }
 }
コード例 #8
0
 private void Editar(int id_recordatorio, string titulo, string descripcion, DateTime fecha, string usuario,
                     string organ, string organ_mail, DateTime fecha_end)
 {
     try
     {
         datos.Model.recordatorios entidad = new datos.Model.recordatorios();
         entidad.titulo            = titulo;
         entidad.id_recordatorio   = id_recordatorio;
         entidad.descripcion       = descripcion;
         entidad.fecha             = fecha;
         entidad.organizer         = organ;
         entidad.organizer_address = organ_mail;
         entidad.usuario           = usuario;
         entidad.fecha_end         = fecha_end;
         entidad.usuario_creacion  = usuario;
         RecordatoriosCOM recordatorio = new RecordatoriosCOM();
         string           vmensaje     = recordatorio.Editar(entidad, new List <recordatorios_usuarios_adicionales>());
         if (vmensaje == "")
         {
             ModalClose("#myModal");
             usuario = Session["usuario"] as string;
             ListaRecordatorios(usuario, Convert.ToDateTime(hdffecha.Value));
             LimpiarControles();
             IniciarCalendario();
             Toast.Success("Recordatorio editado correctamente.", "Mensaje del sistema", this);
         }
         else
         {
             Toast.Error("Error al editado recordatorio: " + vmensaje, this);
         }
     }
     catch (Exception ex)
     {
         Toast.Error("Error al editar recordatorio: " + ex.Message, this);
     }
     finally
     {
         lnkguardar.Visible           = true;
         lnkcargando.Style["display"] = "none";
     }
 }
コード例 #9
0
        private void ListaRecordatorios(string usuario, DateTime fecha)
        {
            try
            {
                hdffecha.Value           = fecha.ToString("yyyy-MM-dd");
                txtfecha.Text            = fecha.ToString("yyyy-MM-dd");
                txtfecharec.SelectedDate = fecha;
                txtfechafin.SelectedDate = fecha;
                RecordatoriosCOM recordatorio = new RecordatoriosCOM();
                DataTable        dt_days      = recordatorio.Select(usuario.ToUpper(), fecha);
                repeat_list_rec.DataSource = dt_days;
                repeat_list_rec.DataBind();

                String fcha    = Convert.ToDateTime(fecha).ToString("dddd dd MMMM, yyyy", CultureInfo.CreateSpecificCulture("es-MX")).ToLower();
                String fecha_r = fcha.ToLower();
                lblfechaselected.Text = CultureInfo.InvariantCulture.TextInfo.ToTitleCase(fcha);
            }
            catch (Exception ex)
            {
                Toast.Error("Error al cargar los recordatorios en el calendario: " + ex.Message, this);
            }
        }
コード例 #10
0
        public StringBuilder InicializarCalendario()
        {
            try
            {
                string           usuario       = Session["usuario"] as string;
                DateTime         fecha         = Convert.ToDateTime(txtfecha.Text);
                RecordatoriosCOM recordatorios = new RecordatoriosCOM();
                DataTable        dt            = recordatorios.Get(usuario);
                StringBuilder    sb            = new StringBuilder();
                string           day           = fecha.Day.ToString();
                string           month         = fecha.Month.ToString();
                string           year          = fecha.Year.ToString();
                month = month.Length == 1 ? "0" + month : month;
                day   = day.Length == 1 ? "0" + day : day;
                if (dt.Rows.Count > 0)
                {
                    string eventos = "";
                    foreach (DataRow row in dt.Rows)
                    {
                        row["fecha_end"] = row["fecha_end"] == DBNull.Value ? Convert.ToDateTime(row["fecha"]).AddMinutes(30) : row["fecha_end"];
                        string color          = Convert.ToBoolean(row["appointment"]) ? "#1565c0 " : "#f56954";
                        string day_           = Convert.ToDateTime(row["fecha"]).Day.ToString();
                        string month_         = (Convert.ToDateTime(row["fecha"]).Month).ToString();
                        string year_          = Convert.ToDateTime(row["fecha"]).Year.ToString();
                        string minutes_       = (Convert.ToDateTime(row["fecha"]).Minute).ToString();
                        string minutes_finish = (Convert.ToDateTime(row["fecha_end"]).Minute).ToString();
                        string hours          = Convert.ToDateTime(row["fecha"]).Hour.ToString();
                        string hours_         = Convert.ToDateTime(row["fecha_end"]).Hour.ToString();
                        month_         = month_.Length == 1 ? "0" + month_ : month_;
                        day_           = day_.Length == 1 ? "0" + day_ : day_;
                        hours          = hours.Length == 1 ? "0" + hours : hours;
                        minutes_       = minutes_.Length == 1 ? "0" + minutes_ : minutes_;
                        minutes_finish = minutes_finish.Length == 1 ? "0" + minutes_finish : minutes_finish;
                        eventos        = eventos + "  {title: '" + row["titulo"].ToString() + "'," +
                                         "start: '" + year_ + "-" + month_ + "-" + day_ + "T" + hours + ":" + minutes_ + ":00'," +
                                         "end:'" + year_ + "-" + month_ + "-" + day_ + "T" + hours + ":" + minutes_finish + ":00'," +
                                         "backgroundColor:'" + color + "'," +
                                         "borderColor: '" + color + "'," +
                                         "allday:false," +
                                         "id:" + row["id_recordatorio"].ToString() +
                                         "},";
                    }
                    eventos = eventos.Substring(0, eventos.Length - 1);

                    sb.Append("<script type='text/javascript'>");
                    sb.Append(""
                              + " $(function () {" +
                              " $('#calendar').fullCalendar({" +
                              "     locale: 'es'," +
                              "     dayClick: function(date, jsEvent, view) {" +
                              "         $('#" + hdffecha.ClientID + "').val(date.format());" +
                              "         document.getElementById('" + btncalendar.ClientID + "').click();" +
                              "     }," +
                              "     eventClick: function(calEvent, jsEvent, view) {" +
                              "         $('#" + hdffecha.ClientID + "').val(calEvent.start.format());" +
                              "         return EditRecordatorios(calEvent.id); }," +
                              "     header: {" +
                              "         left: 'prev,next today'," +
                              "         center: 'title'," +
                              "         right: 'month,agendaWeek,agendaDay'" +
                              "     }," +
                              "     buttonText: {" +
                              "         today: 'Hoy'," +
                              "         month: 'Mes'," +
                              "         week: 'Sem'," +
                              "         day: 'Dia'" +
                              "     }," +
                              "     events: [" + eventos + "]," +
                              "     editable: false," +
                              "     droppable: false" +
                              " });" +
                              " $('#calendar').fullCalendar('gotoDate', '" + year + "-" + month + "-" + day + "');" +
                              " });");
                    sb.Append("</script>");
                }
                else
                {
                    sb.Append("<script type='text/javascript'>");
                    sb.Append(""
                              + " $(function () {" +
                              " $('#calendar').fullCalendar({" +
                              "     locale: 'es'," +
                              "     dayClick: function(date, jsEvent, view) {" +
                              "         $('#" + hdffecha.ClientID + "').val(date.format());" +
                              "         document.getElementById('" + btncalendar.ClientID + "').click();" +
                              "     }," +
                              "     eventClick: function(calEvent, jsEvent, view) {" +
                              "         $('#" + hdffecha.ClientID + "').val(calEvent.start.format());" +
                              "         return EditRecordatorios(calEvent.id); }," +
                              "     header: {" +
                              "         left: 'prev,next today'," +
                              "         center: 'title'," +
                              "         right: 'month,agendaWeek,agendaDay'" +
                              "     }," +
                              "     buttonText: {" +
                              "         today: 'Hoy'," +
                              "         month: 'Mes'," +
                              "         week: 'Sem'," +
                              "         day: 'Dia'" +
                              "     }" +
                              " });" +
                              " $('#calendar').fullCalendar('gotoDate', '" + year + "-" + month + "-" + day + "');" +
                              " });");
                    sb.Append("</script>");
                }

                return(sb);
            }
            catch (Exception ex)
            {
                Toast.Error("Error al generar calendario: " + ex.Message, this);
                return(new StringBuilder());
            }
        }
コード例 #11
0
        /// <summary>
        /// Inserta los meetings en una tabla sql
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public void GetAllCalendar(string userId, string password)
        {
            try
            {
                List <datos.Model.recordatorios> list = new List <datos.Model.recordatorios>();
                service              = new ExchangeService(ExchangeVersion.Exchange2010);
                credentials          = new WebCredentials(userId, password);
                service.Credentials  = credentials;
                service.TraceEnabled = true;
                service.TraceFlags   = TraceFlags.All;
                service.Url          = new Uri("https://mail.migesa.com.mx/ews/exchange.asmx");
                service.AutodiscoverUrl(userId, RedirectionUrlValidationCallback);
                DateTime startDate = DateTime.Now.AddMonths(-6);
                DateTime endDate   = DateTime.Now.AddMonths(3);
                // Initialize the calendar folder object with only the folder ID.
                CalendarFolder calendar = CalendarFolder.Bind(service, WellKnownFolderName.Calendar, new PropertySet());

                // Set the start and end time and number of appointments to retrieve.
                CalendarView cView = new CalendarView(startDate.AddDays(-1), endDate.AddDays(1));

                // Limit the properties returned to the appointment's subject, start time, and end time.
                cView.PropertySet = new PropertySet(AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.End);

                // Retrieve a collection of appointments by using the calendar view.
                FindItemsResults <Microsoft.Exchange.WebServices.Data.Appointment> appointments = calendar.FindAppointments(cView);
                string      username        = (userId.Split('@')[0]);
                PropertySet itempropertyset = new PropertySet(BasePropertySet.FirstClassProperties);
                itempropertyset.RequestedBodyType = BodyType.Text;
                RecordatoriosCOM reco = new RecordatoriosCOM();
                int total_actual      = reco.GetRecords(username);
                if (total_actual != appointments.Items.Count)
                {
                }

                foreach (Microsoft.Exchange.WebServices.Data.Appointment a in appointments)
                {
                    a.Load(itempropertyset);
                    DateTime         fecha_inicio  = a.Start;
                    DateTime         fecha_fin     = a.End;
                    string           subject       = a.Subject == null ? "" : a.Subject.ToString();
                    string           organizer     = a.Organizer.Name == null ? "" : a.Organizer.Name.ToString();
                    RecordatoriosCOM recordatorios = new RecordatoriosCOM();
                    string           id            = a.Id.ToString();
                    List <recordatorios_usuarios_adicionales> list_Ad = new List <recordatorios_usuarios_adicionales>();
                    string nbody = a.Body.Text == null ? "" : a.Body.Text.ToString();
                    datos.Model.recordatorios e = new datos.Model.recordatorios();
                    string organizer_address    = a.Organizer.Address == null ? "" : a.Organizer.Address.ToString();
                    string body          = a.Body.Text == null ? "" : a.Body.Text.ToString();
                    string participantes = a.DisplayTo == null ? "" : a.DisplayTo.ToString();
                    string lugar         = a.Location == null ? "" : a.Location.ToString();
                    if (participantes != "")
                    {
                        string[] participantes_array = participantes.Split(';');
                        foreach (string part in participantes_array)
                        {
                            if (part.ToUpper() != organizer.ToUpper())
                            {
                                recordatorios_usuarios_adicionales rec = new recordatorios_usuarios_adicionales
                                {
                                    nombre = part,
                                    activo = true
                                };
                                list_Ad.Add(rec);
                            }
                        }
                    }
                    e.organizer                 = organizer;
                    e.organizer_address         = organizer_address;
                    e.key_appointment_exchanged = id;
                    e.fecha            = fecha_inicio;
                    e.fecha_end        = fecha_fin;
                    e.titulo           = subject;
                    e.usuario          = username;
                    e.descripcion      = body;
                    e.usuario_creacion = username;
                    e.location         = lugar;
                    bool caneled = e.titulo.Contains("Cancelada:") || a.IsCancelled;
                    e.activo = !caneled;
                    if (e.descripcion.Contains("https://connext.webex.com/join/sergio_gaytan"))
                    {
                        e.activo = e.activo;
                    }
                    int id_recordatorio = recordatorios.ExistAppointmentID(username, id, organizer, subject, fecha_inicio, fecha_fin);
                    e.id_recordatorio = id_recordatorio;
                    string vmensaje = id_recordatorio == 0 ?
                                      recordatorios.Agregar(e, list_Ad) :
                                      reco.Editar(e, list_Ad);
                }
            }
            catch (Microsoft.Exchange.WebServices.Data.ServiceObjectPropertyException obj)
            {
                exchangeInitialized = false;
            }
            catch (Exception ex)
            {
                exchangeInitialized = false;
            }
        }
コード例 #12
0
        public StringBuilder InicializarCalendario()
        {
            try
            {
                string           usuario       = Session["usuario"] as string;
                DateTime         fecha         = Convert.ToDateTime(DateTime.Now);
                RecordatoriosCOM recordatorios = new RecordatoriosCOM();
                DataTable        dt            = recordatorios.Get(usuario);
                string           eventos       = "";
                foreach (DataRow row in dt.Rows)
                {
                    row["fecha_end"] = row["fecha_end"] == DBNull.Value ? Convert.ToDateTime(row["fecha"]).AddMinutes(30) : row["fecha_end"];
                    string color          = Convert.ToBoolean(row["appointment"]) ? "#1565c0 " : "#f56954";
                    string day_           = Convert.ToDateTime(row["fecha"]).Day.ToString();
                    string month_         = (Convert.ToDateTime(row["fecha"]).Month).ToString();
                    string year_          = Convert.ToDateTime(row["fecha"]).Year.ToString();
                    string minutes_       = (Convert.ToDateTime(row["fecha"]).Minute).ToString();
                    string minutes_finish = (Convert.ToDateTime(row["fecha_end"]).Minute).ToString();
                    string hours          = Convert.ToDateTime(row["fecha"]).Hour.ToString();
                    string hours_         = Convert.ToDateTime(row["fecha_end"]).Hour.ToString();
                    month_         = month_.Length == 1 ? "0" + month_ : month_;
                    day_           = day_.Length == 1 ? "0" + day_ : day_;
                    hours          = hours.Length == 1 ? "0" + hours : hours;
                    minutes_       = minutes_.Length == 1 ? "0" + minutes_ : minutes_;
                    minutes_finish = minutes_finish.Length == 1 ? "0" + minutes_finish : minutes_finish;
                    eventos        = eventos +
                                     "{title: '" + row["titulo"].ToString() + "'," +
                                     "start: '" + year_ + "-" + month_ + "-" + day_ + "T" + hours + ":" + minutes_ + ":00'," +
                                     "end:'" + year_ + "-" + month_ + "-" + day_ + "T" + hours + ":" + minutes_finish + ":00'," +
                                     "backgroundColor:'" + color + "'," +
                                     "borderColor: '" + color + "'," +
                                     "allday:false," +
                                     "id:" + row["id_recordatorio"].ToString() + "," +
                                     "organizador:'" + (row["organizer"] == null ? "" : row["organizer"].ToString()) + "'," +
                                     "ubicacion:'" + (row["location"] == null ? "" : row["location"].ToString()) + "'," +
                                     "descripcion:'" + (row["descripcion"] == null ? "" : row["descripcion"].ToString().Replace(Environment.NewLine, " ")) + "'," +
                                     "organizador_mail:'" + (row["organizer_address"] == null ? "" : row["organizer_address"].ToString()) + "'," +
                                     "Isappointment:" + Convert.ToBoolean(row["appointment"]).ToString().ToLower() + "," +
                                     "start_:'" + Convert.ToDateTime(row["fecha"]).ToString("dddd dd MMMM, yyyy hh:mm tt", CultureInfo.CreateSpecificCulture("es-MX")) + "'," +
                                     "end_:'" + Convert.ToDateTime(row["fecha_end"]).ToString("dddd dd MMMM, yyyy hh:mm tt", CultureInfo.CreateSpecificCulture("es-MX")) + "'" +

                                     "},";
                }
                eventos = eventos.Length > 1 ? eventos.Substring(0, eventos.Length - 1) : eventos;
                string day   = fecha.Day.ToString();
                string month = fecha.Month.ToString();
                string year  = fecha.Year.ToString();
                month = month.Length == 1 ? "0" + month : month;
                day   = day.Length == 1 ? "0" + day : day;
                StringBuilder sb = new StringBuilder();
                sb.Append("<script type='text/javascript'>");
                sb.Append(""
                          + " $(function () {" +
                          " $('#calendar').fullCalendar({" +
                          "     locale: 'es',height: 300," +
                          "     header: {" +
                          "         left: 'prev,next today'," +
                          "         center: 'title'," +
                          "         right: 'month,agendaWeek,agendaDay'" +
                          "     }," +
                          "eventClick: function (calEvent, jsEvent, view) {" +
                          "      var Isappointment = calEvent.Isappointment;" +
                          "      $('#div_fecha_fin').hide();" +
                          "      $('#div_organizador').hide();" +
                          "      if (calEvent.Isappointment)" +
                          "      {                " +
                          "          $('#div_fecha_fin').show();" +
                          "          $('#div_organizador').show();" +
                          "          $('#ContentPlaceHolder1_rtxtlugar').val(calEvent.ubicacion);" +
                          "          $('#ContentPlaceHolder1_rtxtorganizador').val(calEvent.organizador);" +
                          "          $('#ContentPlaceHolder1_rtxtcorreorganizador').val(calEvent.organizador_mail);" +
                          "          $('#ContentPlaceHolder1_txtfechafin').val(calEvent.end_);" +
                          "      }" +
                          "      $('#ContentPlaceHolder1_txtfechainicio').val(calEvent.start_);" +
                          "      $('#ContentPlaceHolder1_rtxttitulo').val(calEvent.title);" +
                          "      $('#ContentPlaceHolder1_rtxtdescripcion').val(calEvent.descripcion);" +
                          "      ModalShow('#modal_evento');" +
                          "  }," +
                          "     buttonText: {" +
                          "         today: 'Hoy'," +
                          "         month: 'Mes'," +
                          "         week: 'Sem'," +
                          "         day: 'Dia'" +
                          "     }," +
                          "     events: [" + eventos + "]," +
                          "     editable: false," +
                          "     droppable: false" +
                          " });" +
                          " $('#calendar').fullCalendar('gotoDate', '" + year + "-" + month + "-" + day + "');" +
                          " });");
                sb.Append("</script>");
                return(sb);
            }
            catch (Exception ex)
            {
                Toast.Error("Error al generar calendario: " + ex.Message, this);
                return(new StringBuilder());
            }
        }