private void GenerateGui() { po poMain = poList[tabControl1.SelectedIndex]; if (poMain.poStates != (int)PoStatesEnum.New && UserCombine.GetUserCanBeBuyerMananger().Contains((int)UserInfo.Job)) { tsbUpdate.Enabled = true; } else if (poMain.poStates == (int)PoStatesEnum.New && UserCombine.GetUserCanBeBuyers().Contains((int)UserInfo.Job)) { tsbUpdate.Enabled = true; } else { tsbUpdate.Enabled = false; } //for approve and rejected. if (poMain.poStates == (int)PoStatesEnum.New) { tsbApprove.Enabled = true; tsbReject.Enabled = true; } else { tsbApprove.Enabled = false; tsbReject.Enabled = false; } //for cancel if (poMain.poStates == (int)PoStatesEnum.Approved) { tsbCancel.Enabled = true; } else { tsbCancel.Enabled = false; } if (UserInfo.Job == JobDescription.Admin || UserInfo.Job == JobDescription.Boss) { tsbForceClose.Enabled = true; } else { tsbForceClose.Enabled = false; } if (!UserCombine.GetUserCanBeBuyerMananger().Contains((int)UserInfo.Job)) { tsbApprove.Enabled = false; tsbReject.Enabled = false; tsbCancel.Enabled = false; tsbForceClose.Enabled = false; } }