protected void btnOk_ServerClick(object sender, EventArgs e) { XYECOM.Business.Server s = new XYECOM.Business.Server(); XYECOM.Model.ServerInfo es = new XYECOM.Model.ServerInfo(); es.S_Name = this.txtName.Text; es.S_Path = this.serverpath.Text; es.S_URL = this.serversul.Text; if (this.lbimage.Checked == true) { es.S_Flag = false; } if (this.lbwenzi.Checked == true) { es.S_Flag = true; } if (this.rbyes.Checked == true) { es.S_IsCurrent = true; } if (this.rbno.Checked == true) { es.S_IsCurrent = false; } int i = 0; i = s.Insert(es); if (i >= 0) { this.key.Value = "3"; Reload(); } else { Alert("添加失败!", url); } }
protected void gvlist_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "del") { Server s = new Server(); int s_id = Convert.ToInt32(this.gvlist.DataKeys[Convert.ToInt32(e.CommandArgument)].Value.ToString()); if (!(s.IsUsed(s_id))) { int i = 0; i = s.Delete(s_id); if (i >= 0) { Reload(); } } else { Alert("服务器目录已有相关资源,不能删除!", url); } } else if (e.CommandName == "up") { XYECOM.Model.ServerInfo es = new XYECOM.Model.ServerInfo(); XYECOM.Business.Server s = new XYECOM.Business.Server(); this.key.Value = "2"; this.S_ID.Value = this.gvlist.DataKeys[Convert.ToInt32(e.CommandArgument)].Value.ToString(); es = s.GetItem(Convert.ToInt32(this.gvlist.DataKeys[Convert.ToInt32(e.CommandArgument)].Value.ToString())); this.txtname1.Text = es.S_Name.ToString(); this.serverpath1.Text = es.S_Path.ToString(); ; this.serversul1.Text = es.S_URL.ToString(); } }
protected void Submit1_ServerClick(object sender, EventArgs e) { XYECOM.Business.Server s = new XYECOM.Business.Server(); XYECOM.Model.ServerInfo es = new XYECOM.Model.ServerInfo(); es.S_ID = Convert.ToInt32(this.S_ID.Value); es.S_Name = this.txtname1.Text; es.S_Path = this.serverpath1.Text; es.S_URL = this.serversul1.Text; int i = 0; i = s.Update(es); if (i >= 0) { Reload(); } else { Alert("修改失败!", url); } }