/// <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("数据上传完毕"); }
private void btnSend_Click(object sender, EventArgs e) { if (this.txtContent.Text.Trim() == "") { MessageBox.Show("请输入公告内容"); return; } if (this.lstModule.CheckedItems.Count<=0) { MessageBox.Show("请选择发送对象"); return; } this.Cursor = Cursors.WaitCursor; UserDefinedGroupDao userDefinedGroupDao = new UserDefinedGroupDao(); IList<String> list = new List<string>(); foreach (String item in this.lstGroup.CheckedItems) { list.Add(item); } IList<String> recieveList = userDefinedGroupDao.GetReceiverList(list); foreach (String item in this.lstModule.CheckedItems) { switch (item) { case "佣金结算与支付查询"://12 sendMessage(12, recieveList); break; case "报错处理"://2 sendMessage(2, recieveList); break; case "通知公告与促销政策"://6 sendMessage(6, recieveList); break; case "业绩查询"://7 sendMessage(7, recieveList); break; case "服务监督"://9 sendMessage(9, recieveList); break; case "投诉协查"://10 sendMessage(10, recieveList); break; case "在线学习"://11 sendMessage(11, recieveList); break; case "企业小助手"://0 sendMessage(0, recieveList); break; } } this.Cursor = Cursors.Default; MessageBox.Show("发送完毕"); }