Ejemplo n.º 1
0
 private void  除吊挂设备ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.gridView3.RowCount > 0)
         {
             if (this.gridView3.GetSelectedRows()[0] < 0)
             {
                 MessageBox.Show("没有选中信息,请选择!", "提示", MessageBoxButtons.OK);
                 return;
             }
             else
             {
                 if (MessageBox.Show("确认吊挂设备信息", "确认信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK)
                 {
                     HoistingEquipmentInfoDao dao = new HoistingEquipmentInfoDao();
                     string LATHE_ID = this.gridView3.GetRowCellValue(this.gridView3.FocusedRowHandle, this.gridView3.Columns[0]).ToString();
                     if (dao.delete(LATHE_ID))
                     {
                         FreshForm();
                     }
                 }
             }
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("删除失败,这条数据被其他数据所引用,请先删除使用了该数据的子信息!\n\n详细信息:\n" + ex.Message, "提示信息");
         return;
     }
 }
Ejemplo n.º 2
0
        //添加吊挂设备
        private void simpleButton5_Click(object sender, EventArgs e)
        {
            HoistingEquipmentInfoDao dao = new HoistingEquipmentInfoDao();
            string name = textEdit3.Text.Trim();

            //控制参数格式
            if (name == "")
            {
                MessageBox.Show("信息不能为空!");
                return;
            }
            string sql1 = "select * from HOISTINGEQUIPMENT_INFO where EQUIMENT_NAME = '" + name + "'";

            if (common.SqlHelper.ExcuteSql(sql1) > 0)
            {
                MessageBox.Show("该吊挂设备已经被添加过了!", "信息提示", MessageBoxButtons.OK);
                return;
            }
            dao.Save(this.textEdit3.Text.Trim());
            FreshForm();
        }
Ejemplo n.º 3
0
        //保存吊挂设备信息
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            HoistingEquipmentInfoDao dao = new HoistingEquipmentInfoDao();
            string name = EQUIMENT_NAME.Text.Trim();

            //控制参数格式
            if (name == "")
            {
                MessageBox.Show("信息不能为空!");
                return;
            }
            switch (strOperationFlag)
            {
            case "add":
                string sql1 = "select * from HOISTINGEQUIPMENT_INFO where EQUIMENT_NAME = '" + name + "'";
                if (common.SqlHelper.ExcuteSql(sql1) > 0)
                {
                    MessageBox.Show("该吊挂设备已经被添加过了!", "信息提示", MessageBoxButtons.OK);
                    return;
                }
                dao.Save(this.EQUIMENT_NAME.Text.Trim());
                this.DialogResult = DialogResult.OK;
                this.Close();
                break;

            case "modify":
                string sql2 = "select count(*) from HOISTINGEQUIPMENT_INFO where EQUIMENT_NAME = '" + name + "' and EQUIMENT_ID <> '" + EQUIMENT_ID + "'";
                if (common.SqlHelper.ExcuteSql(sql2) > 0)
                {
                    MessageBox.Show("该吊挂设备已经被添加过了!", "信息提示", MessageBoxButtons.OK);
                    this.EQUIMENT_NAME.Focus();
                    return;
                }
                dao.Modify(EQUIMENT_ID, this.EQUIMENT_NAME.Text.Trim());
                this.DialogResult = DialogResult.OK;
                this.Close();
                break;
            }
        }