protected void gvData_RowCommand(object sender, GridViewCommandEventArgs e) { string commandName = e.CommandName; int id = e.CommandArgument.ToArrowInt(); if (e.CommandName == "UpdateData") { GridViewRow drv = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent)); string picName = (gvData.Rows[drv.RowIndex].FindControl("tbName") as TextBox).Text; var model = PicWallBLL.Select(id); if (model != null) { model.Name = picName; PicWallBLL.UpdatePhoto(model); } } else if (e.CommandName == "DelData") { //删除 PicWallBLL.DelPhoto(id); } BindData(); MessageBox.Show("操作成功!"); }
protected void btnSubmit_Click(object sender, EventArgs e) { string name = tbName.Text.Trim(); string cover = tbCoverPath.Text.Trim(); if (name.ValidateIsNullOrEmpty("请输入商品名称!")) { return; } if (cover.ValidateIsNullOrEmpty("请上传照片!")) { return; } var model = new TMS.PicWallInfo(); model.AddTime = DateTime.Now; model.AddUserName = CurrentAdmin.UserName; model.AddUserRealName = CurrentAdmin.RealName; model.BigPicPath = ""; model.CoverPath = cover; model.IsTop = 0; model.Name = name; model.Remarks = ""; model.SortOrder = 0; PicWallBLL.AddPhoto(model); tbName.Text = ""; tbCoverPath.Text = ""; MessageBox.Show("添加成功!"); }
protected string ShowPics(int pageIndex) { List <PicWallInfo> pics = PicWallBLL.SelectList("1=1", "ID Desc", pageIndex, 8); string format = "<li><a title=\"{0}\" class=\"a1\" href =\"{1}\" target =\"_blank\" rel =\"example_group\" ><img width=\"230\" height =\"250\" alt =\"{0}\" src =\"{1}\" ></a><span class=\"s1\" ></span><span class=\"s2\" ><a>{0}</a></span></li>"; string result = ""; foreach (PicWallInfo model in pics) { result += string.Format(format, model.Name, getRawCover(model.CoverPath)); } return(result); }