Exemplo n.º 1
0
        /// <summary>
        /// 修改连接信息
        /// </summary>
        private void ModLink()
        {
            int    id    = CRequest.GetInt("id", 0);
            string name  = CRequest.GetString("name");
            string title = CRequest.GetString("title");
            string path  = CRequest.GetString("path");
            int    place = CRequest.GetInt("place", 0);
            Links  item  = LinksService.GetModel(id);

            if (item != null)
            {
                item.linkname  = name;
                item.linktitle = title;
                item.linkurl   = path;
                item.istj      = place;
                int num = LinksService.Update(item);
                if (num > 0)
                {
                    Response.Write("success");
                }
                else
                {
                    Response.Write("fail");
                }
            }
        }
Exemplo 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);
                LinksService.Delete(id);
                LoadData();
            }
            if (e.CommandName.Equals("mod"))
            {
                int   id   = Convert.ToInt32(e.CommandArgument);
                Links item = LinksService.GetModel(id);
                if (item != null)
                {
                    DataSet ds   = NewsTypeService.GetList(4, "parentId = 2", "id");
                    int     flag = 0;
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            if (Convert.ToInt32(dr["id"]) == item.istj)
                            {
                                flag = 1;
                                break;
                            }
                        }
                    }
                    if (flag == 1)
                    {
                        ddlPlace.SelectedValue = item.istj.ToString();
                    }

                    txtLinkUrl.Text   = item.linkurl;
                    txtLinkTitle.Text = item.linktitle;
                    txtLinkName.Text  = item.linkname;
                    lblId.Text        = item.id.ToString();
                    pnlAdd.Visible    = true;
                    pnlList.Visible   = false;
                }
            }
        }