protected void gvMain_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#EAF1FD',this.style.fontWeight='';"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor,this.style.fontWeight='';"); RuSellReport model = e.Row.DataItem as RuSellReport; System.Web.UI.WebControls.Label lblIsHanShui = e.Row.FindControl("lblIsHanShui") as System.Web.UI.WebControls.Label; if (lblIsHanShui != null) { lblIsHanShui.Text = model.IsHanShui == 1 ? "含税" : "不含税"; } if (model.IsHanShui == 0) { e.Row.BackColor = System.Drawing.Color.LightGray; } } }
/// <summary> /// 对象实体绑定数据 /// </summary> public RuSellReport ReaderBind(IDataReader dataReader) { RuSellReport model = new RuSellReport(); object ojb; model.GoodTypeSmName = dataReader["GoodTypeSmName"].ToString(); model.PONo = dataReader["PONo"].ToString(); model.AE = dataReader["AE"].ToString(); model.GuestName = dataReader["GuestName"].ToString(); ojb = dataReader["GooId"]; if (ojb != null && ojb != DBNull.Value) { model.GoodId = (int)ojb; } model.GoodNo = dataReader["GoodNo"].ToString(); model.GoodName = dataReader["GoodName"].ToString(); model.GoodSpec = dataReader["GoodSpec"].ToString(); ojb = dataReader["LastNum"]; if (ojb != null && ojb != DBNull.Value) { model.totalNum = (decimal)ojb; } model.avgGoodPrice = 0; ojb = dataReader["GoodAvgPrice"]; if (ojb != null && ojb != DBNull.Value) { model.avgGoodPrice = (decimal)ojb; } ojb = dataReader["avgSellPrice"]; if (ojb != null && ojb != DBNull.Value) { model.avgSellPrice = (decimal)ojb; } ojb = dataReader["minRuTime"]; if (ojb != null && ojb != DBNull.Value) { model.minRuTime = (DateTime)ojb; } ojb = dataReader["minPODate"]; if (ojb != null && ojb != DBNull.Value) { model.minPODate = (DateTime)ojb; } ojb = dataReader["outNum"]; if (ojb != null && ojb != DBNull.Value) { model.OutNum = (decimal)ojb; } ojb = dataReader["GoodNum"]; if (ojb != null && ojb != DBNull.Value) { model.HouseNum = (decimal)ojb; } ojb = dataReader["RuChuNum"]; if (ojb != null && ojb != DBNull.Value) { model.RuChuNum = (decimal)ojb; } ojb = dataReader["IsHanShui"]; if (ojb != null && ojb != DBNull.Value) { model.IsHanShui = (int)ojb; } return(model); }