Exemplo n.º 1
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        bool rs = false;
        string url = "List_Form.aspx?pid=" + txt_pid.Value;
        string sql = "";
        string pagename = Web9long.DB.SQLUtility.Replace(this.txtName.Text);
        if (txt_fid.Value != "")
        {
            sql = "select * from Com_Form where CF_Name='" + pagename + "'  and CF_ID<>" + txt_fid.Value;
        }
        else
        {
            sql = "select * from Com_Form where CF_Name='" + pagename + "'";
        }
        etyForm = bll.GetOnlyRow<Com_Form>(sql);
        if (etyForm != null) Web9long.Web.Clew.AlertBack("名称不能重复");

        etyForm = new Com_Form();
        etyForm.CF_ListOrder = int.Parse(txtListOrder.Text);
        etyForm.CF_CPID = int.Parse(txt_pid.Value);
        etyForm.CF_Name = txtName.Text;
        etyForm.CF_Title = txtTitle.Text;
        etyForm.CF_Dec = txtDec.Text;
        etyForm.CF_Type = int.Parse(ddlTypeId.SelectedValue);
        etyForm.CF_IsMust = int.Parse(rblIsMust.SelectedValue);
        etyForm.CF_DefaltValue = txtDefaltValue.Text;
        etyForm.CF_RefDataTable = txtRefDataTable.Text;
        etyForm.CF_Order = int.Parse(txtOrder.Text);

        if (txt_fid.Value != "")
        {
            etyForm.TableCondition().Where = " CF_ID=" + txt_fid.Value;
            rs = bll.Update(etyForm) > 0;
            //Loneu.Web.UI.Table.ComTable.AlertTable(bll.GetOnlyRow<Com_Page>(new Com_Page(etyForm.CF_CPID)).CP_TableName, etyForm);
            //url = "From_Edit.aspx?action=edit&id=" + txt_fid.Value+"&pid="+txt_pid.Value;
        }
        else
        {
            Loneu.Web.UI.Table.ComTable.AlertTable(bll.GetOnlyRow<Com_Page>(new Com_Page(etyForm.CF_CPID)).CP_TableName, etyForm);
            rs = bll.Insert(etyForm) > 0;
        }
        Web9long.Web.Clew.Alert("操作" + (rs ? "成功" : "失败") + "!", url);
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string action = Web9long.Web.Util.Query("action");

        if (!int.TryParse(Web9long.Web.Util.Query("pid"), out pid))
            Web9long.Web.Clew.AlertBack("参数错误");

        txt_pid.Value = pid.ToString();
        if (action == "edit")
        {
            if (!int.TryParse(Web9long.Web.Util.Query("id"), out fid))
                Web9long.Web.Clew.AlertBack("参数错误");
            etyForm = bll.GetOnlyRow<Com_Form>(new Com_Form(fid));
            txt_fid.Value = fid.ToString();
            if (etyForm == null)
                Web9long.Web.Clew.AlertBack("信息不存在或已被删除!");
        }

        if (!IsPostBack)
        {
            TreeBind(ddlTypeId);
            if (action == "edit")
            {
                txtListOrder.Text = etyForm.CF_ListOrder.ToString();
                txtName.Text = etyForm.CF_Name;
                txt_fid.Value = etyForm.CF_ID.ToString();
                txtTitle.Text = etyForm.CF_Title;
                txtDec.Text = etyForm.CF_Dec;
                txtDefaltValue.Text = etyForm.CF_DefaltValue;
                ddlTypeId.SelectedValue = etyForm.CF_Type.ToString();
                txtRefDataTable.Text = etyForm.CF_RefDataTable;
                txtOrder.Text = etyForm.CF_Order.ToString();
                rblIsMust.SelectedValue = etyForm.CF_IsMust.ToString();
                btnSubmit.Text = "提交修改";
            }
        }
    }