/// <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()); }
/// <summary> /// 批量投资 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripButton3_Click(object sender, EventArgs e) { List <string> selectedUserIdentifiers = DataGridViewHelper.GetCheckdCloumnsData(this.dgv_Data, 0, 1); if (selectedUserIdentifiers == null || selectedUserIdentifiers.Count == 0) { MessageBox.Show("数据表中没有数据还不能进行此次操作", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //投资 if (MessageBox.Show("批量投资选中的用户账户必须余额足够,您确定继续吗?", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { BatchInvestForm batchInvestForm = new BatchInvestForm(selectedUserIdentifiers); batchInvestForm.ShowDialog(); } //this.toolStripButton3.Enabled = false; //List<RegularProductInfo> infos = await this.jymService.GetAllProductInfo(); }
/// <summary> /// 批量下订单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripButton6_Click(object sender, EventArgs e) { if (this.dgv_Data.Rows.Count == 0) { MessageBox.Show("数据表中没有数据还不能进行此次操作", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //GetCheckdCloumnsDatasModels List <DataGridViewModel> models = DataGridViewHelper.GetCheckdCloumnsDatasModels(this.dgv_Data, 0, 1); if (models == null || models.Count == 0 || models.Where(x => x.IsBankAuth == "1" && x.RechargeAmount > 0).ToList().Count == 0) { MessageBox.Show("请选择需要执行的记录,获取选择的用户不满足购买条件", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //BatchRecharge BatchPurchaseForm form = new BatchPurchaseForm(models.Select(x => x.UserIdentifer).ToList()); form.Show(); }
/// <summary> /// 批量充值 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripButton1_Click(object sender, EventArgs e) { if (this.dgv_Data.Rows.Count == 0) { MessageBox.Show("数据表中没有数据还不能进行此次操作", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //GetCheckdCloumnsDatasModels List <DataGridViewModel> models = DataGridViewHelper.GetCheckdCloumnsDatasModels(this.dgv_Data, 0, 1); if (models == null || models.Count == 0) { MessageBox.Show("请选择需要执行的记录", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //BatchRecharge BatchRechargeForm bathBatchRechargeForm = new BatchRechargeForm(models, this.toolStripButton1, () => this.LoadPageData(this.WhereExpression, this.cb_SortType.SelectedIndex == 0 ? " order by Id Desc" : " order by Id asc")); bathBatchRechargeForm.Show(); }
//loadData private void LoadData() { try { List <RegularProductInfo> productInfos = this.jymService.GetAllProductInfo().Result; //100000010 100000020 DataTable dtDgv = new DataTable(); dtDgv.Columns.Add(new DataColumn("productCatorgary", Type.GetType("System.String"))); dtDgv.Columns.Add(new DataColumn("ProductId", Type.GetType("System.String"))); dtDgv.Columns.Add(new DataColumn("FinancingSumAmount", Type.GetType("System.String"))); dtDgv.Columns.Add(new DataColumn("paidAmount", Type.GetType("System.String"))); dtDgv.Columns.Add(new DataColumn("UnitPrise", Type.GetType("System.String"))); dtDgv.Columns.Add(new DataColumn("yield", Type.GetType("System.String"))); dtDgv.Columns.Add(new DataColumn("period", Type.GetType("System.String"))); dtDgv.Columns.Add(new DataColumn("leftCount", Type.GetType("System.String"))); foreach (RegularProductInfo t in productInfos) { DataRow dr = dtDgv.NewRow(); dr[0] = t.ProductCategory == 100000010 ? "商票" : "银票"; dr[1] = t.ProductId.ToString().Replace("-", "").ToUpper(); dr[2] = t.FinancingSumAmount.ToString(); dr[3] = t.PaidAmount; dr[4] = t.UnitPrice; dr[5] = (t.Yield * 1.0 / 100).ToString(CultureInfo.InvariantCulture); dr[6] = t.Period.ToString(); dr[7] = (t.FinancingSumAmount - t.PaidAmount) / t.UnitPrice; //int index = this.dgv_Data.Rows.Add() //DataGridViewRow dr = this.dgv_Data.Rows[index]; dtDgv.Rows.Add(dr); } DataGridViewHelper.InsertDataToDgv(dtDgv, this.dgv_Data, new List <int> { 2, 3, 4, 5 }); } catch (Exception e) { MessageBox.Show("没有可以投资的标的,请让夏敏上一下"); } }
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()); }
/// <summary> /// 选中和取消全选 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ck_IsSelectedAll_CheckedChanged(object sender, EventArgs e) { DataGridViewHelper.AsAndCs(this.dgv_Data, 0, this.ck_IsSelectedAll.Checked ? 0 : 1); }