Exemplo n.º 1
0
        private void RenderTable()
        {
            ItemTimetable itemTimetable = Iterator.get();

            DayOfWeek.Text = itemTimetable.DayOfWeek;
            this.FillTable(itemTimetable.Lessons);
        }
Exemplo n.º 2
0
        public static string PerformData(DataTable dataTable)
        {
            Dictionary <string, Dictionary <string, ItemDoctor> > data = new Dictionary <string, Dictionary <string, ItemDoctor> >();
            ItemTimetable itemTimetable = new ItemTimetable();

            foreach (DataRow row in dataTable.Rows)
            {
                string filial     = row["FILIAL"].ToString();
                string filname    = row["FILNAME"].ToString();
                string dcode      = row["DCODE"].ToString();
                string efio       = row["EFIO"].ToString();
                string espec      = row["ESPEC"].ToString();
                string dt         = row["DT"].ToString();
                string time_start = row["TIME_START"].ToString();
                string time_end   = row["TIME_END"].ToString();
                string free       = row["FREE"].ToString();

                if (!itemTimetable.filials.ContainsKey(filial))
                {
                    itemTimetable.filials.Add(filial, filname);
                }

                if (!data.ContainsKey(filial))
                {
                    data.Add(filial, new Dictionary <string, ItemDoctor>());
                }

                if (!data[filial].ContainsKey(dcode))
                {
                    data[filial].Add(dcode, new ItemDoctor(efio, espec));
                }

                data[filial][dcode].cells.Add(new ItemCell(dt, time_start, time_end, free.Equals("0") ? false : true));
            }

            itemTimetable.filials.Add("data", data);

            string filePath    = GetResultFilePath("bz_timetable.json", isPlainText: true);
            string fileContent = JsonConvert.SerializeObject(itemTimetable, Formatting.Indented);

            File.WriteAllText(filePath, fileContent);

            return(filePath);
        }