/// <summary> /// 移动端列表图片 /// </summary> /// <param name="productId"></param> /// <returns></returns> protected string GetMobileImg(object productId) { ProductImgMobile item = ProductImgMobileService.GetModelByProductId(Convert.ToInt32(productId)); if (item != null) { return(item.imgUrl); } return(""); }
/// <summary> /// 加载信息 /// </summary> private void LoadData() { DataSet ds = ProductImgMobileService.GetList("productId = " + productId); if (ds.Tables[0].Rows.Count > 0) { this.repInfo.DataSource = ds; repInfo.DataBind(); } else { this.repInfo.DataSource = null; repInfo.DataBind(); } }
/// <summary> /// 控件行命令事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void repInfo_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName.Equals("del")) { int id = Convert.ToInt32(e.CommandArgument); ProductImgMobile item = ProductImgMobileService.GetModel(id); if (item != null) { if (System.IO.File.Exists(Server.MapPath(item.imgUrl))) { System.IO.File.Delete(Server.MapPath(item.imgUrl)); } } ProductImgMobileService.Delete(id); LoadData(); } if (e.CommandName.Equals("mod")) { int id = Convert.ToInt32(e.CommandArgument); ProductImgMobile item = ProductImgMobileService.GetModel(id); if (item != null) { ddlType.SelectedValue = item.infoType.ToString(); txtLinkUrl.Text = item.typeName; content1.Value = item.remark; lblURL1.Text = item.imgUrl; if (item.status == 1) { cboYes.Checked = true; } else { cboYes.Checked = false; } lblId.Text = item.id.ToString(); this.pnlAdd.Visible = true; pnlList.Visible = false; } } }
/// <summary> /// 绑定数据 /// </summary> private void BindData() { Product pt = ProductService.GetModel(typeId); if (pt != null) { ProductImgMobile item = ProductImgMobileService.GetMobileBanner(pt.id); if (item != null) { ViewState["typeImg"] = item.imgUrl; } ViewState["typeName"] = pt.proName; } StringBuilder sb = new StringBuilder(); sb.Append("1=1"); if (typeId != 0) { sb.Append(" and infoType = " + typeId); } sb.Append(" order by releaseTime desc"); }
/// <summary> /// 添加友情连接 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { string url = this.txtLinkUrl.Text.Trim(); string spic = ""; if (this.FileUpload1.PostedFile != null && FileUpload1.PostedFile.FileName != "") { if (!Directory.Exists(Server.MapPath(Global_Upload.FriendImgPath))) //判断目录是否存在 { Directory.CreateDirectory(Server.MapPath(Global_Upload.FriendImgPath)); //创建目录 } spic = DoClass.UploadFile(FileUpload1.PostedFile, Global_Upload.Imgsize, Global_Upload.ImgType, Global_Upload.FriendImgPath); if (spic == "-1") { return; } else if (spic == "0") { return; } else { ViewState["img1Name"] = spic; spic = Global_Upload.FriendImgPath + spic; ViewState["newsImg1"] = spic; lblURL1.Text = spic; } } ProductImgMobile item = new ProductImgMobile(); item.typeId = Convert.ToInt32(ddlType.SelectedValue); item.typeName = txtLinkUrl.Text.Trim(); if (item.typeId == 1) { item.typeName = "移动端Banner"; } if (item.typeId == 2) { item.typeName = "移动端证书"; } if (item.typeId == 3) { item.typeName = "成长阶段"; } if (item.typeId == 4) { item.typeName = "移动端产品展示图"; } item.productId = productId; item.orderNum = 0; item.imgUrl = lblURL1.Text; item.status = 0; if (cboYes.Checked) { item.status = 1; } item.remark = content1.Value; item.addTime = DateTime.Now; item.addUser = 0; AdminUser au = Session["loginUser"] as AdminUser; if (au != null) { item.addUser = au.id; } item.infoType = Convert.ToInt32(ddlType.SelectedValue); if (lblId.Text != "") { item.id = Convert.ToInt32(lblId.Text.Trim()); ProductImgMobileService.Update(item); } else { int num = ProductImgMobileService.Add(item); } pnlAdd.Visible = false; pnlList.Visible = true; LoadData(); }
/// <summary> /// 绑定信息 /// </summary> private void BindData() { Product item = ProductService.GetModel(id); if (item != null) { this.hidStoreCount.Value = item.proType.ToString(); ViewState["proName"] = item.proName; ViewState["proDesc"] = item.proDesc; if (item.detailImg1 != "") { ViewState["imgInfo"] = "<div class=\"guige\" style=\"text-align:center;\"> <img src='" + item.detailImg1 + "'></div>"; } ViewState["productInfo"] = item.proContent; ViewState["specialInfo"] = item.advantage; ViewState["unitInfo"] = item.unit1; ViewState["price1"] = item.price1.ToString("0.00"); if (item.proDesc != "") { ViewState["goodInfo"] = "<div class=\"guige\">" + item.proDesc + ":" + item.stopTypeName + "</div>"; } ViewState["productContent"] = item.ImgDesc; UserInfo user = UserInfoService.GetModel(item.useId); if (user != null) { ViewState["shoperId"] = user.id; ViewState["shoperName"] = user.comName; } //相关产品 DataSet ds = ProductService.GetList(16, "productType = " + item.productType, "id"); if (ds.Tables[0].Rows.Count > 0) { //repXG.DataSource = ds; //repXG.DataBind(); } //推荐购买 ProductType pt = ProductTypeService.GetModel(item.productType); if (pt != null) { ds = ProductService.GetList(10, "productType in(select id from ProductType where parentId = " + pt.parentId + ") and id <> " + id, "id"); if (ds.Tables[0].Rows.Count > 0) { repTj.DataSource = ds; repTj.DataBind(); } } else { ds = ProductService.GetList(10, "productType = " + item.productType + " and id <> " + id, "id"); if (ds.Tables[0].Rows.Count > 0) { repTj.DataSource = ds; repTj.DataBind(); } } ///bannner ds = ProductImgMobileService.GetList("productId = " + item.id + " and infoType = 1"); if (ds.Tables[0].Rows.Count > 0) { repBanner.DataSource = ds; repBanner.DataBind(); } } }