示例#1
0
        /// <summary>
        /// 获取PathInfo信息
        /// </summary>
        /// <param name="conditon">查询条件</param>
        /// <returns>PathInfo信息</returns>
        private DataTable GetPathInfo(string conditon)
        {
            if (pathInfoBll == null)
            {
                pathInfoBll = new PathInfoBll();
            }
            DataTable dt = pathInfoBll.SelectPathInfo(conditon);

            return(dt);
        }
示例#2
0
        /// <summary>
        /// 查找方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSerch_Click(object sender, EventArgs e)
        {
            try
            {
                string condition = String.Empty;

                if (tbpId.Text.Trim() != "")
                {
                    condition = "Id like '%" + tbpId.Text + "%'";
                }
                else
                {
                    condition = "1=1";
                }
                if (tbpNo.Text.Trim() != "")
                {
                    condition += " and PathNo like '%" + tbpNo.Text + "%'";
                }

                if (tbpName.Text.Trim() != "")
                {
                    condition += " and PathName like '%" + tbpName.Text + "%'";
                }

                if (tbpRemark.Text.Trim() != "")
                {
                    condition += " and Remark like '%" + tbpRemark.Text + "%'";
                }

                if (infoBll == null)
                {
                    infoBll = new PathInfoBll();
                }
                DataTable dt = infoBll.SelectPathInfo(condition);

                this.dgvMain.DataSource = dt;
            }
            catch (Exception ex)
            {
                MessageBox.Show("查找条件错误,未能查询到数据", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }