/// <summary> /// 添加或修改友情链接 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { XYECOM.Model.FriendLinkInfo MyLink = new XYECOM.Model.FriendLinkInfo(); XYECOM.Business.FriendLink fl = new XYECOM.Business.FriendLink(); if (this.rbtext.Checked == true) { MyLink.FL_Type = false; MyLink.FL_Font = this.tblinkfont.Text.Trim(); MyLink.FL_URL = this.tblinkrul.Text.Trim(); MyLink.FL_Alt = this.tblinkalt.Text.Trim(); MyLink.FL_Flag = true; MyLink.FS_ID = int.Parse(this.flsortid.Text.ToString()); if (Request.QueryString["id"] != null) { MyLink.FL_ID = Convert.ToInt16(Request.QueryString["id"]); int a = fl.Update(MyLink); if (a > -1) { // this.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alertmsg(\"修改文字链接成功.\",\"List.aspx\")</script>"); this.Response.Redirect("List.aspx?" + XYECOM.Core.XYRequest.GetQueryString("backURL")); } else { Alert("修改文字链接失败,可以进行重新操作.", "List.aspx"); } } else { int a = fl.Insert(MyLink, out sid); if (a > -1) { //this.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alertmsg(\"添加文字链接成功.\",\"List.aspx\")</script>"); this.Response.Redirect("List.aspx?" + XYECOM.Core.XYRequest.GetQueryString("backURL")); } else { Alert("添加文字链接失败,可以进行重新操作","List.aspx"); } } } else if (this.rbpic.Checked == true) { MyLink.FL_Type = true; MyLink.FL_URL = this.tblinkrul.Text.Trim(); MyLink.FL_Alt = this.tblinkalt.Text.Trim(); MyLink.FL_Flag = true; MyLink.FS_ID = int.Parse(this.flsortid.Text.ToString()); if (this.rbpicurl.Checked == true) { MyLink.FL_Font = this.tbpicaddress.Text.Trim(); int b = 0; if (Request.QueryString["id"] != null) { MyLink.FL_ID = Convert.ToInt16(Request.QueryString["id"].ToString()); b = fl.Update(MyLink); if (b > -1) { // this.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alertmsg(\"图片友情链接修改成功.\",\"List.aspx\")</script>"); this.Response.Redirect("List.aspx?" + XYECOM.Core.XYRequest.GetQueryString("backURL")); } else { Alert("图片友情链接修改失败.","List.aspx"); } } else { b = fl.Insert(MyLink, out sid); if (b > -1) { //this.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alertmsg(\"图片友情链接添加成功.\",\"List.aspx\")</script>"); this.Response.Redirect("List.aspx?" + XYECOM.Core.XYRequest.GetQueryString("backURL")); } else { Alert("图片友情链接添加失败.", "List.aspx"); } } } else if (this.rbpicupload.Checked == true) { MyLink.FL_Font = "Image"; int b = 0; if (Request.QueryString["id"] != null) { MyLink.FL_ID = Convert.ToInt16(Request.QueryString["id"].ToString()); b = fl.Update(MyLink); UploadFile1.InfoID = MyLink.FL_ID; UploadFile1.Update(); if (b > -1) { //this.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alertmsg(\"图片友情链接修改成功.\",\"List.aspx\")</script>"); this.Response.Redirect("List.aspx?" + XYECOM.Core.XYRequest.GetQueryString("backURL")); } else { Alert("图片友情链接修改失败.", "List.aspx"); } } else { b = fl.Insert(MyLink, out sid); UploadFile1.InfoID = sid; UploadFile1.Update(); if (b > -1) { //this.ClientScript.RegisterClientScriptBlock(GetType(), "", "<script>alertmsg(\"图片友情链接添加成功.\",\"List.aspx\")</script>"); this.Response.Redirect("List.aspx?" + XYECOM.Core.XYRequest.GetQueryString("backURL")); } else { Alert("图片友情链接添加失败.", "List.aspx"); } } } } }
/// <summary> /// 单击激发推荐和审核状态的转变 /// </summary> /// <param name="sender">激发事件对象</param> /// <param name="e">响应对象集</param> protected void gvList_RowCommand(object sender, GridViewCommandEventArgs e) { short IRowNow = Convert.ToInt16(e.CommandArgument); short ID = Convert.ToInt16(gvList.DataKeys[IRowNow].Value); XYECOM.Business.FriendLink fl = new XYECOM.Business.FriendLink(); if (e.CommandName == "ChangeFlag") { LinkButton LB = (LinkButton)gvList.Rows[IRowNow].Cells[7].Controls[0]; if (LB.ToolTip == DISPLAY_TOOLTIP) fl.UpdateForFlag(ID, false); else if (LB.ToolTip == UNDISPLAY_TOOLTIP) fl.UpdateForFlag(ID, true); } if (e.CommandName == "SetCommend") { LinkButton LB = (LinkButton)gvList.Rows[IRowNow].Cells[8].Controls[0]; if (LB.ToolTip == COMMEND_TOOLTIP) fl.UpdateIsCommend(ID, false); else if (LB.ToolTip == UNCOMMEND_TOOLTIP) fl.UpdateIsCommend(ID, true); } lblMessage.Text = ""; BindData(); }
private void BindData(int flid) { string strWhere = "where FL_ID=" + flid; XYECOM.Business.FriendLink fl = new XYECOM.Business.FriendLink(); XYECOM.Business.FriendLinkSort fls = new XYECOM.Business.FriendLinkSort(); DataTable dt = fl.GetDataTable(strWhere, ""); if (dt.Rows.Count > 0) { if (Convert.ToBoolean(dt.Rows[0]["FL_Type"]) == false) { this.rbtext.Checked = true; this.tblinkfont.Text = dt.Rows[0]["FL_Font"].ToString(); } else { this.rbpic.Checked = true; if (dt.Rows[0]["Fl_Font"].ToString() != "Image") { this.rbpicurl.Checked = true; this.tbpicaddress.Text = dt.Rows[0]["FL_Font"].ToString(); } else { this.rbpicupload.Checked = true; } } this.tblinkrul.Text = dt.Rows[0]["FL_URL"].ToString(); this.tblinkalt.Text = dt.Rows[0]["FL_Alt"].ToString(); this.flsortid.Text = dt.Rows[0]["FS_ID"].ToString(); } }
/// <summary> /// 单击删除按钮操作 /// </summary> /// <param name="sender">激发事件对象</param> /// <param name="e">响应对象集</param> protected void lnkDel_Click1(object sender, EventArgs e) { string id = ""; XYECOM.Business.FriendLink fl = new XYECOM.Business.FriendLink(); foreach (GridViewRow row in this.gvList.Rows) { if (((CheckBox)(row.FindControl("chkExport"))).Checked == true) id += "," + this.gvList.DataKeys[row.DataItemIndex].Value.ToString(); } if (id.IndexOf(",") == 0) id = id.Substring(1); int rowAffected = fl.Delete(id); if (rowAffected < 0) { Alert("删除失败,可重新操作.", "List.aspx"); } BindData(); }