Esempio n. 1
0
    /// <summary>
    /// 保存事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ButtonSave_Click(object sender, EventArgs e)
    {
        try
        {
            WebBean bean  = WebBean.GetInstance();
            var     model = new UrlDataModel
            {
                GUID               = "add".Equals(AddOrUpdate) ? Guid.NewGuid().ToString() : UrlGuid,
                ParentGUID         = null,
                Url                = TextBoxUrl.Text.Trim(),
                UrlCode            = TextBoxUrlCode.Text.Trim(),
                UrlParams          = TextBoxParams.Text.Trim(),
                UrlName            = TextBoxUrlName.Text.Trim(),
                UserAuthentication = DropDownListAuthentication.SelectedValue == "0",
                Show               = DropDownListShow.SelectedValue == "0"
            };

            if ("add".Equals(AddOrUpdate))
            {
                bean.AddUrl(model);
            }
            else
            {
                bean.UpdateUrl(model);
            }
            Show(this.Page, "保存成功!");
        }
        catch (Exception ex)
        {
            Show(this.Page, "保存失败!");
            WriteLog.WriteExceptionLog(ex.ToString());
        }
    }