/// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_save_Click(object sender, EventArgs e)
        {
            if (this.grid_weights.SelectedCells.Count != 0)
            {
                int    r       = this.grid_weights.SelectedCells[0].RowIndex;
                string id      = (string)this.grid_weights.Rows[r].Cells["id"].Value;
                string level   = this.combobox_labels.Text;
                string remarks = this.input_remarks.Text;
                string sql     = "update t_weights set level='" + level + "', remarks='" + remarks + "' where id='" + id + "'";

                if (DbUtil.edit(sql))
                {
                    this.dataSource_weights();
                    MessageBox.Show("操作成功");
                }
                else
                {
                    MessageBox.Show("操作失败");
                }
            }
            else
            {
                MessageBox.Show("请选择一条数据");
            }
        }
Example #2
0
        /// <summary>
        /// 更新级别
        /// </summary>
        private void update_weight_level(string levelStr)
        {
            string id  = (string)this.grid_weights.Rows[this.grid_weights.RowCount - 1].Cells["id"].Value;
            string sql = "update t_weights set level='" + levelStr + "' where id = '" + id + "'";

            if (DbUtil.edit(sql))
            {
                this.grid_weights.Rows[this.grid_weights.RowCount - 1].Cells["level"].Value = levelStr;
                //MessageBox.Show("操作成功");
            }
            else
            {
                //MessageBox.Show("操作失败");
            }
        }
Example #3
0
        private void input_remarks_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                TextBox test = (TextBox)sender;
                string  id   = (string)this.grid_weights.Rows[this.grid_weights.RowCount - 1].Cells["id"].Value;
                string  sql  = "update t_weights set remarks='" + test.Text + "' where id = '" + id + "'";

                if (DbUtil.edit(sql))
                {
                    this.grid_weights.Rows[this.grid_weights.RowCount - 1].Cells["remarks"].Value = test.Text;
                    //MessageBox.Show("操作成功");
                }
                else
                {
                    //MessageBox.Show("操作失败");
                }
            }
        }
        private void button_del_Click(object sender, EventArgs e)
        {
            if (this.grid_weights.SelectedCells.Count != 0)
            {
                int    r  = this.grid_weights.SelectedCells[0].RowIndex;
                string id = (string)this.grid_weights.Rows[r].Cells["id"].Value;

                string sql = "update t_weights set life_cycle=-1 where id='" + id + "'";

                if (DbUtil.edit(sql))
                {
                    this.dataSource_weights();
                    MessageBox.Show("操作成功");
                }
                else
                {
                    MessageBox.Show("操作失败");
                }
            }
            else
            {
                MessageBox.Show("请选择一条数据");
            }
        }