示例#1
0
        //根据后台数据设置界面上风险、流动性的勾选状态
        private void setCheckItem(DemandItem demandItem)
        {
            riskCheckBox1.Checked = demandItem.getRisk(0);
            riskCheckBox2.Checked = demandItem.getRisk(1);
            riskCheckBox3.Checked = demandItem.getRisk(2);
            riskCheckBox4.Checked = demandItem.getRisk(3);

            fluidityCheckBox1.Checked = demandItem.getFluidity(0);
            fluidityCheckBox2.Checked = demandItem.getFluidity(1);
            fluidityCheckBox3.Checked = demandItem.getFluidity(2);
        }
示例#2
0
        //根据用户需求生成产品配置,返回 List<ResultItem>
        private List<ResultItem> getResult(DemandItem demandItem,SqlCommand sqlCommand)
        {
            SqlDataReader sqlDataReader;
            List<ResultItem> resultList = new List<ResultItem>();
            string sqlstr = "select * from dbo.product_info t where 1=1";
            sqlstr += " and t.buttom_amount <=" + Convert.ToString(Convert.ToInt32(amountTextBox.Text)*demandItem.getRatio()/100 * 10000);

            sqlstr += " and product_risk in ( 999," + Convert.ToString((demandItem.getRisk(0) ? 10 : 999)) + " , "
                + Convert.ToString((demandItem.getRisk(1) ? 5 : 999)) + " , "
                + Convert.ToString((demandItem.getRisk(2) ? 1 : 999)) + " , "
                + Convert.ToString((demandItem.getRisk(3) ? 0 : 999))
                + " )";

            //TO-DO   流动性的sql拼接需要修改
            sqlstr += " and fluidity in ( 999, " + Convert.ToString((demandItem.getFluidity(0) ? 1 : 999)) + " , "
                + Convert.ToString((demandItem.getFluidity(1) ? 7 : 999)) + " , "
                + Convert.ToString((demandItem.getFluidity(2) ? 720 : 999))
                 + " ) ";
            sqlstr += " order by l_benifit desc";
            Console.WriteLine(sqlstr);
            sqlCommand.CommandText = sqlstr;
            sqlDataReader = sqlCommand.ExecuteReader();
            //封装
            while (sqlDataReader.Read())
            {
                resultList.Add(new ResultItem(sqlDataReader["product_id"].ToString(),
                    sqlDataReader["product_name"].ToString(),
                    Convert.ToInt32(amountTextBox.Text) * demandItem.getRatio() / 100 * 10000,
                    demandItem.getRatio(), sqlDataReader["l_benifit"].ToString(),
                    sqlDataReader["h_benifit"].ToString(),
                    Convert.ToInt32(sqlDataReader["product_risk"].ToString()) > 5 ? "高" : (Convert.ToInt32(sqlDataReader["product_risk"].ToString()) > 1?"中":(Convert.ToInt32(sqlDataReader["product_risk"].ToString()) > 0?"低":"无")),
                    Convert.ToInt32(sqlDataReader["fluidity"].ToString()) > 14 ? "弱" : (Convert.ToInt32(sqlDataReader["fluidity"].ToString()) > 3 ? "较好" : "很好")
                    ));
                //Console.WriteLine(sqlDataReader["product_name"]);
            }
            sqlDataReader.Close();
            //Console.WriteLine(resultList.Count);
            return resultList;
        }