2. 기준값 초기화시 신규 설정된 기준값이 바로 저장되도록 함 (필요한 경우 5분 혹은 10분간격으로 window1, window2 : grp 파일은 생성해주는 것이 좋을 듯함) 3. 알람 설정화면을 통해서 값 변경시 , 기준값초기화 기능이 서브윈도우에 적용되지 않는 버그 수정
142 lines
5.7 KiB
C#
142 lines
5.7 KiB
C#
using System.Collections.Generic;
|
|
using System;
|
|
using System.Drawing;
|
|
using System.Diagnostics;
|
|
using System.Data;
|
|
using System.Collections;
|
|
using System.Windows.Forms;
|
|
using System.Linq;
|
|
using AR;
|
|
using vmsnet;
|
|
|
|
namespace vmsnet
|
|
{
|
|
public partial class Frm_Alam
|
|
{
|
|
public Frm_Alam()
|
|
{
|
|
InitializeComponent();
|
|
this.KeyDown += (s1, e1) =>
|
|
{
|
|
if (e1.KeyCode == Keys.Escape) this.Close();
|
|
};
|
|
}
|
|
|
|
|
|
DataTable dt;
|
|
public void Frm_Alam_Load(object sender, System.EventArgs e)
|
|
{
|
|
dt = this.DataSet1.Tables[0];
|
|
dt.Rows.Clear();
|
|
try
|
|
{
|
|
var Dtg = PUB.DS.GRP.Select("use=1", "idx") as DocumentElement.GRPRow[]; // DBC.GetTable("select * from GRP where USE=1 order by IDX")
|
|
foreach (var drg in Dtg)
|
|
{
|
|
DataRow dr = dt.NewRow();
|
|
dr["group"] = drg.TITLE;// ["TITLE"].ToString();
|
|
dr["type"] = drg.ALAMTYPE;// ["ALAMTYPE"].ToString();
|
|
dr["high"] = drg.ALAMH;// ["ALAMH"].ToString();
|
|
dr["low"] = drg.ALAML;// ["ALAML"].ToString();
|
|
dr["ahigh"] = drg.AUTOH;//"].ToString();
|
|
dr["alow"] = drg.AUTOL;//"].ToString();
|
|
dr["nbhh"] = drg.NBHH;//"].ToString();
|
|
dr["nbh"] = drg.NBH;//"].ToString();
|
|
dr["nbl"] = drg.NBL;//"].ToString();
|
|
dr["nbll"] = drg.NBLL;//"].ToString();
|
|
dr["SET"] = "SET";
|
|
dr["IDX"] = drg["IDX"];
|
|
dt.Rows.Add(dr);
|
|
}
|
|
dt.AcceptChanges();
|
|
}
|
|
catch (Exception)
|
|
{
|
|
UTIL.MsgE("알람 목록을 불러올 수 없습니다" + "\r\n" + "이 창을 닫고 다시 클릭하세요");
|
|
}
|
|
|
|
}
|
|
|
|
public void Button1_Click(System.Object sender, System.EventArgs e)
|
|
{
|
|
this.DataGridView1.EndEdit();
|
|
this.BindingSource1.EndEdit();
|
|
DataTable CDT = dt.GetChanges();
|
|
if (CDT == null)
|
|
{
|
|
//MsgBox("변경된 내용이 없습니다", MsgBoxStyle.Information, "확인")
|
|
if (chkResetValue.Checked)
|
|
this.DialogResult = DialogResult.OK;
|
|
else
|
|
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
|
}
|
|
else
|
|
{
|
|
foreach (DataRow DR in CDT.Rows)
|
|
{
|
|
string TYPE = DR["type"].ToString();
|
|
string title = DR["group"].ToString();
|
|
string HIG = DR["high"].ToString().Trim();
|
|
string LOW = DR["low"].ToString().Trim();
|
|
string AHG = DR["ahigh"].ToString().Trim();
|
|
string ALW = DR["alow"].ToString().Trim();
|
|
var idx = int.Parse(DR["IDX"].ToString());
|
|
string NBH = DR["NBH"].ToString().Trim();
|
|
string NBL = DR["NBL"].ToString().Trim();
|
|
|
|
if (HIG.IsNumeric() == false) HIG = "0";
|
|
if (LOW.IsNumeric() == false) LOW = "0";
|
|
if (AHG.IsNumeric() == false) AHG = "0";
|
|
if (ALW.IsNumeric() == false) ALW = "0";
|
|
if (NBH.IsNumeric() == false) NBH = "0";
|
|
if (NBL.IsNumeric() == false) NBL = "0";
|
|
|
|
////그룹정보업데이트
|
|
PUBC.UpdateGroup(idx, TYPE, float.Parse(HIG), float.Parse(LOW), float.Parse(AHG), float.Parse(ALW), float.Parse(NBH), float.Parse(NBL));
|
|
|
|
////설정바꾼다.
|
|
PUB.RaiseRemoteCommandEvent(rCommand.UpdateAlarmSetting,idx);
|
|
|
|
|
|
}
|
|
this.DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
}
|
|
}
|
|
|
|
public void DataGridView1_CellContentClick(System.Object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
public void DataGridView1_CellFormatting(object sender, System.Windows.Forms.DataGridViewCellFormattingEventArgs e)
|
|
{
|
|
if (this.DataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString() == "MANUAL")
|
|
{
|
|
this.DataGridView1.Rows[e.RowIndex].Cells[2].Style.BackColor = Color.White;
|
|
this.DataGridView1.Rows[e.RowIndex].Cells[3].Style.BackColor = Color.White;
|
|
this.DataGridView1.Rows[e.RowIndex].Cells[4].Style.BackColor = Color.Gainsboro;
|
|
this.DataGridView1.Rows[e.RowIndex].Cells[5].Style.BackColor = Color.Gainsboro;
|
|
}
|
|
else if (this.DataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString() == "AUTO")
|
|
{
|
|
this.DataGridView1.Rows[e.RowIndex].Cells[4].Style.BackColor = Color.White;
|
|
this.DataGridView1.Rows[e.RowIndex].Cells[5].Style.BackColor = Color.White;
|
|
this.DataGridView1.Rows[e.RowIndex].Cells[2].Style.BackColor = Color.Gainsboro;
|
|
this.DataGridView1.Rows[e.RowIndex].Cells[3].Style.BackColor = Color.Gainsboro;
|
|
}
|
|
else
|
|
{
|
|
this.DataGridView1.Rows[e.RowIndex].Cells[4].Style.BackColor = Color.Gainsboro;
|
|
this.DataGridView1.Rows[e.RowIndex].Cells[5].Style.BackColor = Color.Gainsboro;
|
|
this.DataGridView1.Rows[e.RowIndex].Cells[2].Style.BackColor = Color.Gainsboro;
|
|
this.DataGridView1.Rows[e.RowIndex].Cells[3].Style.BackColor = Color.Gainsboro;
|
|
}
|
|
}
|
|
|
|
private void DataGridView1_DataError(object sender, DataGridViewDataErrorEventArgs e)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|