循环读取某一列的值,进行相应的操作

12 篇文章 0 订阅

1, public decimal getTotal()

    {
        decimal TotalMoney1 = 0;
        string strCmd = "select bm from orders where AccountID=@AccountID and LendTime<=@LendTime and keep1=1";//and State=2  ";
        SqlParameter[] paras = { 
                               new SqlParameter("@AccountID",Request.QueryString["AccountId"].ToString()),
                                new SqlParameter("@LendTime",new DateTime(DateTime.Now.Year,DateTime.Now.Month,26).ToShortDateString())
                               };


        DataSet da = HTDT.DbUtility.AosySql.ExecuteforDataSet(strCmd, CommandType.Text, paras);
        if (da.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < da.Tables[0].Rows.Count; i++)
            {
                TotalMoney1 += Convert.ToDecimal(da.Tables[0].Rows[i]["bm"].ToString());
            }
          
        }
        return TotalMoney1;
    }




2,if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)

        {
            Label lblOfZhaiqian = e.Item.FindControl("zhaiquan") as Label;
            decimal moenyzhaiqian = Convert.ToDecimal(lblOfZhaiqian.Text.ToString());
            totalMoneyOfBorrow += moenyzhaiqian;
            totalMoneyOfTranfer += moenyzhaiqian;
        }
        if (e.Item.ItemType == ListItemType.Footer)
        {
            Label lblOfTransFer = e.Item.FindControl("lblOfTransFer") as Label;
            Label lblOfMoney = e.Item.FindControl("lblOfMoney") as Label;
            lblOfTransFer.Text = String.Format("{0:f2}", totalMoneyOfBorrow);
            lblOfMoney.Text = String.Format("{0:f2}", totalMoneyOfTranfer);

        }


3, try
            {
                List<string> SqlStr = new List<string>();
                string sqlUpDate = "update HT_Customer set UpgradeImg='" + UpImage + "' Where AccountID='" + ProductNum + "'";
                //string sqlUpdate1 = "update HT_ProductOrder set IsApplyForSuccess=1 where FK_Customer_Id in (select ID from HT_Customer where AccountID='" + Request.QueryString["AccountId"].ToString() + "')";
                int countRow = 0;
                for (int i = 0; i < HT_ApplyForProduct.Rows.Count; i++)
                {
                    CheckBox ck = (CheckBox)HT_ApplyForProduct.Rows[i].FindControl("selectid");


                    if (ck.Checked)
                    {
                        Label lblLendNum = HT_ApplyForProduct.Rows[i].FindControl("lblLendNum") as Label;
                        string sql = " update HT_ProductOrder set IsApplyForSuccess=1 where lendNum='" + lblLendNum.Text + "'";
                        string sql2 = "update HT_ProductOrder set  keep2='2' where Substring(lendNum,0,17)=" + lblLendNum.Text.Substring(0, 16);
                        SqlStr.Add(sql);
                        SqlStr.Add(sql2);
                        countRow++;
                    }
                }
                if (countRow < 2)
                {
                    Msg.Show("请正确选择升级产品!");
                    return;
                }
                SqlStr.Add(sqlUpDate);
                //SqlStr.Add(sqlUpdate1);
                int count = HTDT.DbUtility.AosySql.ExecuteListSQL(SqlStr);
                if (SqlStr.Count == count)
                {
                  
                    Msg.ShowAndRedirect("成功!", "../HT_Mangge/Manage_HT_ProductOrderForBackMoney.aspx?AccountId=" + Request.QueryString["AccountId"].ToString());
                }
                else
                {
                    Msg.Show("失败!");
                }






  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值