private void grdGroupBuyList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { FormatedMoneyLabel label = (FormatedMoneyLabel)e.Row.FindControl("lblCurrentPrice"); int groupBuyId = Convert.ToInt32(this.grdGroupBuyList.DataKeys[e.Row.RowIndex].Value.ToString()); int prodcutQuantity = int.Parse(DataBinder.Eval(e.Row.DataItem, "ProdcutQuantity").ToString()); label.Money = PromoteHelper.GetCurrentPrice(groupBuyId, prodcutQuantity); } }
private DataGridViewModel <Dictionary <string, object> > GetDataList(GroupBuyQuery query) { DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >(); if (query != null) { DbQueryResult groupBuyList = PromoteHelper.GetGroupBuyList(query); dataGridViewModel.rows = DataHelper.DataTableToDictionary(groupBuyList.Data); dataGridViewModel.total = groupBuyList.TotalRecords; foreach (Dictionary <string, object> row in dataGridViewModel.rows) { GroupBuyInfo groupBuyInfo = row.ToObject <GroupBuyInfo>(); decimal currentPrice = PromoteHelper.GetCurrentPrice(groupBuyInfo.GroupBuyId); row.Add("CurrentPrice", currentPrice); row.Add("StatusText", groupBuyInfo.StatusText); row.Add("CanDelete", (groupBuyInfo.Status != GroupBuyStatus.UnderWay || !(groupBuyInfo.StartDate <= DateTime.Now) || !(groupBuyInfo.EndDate >= DateTime.Now)) && groupBuyInfo.Status != GroupBuyStatus.EndUntreated); } } return(dataGridViewModel); }