Example #1
0
        public void Page_Load(object sender, EventArgs e)
        {
            channelId = Utils.ToInt(Request.QueryString["channelId"]);
            var id = Convert.ToInt32(Request.QueryString["id"]);

            if (!IsPostBack && channelId > 0)
            {
                if (Request.QueryString["Delete"] != null && id > 0)
                {
                    try
                    {
                        TypeDao.Delete(id);
                        LtlMessage.Text = Utils.GetMessageHtml("成功删除分类法", true);
                    }
                    catch (Exception ex)
                    {
                        LtlMessage.Text = Utils.GetMessageHtml($"删除分类法失败,{ex.Message}", false);
                    }
                }
                else if ((Request.QueryString["Up"] != null || Request.QueryString["Down"] != null) && id > 0)
                {
                    var isDown = Request.QueryString["Down"] != null;
                    if (isDown)
                    {
                        TypeDao.UpdateTaxisToUp(id, channelId);
                        LtlMessage.Text = Utils.GetMessageHtml($"排序成功", true);
                    }
                    else
                    {
                        TypeDao.UpdateTaxisToDown(id, channelId);
                        LtlMessage.Text = Utils.GetMessageHtml($"排序成功", true);
                    }
                }

                DgContents.DataSource     = TypeDao.GetDataSource(channelId);
                DgContents.ItemDataBound += DgContents_ItemDataBound;
                DgContents.DataBind();

                BtnAdd.Attributes.Add("onclick", ModalConfigTypeAdd.GetOpenWindowStringToAdd(SiteId, channelId));
            }
        }