/// <summary> /// /// </summary> void BindSampleValues() { //string ECWeb = ViewState["ecweb"].ToString(); //if (ECWeb.Equals("")) //{ // return; //} //绑定参数 DataTable dt = KPI_LinqDal.GetTagLists(); //绑定参数 foreach (DataRow dr in dt.Rows) { ///////////////////////////////////////////////////////////////////////// //获得时间 //DateTime dtTime = DateTime.Now; /////////////////////////////////////////////////////////////////////////////////// //实时值 Random rd = new Random(); dr["LinqValue"] = rd.NextDouble() * 1000; } //Linq 行转列 dt = ConvertToTable(dt); //绑定最优参数 gvReal.DataSource = dt; gvReal.DataBind(); }
void BindGrid() { DataTable dt = KPI_LinqDal.GetLinqSearch(""); gvLinq.DataSource = dt; gvLinq.DataBind(); }
protected void btnAddLinq_Click(object sender, EventArgs e) { int index = KPI_LinqDal.LinqIDCounts(); string sID = PageControl.GetGuid(); LinqEntity ote = new LinqEntity(); ote.LinqID = sID; ote.LinqName = "InputName"; ote.LinqDesc = ""; ote.LinqEngunit = ""; ote.LinqIndex = index + 1; ote.LinqIsValid = 1; ote.LinqNote = ""; ote.LinqCreateTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"); ote.LinqModifyTime = ote.LinqCreateTime; if (KPI_LinqDal.Insert(ote)) { //MessageBox.popupClientMessage(this.Page, "添加成功!", "call();"); gvLinq.EditIndex = index; BindGrid(); } else { MessageBox.popupClientMessage(this.Page, "添加错误!", "call();"); } }
protected void gvLinq_RowCommand(object sender, GridViewCommandEventArgs e) { string keyid = e.CommandArgument.ToString(); if (e.CommandName == "dataDelete") { if (KPI_LinqDal.DeleteLinq(keyid)) { MessageBox.popupClientMessage(this.Page, "删除成功!", "call();"); BindGrid(); return; } else { MessageBox.popupClientMessage(this.Page, "删除错误!", "call();"); BindGrid(); } } else if (e.CommandName == "dataConfig") { Response.Redirect("KPI_SubLinqTag.aspx?linqid=" + keyid); } }
protected void gvLinq_RowUpdating(object sender, GridViewUpdateEventArgs e) { //从GridView获得数据 string sID = ((HtmlInputHidden)(gvLinq.Rows[e.RowIndex].Cells[0].FindControl("linqid"))).Value; string sName = ((TextBox)(gvLinq.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim().ToUpper(); string sDesc = ((TextBox)(gvLinq.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim().ToUpper(); string sEngunit = ((TextBox)(gvLinq.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim(); string sValid = ((DropDownList)(gvLinq.Rows[e.RowIndex].Cells[4].FindControl("ddlValid"))).SelectedValue; string sNote = ((TextBox)(gvLinq.Rows[e.RowIndex].Cells[5].Controls[0])).Text.ToString().Trim(); string msg = ""; //检查名称 if (sName == "") { msg += "名称不能为空!\r\n"; } else if (KPI_LinqDal.LinqNameExists(sName, sID)) { MessageBox.popupClientMessage(this.Page, "已存在相同的名称!"); return; } if (msg != "") { MessageBox.popupClientMessage(this.Page, msg); return; } LinqEntity csE = new LinqEntity(); csE.LinqID = sID; csE.LinqName = sName; csE.LinqDesc = sDesc; csE.LinqEngunit = sEngunit; csE.LinqIsValid = int.Parse(sValid); csE.LinqNote = sNote; csE.LinqModifyTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"); if (KPI_LinqDal.Update(csE)) { MessageBox.popupClientMessage(this.Page, "修改成功!", "call();"); gvLinq.EditIndex = -1; BindGrid(); } else { MessageBox.popupClientMessage(this.Page, "修改错误!", "call();"); } }
//static string PlantName = ""; //static string ZBName = ""; //static string PlantID = ""; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { btnAdd.Attributes.Add("onclick", "setDivPos('Lay1');Lay1.style.visibility='';progress_update();"); //btnClose.Attributes.Add("onclick", "javascript:return confirm('确认关闭吗?');"); if (Request.QueryString["linqid"] != null) { string LinqID = Request.QueryString["linqid"].ToString(); string LinqName = KPI_LinqDal.GetLinqName(LinqID); //标签信息 lbl_Name.Text = "当前配置指标为:" + LinqName; ViewState["linqid"] = LinqID; ////////////////////////////////////////////// //机组信息 DataTable dt = KPI_UnitDal.GetUnits(""); foreach (DataRow dr in dt.Rows) { ddl_UnitID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } BindValues(); BindECs(); } } }