protected void btnAddCycle_Click(object sender, EventArgs e) { int index = CycleDal.CycleIDCounts(); string sID = PageControl.GetGuid(); CycleEntity ote = new CycleEntity(); ote.CycleID = sID; ote.CycleName = "TX"; ote.CycleDesc = "10分钟"; ote.CycleValue = 10; ote.CycleNote = "分钟计算周期"; ote.CycleCreateTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"); ote.CycleModifyTime = ote.CycleCreateTime; if (CycleDal.Insert(ote)) { //MessageBox.popupClientMessage(this.Page, "添加成功!", "call();"); } else { MessageBox.popupClientMessage(this.Page, "添加错误!", "call();"); } gvCycle.EditIndex = index; BindGrid(); }
protected void gvCycle_RowUpdating(object sender, GridViewUpdateEventArgs e) { string keyid = ((HtmlInputHidden)(gvCycle.Rows[e.RowIndex].Cells[0].FindControl("Cycleid"))).Value; string eName = ((TextBox)(gvCycle.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim().ToUpper(); string eDesc = ((TextBox)(gvCycle.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim(); string eValue = ((TextBox)(gvCycle.Rows[e.RowIndex].Cells[3].Controls[0])).Text.ToString().Trim(); string eNote = ((TextBox)(gvCycle.Rows[e.RowIndex].Cells[4].Controls[0])).Text.ToString().Trim(); string msg = ""; if (eName == "") { msg += "名称不能为空!\r\n"; } if (!Regex.IsMatch(eValue, "^[0-9]+$")) { msg += "周期只能为数字!\r\n"; } if ( (int.Parse(eValue)<=60 && 60 % int.Parse(eValue)!=0) || (int.Parse(eValue) > 60 && int.Parse(eValue) % 60 != 0)) { msg += "周期只能为分钟的倍数!\r\n"; } if ((eName != "TN" || eName != "TD") && double.Parse(eValue) == 0) { msg += "除TN,TD外,计算周期不能为0"; } if (msg != "") { MessageBox.popupClientMessage(this.Page, msg); return; } if (CycleDal.CycleNameExists(eName, keyid)) { MessageBox.popupClientMessage(this.Page, "该周期已存在!", "call();"); return; } CycleEntity mEntity = new CycleEntity(); mEntity.CycleID = keyid; mEntity.CycleName = eName; mEntity.CycleDesc = eDesc; mEntity.CycleValue = int.Parse(eValue); mEntity.CycleNote = eNote; //mEntity.CycleCreateTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"); mEntity.CycleModifyTime = DateTime.Now.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss"); if (!CycleDal.Update(mEntity)) { MessageBox.popupClientMessage(this.Page, "编辑错误!", "call();"); } else { MessageBox.popupClientMessage(this.Page, "编辑成功!", "call();"); gvCycle.EditIndex = -1; BindGrid(); } }
/// <summary> /// KPI_Snapshot And KPI_Archive的操作 /// </summary> /// <returns></returns> public bool KPICalcForTD(bool bsnap, ECTagEntity ecte, CycleEntity cye, DateTime dtValid, string strCurrentShift, string strCurrentPeriod, out ECSSValueEntity kpiEV) { //bsnap== false时,更新 EC_SSArchive即可。 kpiEV = null; return true; }