protected void OnButtonEditClicked(object sender, EventArgs e) { TreeIter iter; int itemid; ResponseType result; switch (notebookMain.CurrentPage) { case 0: treeviewObjects.Selection.GetSelected(out iter); itemid = (int) ObjectFilter.GetValue(iter,0); ObjectDlg winObject = new ObjectDlg(itemid); winObject.Show(); result = (ResponseType)winObject.Run(); winObject.Destroy(); if(result == ResponseType.Ok) UpdateObject(); break; case 1: itemid = treeviewEmployees.GetSelectedObject<EmployeesVMNode>().Id; EmployeeCardDlg winWearCadr = new EmployeeCardDlg(itemid); winWearCadr.Show(); result = (ResponseType)winWearCadr.Run(); winWearCadr.Destroy(); if(result == ResponseType.Ok) UpdateCards(); break; case 2: switch (notebookStock.CurrentPage) { case 0: treeviewIncome.Selection.GetSelected(out iter); itemid = (int)IncomeFilter.GetValue(iter, 0); IncomeDocDlg winIncome = new IncomeDocDlg(itemid); winIncome.Show(); result = (ResponseType) winIncome.Run(); winIncome.Destroy(); break; case 1: treeviewExpense.Selection.GetSelected(out iter); itemid = (int)ExpenseFilter.GetValue(iter, 0); ExpenseDocDlg winExpense = new ExpenseDocDlg(itemid); winExpense.Show(); result = (ResponseType) winExpense.Run(); winExpense.Destroy(); break; case 2: treeviewWriteOff.Selection.GetSelected(out iter); itemid = (int)WriteOffFilter.GetValue(iter, 0); WriteOffDocDlg winWriteOff = new WriteOffDocDlg(itemid); winWriteOff.Show(); result = (ResponseType) winWriteOff.Run(); winWriteOff.Destroy(); break; default: result = ResponseType.Reject; break; } if(result == ResponseType.Ok) UpdateStock(); break; } }
protected void OnButtonAddClicked(object sender, EventArgs e) { switch (notebookMain.CurrentPage) { case 0: ObjectDlg winObject = new ObjectDlg(); winObject.Show(); winObject.Run(); winObject.Destroy(); UpdateObject(); break; case 1: EmployeeCardDlg winWearCard = new EmployeeCardDlg(); winWearCard.Show(); winWearCard.Run(); winWearCard.Destroy(); UpdateCards(); break; case 2: switch (notebookStock.CurrentPage) { case 0: IncomeDocDlg winIncome = new IncomeDocDlg(); winIncome.Show(); winIncome.Run(); winIncome.Destroy(); break; case 1: ExpenseDocDlg winExpense = new ExpenseDocDlg(); winExpense.Show(); winExpense.Run(); winExpense.Destroy(); break; case 2: WriteOffDocDlg winWriteOff = new WriteOffDocDlg(); winWriteOff.Show(); winWriteOff.Run(); winWriteOff.Destroy(); break; } UpdateStock(); break; } }