protected void save_Click(object sender, EventArgs e) { try { check(); T_ActualProfitAccounting item = new T_ActualProfitAccounting(); item.SaleBillNo = txt_sale_bill_no.Text.Trim(); item.ActualAmount = Decimal.Parse(txt_actual_amount.Text.Trim()); item.ReturnTax = Decimal.Parse(txt_return_tax.Text.Trim()); item.ActualPay = Decimal.Parse(txt_actual_pay.Text.Trim()); item.ExtraCharges = Decimal.Parse(txt_extra_charges.Text.Trim()); item.Commission = Decimal.Parse(txt_commission.Text.Trim()); item.ActualProfitAmount = Decimal.Parse(lbl_actual_profit_amount.Text.Trim()); item.ActualProfit = Decimal.Parse(lbl_actual_profit.Text.Trim()); item.AuditStatus = false; ProfitAccountingAdapter paa = new ProfitAccountingAdapter(); paa.IsActualAudit(item.SaleBillNo, true); ActualProfitAccountingAdapter apaa = new ActualProfitAccountingAdapter(); apaa.addData(item); Label1.Text = "保存成功"; clean(); } catch (Exception ex) { Label1.Text = ex.Message; return; } }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { Label1.Text = ""; int index = GridView1.SelectedIndex; GridViewRow grv = GridView1.SelectedRow; string sale_bill_no = (grv.Cells[1].Controls[0] as HyperLink).Text; ProfitAccountingAdapter paa = new ProfitAccountingAdapter(); DataSet ds = paa.getActualProfit(sale_bill_no); if (ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; txt_sale_bill_no.Text = sale_bill_no; decimal actual_amount = Decimal.Parse(dr["actual_amount"].ToString()); txt_actual_amount.Text = actual_amount.ToString("f2"); decimal commission = decimal.Parse(dr["commission"].ToString()); txt_commission.Text = commission.ToString("f3"); decimal extra_charges = decimal.Parse(dr["extra_charges"].ToString()); txt_extra_charges.Text = extra_charges.ToString("f2"); decimal actual_pay = decimal.Parse(dr["actual_pay"].ToString()); txt_actual_pay.Text = actual_pay.ToString("f2"); //退税 TaxListAdapter tla = new TaxListAdapter(); decimal return_tax = tla.getTaxReturnTotal(sale_bill_no); txt_return_tax.Text = return_tax.ToString("f2"); decimal actual_profit_amount = actual_amount - actual_pay; lbl_actual_profit_amount.Text = (actual_profit_amount - extra_charges - commission + return_tax).ToString("f2"); decimal actual_profit = (actual_profit_amount - extra_charges - commission + return_tax) / actual_amount; lbl_actual_profit.Text = actual_profit.ToString("f3"); save.Enabled = true; } }
private void show() { ProfitAccountingAdapter paa = new ProfitAccountingAdapter(); DataSet ds = paa.getProfitBudgetSummary(); GridView1.DataSource = ds; GridView1.DataBind(); }
private void show() { ProfitAccountingAdapter pba = new ProfitAccountingAdapter(); DataSet ds = pba.getProfitBudgetByID(0, sale_bill_no); lbl_extra_charges.Text = decimal.Parse(ds.Tables[0].Rows[0]["extra_charges"].ToString()).ToString("f2"); txt_dept_id.Text = getDeptName(ds.Tables[0].Rows[0]["dept_id"].ToString()); txt_emp.Text = getEmpName(ds.Tables[0].Rows[0]["emp_id"].ToString()); GridView1.DataSource = ds; GridView1.DataBind(); }
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e) { HyperLink thisData = GridView2.SelectedRow.Cells[1].Controls[0] as HyperLink; sale_bill_no = thisData.Text; this.txt_extra_charges.Text = GridView2.SelectedRow.Cells[2].Text; finterid = Int32.Parse((GridView2.SelectedRow.Cells[0].FindControl("hdf_finter_id") as HiddenField).Value); ProfitAccountingAdapter pba = new ProfitAccountingAdapter(); DataSet ds = pba.getProfitBudgetByID(finterid, sale_bill_no); show(GridView1, ds); }
protected void btn_query_Click(object sender, EventArgs e) { string queryStr = this.txt_sale_bill_no.Text.Trim(); ProfitAccountingAdapter pba = new ProfitAccountingAdapter(); if (String.IsNullOrEmpty(queryStr)) { show(GridView2, pba.getProfitBudgetSummary()); } else { show(GridView2, pba.getProfitBudgetSummaryByID(queryStr)); } }
protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e) { GridViewRow row = null; if (e.CommandName == "Delete") { string sale_bill_no = e.CommandArgument.ToString(); //获取当前行 Control cmdControl = e.CommandSource as Control; row = cmdControl.NamingContainer as GridViewRow; finterid = Int32.Parse((row.Cells[0].FindControl("hdf_finter_id") as HiddenField).Value); ProfitAccountingAdapter paa = new ProfitAccountingAdapter(); DataSet ds = paa.getProfitBudgetByID(finterid, sale_bill_no); List <T_ProfitBudgetList> lists = new List <T_ProfitBudgetList>(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { T_ProfitBudgetList list = new T_ProfitBudgetList(); DataRow dr = ds.Tables[0].Rows[i]; list.BuyFentryid = Int32.Parse(dr["Buy_FEntryID"].ToString()); list.SaleBillNo = dr["SEOrderID"].ToString(); list.BuyBillNo = dr["buy_bill_no"].ToString(); list.UnAccountingQty = decimal.Parse(dr["sale_qty"].ToString()); list.CheckStatus = false; lists.Add(list); } ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); try { paa.deleteBySaleBillNo(sale_bill_no); pba.AddUnAccountingQtyBecauseDelete(lists); GridViewBind(); clean(); GridView1.DataSource = ""; GridView1.DataBind(); Label2.Visible = true; Label2.Text = "删除成功"; } catch (Exception ex) { Label2.Text = ex.Message; } } }
protected void btn_approve_Click(object sender, EventArgs e) { Button bt = sender as Button; string args = bt.CommandArgument.ToString(); GridViewRow row = bt.Parent.Parent as GridViewRow; string sale_bill_no = row.Cells[1].Text.ToString(); ProfitAccountingAdapter pba = new ProfitAccountingAdapter(); if (args == "Y") { pba.audit(sale_bill_no, true); } else { pba.audit(sale_bill_no, false); } GridViewBind(); }
protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { string sale_bill_no = e.CommandArgument.ToString(); ProfitAccountingAdapter pba = new ProfitAccountingAdapter(); try { pba.deleteBySaleBillNo(sale_bill_no); GridViewBind(); clean(); GridView1.DataSource = ""; GridView1.DataBind(); Label2.Visible = true; Label2.Text = "删除成功"; } catch (Exception ex) { Label2.Text = ex.Message; } } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { string sale_bill_no = e.CommandArgument.ToString(); ActualProfitAccountingAdapter aa = new ActualProfitAccountingAdapter(); ProfitAccountingAdapter paa = new ProfitAccountingAdapter(); try { paa.IsActualAudit(sale_bill_no, false); aa.delete(sale_bill_no); GridView1.SelectedIndex = -1; show(); clean(); Label1.Text = "删除成功"; } catch (Exception ex) { Label1.Text = ex.Message; } } }
protected void submit_Click(object sender, EventArgs e) { ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); //收集利润核算表头信息 T_ProfitAccounting item = new T_ProfitAccounting(); item.UpdateTime = DateTime.Now; decimal extra_charges = 0; if (!string.IsNullOrEmpty(txt_extra_charges.Text.Trim())) { extra_charges += Decimal.Parse(txt_extra_charges.Text.Trim()); } if (!string.IsNullOrEmpty(txt_extra_charges_lists_all.Text.Trim())) { extra_charges += Decimal.Parse(txt_extra_charges_lists_all.Text.Trim()); } item.ExtraCharges = extra_charges; item.FInterID = finterid; item.SaleBillNo = sale_bill_no; item.AuditState = false; item.IsActualAudit = false; //收集利润核算表体信息 List <T_ProfitAccountingList> lists = new List <T_ProfitAccountingList>(); List <T_ProfitBudgetList> pbls = new List <T_ProfitBudgetList>(); for (int i = 0; i <= GridView1.Rows.Count - 1; i++) { T_ProfitAccountingList list = new T_ProfitAccountingList(); T_ProfitBudgetList pbl = new T_ProfitBudgetList(); list.FInterID = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[18].FindControl("hdf_finter_id")).Value); list.SaleFentryid = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[18].FindControl("hdf_sale_fentry_id")).Value); list.BuyFentryid = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[18].FindControl("hdf_buy_fentry_id")).Value); list.FItemID = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[18].FindControl("hdf_fitem_id")).Value); list.SaleBillNo = sale_bill_no; list.BuyBillNo = GridView1.Rows[i].Cells[0].Text; list.FName = GridView1.Rows[i].Cells[1].Text; list.FNumber = GridView1.Rows[i].Cells[2].Text; list.DeptId = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[18].FindControl("hdf_dept_id")).Value); list.EmpId = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[18].FindControl("hdf_emp_id")).Value); list.SalePrice = Decimal.Parse(GridView1.Rows[i].Cells[3].Text); list.Currency = GridView1.Rows[i].Cells[4].Text; TextBox txt_exchange_rate = (TextBox)GridView1.Rows[i].Cells[5].FindControl("txt_exchange_rate"); if (string.IsNullOrEmpty(txt_exchange_rate.Text)) { list.ExchangeRate = 0; } else { list.ExchangeRate = Decimal.Parse(txt_exchange_rate.Text); } list.BuyPrice = Decimal.Parse(GridView1.Rows[i].Cells[7].Text); list.SaleQty = Decimal.Parse(GridView1.Rows[i].Cells[9].Text); list.BuyQty = Decimal.Parse(GridView1.Rows[i].Cells[10].Text); list.Accessory = (GridView1.Rows[i].Cells[11].FindControl("txt_accessory") as TextBox).Text; TextBox txt_accessory_price = GridView1.Rows[i].Cells[12].FindControl("txt_accessory_price") as TextBox; if (!String.IsNullOrEmpty(txt_accessory_price.Text)) { list.AccessoryPrice = Decimal.Parse(txt_accessory_price.Text); } else { list.AccessoryPrice = 0; } string length = (GridView1.Rows[i].Cells[13].FindControl("txt_length") as TextBox).Text; if (string.IsNullOrEmpty(length)) { list.Length = 0; } else { list.Length = Decimal.Parse(length); } string width = (GridView1.Rows[i].Cells[13].FindControl("txt_width") as TextBox).Text; if (string.IsNullOrEmpty(width)) { list.Width = 0; } else { list.Width = Decimal.Parse(width); } string height = (GridView1.Rows[i].Cells[13].FindControl("txt_height") as TextBox).Text; if (string.IsNullOrEmpty(height)) { list.Height = 0; } else { list.Height = Decimal.Parse(height); } string capacity = (GridView1.Rows[i].Cells[16].FindControl("txt_capacity") as TextBox).Text; if (string.IsNullOrEmpty(capacity)) { list.Capacity = 0; } else { list.Capacity = Decimal.Parse(capacity); } string estimate_freight_charge = (GridView1.Rows[i].Cells[15].FindControl("txt_estimate_freight_charge") as TextBox).Text; if (string.IsNullOrEmpty(estimate_freight_charge)) { list.EstimateFreightCharge = 0; } else { list.EstimateFreightCharge = Decimal.Parse(estimate_freight_charge); } string tax_rate = (GridView1.Rows[i].Cells[17].FindControl("txt_tax_rate") as TextBox).Text; if (string.IsNullOrEmpty(tax_rate)) { list.TaxRate = 0; } else { list.TaxRate = Decimal.Parse(tax_rate); } list.SaleRate = GridView1.Rows[i].Cells[6].Text == "是" ? true : false; list.BuyRate = GridView1.Rows[i].Cells[8].Text == "是" ? true : false; string profit = (GridView1.Rows[i].Cells[19].FindControl("lbl_profit") as Label).Text; if (string.IsNullOrEmpty(profit)) { list.Profit = 0; } else { list.Profit = Decimal.Parse(profit); } string volume = (GridView1.Rows[i].Cells[14].FindControl("lbl_volume") as Label).Text; if (string.IsNullOrEmpty(volume)) { list.Volume = 0; } else { list.Volume = Decimal.Parse(volume); } string return_rate = (GridView1.Rows[i].Cells[18].FindControl("txt_return_rate") as TextBox).Text; if (string.IsNullOrEmpty(return_rate)) { list.ReturnRate = 0; } else { list.ReturnRate = Decimal.Parse(return_rate); } Label lbCommission = GridView1.Rows[i].Cells[20].FindControl("lbl_commission") as Label; list.Commission = Decimal.Parse(lbCommission.Text); list.SEOrderID = GridView1.Rows[i].Cells[21].Text; lists.Add(list); pbl.BuyFentryid = list.BuyFentryid; pbl.SaleBillNo = list.SEOrderID; pbl.BuyBillNo = list.BuyBillNo; DataSet ds = pba.getProfitBudgetList(pbl); decimal un_accounting_qty = Decimal.Parse(ds.Tables[0].Rows[0]["un_accounting_qty"].ToString()); pbl.UnAccountingQty = un_accounting_qty - list.SaleQty; if (un_accounting_qty - list.SaleQty == 0) { pbl.CheckStatus = true; } else { pbl.CheckStatus = false; } pbls.Add(pbl); } try { //更新check_status字段为true,如果表体相关记录check_status字段全为true //var query1 = (from tt in pbls // where tt.CheckStatus == true // select tt.SaleBillNo).Distinct().ToList(); //var query2 = (from tt in pbls // where tt.CheckStatus == false // select tt.SaleBillNo).Distinct().ToList(); //var query = query1.Except(query2).ToList(); ProfitAccountingAdapter paa = new ProfitAccountingAdapter(); paa.addProfitBudgetHead(item); paa.addProfitBudgetList(lists); pba.updateList(pbls); Label2.Text = "保存成功!"; Label2.Visible = true; } catch (Exception ex) { Label2.Text = ex.Message; Label2.Visible = true; return; } }
protected void query_Click(object sender, EventArgs e) { Label2.Text = ""; Label2.Visible = false; ProfitAccountingAdapter pba = new ProfitAccountingAdapter(); T_ProfitAccounting item = new T_ProfitAccounting(); sale_bill_no = this.txt_sale_bill_no.Text.Trim(); item.SaleBillNo = sale_bill_no; DataSet ds1 = pba.getSEOrderInfo(item); finterid = Int32.Parse(ds1.Tables[0].Rows[0][0].ToString()); var list = ds1.Tables[0].AsEnumerable().Select <DataRow, int>(x => Convert.ToInt32(x["FOrderInterID"])).ToList <int>().Distinct().ToList <int>(); DataSet ds2 = pba.getProfitBudgetList(list); txt_extra_charges_lists_all.Text = pba.getExtraCharges(sale_bill_no); var query = from rds1 in ds1.Tables[0].AsEnumerable() join rds2 in ds2.Tables[0].AsEnumerable() on new { FInterID = rds1.Field <Int32>("FOrderInterID"), Sale_FEntryID = rds1.Field <Int32>("FOrderEntryID"), Buy_FEntryID = rds1.Field <Int32>("Buy_FEntryID") } equals new { FInterID = rds2.Field <Int32>("FInterID"), Sale_FEntryID = rds2.Field <Int32>("Sale_FEntryID"), Buy_FEntryID = rds2.Field <Int32>("Buy_FEntryID") } into temp from tt in temp.DefaultIfEmpty() select new { FInterID = rds1.Field <Int32>("FInterID"), Sale_FEntryID = rds1.Field <Int32>("Sale_FEntryID"), Buy_FEntryID = rds1.Field <Int32>("Buy_FEntryID"), FItemID = rds1.Field <Int32>("FItemID"), sale_bill_no = rds1.Field <String>("sale_bill_no"), buy_bill_no = rds1.Field <String>("buy_bill_no"), dept_id = tt == null ? 0 : tt.Field <Int32>("dept_id"), emp_id = tt == null ? 0 : tt.Field <Int32>("emp_id"), sale_price = rds1.Field <Decimal>("sale_price"), currency = tt == null ? "" : tt.Field <String>("currency"), exchange_rate = tt == null ? 0 : tt.Field <Decimal>("exchange_rate"), buy_price = tt == null ? 0 : tt.Field <Decimal>("buy_price"), sale_qty = rds1.Field <Decimal>("sale_qty"), buy_qty = tt == null ? 0 : tt.Field <Decimal>("buy_qty"), accessory = tt == null ? "" : tt.Field <String>("accessory"), accessory_price = tt == null ? 0 : tt.Field <Decimal>("accessory_price"), length = tt == null ? 0 : tt.Field <Decimal>("length"), width = tt == null ? 0 : tt.Field <Decimal>("width"), height = tt == null ? 0 : tt.Field <Decimal>("height"), capacity = tt == null ? 0 : tt.Field <Decimal>("capacity"), estimate_freight_charge = tt == null ? 0 : tt.Field <Decimal>("estimate_freight_charge"), tax_rate = tt == null ? 0 : tt.Field <Decimal>("tax_rate"), sale_rate = tt == null ? false : tt.Field <Boolean>("sale_rate"), buy_rate = tt == null ? false : tt.Field <Boolean>("buy_rate"), return_rate = tt == null ? 0 : tt.Field <Decimal>("return_rate"), profit = tt == null ? 0 : tt.Field <Decimal>("profit"), volume = tt == null ? 0 : tt.Field <Decimal>("volume"), FOrderBillNo = rds1.Field <String>("FOrderBillNo"), FName = tt == null ? "" : tt.Field <String>("FName"), FNumber = tt == null ? "" : tt.Field <String>("FNumber") }; DataTable dt = getNewTable(); foreach (var obj in query) { dt.Rows.Add(obj.FInterID, obj.Sale_FEntryID, obj.Buy_FEntryID, obj.FItemID, obj.sale_bill_no, obj.buy_bill_no, obj.dept_id, obj.emp_id, obj.sale_price, obj.currency, obj.exchange_rate, obj.buy_price, obj.sale_qty, obj.buy_qty, obj.accessory, obj.accessory_price, obj.length, obj.width, obj.height, obj.capacity, obj.estimate_freight_charge, obj.tax_rate, obj.sale_rate, obj.buy_rate, obj.return_rate, obj.profit, obj.volume, obj.FOrderBillNo, obj.FName, obj.FNumber); } show(dt); }
private void GridViewBind() { ProfitAccountingAdapter pba = new ProfitAccountingAdapter(); show(GridView2, pba.getProfitBudgetSummary()); }
protected void submit_Click(object sender, EventArgs e) { //收集利润核算表头信息 T_ProfitAccounting item = new T_ProfitAccounting(); item.UpdateTime = DateTime.Now; decimal extra_charges = 0; if (!string.IsNullOrEmpty(txt_extra_charges.Text.Trim())) { extra_charges = Decimal.Parse(txt_extra_charges.Text.Trim()); } item.ExtraCharges = extra_charges; item.FInterID = finterid; item.SaleBillNo = sale_bill_no; item.AuditState = false; //收集利润核算表体信息 List <T_ProfitAccountingList> lists = new List <T_ProfitAccountingList>(); for (int i = 0; i <= GridView1.Rows.Count - 1; i++) { T_ProfitAccountingList list = new T_ProfitAccountingList(); list.FInterID = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[19].FindControl("hdf_finter_id")).Value); list.SaleFentryid = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[19].FindControl("hdf_sale_fentry_id")).Value); list.BuyFentryid = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[19].FindControl("hdf_buy_fentry_id")).Value); list.FItemID = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[19].FindControl("hdf_fitem_id")).Value); list.SaleBillNo = sale_bill_no; list.BuyBillNo = GridView1.Rows[i].Cells[0].Text; list.FName = GridView1.Rows[i].Cells[1].Text; list.FNumber = GridView1.Rows[i].Cells[2].Text; list.DeptId = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[19].FindControl("hdf_dept_id")).Value); list.EmpId = Int32.Parse(((HiddenField)GridView1.Rows[i].Cells[19].FindControl("hdf_emp_id")).Value); list.SalePrice = Decimal.Parse(GridView1.Rows[i].Cells[3].Text); list.Currency = GridView1.Rows[i].Cells[4].Text; TextBox txt_exchange_rate = (TextBox)GridView1.Rows[i].Cells[5].FindControl("txt_exchange_rate"); if (string.IsNullOrEmpty(txt_exchange_rate.Text)) { list.ExchangeRate = 0; } else { list.ExchangeRate = Decimal.Parse(txt_exchange_rate.Text); } list.BuyPrice = Decimal.Parse(GridView1.Rows[i].Cells[7].Text); list.SaleQty = Decimal.Parse(GridView1.Rows[i].Cells[9].Text); list.BuyQty = Decimal.Parse(GridView1.Rows[i].Cells[10].Text); list.Accessory = (GridView1.Rows[i].Cells[11].FindControl("txt_accessory") as TextBox).Text; TextBox txt_accessory_price = GridView1.Rows[i].Cells[12].FindControl("txt_accessory_price") as TextBox; if (!String.IsNullOrEmpty(txt_accessory_price.Text)) { list.AccessoryPrice = Decimal.Parse(txt_accessory_price.Text); } else { list.AccessoryPrice = 0; } string length = (GridView1.Rows[i].Cells[13].FindControl("txt_length") as TextBox).Text; if (string.IsNullOrEmpty(length)) { list.Length = 0; } else { list.Length = Decimal.Parse(length); } string width = (GridView1.Rows[i].Cells[13].FindControl("txt_width") as TextBox).Text; if (string.IsNullOrEmpty(width)) { list.Width = 0; } else { list.Width = Decimal.Parse(width); } string height = (GridView1.Rows[i].Cells[13].FindControl("txt_height") as TextBox).Text; if (string.IsNullOrEmpty(height)) { list.Height = 0; } else { list.Height = Decimal.Parse(height); } string capacity = (GridView1.Rows[i].Cells[16].FindControl("txt_capacity") as TextBox).Text; if (string.IsNullOrEmpty(capacity)) { list.Capacity = 0; } else { list.Capacity = Decimal.Parse(capacity); } string estimate_freight_charge = (GridView1.Rows[i].Cells[15].FindControl("txt_estimate_freight_charge") as TextBox).Text; if (string.IsNullOrEmpty(estimate_freight_charge)) { list.EstimateFreightCharge = 0; } else { list.EstimateFreightCharge = Decimal.Parse(estimate_freight_charge); } string tax_rate = (GridView1.Rows[i].Cells[17].FindControl("txt_tax_rate") as TextBox).Text; if (string.IsNullOrEmpty(tax_rate)) { list.TaxRate = 0; } else { list.TaxRate = Decimal.Parse(tax_rate); } list.SaleRate = GridView1.Rows[i].Cells[6].Text == "是" ? true : false; list.BuyRate = GridView1.Rows[i].Cells[8].Text == "是" ? true : false; string profit = (GridView1.Rows[i].Cells[19].FindControl("lbl_profit") as Label).Text; if (string.IsNullOrEmpty(profit)) { list.Profit = 0; } else { list.Profit = Decimal.Parse(profit); } string volume = (GridView1.Rows[i].Cells[14].FindControl("lbl_volume") as Label).Text; if (string.IsNullOrEmpty(volume)) { list.Volume = 0; } else { list.Volume = Decimal.Parse(volume); } string return_rate = (GridView1.Rows[i].Cells[18].FindControl("txt_return_rate") as TextBox).Text; if (string.IsNullOrEmpty(return_rate)) { list.ReturnRate = 0; } else { list.ReturnRate = Decimal.Parse(return_rate); } Label lb_commission = GridView1.Rows[i].Cells[20].FindControl("lbl_commission") as Label; list.Commission = Decimal.Parse(lb_commission.Text); list.SEOrderID = GridView1.Rows[i].Cells[21].Text; lists.Add(list); } try { ProfitAccountingAdapter pba = new ProfitAccountingAdapter(); pba.updateProfitBudgetHead(item); pba.updateProfitBudgetList(lists); Label2.Text = "保存成功!"; Label2.Visible = true; GridViewBind(); GridView2.SelectedIndex = -1; } catch (Exception ex) { Label2.Text = ex.Message; Label2.Visible = true; return; } }