public changeTaskForm(Base_Class.Task task) { InitializeComponent(); OrderDate_TextBox.Text = task.orderDate; OwnerName_TextBox.Text = task.ownerName; FinishDate_TextBox.Text = task.finishDate; DeliveryDate_TextBox.Text = task.deliveryDate; }
void TreeTypeSort() { int i; TreeNode tn = new TreeNode(); List<Type> WaitList = new List<Type>(); treeView1.BeginUpdate(); treeView1.Nodes.Clear(); tn.Name = "Base_Class"; tn.Text = "Товары"; treeView1.Nodes.Add(tn); TreeNode[] tempNode; for (i = 0; i < TypeList.Count; i++) { tempNode = treeView1.Nodes.Find(TypeList[i].BaseType.Name, true); if (tempNode.Length > 0) { tn = new TreeNode(); selectedObject = ObjList.First(someObject => someObject.GetType().Name == TypeList[i].Name); tn.Name = TypeList[i].Name; tn.Text = selectedObject.GetName(); treeView1.SelectedNode = tempNode[0]; treeView1.SelectedNode.Nodes.Add(tn); } else { WaitList.Add(TypeList[i]); } } i = 0; while (WaitList.Count != 0) { i++; if (i >= WaitList.Count) i -= WaitList.Count; tempNode = treeView1.Nodes.Find(WaitList[i].BaseType.Name, true); if (tempNode.Length > 0) { tn = new TreeNode(); selectedObject = ObjList.First(someObject => someObject.GetType().Name == TypeList[i].Name); tn.Name = TypeList[i].Name; tn.Text = selectedObject.GetName(); treeView1.SelectedNode = tempNode[0]; treeView1.SelectedNode.Nodes.Add(tn); WaitList.RemoveAt(i); i--; } } treeView1.Sort(); treeView1.EndUpdate(); }
private void editToolStripMenuItem_Click(object sender, EventArgs e) { selectedObject = ObjList.First(someObject => someObject.GetType().Name == treeView1.SelectedNode.Name); if (dataGridView1.SelectedRows[0]!=null) changeTaskForm changeForm = new changeTaskForm(selectedObject.taskList[dataGridView1.SelectedRows[0].Index]); }
private void newToolStripMenuItem_Click(object sender, EventArgs e) { DateTime dt = DateTime.Now; newTask = new Base_Class.Task(); selectedObject = ObjList.First(someObject => someObject.GetType().Name == treeView1.SelectedNode.Name); selectedObject.AddTask(newTask); }
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { if (treeView1.SelectedNode.Name == "Base_Class") { textBox_Name.Text = ""; textBox_Cost.Text = ""; textBox_Desc.Text = ""; } else { selectedObject = ObjList.First(someObject => someObject.GetType().Name == treeView1.SelectedNode.Name); textBox_Name.Text = selectedObject.GetName(); textBox_Desc.Text = selectedObject.description; if (treeView1.SelectedNode.Name.Contains("Base_")) { textBox_Cost.Text = ""; tasksToolStripMenuItem.Enabled = false; } else { textBox_Cost.Text = selectedObject.cost.ToString(); tasksToolStripMenuItem.Enabled = true; } UpdateDataGrid(selectedObject); } }
private void UpdateDataGrid(Base_Class selObject) { dataGridView1.Rows.Clear(); foreach (Base_Class.Task task in selObject.taskList) dataGridView1.Rows.Add(task.orderDate, task.ownerName, task.finishDate, task.deliveryDate); }
void AlphabetTypeSort() { int i; TreeNode tn = new TreeNode(); List<Type> WaitList = new List<Type>(); treeView1.BeginUpdate(); treeView1.Nodes.Clear(); tn.Name = "Base_Class"; tn.Text = "Товары"; treeView1.Nodes.Add(tn); for (i = 0; i < TypeList.Count; i++) { if (!TypeList[i].Name.Contains("Base_")) { tn = new TreeNode(); selectedObject = ObjList.First(someObject => someObject.GetType().Name == TypeList[i].Name); tn.Name = TypeList[i].Name; tn.Text = selectedObject.GetName(); treeView1.Nodes[0].Nodes.Add(tn); } } treeView1.Sort(); treeView1.EndUpdate(); }