コード例 #1
0
        private void Search()
        {
            Messages oErrMsg = Messages.Instance;
            FeedBack oFeedBack = new FeedBack();

            DataSet ds = null;

            if (this.InvokeRequired)
            {

                this.Invoke(new MethodInvoker(delegate
                {
                    this.Cursor = Cursors.WaitCursor;
                    btnSearch.Enabled = false;
                }));
            }
            else
            {
                this.Cursor = Cursors.WaitCursor;
                btnSearch.Enabled = false;
            }

            if (!Utils.PingTest())
            {
                if (this.InvokeRequired)
                {
                    this.Invoke(new MethodInvoker(delegate
                    {
                        this.Cursor = Cursors.Default;
                        MessageBox.Show("VPN disconnected. Please connect and try again.", "CSRAssistance");
                        return;
                    }));
                }
                else
                {
                    this.Cursor = Cursors.Default;
                    MessageBox.Show("VPN disconnected. Please connect and try again.", "CSRAssistance");
                    return;
                }

            }

            if (chkExcludeCallCust.InvokeRequired)
            {
                chkExcludeCallCust.Invoke(new MethodInvoker(delegate
                {
                    oErrMsg = oFeedBack.LoadData(dtfrom.Value.ToString("yyyyMMdd"),
                        dtto.Value.ToString("yyyyMMdd"),
                        (chkExcludeCallCust.Checked ? 1 : 0),
                        txtSearch.Text, 1,
                        Pager.PageSize,
                        false,
                        txtJobID.Text,
                        dtExFrom.Value.ToString("yyyyMMdd"),
                        dtExTo.Value.ToString("yyyyMMdd"),
                        (chkRepair.Checked ? 1 : 0),
                        RangeExclude);
                }));
            }
            else
            {
                oErrMsg = oFeedBack.LoadData(dtfrom.Value.ToString("yyyyMMdd"),
                dtto.Value.ToString("yyyyMMdd"),
                (chkExcludeCallCust.Checked ? 1 : 0),
                txtSearch.Text, 1,
                Pager.PageSize,
                false,
                txtJobID.Text,
                dtExFrom.Value.ToString("yyyyMMdd"),
                dtExTo.Value.ToString("yyyyMMdd"),
                (chkRepair.Checked ? 1 : 0),
                RangeExclude);

            }

            if (!oErrMsg.IsError)
            {
                ds = (DataSet) oErrMsg.Results;

                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables[0] != null)
                    {
                        dtExport = ds.Tables[0];
                    }
                }

                if (outlookGrid1.InvokeRequired)
                {
                    outlookGrid1.Invoke(new MethodInvoker(delegate
                    {
                        if (ds.Tables.Count > 0)
                        {
                            outlookGrid1.BindData(ds, "data");
                            View = "BoundInvoices";
                            DataGridViewCellEventArgs evt = new DataGridViewCellEventArgs(2, -1);
                            object sender = null;
                        }
                    }));
                }
                else
                {
                    if (ds.Tables.Count > 0)
                    {
                        outlookGrid1.BindData(ds, "data");
                        View = "BoundInvoices";
                        DataGridViewCellEventArgs evt = new DataGridViewCellEventArgs(2, -1);
                        object sender = null;
                    }
                }

                this.Invoke(new Action(() =>
                {
                    this.wfrm.Hide();
                    Pager.RecordCount = 0;
                    if (ds.Tables.Count > 0)
                        Pager.RecordCount = Convert.ToInt32(ds.Tables["counter"].Rows[0]["CNT"].ToString());

                    Pager.PageSize = 20;
                    Pager.MaximumNumberofLinks = (Pager.RecordCount > 0 ? 5 : 0);
                    lblCount.Text = Pager.RecordCount.ToString();

                    if (Pager.RecordCount > 0)
                        Pager.Visible = true;
                    else
                        Pager.Visible = false;
                }));

            }
            else
            {
                this.Invoke(new Action(() =>
                {
                    this.wfrm.Hide();
                    MessageBox.Show(oErrMsg.Message);
                }));

            }

            this.Invoke(new Action(() =>
            {
                this.btnSearch.Enabled = true;
                this.Cursor = Cursors.Default;
            }));
        }
コード例 #2
0
        private void Pager_PageClicked(object sender, PagerControl.PageClickEventHandler e)
        {
            Messages oErrMsg = Messages.Instance;
            FeedBack oFeedBack = new FeedBack();
            DataSet ds = null;
            oErrMsg = oFeedBack.LoadData(dtfrom.Value.ToString("yyyyMMdd"),
            dtto.Value.ToString("yyyyMMdd"),
            (chkExcludeCallCust.Checked ? 1 : 0),
            txtSearch.Text, e.SelectedPage,
            Pager.PageSize,
            false,
            txtJobID.Text,
            dtExFrom.Value.ToString("yyyyMMdd"),
            dtExTo.Value.ToString("yyyyMMdd"),
            (chkRepair.Checked ? 1 : 0),
            (chkExcludeCallCust.Checked ? 1 : 0));

            if(!oErrMsg.IsError)
            {
                ds = (DataSet)oErrMsg.Results;
                if (ds.Tables.Count > 0)
                {
                    outlookGrid1.BindData(ds, "data");
                    View = "BoundInvoices";
                    DataGridViewCellEventArgs evt = new DataGridViewCellEventArgs(2, -1);
                }
            }
        }