Exemplo n.º 1
0
    protected void btUpdate_Click(object sender, EventArgs e)
    {
        var _Cate = new NewsCategories()
        {
            CateID = AppUtils.Request("id")
        };

        _Cate          = _Cate.Get();
        _Cate.Name     = txtName.Text.Trim();
        _Cate.Alias    = txtAlias.Text.Trim();
        _Cate.Url      = txtUrl.Text.Trim();
        _Cate.FatherID = Convert.ToInt32(drpFather.SelectedValue);
        if (Convert.ToInt32(drpOrder.SelectedValue) != _Cate.Order)
        {
            _Cate.Order = Convert.ToInt32(drpOrder.SelectedValue) + 1;
        }
        _Cate.Note      = txtNote.Text.Trim();
        _Cate.IsDisplay = cbxIsActive.Checked;
        _Cate.Update();

        Response.Redirect(Constant.ADMIN_PATH + Resources.Url.NewsCategoriesList);
    }
Exemplo n.º 2
0
    private void init()
    {
        var _Cate = new NewsCategories()
        {
            CateID = AppUtils.Request("id")
        };

        _Cate = _Cate.Get();
        if (_Cate == null)
        {
            Response.Redirect(Constant.ADMIN_PATH + Resources.Url.NewsCategoriesList);
        }
        txtName.Text            = _Cate.Name;
        txtAlias.Text           = _Cate.Alias;
        txtUrl.Text             = _Cate.Url;
        drpFather.SelectedValue = _Cate.FatherID.ToString();
        txtNote.Text            = _Cate.Note;
        cbxIsActive.Checked     = _Cate.IsDisplay;

        GetDrpOrder();
        drpOrder.SelectedValue = _Cate.Order.ToString();
    }