58 lines
2.0 KiB
C#
58 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace ControlServer
|
|
{
|
|
public partial class Form3 : Form
|
|
{
|
|
public Form3(string terminalName, string terminalIP) // 매개변수 추가
|
|
{
|
|
InitializeComponent();
|
|
|
|
// 가져온 데이터를 Form3의 라벨이나 텍스트박스에 표시
|
|
lblTerminalName.Text = terminalName;
|
|
lblTerminalIP.Text = terminalIP;
|
|
|
|
txtBoxOnYY.TextChanged += ValidateInputs;
|
|
txtBoxOnMM.TextChanged += ValidateInputs;
|
|
txtBoxOffYY.TextChanged += ValidateInputs;
|
|
txtBoxOffMM.TextChanged += ValidateInputs;
|
|
txtBoxOnYY.PlaceholderText = "YY";
|
|
txtBoxOnMM.PlaceholderText = "MM";
|
|
txtBoxOffYY.PlaceholderText = "YY";
|
|
txtBoxOffMM.PlaceholderText = "MM";
|
|
}
|
|
|
|
private void ValidateInputs(object? sender, EventArgs e)
|
|
{
|
|
// 프로그램 시간 조건 체크
|
|
bool isOnYYEmpty = string.IsNullOrWhiteSpace(txtBoxOnYY.Text);
|
|
bool isOnMMEmpty = string.IsNullOrWhiteSpace(txtBoxOnMM.Text);
|
|
bool isOffYYEmpty = string.IsNullOrWhiteSpace(txtBoxOffYY.Text);
|
|
bool isOffMMEmpty = string.IsNullOrWhiteSpace(@txtBoxOffMM.Text);
|
|
|
|
// 둘 다 비어있거나(AND), 둘 다 비어있지 않거나(AND)
|
|
bool isTimeValid = (isOnYYEmpty && isOnMMEmpty && isOffYYEmpty && isOffMMEmpty) || (!isOnYYEmpty && !isOnMMEmpty && !isOffYYEmpty && !isOffMMEmpty);
|
|
|
|
// 저장 버튼 활성화
|
|
btnUpdate.Enabled = isTimeValid;
|
|
}
|
|
|
|
private void btnCancel_MouseClick(object sender, MouseEventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void btnUpdate_MouseClick(object sender, MouseEventArgs e)
|
|
{
|
|
// 수정
|
|
// 수정 시 DB 저장
|
|
}
|
|
}
|
|
}
|