//保存
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        TB_Product_Categorys model = new TB_Product_Categorys();

        model.CategoryName = TbCategoryName.Text.Trim();
        model.ParentID     = DDLCategory.SelectedValue.ToInt();
        model.TypeID       = DDLType.Text.ToInt();
        model.OrderBy      = TbOrder.Text.ToInt();
        model.PicUrl       = FileUploadImg.Url;
        model.Description  = TbDescription.Text;
        model.IsHidden     = CheckBoxIsHidden.Checked;
        model.VouchType    = DDLVouch.SelectedValue.ToInt();
        model.Creater      = BasePage.AdminUserName;
        model.AddDate      = DateTime.Now;
        if (ViewState["id"] == null)
        {
            ProductService.CategoryService.Insert(model);
        }
        else
        {
            List <Expression> express = new List <Expression>()
            {
                new Expression("ID", "=", ViewState["id"].ToStr())
            };
            ProductService.CategoryService.Update(model, express);
        }
        MessageDiv.InnerHtml = CommonClass.Reload("数据保存成功");
    }
Example #2
0
    //加载
    public void LoadDataBind()
    {
        int ID = CommonClass.ReturnRequestInt("id", 0);

        if (ID > 0)
        {
            TB_Product_Products model = ProductService.ProductsService.Get(ID);
            if (model.ID.ToInt() > 0)
            {
                ViewState["id"] = model.ID;

                TB_Product_Categorys category = ProductService.CategoryService.Get(model.CategoryID);
                DDLOneLevel.SelectedValue = ProductService.CategoryService.Get(category.ParentID).ParentID.ToStr();

                GetTwoCategory();
                DDLTwoLevel.SelectedValue = category.ParentID.ToStr();

                GetThreeCategory();
                DDLThreeLevel.SelectedValue = model.CategoryID.ToStr();

                BindProperties();
                BindBrand(model.CategoryID);

                TbProductName.Text         = model.ProName;
                TbProNumber.Text           = model.ProNumber;
                TbIntroduction.Text        = model.Introduction;
                DDLBrand.SelectedValue     = model.BrandID.ToStr();
                ProPic.Url                 = model.PicUrl;
                ProImg.Url                 = model.ImgUrl;
                TbPurchasPrice.Text        = model.PurchasPrice.ToStr();
                TbMarketPrice.Text         = model.MarketPrice.ToStr();
                TbSalesPrice.Text          = model.SalesPrice.ToStr();
                TbColor.Text               = model.Color;
                FckDesc.Value              = model.ProDesc;
                FckPakingList.Value        = model.PakingList;
                FckSalesService.Value      = model.CustomerService;
                TbOrderBy.Text             = model.OrderBy.ToStr();
                TbKeyWord.Text             = model.KeyWord;
                TbClickCount.Text          = model.ClickCount.ToStr();
                CheckBoxIsHidden.Checked   = model.IsHidden;
                DDLVouchType.SelectedValue = model.VouchType.ToStr();
                TbDate.Text                = model.AddDate.ToString();

                foreach (ListItem li in CheckBoxListMark.Items)
                {
                    if (model.Mark.Contains(li.Value))
                    {
                        li.Selected = true;
                    }
                }

                //绑定子商品
                RepChildList.DataSource = GetChildProducts(model.ID);
                RepChildList.DataBind();
            }
        }
    }
    private string jiantou = "";//记录箭头

    //加载
    public void LoadDataBind()
    {
        int classID = CommonClass.ReturnRequestInt("classID", 0);
        List <Expression> express = new List <Expression>()
        {
            new Expression("ParentID", "=", classID.ToStr()),
            new Expression("IsDelete", "=", "0")
        };
        List <TB_Product_Categorys> list = ProductService.CategoryService.Search(express, "OrderBy asc");

        foreach (TB_Product_Categorys model in list)
        {
            ListItem li = new ListItem();
            li.Text  = model.CategoryName;
            li.Value = model.ID.ToStr();
            DDLCategory.Items.Add(li);

            //获取子类
            GetChildClass(model.ID);
        }


        //添加项
        ListItem lit = new ListItem();

        lit.Value    = classID.ToString();
        lit.Text     = "根栏目";
        lit.Selected = true;
        DDLCategory.Items.Insert(0, lit);

        if (Request.QueryString["id"] != null)
        {
            int id;
            if (int.TryParse(Request.QueryString["id"].ToString(), out id))
            {
                List <Expression> express2 = new List <Expression>()
                {
                    new Expression("ID", "=", id.ToStr())
                };
                TB_Product_Categorys model = ProductService.CategoryService.Get(express2);
                DDLType.SelectedValue     = model.TypeID.ToStr();
                DDLCategory.SelectedValue = model.ParentID.ToStr();
                TbCategoryName.Text       = model.CategoryName;
                TbOrder.Text             = model.OrderBy.ToStr();
                FileUploadImg.Url        = model.PicUrl;
                TbDescription.Text       = model.Description;
                CheckBoxIsHidden.Checked = model.IsHidden;
                DDLVouch.SelectedValue   = model.VouchType.ToStr();
                ViewState["id"]          = id;
            }
        }
    }
Example #4
0
    /// <summary>
    /// 绑定品牌
    /// </summary>
    public void BindBrands()
    {
        int  categoryId = CommonClass.ReturnRequestInt("categoryId", 0);
        bool isCategory = false;//是否存在类别

        if (categoryId > 0)
        {
            TB_Product_Categorys entity = ProductService.CategoryService.Get(categoryId);
            if (entity.ID > 0)
            {
                brandList  = ProductService.BrandsService.GetCategoryBrands(categoryId);
                isCategory = true;
            }
        }
        if (!isCategory)
        {
            brandList = ProductService.BrandsService.GetAllVouchBrands(categoryId);
        }
    }
Example #5
0
 //显示设置
 protected void DDLIsHiddenSet_Click(object sender, EventArgs e)
 {
     foreach (RepeaterItem ri in RepList.Items)
     {
         CheckBox cb = ((CheckBox)ri.FindControl("CheckBoxChoose"));
         string   ID = ((HiddenField)ri.FindControl("HiddenFieldID")).Value;
         if (cb.Checked == true)
         {
             List <Expression> express = new List <Expression>()
             {
                 new Expression("ID", "=", ID)
             };
             TB_Product_Categorys model = ProductService.CategoryService.Get(express);
             model.IsHidden = CheckBoxIsHiddenSet.Checked;
             ProductService.CategoryService.Update(model, express);
         }
     }
     Response.Write("<script>window.location='" + Request.Url.ToString() + "';</script>");
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindCategory();

            //当categoryId不为空时
            if (categoryId > 0)
            {
                TB_Product_Categorys entity       = ProductService.CategoryService.Get(categoryId);
                TB_Product_Categorys parentEntity = ProductService.CategoryService.Get(entity.ParentID);
                GetTwoCategory(parentEntity.ParentID);
                GetThreeCategory(parentEntity.ID);

                DDLOneLevel.SelectedValue   = parentEntity.ParentID.ToStr();
                DDLTwoLevel.SelectedValue   = parentEntity.ID.ToStr();
                DDLThreeLevel.SelectedValue = entity.ID.ToStr();
            }
        }
    }