/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelete_Click(object sender, EventArgs e) { try { int pdaId = Convert.ToInt32(dataGridView1.SelectedCells[0].Value); if (MessageBox.Show("确定是否删除?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Model_Destination destination = new Model_Destination(); destination.Idk__BackingField = pdaId; ResultModelOfModel_Destinationd4FqxSXX dest = cs.EditPDADestination(destination); if (dest.Code != 0) { MessageBox.Show(dest.Message); } else { MessageBox.Show("操作成功!"); PDADest(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (txtDestination.Text.Trim() == string.Empty) { MessageBox.Show("目的地不能为空"); return; } if (Encoding.Default.GetBytes(txtDestination.Text.Trim()).Length > 20) { MessageBox.Show("目的地不能超过20"); return; } Model_Destination destination = new Model_Destination(); destination.Addressk__BackingField = txtDestination.Text.Trim(); destination.DeviceIdk__BackingField = mp.Idk__BackingField; ResultModelOfModel_Destinationd4FqxSXX dest = cs.EditPDADestination(destination); if (dest.Code != 0) { MessageBox.Show(dest.Message); } else { MessageBox.Show("操作成功"); txtDestination.Text = string.Empty; PDADest(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }