public void MyBind() { M_UserInfo mu = buser.GetLogin(); DataTable dt = stepBll.SelByUid(mu.UserID); ProList_RPT.DataSource = dt; ProList_RPT.DataBind(); DataTable parDt = stepBll.SelByParUser(mu.UserID); Par_RPT.DataSource = parDt; Par_RPT.DataBind(); }
private void MyBind() { int guestnum = 0, totalnum = 0; if (!string.IsNullOrEmpty(ids)) { M_Cart cartMod = cartBll.SelReturnModel(DataConvert.CLng(ids.Split(',')[0])); M_Cart_Hotel hotelMod = JsonConvert.DeserializeObject <M_Cart_Hotel>(cartMod.Additional); Pros = JsonConvert.SerializeObject(hotelMod.ProList); Guest_Hid2.Value = JsonConvert.SerializeObject(hotelMod.Guest); Contract_Hid2.Value = JsonConvert.SerializeObject(hotelMod.Contract); guestnum = hotelMod.Guest.Count; } //绑定显示商品 if (!string.IsNullOrEmpty(Pros)) { JArray proArr = (JArray)JsonConvert.DeserializeObject(Pros);//将其转化为DataTable? DataTable proDT = CreateProDT(); double proAllMoney = 0; for (int i = 0; i < proArr.Count; i++) { M_Product proMod = proBll.GetproductByid(Convert.ToInt32(proArr[i]["ProID"].ToString())); if (proMod.ID > 0) { for (int j = 0; j < DataConvert.CLng(proArr[i]["Pronum"].ToString()); j++) { DataRow proDR = proDT.NewRow(); proDR["ProID"] = proMod.ID; proDR["ProName"] = proMod.Proname; proDR["Pronum"] = GetDiffDay(DataConvert.CDate(proArr[i]["GoDate"].ToString()), DataConvert.CDate(proArr[i]["OutDate"].ToString())); proDR["Price"] = proMod.LinPrice; proDR["AllMoney"] = GetDiffDay(DataConvert.CDate(proArr[i]["GoDate"].ToString()), DataConvert.CDate(proArr[i]["OutDate"].ToString())) * Convert.ToDouble(proDR["Price"]); proDR["GoDate"] = DataConvert.CDate(proArr[i]["GoDate"]); proDR["OutDate"] = proArr[i]["OutDate"].ToString(); proDR["Remind"] = HttpUtility.UrlDecode(proArr[i]["Remind"].ToString()); proDT.Rows.Add(proDR); proAllMoney += Convert.ToDouble(proDR["AllMoney"]); totalnum += 2; } } } AllMoney_sp.InnerText = proAllMoney.ToString("0.00"); ProList_RPT.DataSource = proDT; ProList_RPT.DataBind(); Pros = JsonHelper.JsonSerialDataTable(proDT); function.Script(this, "AddGuests(" + (string.IsNullOrEmpty(ids) ? totalnum : guestnum) + ");"); } }
private void MyBind() { int guestnum = 0, totalnum = 0; if (!string.IsNullOrEmpty(ids)) { M_Cart cartMod = cartBll.SelReturnModel(DataConvert.CLng(ids.Split(',')[0])); M_Cart_Travel traveMod = JsonConvert.DeserializeObject <M_Cart_Travel>(cartMod.Additional); Pros = JsonConvert.SerializeObject(traveMod.ProList); Guest_Hid2.Value = JsonConvert.SerializeObject(traveMod.Guest); Contract_Hid2.Value = JsonConvert.SerializeObject(traveMod.Contract); guestnum = traveMod.Guest.Count; } //绑定显示商品 if (!string.IsNullOrEmpty(Pros)) { JArray proArr = (JArray)JsonConvert.DeserializeObject(Pros); DataTable proDT = CreateProDT();//仅用于展示,不参与逻辑 double proAllMoney = 0; for (int i = 0; i < proArr.Count; i++) { DataRow proDR = proDT.NewRow(); M_Product proMod = proBll.GetproductByid(Convert.ToInt32(proArr[i]["ProID"].ToString())); switch ((M_Product.ClassType)proMod.ProClass) { case M_Product.ClassType.LY: case M_Product.ClassType.JD: break; default: function.WriteErrMsg("[" + proMod.Proname + "]商品类型不正确"); break; } if (proMod.ID > 0) { proDR["ID"] = proMod.ID; proDR["ProName"] = proMod.Proname; proDR["Pronum"] = proArr[i]["Pronum"].ToString(); //----如果传递了编号,则读取多价格信息 double price = proMod.LinPrice; DataRow priceDR = proBll.GetPriceByCode(proArr[i]["code"], proMod.Wholesalesinfo, ref price); proDR["Price"] = price; if (priceDR != null) { proDR["ProName"] += "(" + priceDR["Proname"] + ")"; } //---- proDR["AllMoney"] = Convert.ToInt32(proDR["Pronum"]) * Convert.ToDouble(proDR["Price"]); proDR["GoDate"] = DataConvert.CDate(proArr[i]["GoDate"]); proDR["Remind"] = HttpUtility.UrlDecode(proArr[i]["Remind"].ToString()); proDT.Rows.Add(proDR); proAllMoney += Convert.ToDouble(proDR["AllMoney"]); totalnum += Convert.ToInt32(proDR["Pronum"]); } } AllMoney_sp.InnerText = proAllMoney.ToString("0.00"); ProList_RPT.DataSource = proDT; ProList_RPT.DataBind(); function.Script(this, "AddGuests(" + (string.IsNullOrEmpty(ids) ? totalnum : guestnum) + ");"); } }