protected void ConfirmButton1_Click(object sender, EventArgs e)
{
TransportOrder model = new TransportOrder();
model.MemberID = Convert.ToInt32(MemberDropDownList.SelectedValue);
model.LineID = Convert.ToInt32(TransportRouteDropDownList.SelectedValue);
model.Re = ReBox.Text;
model.State = TransportOrder.YSZ;
//model.Weight=private void SaveCurrentGridViewData()
{
IList<TransportDetail> ls = GetDataSource();
TextBox txt;
//double total = 0;
double weight = 0;
double tmp;
int id;
for (int i = 0; i < ls.Count; i++)
{
TransportDetail item = ls[i]; HiddenField hid = ExtendGridView1.Rows[i].FindControl("hidGoodsID") as HiddenField;
int.TryParse(hid.Value, out id);
item.ProductID = id; txt = ExtendGridView1.Rows[i].FindControl("txtProductSpec") as TextBox;
item.Spec = txt.Text.Trim(); txt = ExtendGridView1.Rows[i].FindControl("txtProductName") as TextBox;
item.Productname = txt.Text.Trim(); txt = ExtendGridView1.Rows[i].FindControl("txtProductGrade") as TextBox;
item.Material = txt.Text.Trim(); txt = ExtendGridView1.Rows[i].FindControl("txtProductMaker") as TextBox;
item.Maker = txt.Text.Trim(); txt = ExtendGridView1.Rows[i].FindControl("txtQty") as TextBox;
double.TryParse(txt.Text.Trim(), out tmp);
item.Qty = tmp; txt = ExtendGridView1.Rows[i].FindControl("txtWeight") as TextBox;
double.TryParse(txt.Text.Trim(), out tmp);
item.Weight = tmp; weight = weight + tmp; } 下面算出了这个订单的总重量weight=weight + tmp;那上面的weight赋值是这么写啊? 就是注释部分//model.Weight=
{
TransportOrder model = new TransportOrder();
model.MemberID = Convert.ToInt32(MemberDropDownList.SelectedValue);
model.LineID = Convert.ToInt32(TransportRouteDropDownList.SelectedValue);
model.Re = ReBox.Text;
model.State = TransportOrder.YSZ;
//model.Weight=private void SaveCurrentGridViewData()
{
IList<TransportDetail> ls = GetDataSource();
TextBox txt;
//double total = 0;
double weight = 0;
double tmp;
int id;
for (int i = 0; i < ls.Count; i++)
{
TransportDetail item = ls[i]; HiddenField hid = ExtendGridView1.Rows[i].FindControl("hidGoodsID") as HiddenField;
int.TryParse(hid.Value, out id);
item.ProductID = id; txt = ExtendGridView1.Rows[i].FindControl("txtProductSpec") as TextBox;
item.Spec = txt.Text.Trim(); txt = ExtendGridView1.Rows[i].FindControl("txtProductName") as TextBox;
item.Productname = txt.Text.Trim(); txt = ExtendGridView1.Rows[i].FindControl("txtProductGrade") as TextBox;
item.Material = txt.Text.Trim(); txt = ExtendGridView1.Rows[i].FindControl("txtProductMaker") as TextBox;
item.Maker = txt.Text.Trim(); txt = ExtendGridView1.Rows[i].FindControl("txtQty") as TextBox;
double.TryParse(txt.Text.Trim(), out tmp);
item.Qty = tmp; txt = ExtendGridView1.Rows[i].FindControl("txtWeight") as TextBox;
double.TryParse(txt.Text.Trim(), out tmp);
item.Weight = tmp; weight = weight + tmp; } 下面算出了这个订单的总重量weight=weight + tmp;那上面的weight赋值是这么写啊? 就是注释部分//model.Weight=
private double SaveCurrentGridViewData()
{
return weight ;//最后return 重量
}model.Weight=SaveCurrentGridViewData();