Esempio n. 1
0
        /// <summary>
        /// 属性操作
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void repList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "lbtnState")//修改状态
            {
                HiddenField hidid = e.Item.FindControl("hidid") as HiddenField;

                Leadin.Model.DesignTemplate model = bll.GetModel(int.Parse(hidid.Value));

                if (model.StateInfo == 1)
                {
                    model.StateInfo = 0;
                }
                else
                {
                    model.StateInfo = 1;
                }

                bll.Update(model);
            }
            if (e.CommandName == "lbtnIndex")//修改是否首页显示
            {
                HiddenField hidid = e.Item.FindControl("hidid") as HiddenField;

                Leadin.Model.DesignTemplate model = bll.GetModel(int.Parse(hidid.Value));

                if (model.IsIndex == 1)
                {
                    model.IsIndex = 0;
                }
                else
                {
                    model.IsIndex = 1;
                }

                bll.Update(model);
            }
            if (e.CommandName == "lbtnhot")//修改是否热门显示
            {
                HiddenField hidid = e.Item.FindControl("hidid") as HiddenField;

                Leadin.Model.DesignTemplate model = bll.GetModel(int.Parse(hidid.Value));

                if (model.IsHot == 1)
                {
                    model.IsHot = 0;
                }
                else
                {
                    model.IsHot = 1;
                }

                bll.Update(model);
            }
            if (e.CommandName == "lbtnRec")//修改是否推荐显示
            {
                HiddenField hidid = e.Item.FindControl("hidid") as HiddenField;

                Leadin.Model.DesignTemplate model = bll.GetModel(int.Parse(hidid.Value));

                if (model.IsRec == 1)
                {
                    model.IsRec = 0;
                }
                else
                {
                    model.IsRec = 1;
                }

                bll.Update(model);
            }

            BindRepList();
        }
Esempio n. 2
0
        /// <summary>
        /// 提交
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOk_Click(object sender, EventArgs e)
        {
            Leadin.Model.DesignTemplate model = new Leadin.Model.DesignTemplate();

            bool isEdit = string.IsNullOrWhiteSpace(Request.Params["id"]);

            if (!isEdit)
            {
                model = bll.GetModel(int.Parse(Request.Params["id"]));
            }


            model.Cycle        = txtCycle.Text;
            model.DesignRemark = txtDesign.Text;
            model.DetailRemark = txtContent.Text;
            model.ImgUrl       = txtfileico1.Text;
            model.IsHot        = ckHot.Checked ? 1 : 0;
            model.IsIndex      = ckIndex.Checked ? 1 : 0;
            model.IsRec        = ckRec.Checked ? 1 : 0;
            model.Price        = txtPrice.Text;
            model.PrintRemark  = txtPrint.Text;
            model.SortNum      = int.Parse(txtSortNum.Text);
            model.StateInfo    = ckState.Checked ? 1 : 0;
            model.StrKey       = txtKey.Text;
            model.SubTitle     = "";
            model.Title        = txtName.Text;
            model.Tools        = txtTools.Text;

            model.TypeId = int.Parse(ddlType.SelectedValue);



            if (isEdit)
            {
                model.AddTime = DateTime.Now;
                model.Num     = SetNumId(blltype.GetModel(int.Parse(ddlType.SelectedValue)).Typekey);
                if (bll.Add(model) > 0)
                {
                    JsMessage("success", "模版添加成功!", 1000, "List.aspx");
                }
                else
                {
                    JsMessage("error", "模版添加失败,请检查您的输入!", 1000, "back");
                }
            }
            else
            {
                if (bll.Update(model))
                {
                    StringBuilder strUrl = new StringBuilder();


                    if (!string.IsNullOrEmpty(Request.Params["type"]))
                    {
                        strUrl.Append("&type=" + Request.Params["type"]);
                    }
                    if (!string.IsNullOrEmpty(Request.Params["keytype"]))
                    {
                        strUrl.Append("&keytype=" + Request.Params["keytype"]);
                    }
                    if (!string.IsNullOrEmpty(Request.Params["key"]))
                    {
                        strUrl.Append("&key=" + Request.Params["key"]);
                    }

                    JsMessage("success", "模版编辑成功!", 1000, "List.aspx?page=" + Request.Params["page"] + strUrl.ToString());
                }

                else
                {
                    JsMessage("error", "模版编辑失败,请检查您的输入!", 1000, "back");
                }
            }
        }