zoukankan      html  css  js  c++  java
  • repater列求和

    repater:

    sql里面求和

     

     1 public void showList()
     2         {
     3             string fromdate = txtFromDate.Text;
     4             string todate = txtToDate.Text;
     5             string sales = ddlSales.SelectedValue;
     6             DataTable dt = B_Commission.getSales_volume(fromdate,todate,sales);
     7             rptList_stk.DataSource =dt;
     8             rptList_stk.DataBind();
     9 
    10             if (dt != null && dt.Rows.Count > 0)
    11             {
    12                 foreach (DataRow dr in dt.Rows)
    13                 {
    14                     p_sub_total = p_sub_total + dr["amount"].getDbl();
    15                     P_sub_profit = P_sub_profit + dr["profit"].getDbl();
    16                 }
    17             }
    18 
    19             lbl_Total.Text = MyNumber.showNum_TwoDecimal(p_sub_total);
    20             lbl_Total_profit.Text = MyNumber.showNum_TwoDecimal(P_sub_profit);
    21         }

    if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
    {
    Model.MP_invoiceItem mp = ((Model.MP_invoiceItem)e.Item.DataItem);(使用model转化的时候)
    tal = tal + Convert.ToDecimal(mp.amount);
    }
    if (e.Item.ItemType == ListItemType.Footer)
    {
    Label lbl = (Label)e.Item.FindControl("lbl_Total");
    lbl.Text = tal.getString();
    }

    Model.MP_invoiceItem mp = ((Model.MP_invoiceItem)e.Item.DataItem);
    Label lbl = (Label)e.Item.FindControl("lbl_Total");
    lbl.Text = mp.amount.getString();
    tal = tal + Convert.ToDecimal(mp["amount"]);

    repeater增删改

     1 获得linkbutton的CommandArgument的值
     2 int spec_id = e.CommandArgument.getInt();
     3 
     4 if (e.CommandName == "Edit")
     5             {
     6                 textcommand = int.Parse(e.CommandArgument.ToString());
     7             }
     8             else if (e.CommandName == "Cancel")
     9             {
    10                 textcommand = -1;
    11             }
    12             else if (e.CommandName == "Update")
    13             {
    14                 //Update
    15                 int spec_id = e.CommandArgument.getInt();
    16                 string batch_code = ((TextBox)this.rptList.Items[e.Item.ItemIndex].FindControl("txtBatchCode")).Text.Trim();
    17                 string step_code = ((TextBox)this.rptList.Items[e.Item.ItemIndex].FindControl("txtStepCode")).Text.Trim();
    18                 int qty = ((TextBox)this.rptList.Items[e.Item.ItemIndex].FindControl("txtQty")).Text.Trim().getInt();
    19                 string warranty = ((TextBox)this.rptList.Items[e.Item.ItemIndex].FindControl("txtWarranty")).Text.Trim();
    20 
    21                 B_Item.updateItemSpac(batch_code, step_code, qty, warranty, spec_id);
    22                 this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('更新ID:" +
    23                      e.CommandArgument + ";页面值:A," + batch_code + "----B," + step_code + "----C," + qty + "');", true);
    24                 AppendRowForUpdate();
    25             }
    26             else if (e.CommandName == "Delete")
    27             {
    28                 //Delete.  
    29                 for (int i = 0; i < rptList.Items.Count; i++)
    30                 {
    31                     CheckBox chk = (CheckBox)rptList.Items[i].FindControl("ckboxRemove");
    32                     if (chk.Checked)
    33                     {
    34                         int spec_id = e.CommandArgument.getInt();
    35                         B_Item.deleteItemSpac(spec_id);
    36                     }
    37                 }
    38                 this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('删除ID:" + e.CommandArgument + "');", true);
    39                 AppendRowForUpdate();
    40             }
    41 
    42             ShowItemspec();
    43             AppendRowForUpdate();
    44         }
    45     }
    46 }
  • 相关阅读:
    【力扣】767. 重构字符串
    【力扣】976. 三角形的最大周长
    【力扣】164. 最大间距
    【力扣】454. 四数相加 II
    JS中,输出1-10之间的随机整数
    web移动端浮层滚动阻止window窗体滚动JS/CSS处理
    禁止网站F12和查看源码
    苹果浏览器移动端click事件延迟300ms的原因以及解决办法
    jQuery下锚点的平滑跳转
    js实现placehoider效果
  • 原文地址:https://www.cnblogs.com/suan1717/p/6378178.html
Copyright © 2011-2022 走看看