예제 #1
0
    //添加产品类型
    public void AddProductType()
    {
        int    ProductType_ID       = tools.CheckInt(Request.Form["ProductType_ID"]);
        string ProductType_Name     = tools.CheckStr(Request.Form["ProductType_Name"]);
        int    ProductType_Sort     = tools.CheckInt(Request.Form["ProductType_Sort"]);
        int    ProductType_IsActive = tools.CheckInt(Request.Form["ProductType_IsActive"]);
        string ProductType_Site     = Public.GetCurrentSite();
        string brand_select         = tools.CheckStr(Request.Form["ProductType_Brand"]) + ",";

        string[] Product_Brand = brand_select.Split(',');

        if (ProductType_Name == "")
        {
            Public.Msg("error", "错误信息", "请填写类型名称!", false, "{back}");
        }


        ProductTypeInfo entity  = new ProductTypeInfo();
        ProductTypeInfo MaxType = new ProductTypeInfo();

        entity.ProductType_ID       = ProductType_ID;
        entity.ProductType_Name     = ProductType_Name;
        entity.ProductType_Sort     = ProductType_Sort;
        entity.ProductType_IsActive = ProductType_IsActive;
        entity.ProductType_Site     = ProductType_Site;

        if (MyProductType.AddProductType(entity, Public.GetUserPrivilege()))
        {
            MaxType = MyProductType.GetProductTypeMax(Public.GetUserPrivilege());
            if (MaxType != null)
            {
                foreach (string i in Product_Brand)
                {
                    if (tools.CheckInt(i) > 0)
                    {
                        MyProductType.AddProductType_Brand(MaxType.ProductType_ID, tools.CheckInt(i), Public.GetUserPrivilege());
                    }
                }
            }

            Public.Msg("positive", "操作成功", "操作成功", true, "ProductType_Add.aspx");
        }
        else
        {
            Public.Msg("error", "错误信息", "操作失败,请稍后重试", false, "{back}");
        }
    }