/// <summary> /// 确认订单填写送货信息 /// </summary> /// <returns></returns> public ActionResult ShopCartOrder() { ViewBag.Title = "确认订单填写收货信息-书生网"; string mid = Request.QueryString["mid"]; dataWork dwgwc = new dataWork(); DataTable dtgwc = dwgwc.GetTab(string.Format("select ProductBase.p_ID as p_id,ShoppingCartBase.m_ID as m_id,ProductImgBase.pi_Url as pi_url,ProductBase.p_Name as p_name,SKUBase.sku_Price as sku_price,ShoppingCartBase.sc_pCount as sc_pcount,ShoppingCartBase.sc_ID as sc_id from ShoppingCartBase,SKUBase,ProductBase,ProductImgBase where ProductImgBase.sku_ID=SKUBase.sku_ID and ShoppingCartBase.sku_ID=SKUBase.sku_ID AND SKUBase.p_ID=ProductBase.p_ID and sc_IsDel=0 and sc_Status=0 and sc_IsGP=0 and ProductImgBase.pi_isDel=0 and ProductImgBase.pi_StatusCode=0 and ProductImgBase.pi_Type=1 and ShoppingCartBase.m_ID={0}", mid)); ViewData["shoplistnum"] = dtgwc.Rows.Count; decimal totalprice = 0;//总价 if (dtgwc != null && dtgwc.Rows.Count > 0) { for (int i = 0; i < dtgwc.Rows.Count; i++) { totalprice += Convert.ToInt32(dtgwc.Rows[i]["sc_pcount"]) * Convert.ToDecimal(dtgwc.Rows[i]["sku_price"]); } } ViewData["shoplistprice"] = totalprice; if (dtgwc.Rows.Count > 0) { ViewData["shopCartList"] = dtgwc; return View(); } else { return View("ShopCartNull"); } }
/// <summary> /// /// </summary> /// <returns></returns> public DataTable GetBianMa() { dataWork dw = new dataWork(); StringBuilder str = new StringBuilder(); str.Append(" select top 1* from BuildingEquipmentBase "); str.Append(" where be_DeleteStateCode=0 and b_ID>87 order by b_ID asc "); string sql = string.Format(str.ToString()); DataTable dt = dw.GetDS(sql.ToString()).Tables[0]; return dt; }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.WebNews DataRowToModel(DataRow row) { string flag = ""; Model.WebNews model = new Model.WebNews(); if (row != null) { if (row["id"] != null && row["id"].ToString() != "") { model.id = int.Parse(row["id"].ToString()); } if (row["title"] != null) { model.title = row["title"].ToString(); } if (row["fromName"] != null) { model.fromName = row["fromName"].ToString(); } if (row["fromPath"] != null) { model.fromPath = row["fromPath"].ToString(); } if (row["author"] != null) { model.author = row["author"].ToString(); } if (row["type"] != null) { model.type = row["type"].ToString(); } if (row["typeId"] != null && row["typeId"].ToString() != "") { model.typeId = int.Parse(row["typeId"].ToString()); } if (row["seque"] != null && row["seque"].ToString() != "") { model.seque = int.Parse(row["seque"].ToString()); } if (row["userId"] != null && row["userId"].ToString() != "") { model.userId = int.Parse(row["userId"].ToString()); } if (row["roleId"] != null && row["roleId"].ToString() != "") { model.roleId = int.Parse(row["roleId"].ToString()); } if (row["limits"] != null) { model.limits = row["limits"].ToString(); } if (row["setHome"] != null) { model.setHome = row["setHome"].ToString(); } if (row["defined"] != null) { model.defined = row["defined"].ToString(); } if (row["putDate"] != null && row["putDate"].ToString() != "") { model.putDate = DateTime.Parse(row["putDate"].ToString()); } if (row["editDate"] != null && row["editDate"].ToString() != "") { model.editDate = DateTime.Parse(row["editDate"].ToString()); } if (row["verifyDate"] != null && row["verifyDate"].ToString() != "") { model.verifyDate = DateTime.Parse(row["verifyDate"].ToString()); } if (row["deadline"] != null && row["deadline"].ToString() != "") { model.deadline = int.Parse(row["deadline"].ToString()); } if (row["contents"] != null) { model.contents = row["contents"].ToString(); } if (row["details"] != null) { model.details = row["details"].ToString(); } if (row["style"] != null) { model.style = row["style"].ToString(); } if (row["contants"] != null) { model.contants = row["contants"].ToString(); } if (row["visit"] != null && row["visit"].ToString() != "") { model.visit = int.Parse(row["visit"].ToString()); } if (row["videoHtml"] != null) { model.videoHtml = row["videoHtml"].ToString(); } if (row["videoType"] != null) { model.videoType = row["videoType"].ToString(); } if (row["videoId"] != null && row["videoId"].ToString() != "") { model.videoId = int.Parse(row["videoId"].ToString()); } if (row["videoPath"] != null) { model.videoPath = row["videoPath"].ToString(); } if (row["imageUrl"] != null) { model.imageUrl = row["imageUrl"].ToString(); } if (row["deteState"] != null && row["deteState"].ToString() != "") { model.deteState = int.Parse(row["deteState"].ToString()); } if (row["IsTop"] != null && row["IsTop"].ToString() != "") { if ((row["IsTop"].ToString() == "1") || (row["IsTop"].ToString().ToLower() == "true")) { model.IsTop = true; } else { model.IsTop = false; } } if (row["browsecount"] != null && row["browsecount"].ToString() != "") { model.browsecount = int.Parse(row["browsecount"].ToString()); } } try { dataWork dw = new dataWork(); Hashtable ht = new Hashtable(); ht.Add("browsecount", model.browsecount + 1); dw.ExecUpdate(ht, "WebNews", "id=" + model.id); } catch (Exception) { throw; } return model; }
/// <summary> /// 根据部门ID获取部门名称 /// </summary> /// <param name="e_ID"></param> /// <returns></returns> public string GetE_NameCh(Guid e_ID) { string value = ""; dataWork dw = new dataWork(); string sql = "select top 1 d_MingCh from DepartmentBase where d_ID='" + e_ID + "' and d_DeleteStateCode=0 "; DataTable dt = dw.GetDS(sql.ToString()).Tables[0]; if (dt.Rows.Count > 0) { value = dt.Rows[0]["d_MingCh"].ToString(); } return value; }
/// <summary> /// 详细商品页 /// </summary> /// <returns></returns> public ActionResult CommodityDetails() { cuixiao(); string pid=Request.QueryString["p_id"]==null?"0":Request.QueryString["p_id"].ToString(); ViewData["p_id"] = pid; dataWork dw = new dataWork();//相似产品 DataTable dtxssp = dw.GetTab(string.Format("select top(5) pi_Url,skubase.p_ID,p_Name from ProductImgBase,SKUBase,ProductBase where ProductBase.p_IsDel=0 and ProductBase.p_StatusCode=0 and ProductBase.p_ID=SKUBase.p_ID and ProductImgBase.sku_ID=SKUBase.sku_ID and pi_type=1 and pi_StatusCode=0 and pi_isDel=0 and ProductImgBase.sku_ID in(select sku_ID from SKUBase where sku_IsDel=0 and sku_StatusCode=0 and p_ID in(select p_ID from ProductBase where p_isdel=0 and pt_id in(select pt_id from ProductTypeBase where pt_parentid in(select pt_parentid from ProductTypeBase where pt_id=( select pt_id from productbase where p_ID={0}))))) ", pid)); ViewData["相似商品"] = dtxssp; if(pid=="0") { return View("~/ErrorPage/Error404"); }else { ListModel model = new ListModel(); List<Model.SKUBase> list = new BLL.SKUBase().GetModelList(" p_id=" + pid + " and sku_StatusCode=0 and sku_IsDel=0"); //model.productinfo = new BLL.ProductInfoBase().GetModelList(" and pin_StatusCode=0 and pin_IsDel=0 and p_ID= "+pid); model.vmpinfolist = new BLL.vw_PInfo().GetModelList(" p_IsDel=0 and p_StatusCode=0 and p_SellStatus=1 and sku_ID= " + list[0].sku_ID);//商品信息 if (model.vmpinfolist.Count > 0) { ViewBag.Title=model.vmpinfolist[0].p_Name+"-书生网"; } else { ViewBag.Title = "商品详细信息-书生网"; } ViewData["ifcmys"]="0";//尺码颜色0:不显示1:显示 if (model.vmpinfolist.Count > 0) { if (model.vmpinfolist[0].pt_ParentId == 488 || model.vmpinfolist[0].pt_ParentId == 489) //男鞋或女鞋的话显示尺码颜色 { ViewData["ifcmys"] = "1"; } else { ViewData["ifcmys"] = "0"; } } else { ViewData["ifcmys"] = "0"; } model.pimglist = new BLL.ProductImgBase().GetModelList(" sku_ID=" + list[0].sku_ID);//图片列表 model.productinfotuijian = new BLL.ProductInfoBase().GetModelList(" p_ID=(select p_ID from SKUBase where sku_ID=" + list[0].sku_ID + ") and pin_StatusCode=0 and pin_IsDel=0 and pin_Type='推荐理由'");//推荐理由 model.productinfo = new BLL.ProductInfoBase().GetModelList(" p_ID=(select p_ID from SKUBase where sku_ID=" + list[0].sku_ID + ") and pin_StatusCode=0 and pin_IsDel=0 and pin_Type='商品介绍'");//商品介绍 model.proattr = new BLL.ProductAttributesBase().GetModelListByskuId("pa2.pa_Type=1 and pad.sku_ID= " + list[0].sku_ID);//属性 model.proattr2 = new BLL.ProductAttributesBase().GetModelListByPid(" and pa.pa_Type=2 and pa.pa_ID in(select pa_ID from ProductAttributeDetails where sku_ID in (select sku_ID from SKUBase where p_ID=(select p_ID from SKUBase where sku_ID=" + list[0].sku_ID + "))) and sku.sku_ID in (select sku_ID from SKUBase where p_ID=(select p_ID from SKUBase where sku_ID=" + list[0].sku_ID + "))");//规格 model.proattr3 = new BLL.ProductAttributesBase().GetModelListByPid(" and pa.pa_Type=3 and pa.pa_ID in(select pa_ID from ProductAttributeDetails where sku_ID in (select sku_ID from SKUBase where p_ID=(select p_ID from SKUBase where sku_ID=" + list[0].sku_ID + "))) and sku.sku_ID in (select sku_ID from SKUBase where p_ID=(select p_ID from SKUBase where sku_ID=" + list[0].sku_ID + "))");//颜色 List<SelectListItem> pchima = new List<SelectListItem>();//商品尺码 pchima = new List<SelectListItem> {new SelectListItem{Text="请选择",Value="0"} }; for (int i = 0; i < model.proattr2.Count; i++) { pchima.Add(new SelectListItem { Text = model.proattr2[i].pa_Name.ToString(), Value = model.proattr2[i].pa_ID.ToString() }); } ViewData["pchima"] = new SelectList(pchima,"Value","Text","请选择"); List<SelectListItem> pyanse = new List<SelectListItem>();//商品颜色 pyanse = new List<SelectListItem> { new SelectListItem { Text = "请选择", Value = "0" } }; for (int i = 0; i < model.proattr3.Count; i++) { pyanse.Add(new SelectListItem { Text = model.proattr3[i].pa_Name.ToString(), Value = model.proattr3[i].pa_ID.ToString() }); } ViewData["pyanse"] = new SelectList(pyanse, "Value", "Text", "请选择"); return View(model); } }