88 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			88 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| 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 : Form
 | |
|     {
 | |
|         public fLayoutEdit(int no)
 | |
|         {
 | |
|             InitializeComponent();
 | |
|             this.textBox1.Text = no.ToString();
 | |
| 
 | |
|             var db = new EEEntities();
 | |
|             var dr = db.EETGW_Project_Layout.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)
 | |
|         {
 | |
| 
 | |
|         }
 | |
| 
 | |
|         private void button1_Click(object sender, EventArgs e)
 | |
|         {
 | |
| 
 | |
| 
 | |
| 
 | |
|             //값을 저장해준다.
 | |
|             var db = new EEEntities();
 | |
|             var no = int.Parse(textBox1.Text);
 | |
|             var dr = db.EETGW_Project_Layout.Where(t => t.no == no).FirstOrDefault();
 | |
|             if (dr != null)
 | |
|             {
 | |
|                 dr.reserve = this.textBox3.Text.Trim();
 | |
|                 dr.project = int.Parse(textBox2.Text);
 | |
|                 db.SaveChanges();
 | |
|                 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;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|     }
 | |
| }
 | 
