private List <SystemParameterEntity> GetDataSource() { KPI_SystemDal DataAccess = new KPI_SystemDal(); List <SystemParameterEntity> List = new List <SystemParameterEntity>(); SystemParameterEntity SystemParameter, Param; List <KPI_UnitEntity> UnitList = KPI_UnitDal.GetAllEntity(); foreach (KPI_UnitEntity Unit in UnitList) { SystemParameter = DataAccess.GetSystemParameter(Unit.UnitID); if (SystemParameter == null) { SystemParameter = new SystemParameterEntity(); SystemParameter.SysName = Unit.UnitID; SystemParameter.SysDesc = Unit.UnitName + "奖金金额"; } SystemParameter.SysCode = Unit.UnitCode; Param = DataAccess.GetSystemParameter(Unit.UnitCode); if (Param != null) { SystemParameter.SysValue2 = Param.SysValue; } //SystemParameter.SysValue2 = DataAccess.GetSystemParameter(Unit.UnitCode).SysValue; List.Add(SystemParameter); } return(List); }
protected void btnUpdateOffset_Click(object sender, EventArgs e) { //判断 int a = 0; if (!int.TryParse(tbxKPIOffset.Text.Trim(), out a)) { MessageBox.popupClientMessage(this.Page, "数值不正确!", "call();"); return; } if (a < 0) { MessageBox.popupClientMessage(this.Page, "数值不能为负值,请调整计算站时间!", "call();"); return; } // if (KPI_SystemDal.UpdateByName("KPIOffset", "1", a.ToString(), "")) { //MessageBox.popupClientMessage(this.Page, "编辑成功!", "call();"); BindGrid(); } }
void BindGrid() { DataTable dt = KPI_SystemDal.GetParamList(); gvSys.DataSource = dt; gvSys.DataBind(); }
/// <summary> /// /// </summary> /// <param name="bFirst"></param> /// <returns></returns> public bool KPIOffReload() { try { KPI_SystemDal.UpdateByName("KPIReload", "1", "0", ""); return(true); } catch (Exception ex) { LogUtil.LogMessage(ex.ToString()); return(false); } }
/// <summary> /// /// </summary> /// <param name="bFirst"></param> /// <returns></returns> public bool KPISetReload() { try { return(KPI_SystemDal.GetKPIReload()); } catch (Exception ex) { LogUtil.LogMessage(ex.ToString()); return(false); } }
protected void btnUpdateKPIFirstURL_Click(object sender, EventArgs e) { string url = tbxKPIFirtURL.Text; // if (KPI_SystemDal.UpdateByName("KPIFirstURL", "1", url, "")) { //MessageBox.popupClientMessage(this.Page, "编辑成功!", "call();"); BindGrid(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { rbnKPIAuto.SelectedValue = KPI_SystemDal.GetKPIAuto().ToString(); rbnKPITimeMode.SelectedValue = KPI_SystemDal.GetKPITimeMode().ToString(); tbxKPIOffset.Text = KPI_SystemDal.GetKPIOffset().ToString(); rbnKPIReload.SelectedValue = KPI_SystemDal.GetKPIReload()?"1" :"0"; BindGrid(); } }
protected void rbnKPIReload_SelectedIndexChanged(object sender, EventArgs e) { //判断 if (rbnKPIReload.SelectedValue == "0" || rbnKPIReload.SelectedValue == "1") { if (KPI_SystemDal.UpdateByName("KPIReload", "1", rbnKPIReload.SelectedValue, "")) { //MessageBox.popupClientMessage(this.Page, "编辑成功!", "call();"); BindGrid(); } } }
////////////////////////////////////////////////////////////////////////////// #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 btnSave_Click(Object sender, EventArgs e) { Literal lblSysName, lblSysDesc, lblSysCode; TextBox txtSysValue, txtSysNote, txtSysValue2; KPI_SystemDal DataAccess = new KPI_SystemDal(); SystemParameterEntity SystemParameter; RepeaterItemCollection Items = Repeater1.Items; foreach (RepeaterItem Item in Items) { lblSysName = (Literal)Item.FindControl("lblSysName"); lblSysDesc = (Literal)Item.FindControl("lblSysDesc"); lblSysCode = (Literal)Item.FindControl("lblSysCode"); txtSysValue = (TextBox)Item.FindControl("txtSysValue"); txtSysValue2 = (TextBox)Item.FindControl("txtSysValue2"); txtSysNote = (TextBox)Item.FindControl("txtSysNote"); SystemParameter = new SystemParameterEntity(); SystemParameter.SysEngunit = "元"; SystemParameter.SysIsValid = 1; SystemParameter.SysID = DateTime.Now.Ticks + ""; SystemParameter.SysName = lblSysName.Text; SystemParameter.SysDesc = lblSysDesc.Text; SystemParameter.SysValue = txtSysValue.Text; SystemParameter.SysNote = txtSysNote.Text; DataAccess.SaveSystemParameter(SystemParameter); SystemParameter = new SystemParameterEntity(); SystemParameter.SysEngunit = ""; SystemParameter.SysIsValid = 1; SystemParameter.SysID = lblSysName.Text; SystemParameter.SysName = lblSysCode.Text; SystemParameter.SysDesc = "奖励名次"; SystemParameter.SysValue = txtSysValue2.Text; SystemParameter.SysNote = "奖励名次"; DataAccess.SaveSystemParameter(SystemParameter); } ShowMessage("数据保存成功!"); }
protected void gvSys_RowUpdating(object sender, GridViewUpdateEventArgs e) { string sysid = ((Label)(gvSys.Rows[e.RowIndex].Cells[0].FindControl("sysid"))).Text.ToString().Trim(); string valid = ((TextBox)(gvSys.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim(); string value = ((TextBox)(gvSys.Rows[e.RowIndex].Cells[4].Controls[0])).Text.ToString().Trim(); string note = ((TextBox)(gvSys.Rows[e.RowIndex].Cells[5].Controls[0])).Text.ToString().Trim(); if (KPI_SystemDal.UpdateByID(sysid, valid, value, note)) { gvSys.EditIndex = -1; BindGrid(); //MessageBox.popupClientMessage(this.Page, "编辑成功!", "call();"); return; } else { MessageBox.popupClientMessage(this.Page, "编辑错误!", "call();"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //if (Request.QueryString["title"] != null) //{ // string title = OPM_TitleDal.GetTitle(Request.QueryString["title"].ToString()); // if (title != "") // { // lblTitle.Text = title; // } //} //电厂信息 DataTable dt = KPI_PlantDal.GetPlants(""); //ddlPlant.Items.Add(new ListItem("全部", "ALL")); foreach (DataRow dr in dt.Rows) { ddlPlant.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } //机组信息 //dt = KPI_UnitDal.GetUnits(""); ////ddlUnit.Items.Add(new ListItem("全部", "ALL")); //foreach (DataRow dr in dt.Rows) //{ // ddlUnit.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); //} //是否显示单元 if (Request.QueryString["plantcode"] != null) { string plantcode = Request.QueryString["plantcode"].ToString(); if (plantcode != "") { string plantid = KPI_PlantDal.GetPlantIDByCode(plantcode); ddlPlant.Visible = false; lblPlant.Visible = false; ddlPlant.SelectedValue = plantid; } } //页面集合 // if (Request.QueryString["ecweb"] != null) { ViewState["ecweb"] = Request.QueryString["ecweb"].ToString(); } else { ViewState["ecweb"] = ""; } //初始化时间 txt_Month.Value = DateTime.Now.ToString("yyyy-MM"); // tbxKPIMoney.Text = KPI_SystemDal.GetKPIMoney().ToString(); BindValues(); } }