private void btnSave_Click(object sender, EventArgs e)
        {
            outputAgentInvoicePayment.agentName = this.txtAgentName.Text;
            outputAgentInvoicePayment.agentNo = this.txtAgentNo.Text;
            outputAgentInvoicePayment.payStatus = this.txtPayStatus.Text;
            outputAgentInvoicePayment.processTime = this.txtProcessTime.Text;
            
            outputAgentInvoicePayment.invoiceFee = this.txtInvoiceFee.Text;
            outputAgentInvoicePayment.summary = this.txtSummary.Text;
            outputAgentInvoicePayment.payFee = this.txtPayFee.Text;
           

            AgentInvoicePaymentDao agentInvoicePaymenDao = new AgentInvoicePaymentDao();
             int i =  agentInvoicePaymenDao.Update(outputAgentInvoicePayment);
             if (i >= 0)
             {
                 MessageBox.Show("修改完成");

                 this.DialogResult = System.Windows.Forms.DialogResult.OK;
             }
             else
             {
                 MessageBox.Show("修改失败");
             }
        }
        private void prepareGrid(string agentNo,string agentName)
        {
            this.Cursor = Cursors.WaitCursor;

            AgentInvoicePaymentDao agentInvoicePaymentDao = new AgentInvoicePaymentDao();
            
            IList<AgentInvoicePayment> agentInvoiceList = new List<AgentInvoicePayment>();

            agentInvoiceList = agentInvoicePaymentDao.GetList(agentNo, agentName,null);
            

            if (agentInvoiceList != null && agentInvoiceList.Count > 0)
            {
                this.grpList.Text = "支付记录列表(" + agentInvoiceList.Count + ")";
                this.dgInvoicePayment.Rows.Clear();
                dgInvoicePayment.Columns.Clear();

               
                dgInvoicePayment.Columns.Add("代理商编号", "代理商编号");
                dgInvoicePayment.Columns.Add("代理商全称", "代理商全称");
                dgInvoicePayment.Columns.Add("处理时间", "处理时间");
                dgInvoicePayment.Columns.Add("发票金额", "发票金额");
                dgInvoicePayment.Columns.Add("付款金额", "付款金额");
                dgInvoicePayment.Columns.Add("摘要", "摘要");
                dgInvoicePayment.Columns.Add("票据状态", "票据状态");

                		
						

                for (int i = 0; i < agentInvoiceList.Count; i++)
                {
                    dgInvoicePayment.Rows.Add();
                    DataGridViewRow row = dgInvoicePayment.Rows[i];

                    row.Cells[0].Value = agentInvoiceList[i].agentNo;
                    row.Cells[1].Value = agentInvoiceList[i].agentName;
                    row.Cells[2].Value = agentInvoiceList[i].processTime;
                    row.Cells[3].Value = agentInvoiceList[i].invoiceFee;
                    row.Cells[4].Value = agentInvoiceList[i].payFee;
                    row.Cells[5].Value = agentInvoiceList[i].summary;
                    row.Cells[6].Value = agentInvoiceList[i].payStatus;
                   
                   

                }
                dgInvoicePayment.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

                dgInvoicePayment.AutoResizeColumns();

            }


            this.Cursor = Cursors.Default;

        }
Exemplo n.º 3
0
        /// <summary>
        /// 异步 开始事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            //需要执行的代码


           


            worker.ReportProgress(3, "开始导入支付记录...\r\n");
            //导入代理商
            AgentInvoicePaymentDao agentInvoicePaymentDao = new AgentInvoicePaymentDao();
            AgentDao agentDao = new AgentDao();
            WechatAction wechatAction = new WechatAction();
            for (int i = 0; i < dgInvoicePayment.RowCount; i++)
            {
                AgentInvoicePayment agentInvoicePayment = new AgentInvoicePayment();
                agentInvoicePayment.agentNo = dgInvoicePayment[0, i].Value.ToString();
                agentInvoicePayment.agentName = dgInvoicePayment[1, i].Value.ToString();
                agentInvoicePayment.processTime = dgInvoicePayment[2, i].Value.ToString();
                agentInvoicePayment.invoiceFee = dgInvoicePayment[3, i].Value.ToString();
                agentInvoicePayment.payFee = dgInvoicePayment[4, i].Value.ToString();
                agentInvoicePayment.summary = dgInvoicePayment[5, i].Value.ToString();
                agentInvoicePayment.payStatus = dgInvoicePayment[6, i].Value.ToString();
                Agent agent = agentDao.Get(agentInvoicePayment.agentNo);
                 if (agent != null && !String.IsNullOrEmpty(agent.agentName))
                 {
                     agentInvoicePaymentDao.Delete(agentInvoicePayment);
                     agentInvoicePaymentDao.Add(agentInvoicePayment);
                     dgInvoicePayment["result", i].Value = "导入成功";
                     String message = String.Format(Settings.Default.InvoicePayment_Wechat_Message, agentInvoicePayment.processTime, agentInvoicePayment.invoiceFee, agentInvoicePayment.payFee, agentInvoicePayment.summary, agentInvoicePayment.payStatus);
                     wechatAction.sendTextMessageToWechat(agentInvoicePayment.agentNo, message, Settings.Default.Wechat_Secret, Settings.Default.Wechar_Invoice_AppId);

                 }
                 else
                 {
                     dgInvoicePayment["result", i].Value = "导入失败,代理商编号:" + agentInvoicePayment.agentNo + "不存在,请先导入代理商.";
                 }

            }
            worker.ReportProgress(4, "导入支付记录完成...\r\n");



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

        }