//编辑 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>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //加载下拉列表 IWcfServerDao dao = CastleContext.Instance.GetService <IWcfServerDao>(); IList <WcfServer> list = dao.FindAll(); foreach (WcfServer obj in list) { ListItem li = new ListItem(); li.Text = obj.Remark + ":" + obj.IP + ":" + obj.Point; li.Value = obj.IP + ":" + obj.Point; this.IP.Items.Add(li); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Request.QueryString["ID"]; if (!string.IsNullOrEmpty(id)) { int ID = int.Parse(id); WcfServer obj = null; IWcfServerDao dao = CastleContext.Instance.GetService <IWcfServerDao>(); obj = dao.Find(ID); if (obj != null) { this.IP.Text = obj.IP; this.Point.Text = obj.Point.ToString(); this.Remark.Text = obj.Remark; } } } }
static void Main(string[] args) { //首先获取wcf监控服务器的信息 IWcfServerDao serverdao = CastleContext.Instance.GetService <IWcfServerDao>(); IList <WcfServer> serverlist = serverdao.FindAll(); //首先建立批次信息 Batch batch = new Batch(); batch.CreateTime = DateTime.Now; IBatchDao batchdao = CastleContext.Instance.GetService <IBatchDao>(); int batchid = batchdao.Insert(batch); IWcfServerPerformanceDao perfdao = CastleContext.Instance.GetService <IWcfServerPerformanceDao>(); IClientConnInfoDao clientdao = CastleContext.Instance.GetService <IClientConnInfoDao>(); IOperationInfoDao operatedao = CastleContext.Instance.GetService <IOperationInfoDao>(); foreach (WcfServer server in serverlist) { string ip = server.IP + ":" + server.Point; PCData pcdata; double memCount; Dictionary <string, LinkModel> modellist = getLinkModel(ip, out pcdata, out memCount); int all_connnums = 0; foreach (string key in modellist.Keys) { LinkModel model = modellist[key]; Dictionary <string, UrlInfo> infolist = model.UrlInfoList; foreach (string url in infolist.Keys) { UrlInfo info = infolist[url]; all_connnums += info.ConnNums; foreach (string opereateName in info.OperateNums.Keys) { //加入操作信息表 OperationInfo oinfo = new OperationInfo(); oinfo.Adress = url; oinfo.BatchID = batchid; oinfo.IP = model.ClientIP.Split('_')[0]; oinfo.OperationName = opereateName; oinfo.OperationNums = info.OperateNums[opereateName]; oinfo.ServerID = server.ID; oinfo.AppName = model.ClientIP.Split('_')[1]; operatedao.Insert(oinfo); } //加入客户端连接信息表 ClientConnInfo clientinfo = new ClientConnInfo(); clientinfo.Adress = url; clientinfo.BatchID = batchid; clientinfo.IP = model.ClientIP.Split('_')[0]; clientinfo.LinkNums = info.ConnNums; clientinfo.ServerID = server.ID; clientinfo.AppName = model.ClientIP.Split('_')[1]; clientdao.Insert(clientinfo); } } //存入服务器性能表 WcfServerPerformance sperf = new WcfServerPerformance(); sperf.BatchID = batchid; sperf.Cpu = (decimal)pcdata.Cpu; sperf.AllMem = (decimal)memCount; sperf.Mem = (decimal)pcdata.Mem; sperf.ProcessId = pcdata.ProcessId; sperf.ServerID = server.ID; sperf.ThreadCount = pcdata.ThreadCount; sperf.CurrentConnNums = all_connnums; perfdao.Insert(sperf); } }