Exemplo n.º 1
0
    //命令事件
    protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
        {
            //删除操作
            if (e.CommandName == "del")
            {
                //获取删除的ID
                int id = int.Parse(e.CommandArgument.ToString());
                WcfServer obj = new WcfServer() { ID = id };
                dao.Delete(obj);

                ClientScript.RegisterClientScriptBlock(this.GetType(), "del", "<script>window.location.href = window.location.href;</script>");
            }
        }
    }
Exemplo n.º 2
0
    //编辑
    protected void add_Click(object sender, EventArgs e)
    {
        string id = Request.QueryString["ID"];
        WcfServer obj = new WcfServer();
        obj.IP = this.IP.Text.Trim();
        obj.Point = int.Parse(this.Point.Text.Trim());
        obj.Remark = this.Remark.Text.Trim();
        IWcfServerDao dao = CastleContext.Instance.GetService<IWcfServerDao>();
        if (!string.IsNullOrEmpty(id))
        {
            obj.ID = int.Parse(id);
            dao.Update(obj);

            ClientScript.RegisterClientScriptBlock(this.GetType(), "sourceedit", "<script>window.parent.location = window.parent.location;</script>");
        }
        else
        {
            obj.CreateTime = DateTime.Now;
            dao.Insert(obj);

            ClientScript.RegisterClientScriptBlock(this.GetType(), "sourceadd", "<script>window.parent.location = window.parent.location;</script>");
        }
    }
Exemplo n.º 3
0
		/// <summary>Implements <see cref="IWcfServerDao.Delete"/></summary>
		public void Delete(WcfServer obj) {
			if (obj == null) throw new ArgumentNullException("obj");
			String stmtId = "WcfServer-Delete";
			Instance.Delete(stmtId, obj);
		}
Exemplo n.º 4
0
		/// <summary>Implements <see cref="IWcfServerDao.Insert"/></summary>
		public void Insert(WcfServer obj) {
			if (obj == null) throw new ArgumentNullException("obj");
			String stmtId = "WcfServer-Insert";
			Instance.Insert(stmtId, obj);
		}
Exemplo n.º 5
0
		/// <summary>Implements <see cref="IWcfServerDao.Reload"/></summary>
		public void Reload(WcfServer obj) {
			if (obj == null) throw new ArgumentNullException("obj");
			String stmtId = "WcfServer-Find";
			Instance.QueryForObject<WcfServer>(stmtId, obj, obj);
		}