void BindData()
    {
        ProductProperty property = ProductProperties.GetProperty(id);

        ProductCategory category = null;

        if (property != null)
        {
            btnPost.Text = "修改";
            this.txtPropertyDesc.Text   = property.PropertyDesc;
            this.txtPropertyName.Text   = property.PropertyName;
            this.txtDisplayOrder.Text   = property.DisplayOrder.ToString();
            this.scHidden.SelectedValue = property.SubCategoryHidden;
            category = ProductCategories.GetCategory(property.CategoryID);
        }
        if (category == null)
        {
            category = ProductCategories.GetCategory(categoryID);
        }

        if (category != null)
        {
            ltParCategory.Text     = category.CategoryName;
            ltParCategoryDesc.Text = category.CategoryDesc;
        }
        else
        {
            parentName.Visible = false;
            parentDesc.Visible = false;
        }
    }
    protected void btnPost_Click(object sender, EventArgs e)
    {
        ProductProperty property = null;

        if (action == OperateType.Add)
        {
            property            = new ProductProperty();
            property.CategoryID = categoryID;
        }
        else
        {
            property = ProductProperties.GetProperty(id);
        }
        property.PropertyName      = this.txtPropertyName.Text;
        property.PropertyDesc      = this.txtPropertyDesc.Text;
        property.SubCategoryHidden = this.scHidden.SelectedValue;
        property.DisplayOrder      = Convert.ToInt32(txtDisplayOrder.Text);
        if (action == OperateType.Add)
        {
            DataActionStatus status = ProductProperties.Create(property);
            switch (status)
            {
            case DataActionStatus.DuplicateName:
                mbMsg.ShowMsg("新增产品分类属性失败,在该分类下存在同名产品分类属性!");
                break;

            case DataActionStatus.UnknownFailure:
                mbMsg.ShowMsg("新增产品分类属性失败,请联系管理员!");
                break;

            case DataActionStatus.Success:
            default:
                base.ExecuteJs("msg('操作成功,已成功增加一个新的产品分类属性!',true);", false);
                break;
            }
        }
        else
        {
            DataActionStatus status = ProductProperties.Update(property);
            switch (status)
            {
            case DataActionStatus.DuplicateName:
                mbMsg.ShowMsg("修改产品分类属性失败,在该分类下存在同名产品分类属性!");
                break;

            case DataActionStatus.UnknownFailure:
                mbMsg.ShowMsg("修改产品分类属性失败,请联系管理员!");
                break;

            case DataActionStatus.Success:
            default:
                base.ExecuteJs("msg('操作成功,已成功修改产品分类属性!',true);", false);
                break;
            }
        }
    }
Esempio n. 3
0
    void BindData()
    {
        ProductCategory category = ProductCategories.GetCategory(id);
        ProductCategory parent   = null;
        ProductProperty property = null;

        if (category != null)
        {
            btnPost.Text         = "修改";
            txtCategoryName.Text = category.CategoryName;
            txtCategoryDesc.Text = category.CategoryDesc;
            txtDisplayOrder.Text = category.DisplayOrder.ToString();
            parent   = ProductCategories.GetCategory(category.ParentID);
            property = ProductProperties.GetProperty(category.PropertyID);
        }
        if (parent == null)
        {
            parent = ProductCategories.GetCategory(parentID);
        }
        if (parent != null)
        {
            ltParCategory.Text     = parent.CategoryName;
            ltParCategoryDesc.Text = parent.CategoryDesc;
        }
        else
        {
            parentName.Visible = false;
            parentDesc.Visible = false;
        }
        if (property == null)
        {
            property = ProductProperties.GetProperty(propertyID);
        }
        if (property != null)
        {
            ltPropertyName.Text = property.PropertyName;
        }
        else
        {
            propertyName.Visible = false;
        }
    }