/// <summary>
        ///     加载数据
        /// </summary>
        /// <param name="where"></param>
        /// <param name="order"></param>
        private void LoadPageData(string where = null, string order = null)
        {
            //select * from ( select *,ROW_NUMBER() OVER(Order by Id) as rownum from Account) as twhere t.rownum between (@pageIndex - 1) * pageSize + 1 and @pageSize * pageIndex order by t.Id asc
            this.LoadData.Func = () => SqlHelperByYem.Query($"select * from(select *,ROW_NUMBER() OVER({order}) as rownum from core.UserAssetRatios where  IsDelete=0 and Status in(10,20,40) and DeptRedeemStatus=10 {where})as t where t.rownum between {(this.LoadData.PageIndex - 1) * this.LoadData.PageSize + 1} and {this.LoadData.PageSize * this.LoadData.PageIndex}", null, false);

            this.LoadData.FuncNums = () => Convert.ToInt16(SqlHelperByYem.ExecuteScalar($"select count(*) from core.UserAssetRatios where  IsDelete=0 and Status in(10,20,40) and DeptRedeemStatus=10  {where}"));

            this.LoadData.LoadOneTablePageData();
            this.LoadData.Action  = () => this.LoadData.Lbl_infos1.Text = "每页";
            this.LoadData.Atcion1 = () => { };
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string    sql1 = "(SELECT UserAssetRatioId FROM Core.RedeemOrderDetail WHERE Status=0 AND AssetRatioType = 1)";
            string    sql2 = "SELECT * FROM Core.RequestBatchDetails WHERE Info LIKE '%@Id@%' AND TypeId=50  ";
            DataTable dt   = SqlHelperByYem.ExecuteDataTable(sql1);

            foreach (DataRow dtRow in dt.Rows)
            {
                //SqlHelperByYem.ExecuteDataTable(sql2.Replace("@Id@",dtRow.));
            }
        }
        /// <summary>
        ///     加载数据
        /// </summary>
        private void LoadPageData(int pageIndex, int type, string userId = "", string userAssetRatioId = "")
        {
            SqlParameter pageIndexParam        = new SqlParameter("@pageIndex", pageIndex);
            SqlParameter pageSizeParam         = new SqlParameter("@pageSize", Convert.ToInt32(this.cbx_pageSize.Text));
            SqlParameter userIdParam           = new SqlParameter("@userId", userId);
            SqlParameter userAssetRatioIdParam = new SqlParameter("@UserAssetRatioId", userAssetRatioId);
            SqlParameter totalCountParam       = new SqlParameter("@totalCount", SqlDbType.Int)
            {
                Direction = ParameterDirection.Output
            };

            SqlParameter[] sqlparams = { pageIndexParam, pageSizeParam, userIdParam, userAssetRatioIdParam, totalCountParam };

            this.LoadData.Func = () => SqlHelperByYem.Query(type == 0 ? "[Core].PROC_UserRedeemableSubOrderForDev" : "[Core].PROC_UserRedeemableUserAssetRatioForDev", sqlparams, true);

            this.LoadData.FuncNums = () => Convert.ToInt32(totalCountParam.Value);

            this.LoadData.LoadOneTablePageData();
            this.LoadData.Action = () => this.LoadData.Lbl_infos1.Text = "每页";
        }
Example #4
0
        /// <summary>
        ///     批量预申购
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btn_purchase_Click(object sender, EventArgs e)
        {
            try
            {
                //验证数据
                //1.金额范围 100-30000元之间 1-300
                int indexAmountRange = this.cbx_AmountRange.SelectedIndex;
                int startIndex       = 1;
                int endIndex         = 301;
                if (indexAmountRange == 1)
                {
                    //自定义
                    int index1 = Convert.ToInt16(this.txb_SAmount.Text.Trim());
                    int index2 = Convert.ToInt16(this.txb_EAmount.Text.Trim());
                    if (index1 < startIndex || index1 >= endIndex)
                    {
                        MessageBox.Show("开始金额不对,金额范围应该是1-300的数");
                        return;
                    }
                    if (index2 <= startIndex || index2 > endIndex)
                    {
                        MessageBox.Show("结束金额不对,金额范围应该是2-301的数");
                        return;
                    }
                    startIndex = index1;
                    endIndex   = index2;
                }
                //2.本次需要申购的数据
                int numsTotal = Convert.ToInt16(this.txb_NumsTotal.Text.Trim());
                if (numsTotal == 0)
                {
                    MessageBox.Show("输入的份数必须大于0");
                    return;
                }
                //3.如果是第三种方式 先将重复的数据移除
                int indexType = this.cbx_Type.SelectedIndex; //0 可重复 1. 不重复 2. 人不重复且订单不重复
                if (indexType == 2)
                {
                    //获取所有订单中的UserId 移除
                    DataTable dt = SqlHelperByYem.ExecuteDataTable("select UserId from core.orders where RemainingAmount >90");
                    if (dt != null)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            this.userIds.Remove(dt.Rows[i]["UserId"].ToString());
                        }
                        if (this.userIds.Count == 0)
                        {
                            MessageBox.Show("所选择的用户中没有满足条件的用户可以购买,请重新选择其他用户批量购买");
                            return;
                        }
                    }
                }
                this.lbl_showMSg.Text     = "执行提示:正在批量下订单操作........";
                this.btn_purchase.Enabled = false;
                Random random      = new Random();
                int    successNums = 0;
                int    failedNums  = 0;
                //3.选择哪种申购方式
                for (int i = 0; i < numsTotal; i++)
                {
                    //申购
                    long amount = random.Next(startIndex, endIndex) * 10000;
                    //人数
                    string userId = this.userIds[random.Next(0, this.userIds.Count)];
                    //购买操作
                    bool result = await this.jymService.PurchaseOrders(amount, userId);

                    if (result)
                    {
                        //提示成功了多少笔
                        successNums++;
                    }
                    else
                    {
                        failedNums++;
                    }
                    if (indexType == 0)
                    {
                        continue;
                    }
                    //都要移除 购买完一次后
                    this.userIds.Remove(userId);
                    if (this.userIds.Count == 0)
                    {
                        break;
                    }
                }
                //结束了
                this.btn_purchase.Enabled = true;
                this.lbl_showMSg.Text     = $"执行提示:执行完毕,成功数量{successNums},失败数量:{failedNums}";
                this.Close();
            }
            catch (Exception exception)
            {
                this.btn_purchase.Enabled = true;
                this.lbl_showMSg.Text     = $"执行提示:{exception.Message}";
            }
        }
Example #5
0
 //债权检查
 private void button2_Click(object sender, EventArgs e)
 {
     string    sql = "SELECT * FROM Core.DeptAssignRelations WHERE OldUserAssetRatioId IN (SELECT UserAssetRatioId FROM Core.RedeemOrderDetail WHERE Status=0 AND AssetRatioType = 2)";
     DataTable dt  = SqlHelperByYem.ExecuteDataTable(sql);
 }