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 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; } } }