Example #1
0
 private void btnDel_Click(object sender, EventArgs e)
 {
     if (this.listView1.SelectedItems.Count > 0 && this.listView1.SelectedItems[0].Tag != null)
     {
         if (MessageBox.Show("确认要删除选中的记录吗?", " 系统提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
         {
             int id = this.listView1.SelectedItems[0].Tag.ToString().ToInt(0);
             if (id < 1)
             {
                 return;
             }
             IpSettingHelper.DeleteByID(id);
             IpSettingHelper.ClearCacheAll();
             loadData();
         }
     }
     else
     {
         MessageBox.Show("请选择你要删除的记录!", " 系统提示");
     }
 }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtWebName.Text))
            {
                MessageBox.Show("网址名称不能为空", "系统提示");
                return;
            }
            if (string.IsNullOrEmpty(this.txtIPUrl.Text))
            {
                MessageBox.Show("网址地址不能为空", "系统提示");
                return;
            }
            DialogResult = System.Windows.Forms.DialogResult.OK;

            IpSetting info = new IpSetting();

            info.WebName    = this.txtWebName.Text;
            info.IPUrl      = this.txtIPUrl.Text;
            info.IPRegex    = this.txtIPRegex.Text;
            info.DataEncode = this.txtDataEncode.Text;

            if (this.id != 0)
            {
                info.IPCID = this.id;
                IpSettingHelper.Update(info);
                IpSettingHelper.ClearCacheAll();
            }
            else
            {
                IpSettingHelper.Insert(info);
                IpSettingHelper.ClearCacheAll();
            }

            MessageBox.Show("保存数据成功!", " 系统提示");
            this.Close();
        }