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 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); } } } } }