示例#1
0
        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='';");
                SellFPReport model = e.Row.DataItem as SellFPReport;
                if (model.hadFpTotal.HasValue && model.POTotal != 0 && model.POTotal == model.hadFpTotal)
                {
                    e.Row.BackColor = System.Drawing.Color.Red;
                }

                if (model.hadFpTotal.HasValue && model.POTotal != 0 && model.POTotal > model.hadFpTotal)
                {
                    e.Row.BackColor = System.Drawing.Color.DarkOrange;
                }
            }
        }
示例#2
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public SellFPReport ReaderBind(IDataReader dataReader)
        {
            SellFPReport model = new SellFPReport();
            object       ojb;

            model.GoodTypeSmName = dataReader["GoodTypeSmName"].ToString();
            model.PONo           = dataReader["PONo"].ToString();
            model.AE             = dataReader["AE"].ToString();
            model.GuestName      = dataReader["GuestName"].ToString();
            ojb = dataReader["GoodId"];
            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["GoodNum"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.totalNum = (decimal)ojb;
            }

            ojb = dataReader["avgSellPrice"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.avgSellPrice = (decimal)ojb;
            }
            ojb = dataReader["avgLastPrice"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.avgLastPrice = (decimal)ojb;
            }
            ojb = dataReader["POTotal"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.POTotal = (decimal)ojb;
            }
            ojb = dataReader["PODate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.PODate = (DateTime)ojb;
            }
            model.FPTotal = dataReader["FPTotal"].ToString();
            ojb           = dataReader["hadFpTotal"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.hadFpTotal = (decimal)ojb;
            }
            ojb = dataReader["RuTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.RuTime = (DateTime)ojb;
            }
            ojb = dataReader["GoodSellPrice"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.GoodSellPrice = (decimal)ojb;
            }
            ojb = dataReader["diffDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.diffDate = (int)ojb;
            }

            ojb = dataReader["diffDate"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.diffDate = (int)ojb;
            }

            ojb = dataReader["outProNo"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.OutProNo = ojb.ToString();
            }
            ojb = dataReader["POName"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.POName = ojb.ToString();
            }
            ojb = dataReader["IsPoFax"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IsPoFax = Convert.ToBoolean(ojb);
            }
            ojb = dataReader["Id"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Id = Convert.ToInt32(ojb);
            }
            ojb = dataReader["SellInNums"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SellInNums = Convert.ToDecimal(ojb);
            }
            model.GoodAreaNumber = dataReader["GoodAreaNumber"].ToString();

            model.TotalAvgPrice = model.avgLastPrice * model.totalNum;

            return(model);
        }