Beispiel #1
0
        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;
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private void SaveBrakeData()
        {
            IRESULT_BRAKE_BLL bll = ObjectFactory.CreateObject <IRESULT_BRAKE_BLL>();

            PropertyInfo[] propertyInfos = 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 propertyInfos)
                            {
                                if (p.Name == textBox.Name)
                                {
                                    p.SetValue(m_RESULT_BRAKE, Convert.ChangeType(textBox.Text, p.PropertyType), null);
                                }
                            }
                        }
                    }
                }
            }
            if (bll.UpdateResultBrakeEntity(m_RESULT_BRAKE))
            {
                MessageBox.Show("更新成功");
            }
            else
            {
                MessageBox.Show("更新失败");
            }
        }
Beispiel #3
0
        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);
        }