Пример #1
0
        /// <summary>
        /// 异步 开始事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            //需要执行的代码

            worker.ReportProgress(3, "开始导入信息...\r\n");
            //导入代理商
            GroupDao groupDao = new GroupDao();
            Group group = new Group();
            group.groupName = this.txtGroupName.Text.Trim();
            group.description = group.groupName;
            groupDao.Delete(group);
            groupDao.Add(group);


            UserDefinedGroupDao userDefinedGroupDao = new UserDefinedGroupDao();
            for (int i = 0; i < dgAgent.RowCount; i++)
            {
                UserDefinedGroup userDefinedGroup = new UserDefinedGroup();
                userDefinedGroup.groupName = group.groupName;
                userDefinedGroup.member = dgAgent[0, i].Value.ToString();
                userDefinedGroup.type = "代理商/渠道";
                userDefinedGroupDao.Add(userDefinedGroup);
                worker.ReportProgress(4, "导入" + userDefinedGroup.member + "信息完成...\r\n");
               


            }
            //dgInvoice.AutoResizeColumns();
            
            worker.ReportProgress(5, "导入信息完成...\r\n");



            //MessageBox.Show("数据上传完毕");

        }
Пример #2
0
        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);
            }
        }