public RESULT_BRAKE GetEntityByJCLSH(string strJCLSH) { SqlDataReader sdr = SqlHelper.ExecuteReader(CommandType.Text, string.Format("SELECT * FROM RESULT_BRAKE WHERE JCLSH = '{0}'", strJCLSH)); RESULT_BRAKE entity = EntityHelper.FillEntity <RESULT_BRAKE>(sdr); return(entity); }
private void LoadBrakeData(string strJCLSH) { IRESULT_BRAKE_BLL bll = ObjectFactory.CreateObject <IRESULT_BRAKE_BLL>(); m_RESULT_BRAKE = bll.GetEntityByJCLSH(strJCLSH); PropertyInfo[] propertyInfo = m_RESULT_BRAKE.GetType().GetProperties(); foreach (Control cols in tabBrake.Controls) { if (cols is TableLayoutPanel) { foreach (Control col in cols.Controls) { if (col is TextBox) { TextBox textBox = (TextBox)col; foreach (PropertyInfo p in propertyInfo) { if (p.Name == textBox.Name) { textBox.TextChanged -= GetXCZDL; textBox.Text = Convert.ToString(p.GetValue(m_RESULT_BRAKE, null)); textBox.TextChanged += GetXCZDL; textBox.Click += MarkRowTag; } } } } } } }
public bool UpdateResultBrakeEntity(RESULT_BRAKE entity) { bool succ = false; PropertyInfo[] propertyInfos = entity.GetType().GetProperties(); string strSql = "UPDATE RESULT_BRAKE SET "; foreach (PropertyInfo p in propertyInfos) { if (p.Name != "ID" && p.Name != "JCLSH") { strSql += string.Format("{0}='{1}',", p.Name, p.GetValue(entity, null)); } } strSql = strSql.Substring(0, strSql.Length - 1); strSql += string.Format(" WHERE JCLSH ='{0}'", entity.JCLSH); int i = SqlHelper.ExcuteNonQuery(CommandType.Text, strSql); if (i > 0) { succ = true; } return(succ); }
public bool UpdateResultBrakeEntity(RESULT_BRAKE entity) { return(dal.UpdateResultBrakeEntity(entity)); }