示例#1
0
        private void btnSearchMsg_Click(object sender, EventArgs e)
        {
            string sql = "SELECT m.ID,m.SendTime,m.MsgContent,m.MsgLevel,m.SendPeople,s.Name as RevStation,m.MsgState" +
                            " FROM [Message] m INNER JOIN [dbo.Station] s ON m.RevStation = s.StationID WHERE ";

            sql += "m.SendTime>='" + dtpStartTime.Value.ToString("yyyy-MM-dd") + "' and " +
                            "m.SendTime<'" + dtpEndTime.Value.AddDays(1).ToString("yyyy-MM-dd") + "' ";

            if (txtMsgWhere.Text.Length > 0)
                sql += "and m.MsgContent LIKE '%" + txtMsgWhere.Text + "%'";

            BaseOperate operate = new BaseOperate();
            DataSet ds = operate.getds(sql, "[Message]");
            if (ds == null || ds.Tables.Count <= 0)
                return;
            this.dgvMsgList.DataSource = ds.Tables[0];
        }
示例#2
0
        private void 删除ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string sql = "DELETE FROM [Message] WHERE [Message].[ID]=" + dgvMsgList.SelectedRows[0].Cells["ID"].Value.ToString();
            BaseOperate operate = new BaseOperate();
            operate.getcom(sql);

            btnSearchMsg_Click(null, null);
        }
示例#3
0
        private void btnSaveMsg_Click(object sender, EventArgs e)
        {
            string stationID = GetRowByValue(stations,"Name",cbRevStation.SelectedItem)["StationID"].ToString();
            int lv = 0;
            if (rbLv0c.Checked)
                lv = 1;
            if (rbLv1c.Checked)
                lv = 2;
            string sql = "UPDATE [Message] SET SendTime='"+DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")+"',MsgContent='"+
                                txtMsgContent1.Text+"',MsgLevel="+
                                lv+",SendPeople='"+
                                UNtextBox .Text+ "',RevStation="+
                                stationID+",MsgState=0 WHERE ID="+txtMsgContent1.Tag.ToString();

            BaseOperate operate = new BaseOperate();
            operate.getcom(sql);
            btnSearchMsg_Click(null,null);
        }