Files
Groupware/SubProject/FPJ0000/Project/fLayoutEdit.cs
2024-05-08 14:53:55 +09:00

90 lines
2.7 KiB
C#

using FCOMMON;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FPJ0000.Project
{
public partial class fLayoutEdit : fBase
{
public fLayoutEdit(int no)
{
InitializeComponent();
this.textBox1.Text = no.ToString();
var db = ta.GetData(FCOMMON.info.Login.gcode);
var dr = db.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.no == no).FirstOrDefault();
if (dr != null)
{
textBox2.Text = dr.project.ToString();
textBox3.Text = dr.reserve;
if (string.IsNullOrEmpty(dr.reserve) == false)
textBox3.Tag = dr.reserve;
}
else
{
textBox2.Enabled = false;
textBox3.Enabled = false;
}
}
private void fLayoutEdit_Load(object sender, EventArgs e)
{
EnsureVisibleAndUsableSize();
}
private void button1_Click(object sender, EventArgs e)
{
//값을 저장해준다.
var db = ta.GetData(FCOMMON.info.Login.gcode);
var no = int.Parse(textBox1.Text);
var dr = db.Where(t => t.no == no).FirstOrDefault();
if (dr != null)
{
dr.reserve = this.textBox3.Text.Trim();
dr.project = int.Parse(textBox2.Text);
dr.EndEdit();
ta.Update(dr);
DialogResult = DialogResult.OK;
}
else
{
FCOMMON.Util.MsgE("해당 자료를 찾을 수 없습니다");
}
}
private void button2_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBox3.Text))
{
textBox3.Text = FCOMMON.info.Login.nameK;
}
else
{
if (textBox3.Text != FCOMMON.info.Login.nameK)
{
FCOMMON.Util.MsgE("타인이 예약된 상태입니다. 기 예약자가 해당 내역을 지운 후 사용하세요\n"+
"(현재는 베타라서 삭제 됩니다)");
textBox3.Text = string.Empty;
}
else
{
if(FCOMMON.Util.MsgQ("예약 정보를 삭제 할까요?")== DialogResult.Yes)
textBox3.Text = string.Empty;
}
}
}
}
}