private void frmNewExam_Load(object sender, EventArgs e) { AgentTypeDao agentTypeDao = new AgentTypeDao(); GroupDao groupDao = new GroupDao(); this.dtStartDate.Value = DateTime.Now; this.dtEndDate.Value = DateTime.Now.AddMonths(1); IList<AgentType> agentTypeList = agentTypeDao.GetDistinctType(); this.lstAgentType.Items.Clear(); this.lstAgentType.Items.Add("所有渠道"); foreach (AgentType agentType in agentTypeList) { this.lstAgentType.Items.Add(agentType.agentType); } IList<Group> groupList = groupDao.GetAll(""); this.lstGroup.Items.Clear(); foreach (Group group in groupList) { this.lstGroup.Items.Add(group.groupName); } }
private void initControl() { this.Cursor = Cursors.WaitCursor; this.btnSave.Enabled = false; this.btnDelete.Enabled = false; this.txtGroupName.Enabled = true; //this.btnClear.Enabled = true; this.txtGroupName.Clear(); this.txtDescription.Clear(); AgentTypeDao agentTypeDao = new AgentTypeDao(); agentTypeList = agentTypeDao.GetDistinctType(); this.lstAgentType.Items.Clear(); this.lstAllType.Items.Clear(); this.lstAssignType.Items.Clear(); // this.lstAgentType.Items.Add("所有渠道"); foreach (AgentType agentType in agentTypeList) { this.lstAgentType.Items.Add(agentType.agentType); this.lstAllType.Items.Add(agentType.agentType); } AgentWechatAccountDao agentWechatAccountDao = new AgentWechatAccountDao(); agentWechatAccountList = agentWechatAccountDao.GetAllAgentOrBranch(); this.lstUser.Items.Clear(); lstAllAgent.Items.Clear(); lstAssignAgent.Items.Clear(); // this.lstAgentType.Items.Add("所有渠道"); ArrayList list = new ArrayList(); foreach (AgentWechatAccount agentWechatAccount in agentWechatAccountList) { if (!String.IsNullOrEmpty(agentWechatAccount.regionName)) { if (!list.Contains(agentWechatAccount.branchNo)) { this.lstUser.Items.Add(agentWechatAccount.branchNo + ":" + agentWechatAccount.branchName); this.lstAllAgent.Items.Add(agentWechatAccount.branchNo + ":" + agentWechatAccount.branchName); list.Add(agentWechatAccount.branchNo); } } else { if (!String.IsNullOrEmpty(agentWechatAccount.branchNo)) { if (!list.Contains(agentWechatAccount.branchNo)) { this.lstUser.Items.Add(agentWechatAccount.branchNo + ":" + agentWechatAccount.branchName); this.lstAllAgent.Items.Add(agentWechatAccount.branchNo + ":" + agentWechatAccount.branchName); list.Add(agentWechatAccount.branchNo); } } else { if (!list.Contains(agentWechatAccount.agentNo)) { this.lstUser.Items.Add(agentWechatAccount.agentNo + ":" + agentWechatAccount.agentName); this.lstAllAgent.Items.Add(agentWechatAccount.agentNo + ":" + agentWechatAccount.agentName); list.Add(agentWechatAccount.agentNo); } } } } this.Cursor = Cursors.Default; }