Exemplo n.º 1
0
        private void butexe_2_Click(object sender, EventArgs e)
        {
            Frmexe f = new Frmexe();

            f.txtrequest.Text = "";
            f.txtpostype.Text = "";

            f.txturl.Text = strTransenUrl;;
            f.ShowDialog();
            return;
        }
Exemplo n.º 2
0
        private void butexe_2_Click(object sender, EventArgs e)
        {
            Frmexe f = new Frmexe();

            f.txtrequest.Text = "";
            f.txtpostype.Text = "";

            DataTable tb  = InstanceForm.BDatabase.GetDataTable("select url from EventType where len(url)>15 order by id");
            string    url = "";

            if (tb.Rows.Count > 0)
            {
                url = tb.Rows[0]["url"].ToString();
            }
            f.txturl.Text = url;
            f.ShowDialog();
            return;
        }
Exemplo n.º 3
0
        /// <summary>
        /// 直接执行
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void butexec_Click(object sender, EventArgs e)
        {
            try
            {
                this.richTextBox1.Text = "";
                DataView  dv   = (DataView)dgveventlog.DataSource;
                int       nrow = dgveventlog.CurrentCell.RowIndex;
                DataRow[] rows = dv.Table.Select("选择=true", "id asc ");

                if (rows.Length == 1)
                {
                    string url          = strTransenUrl;
                    string xml_posttype = rows[0]["EVENT"].ToString();
                    string xml_request  = rows[0]["bizid"].ToString();
                    string xml_message  = handle.GetXml(xml_posttype, xml_request, url);
                    string exe_posttype = rows[0]["EVENT"].ToString();

                    Frmexe f = new Frmexe();
                    f.txtrequest.Text = xml_message;
                    f.txtpostype.Text = exe_posttype;
                    f.txturl.Text     = url;
                    f.ShowDialog();
                    return;
                }

                // int ok_count = 0;
                int err_count = 0;

                if (MessageBox.Show(this, "您选择了 [" + rows.Length.ToString() + "] 条消息,确认执行吗?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }

                pb.Visible = true;
                pb.Value   = 0;
                pb.Minimum = 0;
                pb.Maximum = rows.Length;
                for (int i = 0; i <= rows.Length - 1; i++)
                {
                    string url          = strTransenUrl;
                    string xml_posttype = rows[i]["EVENT"].ToString();
                    string xml_request  = rows[i]["bizid"].ToString();
                    string xml_message  = handle.GetXml(xml_posttype, xml_request, url);

                    string exe_posttype = rows[i]["EVENT"].ToString();
                    string exe_message  = handle.ExecWebService(exe_posttype, xml_message, url);

                    ////判断执行失败条数
                    //if (!handle.ResponseResult(exe_message))
                    //{
                    //    err_count = err_count + 1;
                    //}

                    this.richTextBox1.Text = this.richTextBox1.Text + "★★★★★★" + xml_request + "★★★★★★\r";
                    this.richTextBox1.Text = this.richTextBox1.Text + exe_message + "\n\r";
                    pb.Value = pb.Value + 1;
                }

                string bz = "总消息数: " + rows.Length.ToString() + " ";
                if (err_count > 0)
                {
                    bz = bz + " 失败: " + err_count.ToString();
                    MessageBox.Show(bz, "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    bz = bz + " 全部执行完成 ";
                    MessageBox.Show(bz, "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (System.Exception err)
            {
                MessageBox.Show(err.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                pb.Visible = false;
            }
            finally
            {
                pb.Visible = false;
            }
        }