예제 #1
0
        /// <summary>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BatchInvestForm_Load(object sender, EventArgs e)
        {
            this.picShow.Show();
            Thread thStart = new Thread(() =>
            {
                Thread.Sleep(1000);
                this.LoadData();
                this.picShow.Hide();
            })
            {
                IsBackground = true
            };

            thStart.Start();
            CreateContextMenuStripInstance cst = new CreateContextMenuStripInstance();

            cst.AddToolStripMenuItems(new List <ToolStripMenuItem>
            {
                new ToolStripMenuItem("批量投资(当前行)", null, (obj1, ex1) =>
                {
                    if (this.dgv_Data.SelectedRows.Count > 0)
                    {
                        //判断数据是否整个
                        long count = 1;
                        try
                        {
                            count = Convert.ToInt64(this.txb_InvestCount.Text);
                        }
                        catch (Exception)
                        {
                            MessageBox.Show("输入的投资笔数格式不正确");
                            return;
                        }
                        //判断是否超了
                        long leftCount = Convert.ToInt64(this.dgv_Data.SelectedRows[0].Cells[7].Value);
                        if (leftCount < this.userIdentifiers.Count * count)
                        {
                            MessageBox.Show("投资总笔数大于该产品的剩余份数");
                            return;
                        }
                        InvestForm investForm = new InvestForm(this.userIdentifiers, this.dgv_Data.SelectedRows[0].Cells[1].Value.ToString(), Convert.ToInt64(this.dgv_Data.SelectedRows[0].Cells[4].Value), count);
                        investForm.Show();
                    }
                }, "")
            });
            DataGridViewHelper.AddCellMouseDownClick(this.dgv_Data, cst.GetContexMenuStrip());
        }
예제 #2
0
        private void UserInfoManage_Load(object sender, EventArgs e)
        {
            this.cb_SortType.SelectedIndex    = 0;
            this.cbx_IsAuth.SelectedIndex     = 0;
            this.cbx_IsRecharge.SelectedIndex = 0;
            this.LoadData.PicShow             = this.picShow;
            this.cbx_pageSize.SelectedIndex   = 0;
            this.LoadPageData(null, " order by Id desc");
            this.LoadData.Lbl_infos1.Text = "每页";
            //为页面容量设置改变事件
            this.cbx_pageSize.SelectedValueChanged += (objP, exP) =>
            {
                //获取此时的页码
                int pageSize = Convert.ToInt32(this.cbx_pageSize.Text);
                this.LoadData.PageSize  = pageSize;
                this.LoadData.PageIndex = 1;
                this.LoadPageData(this.WhereExpression, this.cb_SortType.SelectedIndex == 0 ? " order by Id Desc" : " order by Id asc");
                this.LoadData.Lbl_infos1.Text = "每页";
            };
            //右键添加点击事件
            CreateContextMenuStripInstance cst = new CreateContextMenuStripInstance();

            cst.AddToolStripMenuItems(new List <ToolStripMenuItem>
            {
                new ToolStripMenuItem("复制UserIdentifier(当前行)", null, (obj1, ex1) =>
                {
                    if (this.dgv_Data.SelectedRows.Count > 0)
                    {
                        if (this.dgv_Data.SelectedRows.Count > 0)
                        {
                            Clipboard.SetDataObject(this.dgv_Data.SelectedRows[0].Cells[1].Value.ToString());
                            MessageBox.Show("已经复制到剪贴板了");
                        }
                    }
                }, ""),
                new ToolStripMenuItem("复制CellPhone(当前行)", null, (obj1, ex1) =>
                {
                    if (this.dgv_Data.SelectedRows.Count > 0)
                    {
                        Clipboard.SetDataObject(this.dgv_Data.SelectedRows[0].Cells[2].Value.ToString());
                        MessageBox.Show("已经复制到剪贴板了");
                    }
                }),
                new ToolStripMenuItem("复制UserIdentifier(当前页 格式:每行一个)", null, (obj1, ex1) =>
                {
                    StringBuilder sbUserIndentifiers = new StringBuilder();
                    DataGridViewRowCollection drs    = this.dgv_Data.Rows;
                    foreach (DataGridViewRow dr in drs)
                    {
                        sbUserIndentifiers.Append(dr.Cells[1].Value);
                        sbUserIndentifiers.Append("\r\n");
                    }
                    Clipboard.SetDataObject(sbUserIndentifiers.ToString());
                    MessageBox.Show("已经复制到剪贴板了");
                }),
                new ToolStripMenuItem("复制UserIdentifier(当前页 格式:逗号隔开)", null, (obj1, ex1) =>
                {
                    DataGridViewRowCollection drs = this.dgv_Data.Rows;
                    List <string> list            = (from DataGridViewRow dr in drs select dr.Cells[1].Value.ToString()).ToList();
                    Clipboard.SetDataObject(string.Join(",", list));
                    MessageBox.Show("已经复制到剪贴板了");
                }),
                new ToolStripMenuItem("查询余额(当前选中用户)", null, (obj1, ex1) =>
                {
                    if (this.dgv_Data.SelectedRows.Count > 0)
                    {
                        Thread thBalance = new Thread(() =>
                        {
                            BankUserBalance bankUserBalance = this.jymService.GetBankUserBalance(this.dgv_Data.SelectedRows[0].Cells[1].Value.ToString()).Result;
                            if (bankUserBalance == null)
                            {
                                MessageBox.Show("该用户信息异常,请稍后重试");
                                return;
                            }
                            if (bankUserBalance.RespCode != 1)
                            {
                                MessageBox.Show("该用户信息异常,请稍后重试");
                                return;
                            }
                            MessageBox.Show($"该余额为:{bankUserBalance.AvailableBalance}");
                        })
                        {
                            IsBackground = true
                        };
                        thBalance.Start();
                    }
                }),
                new ToolStripMenuItem("预申购(当前用户)", null, (obj1, ex1) =>
                {
                    if (this.dgv_Data.SelectedRows.Count > 0)
                    {
                        //弹出页面供用户选择
                        PurchaseOrderForm purchaseOrderForm = new PurchaseOrderForm(this.dgv_Data.SelectedRows[0].Cells[1].Value.ToString());
                        purchaseOrderForm.ShowDialog();
                    }
                })
            });
            DataGridViewHelper.AddCellMouseDownClick(this.dgv_Data, cst.GetContexMenuStrip());
        }