Esempio n. 1
0
        /// <summary>
        /// 控件行命令事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void repInfo_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName.Equals("del"))
            {
                int     id   = Convert.ToInt32(e.CommandArgument);
                NavInfo item = NavInfoService.GetModel(id);
                if (item != null)
                {
                    if (System.IO.File.Exists(Server.MapPath(item.indexImg)))
                    {
                        System.IO.File.Delete(Server.MapPath(item.indexImg));
                    }
                }
                IndexProductService.Delete(id);
                LoadData();
            }
            if (e.CommandName.Equals("mod"))
            {
                int          id   = Convert.ToInt32(e.CommandArgument);
                IndexProduct item = IndexProductService.GetModel(id);
                if (item != null)
                {
                    ddlCate.SelectedValue = item.typeId.ToString();
                    txtTitle.Text         = item.proName;

                    txtTitle2.Text = item.proDesc;
                    txtPrice.Text  = item.priceStr;

                    lblURL1.Text    = item.imgUrl;
                    txtLinkUrl.Text = item.remark;

                    txtUnit.Text        = item.unitDesc;
                    lblId.Text          = item.id.ToString();
                    this.pnlAdd.Visible = true;
                    pnlList.Visible     = false;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 控件行命令事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void repInfo_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName.Equals("del"))
            {
                int     id   = Convert.ToInt32(e.CommandArgument);
                NavInfo item = NavInfoService.GetModel(id);
                if (item != null)
                {
                    if (System.IO.File.Exists(Server.MapPath(item.indexImg)))
                    {
                        System.IO.File.Delete(Server.MapPath(item.indexImg));
                    }
                }
                NavInfoService.Delete(id);
                LoadData();
            }
            if (e.CommandName.Equals("mod"))
            {
                int     id   = Convert.ToInt32(e.CommandArgument);
                NavInfo item = NavInfoService.GetModel(id);
                if (item != null)
                {
                    txtTitle.Text = item.indexTitle;

                    txtContentTitle.Text = item.title;
                    txtTitle2.Text       = item.indexTitle2;

                    lblURL1.Text        = item.indexImg;
                    txtLinkUrl.Text     = item.linkurl;
                    this.content1.Value = item.infoDesc;

                    lblId.Text          = item.id.ToString();
                    this.pnlAdd.Visible = true;
                    pnlList.Visible     = false;
                }
            }
        }