private void CalendarDayClicked(object sender, DateRangeEventArgs e) { DataTable dt = daysAdapter.GetDataByLoginAndDate(user.Login, e.Start.ToShortDateString()); int id = -1; if (dt.Rows.Count == 0) { NewGymPlannerDataSet.DaysRow dayRow = dataSet.Days.AddDaysRow(e.Start, ""); daysAdapter.Update(dataSet); id = dayRow.ID_Day; NewGymPlannerDataSet.User_DayRow userDayRow = dataSet.User_Day.NewUser_DayRow(); userDayRow.Login = user.Login; userDayRow.ID_Day = id; dataSet.User_Day.AddUser_DayRow(userDayRow); userDayAdapter.Update(dataSet); } else { id = (int)dt.Rows[0]["ID_Day"]; } using (DayForm dayForm = new DayForm(e.Start, id)) { if (dayForm.ShowDialog() != DialogResult.OK) { DataTable daysDT = findDays.GetWorkoutDays(user.Login); Calendar.RemoveAllBoldedDates(); foreach (DataRow row in daysDT.Rows) { Calendar.AddBoldedDate(Convert.ToDateTime(row["Date"])); } Calendar.UpdateBoldedDates(); } } }
public MainForm(User user) { this.user = user; InitializeComponent(); queryAdapter = new NewGymPlannerDataSetTableAdapters.QueryAdapter(); findDays = new NewGymPlannerDataSetTableAdapters.FindDaysTableAdapter(); daysAdapter = new NewGymPlannerDataSetTableAdapters.DaysTableAdapter(); userDayAdapter = new NewGymPlannerDataSetTableAdapters.User_DayTableAdapter(); if (this.user.isAdmin()) { ExercisesMenuStrip.Visible = true; } else { ExercisesMenuStrip.Visible = false; } DataTable muscleDT = (new NewGymPlannerDataSetTableAdapters.MuscleGroupsTableAdapter()).GetData(); this.MuscleGroupToolStripComboBox.ComboBox.DisplayMember = muscleDT.Columns[0].ToString(); this.MuscleGroupToolStripComboBox.ComboBox.ValueMember = muscleDT.Columns[0].ToString(); this.MuscleGroupToolStripComboBox.ComboBox.DataSource = muscleDT; DataTable daysDT = findDays.GetWorkoutDays(user.Login); Calendar.RemoveAllBoldedDates(); foreach (DataRow row in daysDT.Rows) { Calendar.AddBoldedDate(Convert.ToDateTime(row["Date"])); } }
private void IT_Support_Load(object sender, EventArgs e) { connection.Open(); OracleCommand cmd = new OracleCommand("afisare_tickete", connection); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add("registru", OracleDbType.RefCursor).Direction = ParameterDirection.Output; OracleDataAdapter adapter = new OracleDataAdapter(); adapter.SelectCommand = cmd; DataTable dataTable = new DataTable(); adapter.Fill(dataTable); dataGridViewTickets.DataSource = dataTable; string data = ""; OracleCommand cmd1 = new OracleCommand("select data_eveniment, departament_adresat from eveniment, ticket where" + " ticket.id_ticket = eveniment.id_ticket and departament_adresat like '%IT%' ", connection); OracleDataReader read = cmd1.ExecuteReader(); if (read.HasRows == true) { while (read.Read()) { data = read.GetValue(read.GetOrdinal("data_eveniment")).ToString(); Calendar.AddBoldedDate(Convert.ToDateTime(data)); } } read.Close(); Calendar.UpdateBoldedDates(); connection.Close(); }
private void UpdateCalendar() { List <DateTime> dates = (from d in ctx.Days.Where(d => d.Users.Any(u => u.Login == user.Login) && d.Workouts.Count() > 0) select d.Date).ToList(); Calendar.RemoveAllBoldedDates(); foreach (DateTime date in dates) { Calendar.AddBoldedDate(date); } Calendar.UpdateBoldedDates(); }
private void openFileToolStripMenuItem_Click(object sender, EventArgs e) { FolderBrowserDialog fd = new FolderBrowserDialog(); if (fd.ShowDialog() == DialogResult.OK) { fdata = Directory.GetFiles(fd.SelectedPath); DateTime timeValue; string valueTwo = fdata[0]; // start to highlight the starting month in monthcalender StreamReader fileReaderFolderst = new StreamReader(valueTwo); while (!fileReaderFolderst.EndOfStream) { fileData = fileReaderFolderst.ReadLine(); if (fileData.Contains("Date")) { string startTime = fileData; string arraStartTime = startTime.Split('=').Last(); var dt = DateTime.ParseExact(arraStartTime, "yyyyMMdd", CultureInfo.InvariantCulture); dateStart = dt.ToString(); } } foreach (string itemData in fdata) { string value = itemData; StreamReader fileReaderFolder = new StreamReader(value); while (!fileReaderFolder.EndOfStream) { fileData = fileReaderFolder.ReadLine(); if (fileData.Contains("Date")) { string startTime = fileData; string arraStartTime = startTime.Split('=').Last(); //var date = "11252017"; var date = DateTime.ParseExact(arraStartTime, "yyyyMMdd", CultureInfo.InvariantCulture); timeValue = date; Calendar.AddBoldedDate(date); Calendar.UpdateBoldedDates(); Calendar.SelectionStart = DateTime.Parse(dateStart); } } } } }
private void generateCalendar() { if (plans != null) { for (int p = 0; p < plans.Count; p++) { for (int y = 0; y < plans[p].Years.Count; y++) { for (int m = 0; m < plans[p].Years[y].Mouths.Count; m++) { for (int d = 0; d < plans[p].Years[y].Mouths[m].Days.Count; d++) { Calendar.AddBoldedDate(plans[p].Years[y].Mouths[m].Days[d].CurrentDate); } } } } } }