private void GenerateGui() { So so = soList[tabControl1.SelectedIndex]; SoState soState = soStateList.GetSoStateAccordingToValue(so.soStates); if (soState.WhoCanUpdate().Contains(UserInfo.Job)) { tsbUpdate.Enabled = true; } else { tsbUpdate.Enabled = false; } //for list tscbStateList.Items.Clear(); List <Operation> opList = soState.GetOperationList(); foreach (Operation op in opList) { if (op.jobs.Contains(UserInfo.Job)) { tscbStateList.Items.Add(op.operationName); } } //for enter PO if ((UserInfo.Job == JobDescription.Admin || UserInfo.Job == JobDescription.Boss || UserInfo.Job == JobDescription.PurchasersManager || UserInfo.Job == JobDescription.Purchaser) && (so.soStates == new SoApprove().GetStateValue())) { tsbPoEnter.Enabled = true; } else { tsbPoEnter.Enabled = false; } //for view Po if (Order.PoMgr.PoMgr.GetPoNumberAccordingToSoId(soList[tabControl1.SelectedIndex].soId) <= 0) { tsbViewPo.Enabled = false; } else { tsbViewPo.Enabled = true; } }
private void tscbStateList_SelectedIndexChanged(object sender, EventArgs e) { if (MessageBox.Show("Change the state to " + (string)tscbStateList.SelectedItem + "?", "warning", MessageBoxButtons.YesNo) == DialogResult.No) { return; } string selectedItemString = (string)tscbStateList.SelectedItem; So so = soList[tabControl1.SelectedIndex]; SoState soState = soStateList.GetSoStateAccordingToValue(so.soStates); foreach (Operation op in soState.GetOperationList()) { if (selectedItemString == op.operationName) { op.operationMethod(so.soId); } } this.DialogResult = DialogResult.Yes; }