Пример #1
0
        //Lấy số chứng từ, điền thông tin vào Form_M0005_Detail_NoUsed
        private void SLook_DocNo_TextChanged(object sender, EventArgs e)
        {
            string _docNo = "";
            int    _status;

            if (sLook_DocNo.EditValue != null)
            {
                _docNo = sLook_DocNo.EditValue.ToString();
            }
            try
            {
                if (!string.IsNullOrEmpty(_docNo))
                {
                    _HeaderTable.Clear();
                    _HeaderTable = M0005_DAO.GetInfo_M0005_NoUsed_Header(_docNo);
                    if (_HeaderTable.Rows.Count > 0)
                    {
                        AddValue_Header(_HeaderTable);
                        _status = cbx_Status.SelectedIndex;
                        if (_status == 0)
                        {
                            Set_Enable_Control(true);
                        }
                        if (_status == 1)
                        {
                            Set_Enable_Control(false);
                        }
                        _DetailTable.Clear();
                        _DetailTable = M0005_DAO.GetInfo_M0005_NoUsed_Detail(_docNo);
                    }
                    if (_DetailTable.Rows.Count > 0)
                    {
                        gridControl.DataSource  = _DetailTable;
                        bsiRecordsCount.Caption = "Records: " + _DetailTable.Rows.Count;
                    }
                    if (InitValue)
                    {
                        _InitHeaderTable = _HeaderTable.Copy();
                        _InitDetailTable = _DetailTable.Copy();
                        InitValue        = false;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Lỗi: " + ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }