protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //翻译是否含税 bool sale_rate = e.Row.Cells[6].Text.Trim() == "True" ? true : false; if (sale_rate) { e.Row.Cells[6].Text = "是"; } else { e.Row.Cells[6].Text = "否"; } bool buy_rate = e.Row.Cells[8].Text.Trim() == "True" ? true : false; if (buy_rate) { e.Row.Cells[8].Text = "是"; } else { e.Row.Cells[8].Text = "否"; } //翻译业务部门和业务员 ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); string dept_id = e.Row.Cells[1].Text.Trim(); string emp_id = e.Row.Cells[2].Text.Trim(); if (!string.IsNullOrEmpty(dept_id) && dept_id != " ") { string dept_name = pba.getDeptNameById(dept_id); if (!string.IsNullOrEmpty(dept_name)) { e.Row.Cells[1].Text = dept_name; } } if (!string.IsNullOrEmpty(emp_id) && emp_id != " ") { string emp_name = pba.getEmpNameById(emp_id); if (!string.IsNullOrEmpty(emp_name)) { e.Row.Cells[2].Text = emp_name; } } Label lbCommission = e.Row.Cells[20].FindControl("lbl_commission") as Label; decimal commission = 0; if (!string.IsNullOrEmpty(lbCommission.Text)) { commission = Decimal.Parse(lbCommission.Text); } commissionforAll += commission; } else if (e.Row.RowType == DataControlRowType.Footer) { e.Row.Cells[20].Text = commissionforAll.ToString("f3"); } }
private string getEmpName(string emp_id) { string result = emp_id; ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); if (!string.IsNullOrEmpty(emp_id) && emp_id != " ") { string emp_name = pba.getEmpNameById(emp_id); if (!string.IsNullOrEmpty(emp_name)) { result = emp_name; } } return(result); }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //翻译是否含税 bool sale_rate = e.Row.Cells[6].Text.Trim() == "True" ? true : false; if (sale_rate) { e.Row.Cells[6].Text = "是"; } else { e.Row.Cells[6].Text = "否"; } bool buy_rate = e.Row.Cells[8].Text.Trim() == "True" ? true : false; if (buy_rate) { e.Row.Cells[8].Text = "是"; } else { e.Row.Cells[8].Text = "否"; } //翻译业务部门和业务员 ProfitBudgetAdapter pba = new ProfitBudgetAdapter(); string dept_id = e.Row.Cells[1].Text.Trim(); string emp_id = e.Row.Cells[2].Text.Trim(); if (!string.IsNullOrEmpty(dept_id)) { string dept_name = pba.getDeptNameById(dept_id); if (!string.IsNullOrEmpty(dept_name)) { e.Row.Cells[1].Text = dept_name; } } if (!string.IsNullOrEmpty(emp_id)) { string emp_name = pba.getEmpNameById(emp_id); if (!string.IsNullOrEmpty(emp_name)) { e.Row.Cells[2].Text = emp_name; } } } }