protected void btnAddSeq_Click(object sender, EventArgs e) { int index = KPI_SeqDal.SeqIDCounts(); string sID = PageControl.GetGuid(); KPI_SeqEntity ote = new KPI_SeqEntity(); ote.SeqID = sID; ote.SeqCode = "InputCode"; ote.SeqName = "Input Name"; ote.SeqDesc = ""; ote.SeqIsValid = 1; ote.SeqNote = ""; ote.SeqCreateTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"); ote.SeqModifyTime = ote.SeqCreateTime; if (KPI_SeqDal.Insert(ote)) { //MessageBox.popupClientMessage(this.Page, "添加成功!", "call();"); } else { MessageBox.popupClientMessage(this.Page, "添加错误!", "call();"); } gvSeq.EditIndex = index; BindSeq(); }
/// <summary> /// //设备信息 /// </summary> void BindSeq() { //设备信息 DataTable dtSeq = KPI_SeqDal.GetSearchList(""); gvSeq.DataSource = dtSeq; gvSeq.DataBind(); }
protected void gvSeq_RowUpdating(object sender, GridViewUpdateEventArgs e) { HtmlInputHidden key = (HtmlInputHidden)gvSeq.Rows[e.RowIndex].Cells[0].FindControl("seqid"); string sID = key.Value; string sCode = ((TextBox)(gvSeq.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim(); string sName = ((TextBox)(gvSeq.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim(); string sDesc = ((TextBox)(gvSeq.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim(); string sNote = ((TextBox)(gvSeq.Rows[e.RowIndex].Cells[4].Controls[0])).Text.ToString().Trim(); string msg = ""; if (sName == "" || sCode == "") { msg += "代码或名称不能为空!\r\n"; } if (!Regex.IsMatch(sCode, "^[A-Za-z0-9]+$")) { msg += "代码只能为字母和数字组成!\r\n"; } if (msg != "") { MessageBox.popupClientMessage(this.Page, msg); return; } //代码是否重复 if (KPI_SeqDal.SeqCodeExists(sCode, sID)) { MessageBox.popupClientMessage(this.Page, "已存在相同的代码!"); return; } //更新 KPI_SeqEntity ote = new KPI_SeqEntity(); ote.SeqID = sID; ote.SeqCode = sCode; ote.SeqName = sName; ote.SeqDesc = sDesc; ote.SeqNote = sNote; ote.SeqModifyTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"); if (KPI_SeqDal.Update(ote)) { MessageBox.popupClientMessage(this.Page, "编辑成功!", "call();"); } else { MessageBox.popupClientMessage(this.Page, "编辑错误!", "call();"); } gvSeq.EditIndex = -1; BindSeq(); }
protected void rblRMType_SelectedIndexChanged(object sender, EventArgs e) { if (rblRMType.SelectedValue == "0") { cbxRMKPIID.Visible = false; ddlRMKPIID.Visible = true; ddlRMKPIID.Items.Clear(); DataTable dt = KPI_UnitDal.GetUnits(""); foreach (DataRow dr in dt.Rows) { ddlRMKPIID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } } else if (rblRMType.SelectedValue == "1") { cbxRMKPIID.Visible = false; ddlRMKPIID.Visible = true; ddlRMKPIID.Items.Clear(); DataTable dt = KPI_SeqDal.GetSeqs(); foreach (DataRow dr in dt.Rows) { ddlRMKPIID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } } else if (rblRMType.SelectedValue == "2") { cbxRMKPIID.Visible = false; ddlRMKPIID.Visible = true; ddlRMKPIID.Items.Clear(); DataTable dt = KpiDal.GetKpis(); foreach (DataRow dr in dt.Rows) { ddlRMKPIID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } } else if (rblRMType.SelectedValue == "3") { cbxRMKPIID.Visible = true; cbxRMKPIID.Items.Clear(); ddlRMKPIID.Visible = false; ddlRMKPIID.Items.Clear(); DataTable dt = ECTagDal.GetECs(); foreach (DataRow dr in dt.Rows) { cbxRMKPIID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { btnDelete.Attributes.Add("onclick", "return confirm('确认删除吗?');"); //机组信息 DataTable dt = KPI_UnitDal.GetUnits(""); ddl_UnitID.Items.Add(new ListItem("所有机组集", "ALL")); foreach (DataRow dr in dt.Rows) { ddl_UnitID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } //设备信息 dt = KPI_SeqDal.GetSeqs(); ddl_SeqID.Items.Add(new ListItem("所有设备集", "ALL")); foreach (DataRow dr in dt.Rows) { ddl_SeqID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } //指标信息 dt = KpiDal.GetKpis(); ddl_KpiID.Items.Add(new ListItem("所有指标集", "ALL")); foreach (DataRow dr in dt.Rows) { ddl_KpiID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } //周期集信息 //dt = KPI_CycleDal.GetCycles(); //ddl_CycleID.Items.Add(new ListItem("所有周期", "ALL")); //foreach (DataRow dr in dt.Rows) //{ // ddl_CycleID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); //} //实时指标信息 dt = ECTagDal.GetECs(); ddl_ECID.Items.Add(new ListItem("所有指标", "ALL")); foreach (DataRow dr in dt.Rows) { ddl_ECID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } BindEC(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //机组信息 DataTable dt = KPI_UnitDal.GetUnits(""); ddl_UnitID.Items.Add(new ListItem("所有机组集", "ALL")); foreach (DataRow dr in dt.Rows) { ddl_UnitID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } //设备信息 dt = KPI_SeqDal.GetSeqs(); ddl_SeqID.Items.Add(new ListItem("所有设备集", "ALL")); foreach (DataRow dr in dt.Rows) { ddl_SeqID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } //指标信息 dt = KpiDal.GetKpis(); ddl_KpiID.Items.Add(new ListItem("所有指标集", "ALL")); foreach (DataRow dr in dt.Rows) { ddl_KpiID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } //周期集信息 //dt = KPI_CycleDal.GetCycles(); //ddl_CycleID.Items.Add(new ListItem("所有周期", "ALL")); //foreach (DataRow dr in dt.Rows) //{ // ddl_CycleID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); //} //安全指标信息 dt = KPI_SATagDal.GetSAs(); ddl_SAID.Items.Add(new ListItem("所有安全指标", "ALL")); foreach (DataRow dr in dt.Rows) { ddl_SAID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } BindSA(); } }
protected void gvSeq_RowCommand(object sender, GridViewCommandEventArgs e) { string keyid = e.CommandArgument.ToString(); if (e.CommandName == "dataDelete") { if (KPI_SeqDal.DeleteSeq(keyid)) { MessageBox.popupClientMessage(this.Page, "删除成功!", "call();"); BindSeq(); } else { MessageBox.popupClientMessage(this.Page, "删除错误!", "call();"); } } }
////////////////////////////////////////////////////////////////////////////// #region Define Functions /// <summary> /// /// </summary> /// <returns></returns> public bool KPIInitialVar() { try { //是否取服务器时间 bTimeMode = KPI_SystemDal.GetKPITimeMode() == 1 ? true : false; //偏置时间 nOffset = KPI_SystemDal.GetKPIOffset(); //初始所有List<> ltUnits = KPI_UnitDal.GetValidEntity(); ltSeqs = KPI_SeqDal.GetValidEntity(); ltKpis = KpiDal.GetValidEntity(); //实时、手录、曲线指标 ltReals = KPI_RealTagDal.GetAllEntity(); ltInputs = KPI_InputTagDal.GetAllEntity(); ltCurves = CurveTagDal.GetAllEntity(); //计算周期 List <CycleEntity> ltCYs = CycleDal.GetAllEntity(); dicCYs = new Dictionary <string, CycleEntity>(); foreach (CycleEntity cye in ltCYs) { dicCYs[cye.CycleID] = cye; } //经济指标 ltECs = ECTagDal.GetValidEntity(); ltXLines = ECTagDal.GetAllXLineEntity(); ltScores = ECTagDal.GetAllScoreEntity(); ///////////////////////////////////////////////////////////////// //安全指标 dicUnitStatus = new Dictionary <string, bool>(); dicUnitPEs = new Dictionary <string, double>(); dicTags = new Dictionary <string, double>(); dicRealTag = new Dictionary <string, RealTag>(); } catch (Exception ex) { LogUtil.LogMessage(ex.ToString()); return(false); } return(true); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { btnApply.Attributes.Add("onclick", "setDivPos('Lay1');Lay1.style.visibility='';progress_update();"); //机组信息 DataTable dt = KPI_UnitDal.GetUnits(""); foreach (DataRow dr in dt.Rows) { ddl_UnitID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } //设备信息 dt = KPI_SeqDal.GetSeqs(); foreach (DataRow dr in dt.Rows) { ddl_SeqID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } //指标信息 dt = KpiDal.GetKpis(); foreach (DataRow dr in dt.Rows) { ddl_KpiID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } //单位信息 dt = EngunitDal.GetEngunits(); foreach (DataRow dr in dt.Rows) { ddl_EngunitID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } //周期信息 dt = CycleDal.GetCycles(); foreach (DataRow dr in dt.Rows) { ddl_CycleID.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } //网页集信息 //信息在KPI_Constant表中 dt = KPI_ConstantDal.GetECWebs(); foreach (DataRow dr in dt.Rows) { ddl_ECWeb.Items.Add(new ListItem(dr["Name"].ToString(), dr["Value"].ToString())); } //判断是否新建或编辑 if (Request.QueryString["ecid"] != null) { ViewState["ecid"] = Request.QueryString["ecid"].ToString(); BindValues(); } else { //添加 ViewState["ecid"] = ""; // ddl_ECIsValid.Value = "1"; ddl_ECIsCalc.Value = "1"; ddl_ECIsDisplay.Value = "1"; ddl_ECIsTotal.Value = "1"; SetECCodeAndName(); txt_ECIndex.Value = "100"; txt_ECWeight.Value = "1"; txt_ECDenom.Value = "1"; txt_ECCalcClass.Value = "1"; } btnApply.Visible = true; } }
protected bool ImportFromExcelToModify(DataSet ds) { string strError = ""; try { System.Data.DataTable dt = ds.Tables[0]; int nAll = dt.Rows.Count; int nModify = 0; int nNoExist = 0; foreach (System.Data.DataRow dr in dt.Rows) { if (dr["SelectX"].ToString().ToLower() == "x") { string ECCode = dr["ECCode"].ToString().Trim(); strError = ECCode; //判断是否存在 if (!ECTagDal.CodeExist(ECCode, "")) { //MessageBox.popupClientMessage(this.Page, " 该机组的输出标签已存在!", "call();"); nNoExist += 1; continue; } //main tag string keyid = ECTagDal.GetECIDByCode(ECCode); ECTagEntity mEntity = new ECTagEntity(); mEntity.ECID = keyid; string UnitName = dr["UnitName"].ToString().Trim(); mEntity.UnitID = KPI_UnitDal.GetUnitID(UnitName); string SeqName = dr["SeqName"].ToString().Trim(); mEntity.SeqID = KPI_SeqDal.GetSeqID(SeqName); string KpiName = dr["KpiName"].ToString().Trim(); mEntity.KpiID = KpiDal.GetKpiID(KpiName); string EngunitName = dr["EngunitName"].ToString().Trim(); mEntity.EngunitID = EngunitDal.GetEngunitID(EngunitName); string CycleName = dr["CycleName"].ToString().Trim(); mEntity.CycleID = CycleDal.GetCycleID(CycleName); mEntity.ECCode = dr["ECCode"].ToString().Trim(); mEntity.ECName = dr["ECName"].ToString().Trim(); mEntity.ECDesc = dr["ECDesc"].ToString().Trim(); mEntity.ECIndex = int.Parse(dr["ECIndex"].ToString().Trim()); mEntity.ECWeb = dr["ECWeb"].ToString().Trim(); mEntity.ECIsValid = int.Parse(dr["ECIsValid"].ToString().Trim()); mEntity.ECIsCalc = int.Parse(dr["ECIsCalc"].ToString().Trim()); mEntity.ECIsAsses = int.Parse(dr["ECIsAsses"].ToString().Trim()); mEntity.ECIsZero = int.Parse(dr["ECIsZero"].ToString().Trim()); mEntity.ECIsDisplay = int.Parse(dr["ECIsDisplay"].ToString().Trim()); mEntity.ECIsTotal = int.Parse(dr["ECIsTotal"].ToString().Trim()); mEntity.ECDesign = dr["ECDesign"].ToString().Trim(); mEntity.ECOptimal = dr["ECOptimal"].ToString().Trim(); if (dr["ECMaxValue"].ToString().Trim() != "") { mEntity.ECMaxValue = decimal.Parse(dr["ECMaxValue"].ToString().Trim()); } if (dr["ECMinValue"].ToString().Trim() != "") { mEntity.ECMinValue = decimal.Parse(dr["ECMinValue"].ToString().Trim()); } mEntity.ECWeight = decimal.Parse(dr["ECWeight"].ToString().Trim()); mEntity.ECCalcClass = int.Parse(dr["ECCalcClass"].ToString().Trim()); mEntity.ECFilterExp = dr["ECFilterExp"].ToString().Trim(); mEntity.ECCalcExp = dr["ECCalcExp"].ToString().Trim(); mEntity.ECCalcDesc = dr["ECCalcDesc"].ToString().Trim(); mEntity.ECIsSnapshot = int.Parse(dr["ECIsSnapshot"].ToString().Trim()); mEntity.ECXLineType = int.Parse(dr["ECXLineType"].ToString().Trim()); mEntity.ECXLineGetType = int.Parse(dr["ECXLineGetType"].ToString().Trim()); mEntity.ECXLineXRealTag = dr["ECXLineXRealTag"].ToString().Trim(); mEntity.ECXLineYRealTag = dr["ECXLineYRealTag"].ToString().Trim(); mEntity.ECXLineZRealTag = dr["ECXLineZRealTag"].ToString().Trim(); mEntity.ECXLineXYZ = dr["ECXLineXYZ"].ToString().Trim(); mEntity.ECScoreExp = dr["ECScoreExp"].ToString().Trim(); mEntity.ECCurveGroup = dr["ECCurveGroup"].ToString().Trim(); mEntity.ECIsSort = int.Parse(dr["ECIsSort"].ToString().Trim()); mEntity.ECType = int.Parse(dr["ECType"].ToString().Trim()); mEntity.ECSort = int.Parse(dr["ECSort"].ToString().Trim()); mEntity.ECScore = dr["ECScore"].ToString().Trim(); mEntity.ECExExp = dr["ECExExp"].ToString().Trim(); mEntity.ECExScore = dr["ECExScore"].ToString().Trim(); mEntity.ECNote = dr["ECNote"].ToString().Trim(); mEntity.ECCreateTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"); mEntity.ECModifyTime = mEntity.ECCreateTime; ECTagDal.Update(mEntity); nModify += 1; } } string strInfor = "标签点总数为:{0}个, 修改成功:{1}个,不存在标签点: {2}个。"; strInfor = string.Format(strInfor, nAll, nModify, nNoExist); MessageBox.popupClientMessage(this.Page, strInfor, "call();"); return(true); } catch (Exception ee) { // MessageBox.popupClientMessage(this.Page, strError + ": " + ee.Message, "call();"); return(false); } }