public RemindDialog(infoSK inf) { InitializeComponent(); tx_tenSK.Text = "Sự kiện: " + inf.TenSK; tx_thoigian.Text = inf.getTime(); tx_vitri.Text = "Vị trí: " + inf.MotaSK; }
private void SetupInf() { try { string[] lines = File.ReadAllLines("data.csv"); if (lines.Length > 0) { foreach (string line in lines) { string[] data = line.Split(','); if (data[(int)DATA.IS_REMIND].Equals("1") && data[(int)DATA.IS_PASSED].Equals("0")) { /* GET TIME BEFORE REMIND */ int time2rm = TIME_REMIND[int.Parse(data[(int)DATA.TIME_TO_REMIND])]; int h = int.Parse(data[(int)DATA.GIO]), m = int.Parse(data[(int)DATA.PHUT]); if (time2rm >= 60) { if (int.Parse(data[(int)DATA.GIO]) == (int)TimeToRemind.KHONG_BAO_TRUOC) { h = 24; } else { h -= time2rm / 60; } } m -= time2rm % 60; if (m < 0) { m += 60; h--; } DateTime date = new DateTime(int.Parse(data[6]), int.Parse(data[5]), int.Parse(data[4]), h, m, 0); if (DateTime.Compare(date, DateTime.Now) <= 0) { continue; } else { inf = new infoSK(data[(int)DATA.ID], data[1], data[2], date, "0", "1", int.Parse(data[(int)DATA.TIME_TO_REMIND]), data[(int)DATA.IS_LOOP], int.Parse(data[13]), int.Parse(data[14])); break; } } } } if (inf == null) { inf = new infoSK("", "", "", new DateTime(1900, 1, 8), "", ""); } } catch (Exception exp) { MessageBox.Show("Error when opening file!\n" + exp.Message); } }