private void btnRefresh_Click(object sender, EventArgs e)
        {
            if (!m_unitServer.GetAllUnit(out m_findUnit, out m_err))
            {
                MessageDialog.ShowErrorMessage(m_err);
                return;
            }

            RefreshDataGridView(m_findUnit);

            dataGridView1.Columns[0].Visible = false;
            RefreshControl();
            txtUnit.Focus();
        }
Exemple #2
0
        /// <summary>
        /// 窗体载入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormUnit_Load(object sender, EventArgs e)
        {
            if (!m_unitServer.GetAllUnit(out m_findUnit, out m_err))
            {
                MessageDialog.ShowErrorMessage(m_err);
                return;
            }

            m_findUnit = from a in m_findUnit
                         where a.停用 == false
                         select a;

            RefreshDataGridView(m_findUnit);
            dataGridView1.Columns[0].Visible = false;
        }
        /// <summary>
        /// 初始化计量单位ComboBox控件
        /// </summary>
        /// <param name="cmbUnit">要初始化的计量单位ComboBox控件</param>
        static public bool InitUnitComboBox(ComboBox cmbUnit)
        {
            IUnitServer unitServer = ServerModuleFactory.GetServerModule <IUnitServer>();
            IQueryable <View_S_Unit> queryResult = null;

            if (unitServer.GetAllUnit(out queryResult, out m_err))
            {
                queryResult = from a in queryResult
                              where a.停用 == false
                              select a;

                if (queryResult.Count() > 0)
                {
                    cmbUnit.DataSource    = queryResult;
                    cmbUnit.DisplayMember = "单位";
                    cmbUnit.ValueMember   = "序号";

                    return(true);
                }
            }

            return(false);
        }