public ScheduleItemWindow(ScheduleItem si_, DateTime dtClicked_) : base(Gtk.WindowType.Toplevel) { this.Build (); _dtClicked = dtClicked_; if ( si_ != null ) { _si = si_; MySqlConnection conn = new MySqlConnection(Globals.ConnectionString); MySqlCommand cmd = new MySqlCommand("select * from tasks where t_id = @t_id;", conn); cmd.Parameters.Add( new MySqlParameter("t_id", MySqlDbType.VarChar)).Value = _si.TaskId; conn.Open(); MySqlDataReader rdr = cmd.ExecuteReader(); _task = new Task(); if (rdr.Read()) { _task.Id = rdr.GetInt32(rdr.GetOrdinal("t_id")); _task.Name = rdr.GetString(rdr.GetOrdinal("t_title")); _task.TimeRequired = rdr.GetInt32(rdr.GetOrdinal("t_time_req")); if (rdr.IsDBNull(rdr.GetOrdinal("t_depends"))) _task.Depends = 0; else _task.Depends = rdr.GetInt32(rdr.GetOrdinal("t_depends")); _task.TaskType = rdr.GetInt32(rdr.GetOrdinal("t_type")); } conn.Close(); PopulateResources(_task.TaskType); _update = true; } else { _si = new ScheduleItem(); if ( _dtClicked != DateTime.MinValue ) { txtStart.Text = _dtClicked.ToString(); } } if (_update) { FillDetails(); } else { btnDelete.Visible = false; } }
protected void OnBtnOKClicked(object sender, System.EventArgs e) { NodeSelection ns = view.NodeSelection; if ( ns.SelectedNodes.Length > 0 ) { TaskTreeNode tt = (TaskTreeNode)ns.SelectedNode; _selected_task = tt.GetTask(); this.Hide(); } }
public TaskWindow(Task task_) : base(Gtk.WindowType.Toplevel) { this.Build (); PopulateTaskTypes(); if (task_ != null ) { _task = task_; _update = true; FillDetails(); } else { _task = new Task(); } }
public TaskTreeNode(Task t) { task = t; }
private void LoadTasks() { view.NodeStore = Store; view.AppendColumn("Név", new CellRendererText(), "text", 0); view.AppendColumn("Idő", new CellRendererText(), "text", 1); MySqlConnection conn = new MySqlConnection(Globals.ConnectionString); //select t1.t_id, t1.t_title, t1.t_time_req, t2.t_title as t_depends, t1.t_type from tasks t1 left join tasks t2 on t1.t_depends = t2.t_id where t1.t_id not in (select t_id from schedule); MySqlCommand cmd = new MySqlCommand("select * from tasks where t_id not in (select t_id from schedule);", conn); conn.Open(); MySqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { Task t = new Task(); t.Id = rdr.GetInt32(rdr.GetOrdinal("t_id")); t.Name = rdr.GetString(rdr.GetOrdinal("t_title")); t.TimeRequired = rdr.GetInt32(rdr.GetOrdinal("t_time_req")); if (rdr.IsDBNull(rdr.GetOrdinal("t_depends"))) t.Depends = 0; else t.Depends = rdr.GetInt32(rdr.GetOrdinal("t_depends")); t.TaskType = rdr.GetInt32(rdr.GetOrdinal("t_type")); Store.AddNode( new TaskTreeNode(t) ); } conn.Close(); }
void OnTaskSelectedHidden(object sender, EventArgs e) { SelectTaskWindow stw = (SelectTaskWindow)sender; if ( stw.SelectedTask != null ) { _task = stw.SelectedTask; lblTask.Text = _task.Name; PopulateResources( _task.TaskType ); } stw.Destroy(); }