0
양식 컨트롤에 LINQ를 통해 채워지는 개체를 쉽게 채울 수 있는지 알고 싶습니다. 다음은 코드를입니다WPF에서 양식 개체 채우기
코드
private void REG_NO_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
{
string pattern = "^[A-Z][0-9]*-[0-9]+$";
regNo = this.REG_NO.Text;
if (e.Key == System.Windows.Input.Key.Return)
{
if (!Regex.Match(regNo, pattern).Success)
{
System.Windows.MessageBox.Show("Invalid Card Number");
this.REG_NO.Background = Brushes.OrangeRed;
this.REG_NO.Focus();
}
else
{
this.REG_NO.Background = (Brush)App.Current.FindResource("InputBoxGradient");
//Fetch Data From Database
DataAccessLayer DataLayer = new DataAccessLayer();
if (!DataLayer.FetchRegisteredCard(regNo, ref RegCard))
{
System.Windows.MessageBox.Show("No Medical Card Found");
}
else
{
if (RegCard.STATUS == "VALID")
{
}
else
{
System.Windows.MessageBox.Show("Card IS Locked Please Contact ADO/Administrator");
}
}
}
}
}
작성과 같은 속성이 'RegCard은'이것 채워집니다 객체입니다 같은
namespace HospitalSystem
{
using System;
using System.Collections.Generic;
public partial class tbl_registration
{
public string REG_NO { get; set; }
public Nullable<System.DateTime> R_DATE { get; set; }
public string EMP_NO { get; set; }
public string P_NAME { get; set; }
public Nullable<System.DateTime> P_DOB { get; set; }
public string RELATION { get; set; }
public string BLOOD_GROUP { get; set; }
public string P_MEDICAL_CAT { get; set; }
public string MARITAL_STATUS { get; set; }
public string SEX { get; set; }
public string STATUS { get; set; }
public Nullable<System.DateTime> EXP_DATE { get; set; }
public string PT_NIC { get; set; }
public string REMARKS { get; set; }
public Nullable<System.DateTime> STATUS_DATE { get; set; }
public string EMP_Dept { get; set; }
public string EMP_Des { get; set; }
public string EMP_Name { get; set; }
}
}
로 이름을 가지고있는 객체 선 양식 컨트롤을 채우려합니다.
if (RegCard.STATUS == "VALID")
{
}
그렇게하는 방법을 알려줘.