Exemple #1
0
    private bool DoAdd()
    {
        tbl_sinkia_sub model = new tbl_sinkia_sub();


        model.pro_class = txttitle.Text.Trim();
        // model.class_mob_img = txtImgUrl_mob.Text;
        // model.class_shop_img = txtImgUrl_com.Text;
        model.sort_id = int.Parse(txtSortId.Text.Trim());
        if (pid.SelectedValue == "")
        {
            mym.JscriptMsg(this.Page, "必须选择分类!", "", "Error");
            return(false);
        }
        model.pid = int.Parse(pid.SelectedValue);

        if (is_show.Checked == true)
        {
            model.is_show = 1;
        }
        else
        {
            model.is_show = 0;
        }

        if (model.Add() > 0)
        {
            // mym.AddAdminLog("增加", "添加商品类别:" + txttitle.Text); //记录日志
            return(true);
        }

        return(false);
    }
    // 单个删除
    protected void lbtnDelCa_Click(object sender, EventArgs e)
    {
        // 当前点击的按钮
        LinkButton     lb   = (LinkButton)sender;
        int            caId = int.Parse(lb.CommandArgument);
        tbl_sinkia_sub bll  = new tbl_sinkia_sub();

        bll.GetModel(caId);

        string      pro_class = bll.pro_class;
        tbl_product bllpp     = new tbl_product();

        bllpp.pro_pid = caId;
        if (!bllpp.ExistsBM())//查找是否存在下级商品
        {
            bll.Delete(caId);

            mym.JscriptMsg(this.Page, " 成功删除商品类别:" + pro_class + "", Utils.CombUrlTxt("banner_list.aspx", "keywords={0}&page={1}", this.keywords, this.page.ToString()), "Success");
        }
        else
        {
            mym.JscriptMsg(this.Page, "有商品属于该商品类别,不能删除!", "", "Error");
            return;
        }
    }
Exemple #3
0
    private void ZYBind()
    {
        tbl_sinkia_sub bll = new tbl_sinkia_sub();
        DataTable      dt  = bll.GetList("1=1").Tables[0];

        this.ddlproduct_category_id.Items.Clear();
        this.ddlproduct_category_id.Items.Add(new ListItem("==全部==", "0"));
        foreach (DataRow dr in dt.Rows)
        {
            string Id    = dr["id"].ToString();
            string Title = dr["pro_class"].ToString().Trim();
            this.ddlproduct_category_id.Items.Add(new ListItem(Title, Id));
        }
    }
    private void RptBind(string _strWhere, string _orderby)
    {
        this.page        = AXRequest.GetQueryInt("page", 1);
        txtKeywords.Text = this.keywords;
        tbl_sinkia_sub bll = new tbl_sinkia_sub();

        this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
        this.rptList.DataBind();

        //绑定页码
        txtPageNum.Text = this.pageSize.ToString();
        string pageUrl = Utils.CombUrlTxt("pro_sub_list.aspx", "keywords={0}&page={1}", this.keywords, "__id__");

        PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
    }
Exemple #5
0
    private bool DoEdit(int _id)
    {
        bool result = false;

        tbl_sinkia_sub model = new tbl_sinkia_sub();

        //if (model.Exists(txttitle.Text.Trim(), _id))
        //{
        //    mym.JscriptMsg(this.Page, "您输入的类别名称已经存在,请检查!", "", "Error");
        //    return false;
        //}
        model.GetModel(_id);

        model.pro_class = txttitle.Text.Trim();
        model.sort_id   = int.Parse(txtSortId.Text.Trim());
        // model.class_mob_img = txtImgUrl_mob.Text;
        // model.class_shop_img = txtImgUrl_com.Text;

        if (pid.SelectedValue == "")
        {
            mym.JscriptMsg(this.Page, "必须选择分类!", "", "Error");
            return(false);
        }
        model.pid = int.Parse(pid.SelectedValue);
        if (is_show.Checked == true)
        {
            model.is_show = 1;
        }
        else
        {
            model.is_show = 0;
        }


        if (model.Update())
        {
            // mym.AddAdminLog("修改", "修改商品类别:" + txttitle.Text); //记录日志
            result = true;
        }

        return(result);
    }
    //保存排序
    protected void btnSave_Click(object sender, EventArgs e)
    {
        tbl_sinkia_sub bll     = new tbl_sinkia_sub();
        Repeater       rptList = new Repeater();

        rptList = this.rptList;

        for (int i = 0; i < rptList.Items.Count; i++)
        {
            int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
            int sortId;
            if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
            {
                sortId = 99;
            }
            bll.UpdateField(id, "sort_id=" + sortId.ToString());
        }

        mym.JscriptMsg(this.Page, " 排序保存成功", Utils.CombUrlTxt("pro_sub_list.aspx", "keywords={0}&page={1}", this.keywords, this.page.ToString()), "Success");
    }
Exemple #7
0
    private void ShowInfo(int _id)
    {
        tbl_sinkia_sub model = new tbl_sinkia_sub();

        model.GetModel(_id);

        txttitle.Text  = model.pro_class;
        txtSortId.Text = model.sort_id.ToString();
        //txtImgUrl_mob.Text = model.class_mob_img;
        //txtImgUrl_com.Text = model.class_shop_img;
        this.pid.SelectedValue = model.pid.ToString();

        if (model.is_show.ToString() == "1")
        {
            is_show.Checked = true;
        }
        else
        {
            is_show.Checked = false;
        }
    }