Esempio n. 1
0
        private void tBtnDelIntf_Click(object sender, EventArgs e)
        {
            if (listVProjects.SelectedItems.Count > 0 && skinLVInterfaces.SelectedItems.Count > 0)
            {
                if (MessageBox.Show("是否要删除该接口?", "接口删除提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    var proj = listVProjects.SelectedItems[0];
                    var a    = skinLVInterfaces.SelectedItems[0];


                    DbService db = null;
                    db = DB.GetMainDb();
                    Hashtable htPara = new Hashtable();
                    htPara.Add("intf_code", a.SubItems[3].Text);

                    int count = (int)db.ExecuteScalarID("CountMethodNumbers", htPara);
                    if (count > 0)
                    {
                        MessageBox.Show("接口下还存在方法的定义,请先删除接口下的方法");
                        return;
                    }

                    HA_InterfaceDAL dal = new HA_InterfaceDAL();
                    if (dal.Delete(a.SubItems[3].Text))
                    {
                        ReloadInterface(proj.SubItems[0].Text);
                    }
                }
            }
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtIntfCode.Text))
                {
                    MessageBox.Show("请输入代码");
                    return;
                }
                HA_InterfaceDAL dal = new HA_InterfaceDAL();

                if (intfobj == null)
                {
                    int ret = dal.AddNew(new HA_Interface
                    {
                        intf_code      = txtIntfCode.Text,
                        intf_name      = txtIntfName.Text,
                        intf_namespace = txtNameSpace.Text,
                        intf_dbconn    = comboServIP.Text,
                        intf_version   = txtVersion.Text,
                        intf_auth      = "HydAdmin",
                        intf_note      = txtIntfNote.Text,
                        proj_code      = labelProjCode.Text
                    });

                    if (ret < 0)
                    {
                        MessageBox.Show("保存失败 : " + ret);
                    }
                }
                else
                {
                    //UpdateProject
                    bool ret = dal.Update(new HA_Interface
                    {
                        intf_code      = txtIntfCode.Text,
                        intf_name      = txtIntfName.Text,
                        intf_namespace = txtNameSpace.Text,
                        intf_dbconn    = comboServIP.Text,
                        intf_version   = txtVersion.Text,
                        intf_auth      = "HydAdmin",
                        intf_note      = txtIntfNote.Text,
                        proj_code      = labelProjCode.Text
                    });

                    if (ret == false)
                    {
                        MessageBox.Show("保存失败 : " + ret);
                    }
                }
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("保存失败 : " + ex.Message);
            }
        }