public void SaveBaseData() { PropertyInfo[] propertyInfos = m_RESULT_VEHICLE_INFO.GetType().GetProperties(); foreach (Control col in tabBase.Controls) { if (col is FieldTxt) { FieldTxt fieldTxt = (FieldTxt)col; foreach (PropertyInfo p in propertyInfos) { if (p.Name == fieldTxt.Name.Replace("txt", "")) { p.SetValue(m_RESULT_VEHICLE_INFO, Convert.ChangeType(fieldTxt.Text, p.PropertyType), null); } } } } IRESULT_VEHICLE_INFO_BLL bll = ObjectFactory.CreateObject <IRESULT_VEHICLE_INFO_BLL>(); bll.UpdateResultVehicleInfo(m_RESULT_VEHICLE_INFO); }
public Form1() { try { InitializeComponent(); LoadForm(); LOGIN_VEHICLE_INFO_Entity entity = new LOGIN_VEHICLE_INFO_Entity(); IRESULT_VEHICLE_INFO_BLL bll = ObjectFactory.CreateObject <IRESULT_VEHICLE_INFO_BLL>(); dgvMain.DataSource = bll.GetVehicleResultDataSet().Tables[0]; dgvMain.Columns[0].Width = 50; dgvMain.Columns[1].Width = 300; dgvMain.Columns[2].Width = 150; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void LoadBaseData(string strJCLSH) { IRESULT_VEHICLE_INFO_BLL bll = ObjectFactory.CreateObject <IRESULT_VEHICLE_INFO_BLL>(); m_RESULT_VEHICLE_INFO = bll.GetResultVehicleInfoByJCLSH(strJCLSH); PropertyInfo[] propertyInfo = m_RESULT_VEHICLE_INFO.GetType().GetProperties(); foreach (Control col in tabBase.Controls) { if (col is FieldTxt) { FieldTxt fieldTxt = (FieldTxt)col; foreach (PropertyInfo p in propertyInfo) { if (p.Name == fieldTxt.Name.Replace("txt", "")) { fieldTxt.Text = (string)p.GetValue(m_RESULT_VEHICLE_INFO, null); } } } } }