protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { MojoCube.Web.Album.Image image = new MojoCube.Web.Album.Image(); int index = Convert.ToInt32(e.CommandArgument); //保存 if (e.CommandName == "_save") { image.GetData(int.Parse(((Label)GridView1.Rows[index].FindControl("lblID")).Text)); image.Title = ((TextBox)GridView1.Rows[index].FindControl("txtTitleGV")).Text; image.Visible = ((CheckBox)GridView1.Rows[index].FindControl("cbVisible")).Checked; image.UpdateData(image.pk_Image); } //删除 if (e.CommandName == "_delete") { image.DeleteData(int.Parse(((Label)GridView1.Rows[index].FindControl("lblID")).Text)); } //上移 if (e.CommandName == "_up") { MojoCube.Web.Sql.SetSortID("Album_Image", "pk_Image", ((Label)GridView1.Rows[index].FindControl("lblID")).Text, -1); } //下移 if (e.CommandName == "_down") { MojoCube.Web.Sql.SetSortID("Album_Image", "pk_Image", ((Label)GridView1.Rows[index].FindControl("lblID")).Text, 1); } ImageBind(); AlertDiv.InnerHtml = MojoCube.Web.String.ShowAlert("success", "数据保存成功"); }
protected void btnUpload_Click(object sender, EventArgs e) { MojoCube.Api.File.Upload upload = new MojoCube.Api.File.Upload(); upload.FilePath = "Album/" + txtPageName.Text.Trim(); upload.FileName = MojoCube.Api.Text.Function.DateTimeString(true); upload.DoFileUpload(fuImageUpload); if (upload.IsUpload) { MojoCube.Web.Album.Image image = new MojoCube.Web.Album.Image(); image.fk_Album = int.Parse(ViewState["pk_Album"].ToString()); image.FileName = upload.OldFileName; image.FilePath = upload.OldFilePath; image.FileType = upload.FileType; image.FileSize = upload.FileSize; image.Width = 0; image.Height = 0; if (upload.IsImage()) { System.Drawing.Image draw = System.Drawing.Image.FromStream(fuImageUpload.PostedFile.InputStream); image.Width = draw.Width; image.Height = draw.Height; } image.Title = txtImageTitle.Text.Trim(); image.SortID = MojoCube.Web.String.ToInt(txtImageSort.Text.Trim()); image.Visible = true; image.CreateDate = DateTime.Now.ToString(); image.CreateUserID = int.Parse(Session["UserID"].ToString()); image.ModifyDate = DateTime.Now.ToString(); image.ModifyUserID = 0; image.Language = MojoCube.Api.UI.Language.GetLanguage(); image.InsertData(); ImageBind(); AlertDiv.InnerHtml = MojoCube.Web.String.ShowAlert("success", "数据保存成功"); } }