private void LoadData() { try { this.Cursor = Cursors.WaitCursor; string custlist = string.Empty; if (cboCustomer.Visible) { custlist = cboCustomer.SelectedValue.ToString(); } else { custlist = string.Empty; } DBGrid.toolCancelFrozen_Click(null, null); BindingCollection <modSalesShipment> list = _dal.GetIList(rbStatus0.Checked ? "0" : "1", string.Empty, custlist, string.Empty, string.Empty, string.Empty, string.Empty, rbStatus0.Checked ? string.Empty : dtpFrom.Text, rbStatus0.Checked ? string.Empty : dtpTo.Text, out Util.emsg); DBGrid.DataSource = list; if (list == null && !string.IsNullOrEmpty(Util.emsg)) { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { AddComboBoxColumns(); DBGrid.ReadOnly = false; for (int i = 0; i < DBGrid.ColumnCount; i++) { DBGrid.Columns[i].ReadOnly = true; } DBGrid.Columns["ReceiveStatus"].ReadOnly = false; DBGrid.Columns["ReceiveDate"].ReadOnly = false; DBGrid.Columns["AccountNo"].ReadOnly = false; DBGrid.Columns["InvoiceStatus"].ReadOnly = false; DBGrid.Columns["InvoiceNo"].ReadOnly = false; DBGrid.Columns["InvoiceMny"].ReadOnly = false; ShowColor(); string[] showcell = { "AccountNo" }; DBGrid.SetParam(showcell); } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void LoadDBGrid() { try { this.Cursor = Cursors.WaitCursor; DBGrid.Rows.Clear(); DBGrid.Columns.Clear(); DBGrid.ReadOnly = false; DBGrid.AllowUserToAddRows = false; DBGrid.AllowUserToDeleteRows = false; DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn(); col.HeaderText = clsTranslate.TranslateString("SubjectId"); col.DataPropertyName = "SubjectId"; col.Name = "SubjectId"; col.Width = 60; col.ReadOnly = true; DBGrid.Columns.Add(col); col.Dispose(); col = new DataGridViewTextBoxColumn(); col.HeaderText = clsTranslate.TranslateString("SubjectName"); col.DataPropertyName = "SubjectName"; col.Name = "SubjectId"; col.Width = 110; col.ReadOnly = true; DBGrid.Columns.Add(col); col.Dispose(); col = new DataGridViewTextBoxColumn(); col.HeaderText = clsTranslate.TranslateString("DetailId"); col.DataPropertyName = "DetailId"; col.Name = "DetailId"; col.Width = 110; col.ReadOnly = true; DBGrid.Columns.Add(col); col.Dispose(); col = new DataGridViewTextBoxColumn(); col.HeaderText = clsTranslate.TranslateString("DetailName"); col.DataPropertyName = "DetailName"; col.Name = "DetailName"; col.Width = 50; col.ReadOnly = false; DBGrid.Columns.Add(col); col.Dispose(); col = new DataGridViewTextBoxColumn(); col.HeaderText = clsTranslate.TranslateString("Currency"); col.DataPropertyName = "Currency"; col.Name = "Currency"; col.Width = 40; col.ReadOnly = true; DBGrid.Columns.Add(col); col.Dispose(); col = new DataGridViewTextBoxColumn(); col.HeaderText = clsTranslate.TranslateString("Mny"); col.DataPropertyName = "Mny"; col.Name = "Mny"; col.Width = 60; col.ReadOnly = false; col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid.Columns.Add(col); col.Dispose(); col = new DataGridViewTextBoxColumn(); col.HeaderText = clsTranslate.TranslateString("ExchangeRate"); col.DataPropertyName = "ExchangeRate"; col.Name = "ExchangeRate"; col.Width = 60; col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; col.ReadOnly = true; DBGrid.Columns.Add(col); col.Dispose(); col = new DataGridViewTextBoxColumn(); col.HeaderText = clsTranslate.TranslateString("CheckNo"); col.DataPropertyName = "CheckNo"; col.Name = "CheckNo"; col.Width = 60; col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; col.ReadOnly = false; DBGrid.Columns.Add(col); col.Dispose(); col = new DataGridViewTextBoxColumn(); col.HeaderText = clsTranslate.TranslateString("CheckType"); col.DataPropertyName = "CheckType"; col.Name = "CheckType"; col.Width = 60; col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; col.ReadOnly = true; DBGrid.Columns.Add(col); col.Dispose(); col = new DataGridViewTextBoxColumn(); col.HeaderText = clsTranslate.TranslateString("BankName"); col.DataPropertyName = "BankName"; col.Name = "BankName"; col.Width = 60; col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; col.ReadOnly = true; DBGrid.Columns.Add(col); col.Dispose(); col = new DataGridViewTextBoxColumn(); col.HeaderText = clsTranslate.TranslateString("PromiseDate"); col.DataPropertyName = "PromiseDate"; col.Name = "PromiseDate"; col.Width = 90; col.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; col.ReadOnly = false; DBGrid.Columns.Add(col); col.Dispose(); col = new DataGridViewTextBoxColumn(); col.HeaderText = clsTranslate.TranslateString("Remark"); col.DataPropertyName = "Remark"; col.Name = "Remark"; col.Width = 80; col.ReadOnly = false; DBGrid.Columns.Add(col); col.Dispose(); string[] showcell = { "SubjectId", "CheckType", "BankName" }; DBGrid.SetParam(showcell); } catch (Exception ex) { MessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }