Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtName.Text))
                {
                    MessageBox.Show("请输入类名");
                    return;
                }

                HA_RetValObjectDAL dal = new HA_RetValObjectDAL();

                if (cobj == null)
                {
                    int ret = dal.AddNew(new HA_RetValObject
                    {
                        rv_name    = txtName.Text,
                        rv_exttype = txtExtType.Text,
                        rv_note    = txtNote.Text,
                        rv_JSON    = txtRetJSON.Text
                    });

                    if (ret < 0)
                    {
                        MessageBox.Show("保存失败 : " + ret);
                    }
                }
                else
                {
                    //UpdateProject
                    bool ret = dal.Update(new HA_RetValObject
                    {
                        rv_name    = txtName.Text,
                        rv_exttype = txtExtType.Text,
                        rv_note    = txtNote.Text,
                        rv_JSON    = txtRetJSON.Text
                    });

                    if (ret == false)
                    {
                        MessageBox.Show("保存失败 : " + ret);
                    }
                }
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("保存失败 : " + ex.Message);
            }
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txtCode.Text))
                {
                    MessageBox.Show("请输入代码");
                    return;
                }
                HA_MethodDAL dal = new HA_MethodDAL();
                TempType     tt  = TempType.Query;

                switch (comboTemplate.Text)
                {
                case "查询":
                    tt = TempType.Query;
                    break;

                case "增删改":
                    tt = TempType.CDUA;
                    break;

                case "存储过程":
                    tt = TempType.SP;
                    break;

                default:
                    break;
                }
                if (cobj == null)
                {
                    int ret = dal.AddNew(new HA_Method
                    {
                        intf_code      = intfcode,
                        m_code         = txtCode.Text,
                        m_desc         = txtDesc.Text,
                        m_reqtype      = txtReqType.Text,
                        m_template     = (int)tt,
                        m_rtnvaluecode = "ret" + txtCode.Text,
                        m_arggrpcode   = comboAGGCode.Text,
                        m_isencrypted  = false,
                        m_funcode      = txtFunCode.Text,
                        m_name         = txtName.Text,
                        m_version      = "",
                        m_pagesize     = Convert.ToInt32(txtPageSize.Text)
                    });

                    if (ret < 0)
                    {
                        MessageBox.Show("保存失败 : " + ret);
                    }
                    HA_RetValObjectDAL voDAL   = new HA_RetValObjectDAL();
                    string             exttype = "";
                    switch (tt)
                    {
                    case TempType.Query:
                        exttype = "BaseObj";
                        break;

                    case TempType.CDUA:
                        exttype = "BaseObj";
                        break;

                    case TempType.SP:
                        exttype = "BaseObj";
                        break;

                    default:
                        break;
                    }

                    ret = voDAL.AddNew(new HA_RetValObject
                    {
                        rv_name    = "ret" + txtCode.Text,
                        rv_exttype = exttype,
                        rv_note    = "Orignal",
                        rv_JSON    = ""
                    });

                    if (ret < 0)
                    {
                        MessageBox.Show("保存失败 : " + ret);
                    }
                }
                else
                {
                    //UpdateProject
                    bool ret = dal.Update(new HA_Method
                    {
                        intf_code      = intfcode,
                        m_code         = txtCode.Text,
                        m_desc         = txtDesc.Text,
                        m_reqtype      = txtReqType.Text,
                        m_template     = (int)tt,
                        m_rtnvaluecode = txtRetVO.Text,
                        m_arggrpcode   = comboAGGCode.Text,
                        m_isencrypted  = false,
                        m_funcode      = txtFunCode.Text,
                        m_name         = txtName.Text,
                        m_version      = "",
                        m_pagesize     = Convert.ToInt32(txtPageSize.Text)
                    });

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