Ejemplo n.º 1
0
    //品牌添加
    public void AddBrand()
    {
        int    Brand_ID          = 0;
        string Brand_Name        = tools.CheckStr(Request.Form["Brand_Name"].Trim());
        string Brand_Img         = Request.Form["Brand_Img"];
        string Brand_Url         = Request.Form["Brand_Url"].Trim();
        string Brand_Description = Request.Form["Brand_Description"];
        int    Brand_Sort        = tools.CheckInt(Request.Form["Brand_Sort"]);
        int    Brand_IsRecommend = tools.CheckInt(Request.Form["Brand_IsRecommend"]);
        int    Brand_IsActive    = tools.CheckInt(Request.Form["Brand_IsActive"]);
        string Brand_Site        = Public.GetCurrentSite();

        if (Brand_Name.Length == 0)
        {
            Public.Msg("error", "错误信息", "请填写品牌名称!", false, "{back}");
        }

        BrandInfo entity = new BrandInfo();

        entity.Brand_ID          = Brand_ID;
        entity.Brand_Name        = Brand_Name;
        entity.Brand_Img         = Brand_Img;
        entity.Brand_URL         = Brand_Url;
        entity.Brand_Description = Brand_Description;
        entity.Brand_Sort        = Brand_Sort;
        entity.Brand_IsRecommend = Brand_IsRecommend;
        entity.Brand_IsActive    = Brand_IsActive;
        entity.Brand_Site        = Brand_Site;

        if (brand.AddBrand(entity, Public.GetUserPrivilege()))
        {
            entity = GetLastBrandInfo();
            if (entity != null)
            {
                if (entity.Brand_Name == Brand_Name)
                {
                    string ProductTypeID = tools.CheckStr(Request["ProductTypeID"]);
                    if (ProductTypeID.Length > 0)
                    {
                        foreach (string typeid in ProductTypeID.Split(','))
                        {
                            if (tools.CheckInt(typeid) > 0)
                            {
                                MyProductType.AddProductType_Brand(tools.CheckInt(typeid), entity.Brand_ID, Public.GetUserPrivilege());
                            }
                        }
                    }
                }
            }
            Public.Msg("positive", "操作成功", "操作成功", true, "brand_add.aspx");
        }
        else
        {
            Public.Msg("error", "错误信息", "操作失败,请稍后重试", false, "{back}");
        }
    }
Ejemplo n.º 2
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}");
        }
    }