Beispiel #1
0
    protected void lnkDel_Click(object sender, EventArgs e)
    {
        XYECOM.Business.Show cp = new XYECOM.Business.Show();
        string ids = "";
        foreach (GridViewRow row in this.gvlist.Rows)
        {
            if (((CheckBox)(row.FindControl("chkExport"))).Checked == true)
            {
                if (ids.Equals(""))
                {
                    ids += this.gvlist.DataKeys[row.DataItemIndex].Value.ToString();
                }
                else
                {
                    ids += "," + this.gvlist.DataKeys[row.DataItemIndex].Value.ToString();
                }
            }
        }
        //if (ids.IndexOf(",") == 0)
        //    ids.Substring(1);

        int rowAffected = cp.Delete(ids);
        if (rowAffected < 0)
        {
            Alert("删除失败,可重新操作.");
        }
        BindData();
    }
Beispiel #2
0
    protected void gvlist_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        XYECOM.Business.Show cp = new XYECOM.Business.Show();
        int row = Convert.ToInt32(e.CommandArgument); //获取行号
        Int64 CIID = Convert.ToInt64(gvlist.DataKeys[row].Value); //获取展会信息的编号

        string title = "";
        if (gvlist.DataKeys[Convert.ToInt32(e.CommandArgument)]["Infotitle"].ToString() != "")
        {
            title = gvlist.DataKeys[Convert.ToInt32(e.CommandArgument)]["Infotitle"].ToString();
        }
        if (e.CommandName == "SetCommend")
        {
            int rowAffter = 0;
            LinkButton LB = (LinkButton)gvlist.Rows[row].Cells[4].Controls[0];
            if (LB.Text == "推荐")
                rowAffter = cp.SetIsCommend(CIID, false);
            else if (LB.Text == "不推荐")
                rowAffter = cp.SetIsCommend(CIID, true);

            if (rowAffter < 0)
            {
                Alert("抱歉,第" + row + "行的推荐状态更改失败,可重新操作.");
            }
        }
        BindData();
    }