Beispiel #1
0
        private string Guardar_fechas(int IndicadorId, string Newdate, Byte Tipo)
        {
            try
            {
                ESM.Model.ESMBDDataContext db = new ESM.Model.ESMBDDataContext();

                var ind = (from c in db.Indicadores
                           where c.Id == IndicadorId
                           select c).Single();

                if (Tipo == 1)
                    ind.fecha_indicador_inicial = Convert.ToDateTime(Newdate);
                else if (Tipo == 2)
                    ind.fecha_indicador_final = Convert.ToDateTime(Newdate);

                try
                {
                    db.SubmitChanges();
                    return "Ok";
                }
                catch (LinqDataSourceValidationException exlinq)
                {
                    return exlinq.Message;
                }
                catch (Exception ex)
                {
                    return ex.Message;
                }
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
        }
Beispiel #2
0
        public static IQueryable ReportAgendaSE()
        {
            var db = new ESM.Model.ESMBDDataContext();
            try
            {
                var cse = (from c in db.Citas
                           where c.IdSE != null
                           orderby c.Secretaria_Educacion.Nombre
                           orderby c.FechaInicio
                           select new { c.Secretaria_Educacion.Nombre, Consultor = c.Secretaria_Educacion.Consultore.Nombre, DepartamentoMunicipio = c.Secretaria_Educacion.DepMun, c.FechaInicio });

                return cse;
            }
            catch (Exception) { return null; }
        }
Beispiel #3
0
        public static List<object> ReportAgendaEE()
        {
            var db = new ESM.Model.ESMBDDataContext();
            try
            {
                List<object> objList = new List<object>();

                var cee = from c in db.Citas
                          where c.IdEE != null
                          orderby c.Secretaria_Educacion.Nombre
                          orderby c.FechaInicio
                          select new
                          {
                              c.Establecimiento_Educativo.Secretaria_Educacion.Nombre,
                              Consultor = c.Establecimiento_Educativo.Secretaria_Educacion.Consultore.Nombre,
                              c.Establecimiento_Educativo.CodigoDane,
                              Establecimiento = c.Establecimiento_Educativo.Nombre,
                              c.Establecimiento_Educativo.Municipio,
                              c.FechaInicio
                          };

                DateTime fecha_actual = DateTime.Now.AddHours(2);

                int visitados = (from v in cee
                                 where v.FechaInicio <= fecha_actual
                                 select v).Count();

                int porvisitar = (from v in cee
                                  where v.FechaInicio > fecha_actual
                                  select v).Count();

                objList.Add(cee);
                objList.Add(visitados);
                objList.Add(porvisitar);

                return objList;
            }
            catch (Exception) { return null; }
        }
Beispiel #4
0
        public bool genera_gantt(string DivId, int Resultado_id, Page pagina, bool esProyecto = false)
        {
            try
            {
                var cstype = pagina.GetType();
                ClientScriptManager cs = pagina.ClientScript;
                StringBuilder sb = new StringBuilder();
                int Band = 0;
                int i = 1;
                int j = 0;
                string ColorTemp;
                ESM.Model.ESMBDDataContext db = new ESM.Model.ESMBDDataContext();
                IQueryable<ESM.Model.gantt> results = null;
                if (!esProyecto)
                {
                    results = from c in db.gantts
                              where c.Resultado_id == Resultado_id
                              orderby c.Resultado_id
                              select c;
                }
                else
                {
                    results = from c in db.gantts
                              where c.Proyecto_id == Resultado_id
                              orderby c.Resultado_id
                              select c;
                }

                sb.AppendLine("var g = new JSGantt.GanttChart('g', document.getElementById('" + DivId + "'), 'day');");
                sb.AppendLine("g.setShowRes(0); // Show/Hide Responsible (0/1)");
                sb.AppendLine("g.setShowDur(0); // Show/Hide Duration (0/1);");
                sb.AppendLine("g.setShowComp(0); // Show/Hide % Complete(0/1)");
                sb.AppendLine("g.setShowStartDate(1); // Show/Hide Start Date(0/1)");
                sb.AppendLine("g.setShowEndDate(1); // Show/Hide End Date(0/1)");
                sb.AppendLine(@"g.setFormatArr( ""day"", ""week"", ""month"",""quarter""); // Set format options (up to 4 : ""minute"",""hour"",""day"",""week"",""month"",""quarter"")");
                sb.AppendLine("g.setDateInputFormat('dd/mm/yyyy'); // Set format of input dates ('mm/dd/yyyy', 'dd/mm/yyyy', 'yyyy-mm-dd')");
                sb.AppendLine("g.setDateDisplayFormat('dd/mm/yyyy'); // Set format to display dates ('mm/dd/yyyy', 'dd/mm/yyyy', 'yyyy-mm-dd')");
                sb.AppendLine("if (g) {");

                foreach (var x in results)
                {
                    if (Band != x.parent)
                    {
                        ColorTemp = GetRandomColor();
                        sb.AppendLine("g.AddTaskItem(new JSGantt.TaskItem(" + i + ", '" + x.Actividad + "', '', '', '" + ColorTemp + "', '', 0, '', 100, 1, 0, 1,'','',0));");
                        j = i;
                        i = i + 1;
                    }
                    ColorTemp = GetRandomColor();
                    sb.AppendLine("g.AddTaskItem(new JSGantt.TaskItem(" + i + ", '" + x.Indicador + "', '" + x.fecha_inicial + "', '" + x.fecha_final + "', '" + ColorTemp + "', '', 0, '', 100, 0, " + j + ", 0,'',''," + x.Id + "));");
                    Band = x.parent;
                    i = i + 1;
                }
                //Parameters(pID, 'pName', 'pStart', 'pEnd', 'pColor', 'pLink', pMile ,'pRes', pComp, pGroup, pParent, pOpen, pDepend, pCaption, ID)
                sb.AppendLine("g.Draw();");
                sb.AppendLine("g.DrawDependencies();");
                sb.AppendLine(@" }else { alert(""no definida""); }");
                if ((cs.IsStartupScriptRegistered(DivId) == false) && results.Count() != 0)
                {
                    cs.RegisterStartupScript(cstype, DivId, sb.ToString(), true);
                }

                if (results.Count() != 0)
                    return true;
                else
                    return false;
            }
            catch (Exception ex)
            {
                string MsgError = ex.Message;
                return false;
            }
        }