Ejemplo n.º 1
0
    protected void Button1_Command(object sender, CommandEventArgs e)
    {
        int MeetingID = Convert.ToInt32(e.CommandArgument);

        string[] name;
        string   title;

        SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);

        conn.Open();
        string        sqlstr = "select * from MyMeeting where MeetingID=" + MeetingID.ToString();
        SqlCommand    comm   = new SqlCommand(sqlstr, conn);
        SqlDataReader dr     = comm.ExecuteReader();

        if (dr.Read())
        {
            name  = dr["personnel"].ToString().Trim(';').Split(';');
            title = dr["title"].ToString();
        }
        else
        {
            Response.Write("<script>alert('删除失败!')</script>");
            return;
        }
        conn.Close();
        SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);

        con.Open();
        string     sql = "delete from MyMeeting where MeetingID=" + MeetingID;
        SqlCommand com = new SqlCommand(sql, con);

        com.ExecuteReader();
        con.Close();



        SqlConnection connn = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);

        connn.Open();
        foreach (string item in name)
        {
            string     sql1  = "delete from Meeting where personnel='" + item + "' and addtime= '" + e.CommandName + "'";
            SqlCommand commm = new SqlCommand(sql1, connn);
            commm.ExecuteNonQuery();
        }
        connn.Close();
        Bind();
        log si = new log();

        si.InsertWorkLog(Session["UserName"].ToString(), DateTime.Now.ToString(), "删除了主题为:" + title + "的会议");
        Response.Write("<script>alert('删除成功!')</script>");
    }
Ejemplo n.º 2
0
    protected void Button1_Command(object sender, CommandEventArgs e)
    {
        log           si     = new log();
        int           NewsID = Convert.ToInt32(e.CommandArgument);
        SqlConnection con    = new SqlConnection(ConfigurationManager.AppSettings["Connection"]);

        con.Open();
        string     sql = "Delete from News where NewsID=" + NewsID + "";
        SqlCommand com = new SqlCommand(sql, con);

        if (com.ExecuteNonQuery() > 0)
        {
            Response.Write("<script>alert('删除成功!')</script>");
            si.InsertWorkLog(Session["UserName"].ToString(), DateTime.Now.ToString(), "删除了标题为:" + e.CommandName + "的新闻");
        }


        Bind();
        con.Close();
    }
Ejemplo n.º 3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            log    si      = new log();
            string title   = this.titel.Text;
            string content = this.content.Text;
            int    type    = Convert.ToInt32(this.DropDownList1.SelectedItem.Value);
            int    remark  = 1;
            string sql     = "select Employeeid from Employee where username='******'";
            int    userid  = Convert.ToInt32(OperateDB.getExecuteScalar(sql));

            string strSql = "insert into News values(" + type + ",'" + title + "','" + content + "'," + remark + "," + userid + ",default)";

            if (OperateDB.ExecuteNonQuery(strSql) > 0)
            {
                si.InsertWorkLog(Session["UserName"].ToString(), DateTime.Now.ToString(), "添加了标题为:" + title + "的新闻");
                Response.Write("<script>alert('发布成功!');</script>");
                this.titel.Text   = "";
                this.content.Text = "";
            }
            else
            {
                Response.Write("<script>alert('发布失败!');</script>");
            }
        }