private void LoadData() { try { this.Cursor = Cursors.WaitCursor; DBGrid.toolCancelFrozen_Click(null, null); BindingCollection <modPriceAdjustForm> list = _dal.GetIList(rbStatus0.Checked ? "0" : "1", 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 = true; } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void LoadData() { try { this.Cursor = Cursors.WaitCursor; DBGrid.toolCancelFrozen_Click(null, null); BindingCollection <modVendorOrderList> list = _dal.GetIList(chkIncludeFinished.Checked, cboVendor.SelectedValue.ToString(), string.Empty, string.Empty, dtpFrom.Text, 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 { DBGrid.ReadOnly = false; for (int i = 0; i < DBGrid.ColumnCount; i++) { DBGrid.Columns[i].ReadOnly = true; } ShowColor(); } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void toolDel_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (DBGrid.CurrentRow.IsNewRow) { DBGrid.CurrentRow.ErrorText = ""; DBGrid.CancelEdit(); return; } DialogResult result = MessageBox.Show("Do you really want to delete it?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (result == DialogResult.Yes) { DeleteCurrentRow(); DBGrid.Rows.RemoveAt(DBGrid.CurrentRow.Index); } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
protected void Page_Load(object sender, EventArgs e) { Response.BufferOutput = true; Authentication auth = new Authentication(this); if (auth.LoadSession() == false) { auth.RemoveSession(); Response.Redirect("../../UI/FrameUI/login.htm"); Response.End(); } else { m_perimission = ((Authentication.LOGININFO)Session["USERINFO"]).Permission; if (CheckAccessAble()) { if (!IsPostBack) { bindDDLData(); DBGrid.DataSource = null; DBGrid.DataBind(); } } else { auth.RemoveSession(); Response.Redirect("../../UI/FrameUI/login.htm"); Response.End(); } } }
private void LoadData() { try { this.Cursor = Cursors.WaitCursor; DBGrid.toolCancelFrozen_Click(null, null); BindingCollection <modProductionForm> list = _dal.GetIList("1", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, dtpFrom.Text, 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(); for (int i = 0; i < list.Count; i++) { if (list[i].PriceStatus >= 1) { DBGrid.Rows[i].DefaultCellStyle.ForeColor = Color.DarkGray; } } } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void LoadData() { try { this.Cursor = Cursors.WaitCursor; if (cboAccName.SelectedIndex == -1) { return; } DBGrid.toolCancelFrozen_Click(null, null); modAccPeriodList modPeriod = (modAccPeriodList)cboAccName.SelectedItem; BindingCollection <modAccCredenceList> list = _dal.GetIList(modPeriod.AccName, string.Empty, Util.IsTrialBalance, 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(); for (int i = 0; i < list.Count; i++) { if (list[i].Status == 1) { DBGrid.Rows[i].DefaultCellStyle.ForeColor = Color.DarkGray; } } if (modPeriod.LockFlag == 1 || Util.IsTrialBalance) { toolNew.Visible = false; toolEdit.Visible = false; toolDel.Visible = false; toolAudit.Visible = false; toolReset.Visible = false; toolTrial.Visible = false; toolBalance.Visible = false; } else { toolNew.Visible = true; toolEdit.Visible = true; toolDel.Visible = true; toolAudit.Visible = true; toolReset.Visible = true; toolTrial.Visible = true; toolBalance.Visible = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void toolPost_Click(object sender, EventArgs e) { try { if (DBGrid.RowCount == 0) { return; } DBGrid.EndEdit(); if (MessageBox.Show("您真的要更改业务员吗?", clsTranslate.TranslateString("Confirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } string custidlist = string.Empty; for (int i = 0; i < DBGrid.RowCount; i++) { if (DBGrid.Rows[i].Cells[0].Value != null && Convert.ToBoolean(DBGrid.Rows[i].Cells[0].Value) == true) { if (string.IsNullOrEmpty(custidlist)) { custidlist = DBGrid.Rows[i].Cells[1].Value.ToString(); } else { custidlist += "," + DBGrid.Rows[i].Cells[1].Value.ToString(); } } } if (string.IsNullOrEmpty(custidlist)) { MessageBox.Show("请勾选您要的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } bool ret = _dal.UpdateSalesMan(custidlist, cboNewMan.ComboBox.SelectedValue.ToString(), out Util.emsg); if (ret) { LoadData(); } else { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void DBGrid_RowValidating(object sender, DataGridViewCellCancelEventArgs e) { if (!rowChanged) { return; } DataGridViewRow row = DBGrid.Rows[e.RowIndex]; try { this.Cursor = Cursors.WaitCursor; string valResult = ValidateRowEntry(e); if (valResult.Length > 0) { row.ErrorText = valResult; e.Cancel = true; if (row.IsNewRow) { row.ErrorText = ""; DBGrid.CancelEdit(); } return; } string parmid = row.Cells[0].Value.ToString().ToUpper(); string parmname = row.Cells[1].Value.ToString(); string parmvalue = row.Cells[2].Value.ToString(); string remark = row.Cells[3].Value.ToString(); modSysParameters mod = new modSysParameters(parmid, parmname, parmvalue, remark, Util.UserId, DateTime.Now.ToString()); bool ret = _dal.Update(parmid, mod, out Util.emsg); if (!ret) { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Failure"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { row.Cells[0].Value = row.Cells[0].Value.ToString().ToUpper(); row.Cells[4].Value = Util.UserId; row.Cells[5].Value = DateTime.Now.ToString(); StatusLabel4.Text = "Update succeed!"; } rowChanged = false; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } finally { this.Cursor = Cursors.Default; } }
private void DBGrid_RowValidating(object sender, DataGridViewCellCancelEventArgs e) { if (!rowChanged) { return; } DataGridViewRow row = DBGrid.Rows[e.RowIndex]; try { this.Cursor = Cursors.WaitCursor; string valResult = ValidateRowEntry(e); if (valResult.Length > 0) { row.ErrorText = valResult; e.Cancel = true; if (row.IsNewRow) { row.ErrorText = ""; DBGrid.CancelEdit(); } return; } //action_code,action_name,scores string actioncode = row.Cells[0].Value.ToString().ToUpper(); string actionname = row.Cells[1].Value.ToString(); decimal scores = Convert.ToDecimal(row.Cells[2].Value); modCustomerScoreRule mod = new modCustomerScoreRule(actioncode, actionname, scores, 0, Util.UserId, DateTime.Now); bool ret = _dal.Update(actioncode, mod, out Util.emsg); if (!ret) { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Failure"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { row.Cells[0].Value = row.Cells[0].Value.ToString().ToUpper(); row.Cells[3].Value = Util.UserId; row.Cells[4].Value = DateTime.Now.ToString(); StatusLabel4.Text = "Update succeed!"; } rowChanged = false; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } finally { this.Cursor = Cursors.Default; } }
private void toolSave_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (DBGrid.DataSource == null) { return; } //for(int i=0;i<DBGrid.RowCount;i++) //{ // modVendorOrderList mod = (modVendorOrderList)DBGrid.Rows[i].DataBoundItem; // if (mod.Price <= 0) // { // MessageBox.Show("请设置产品[" + mod.ProductName + "]的价格,必须>0", clsTranslate.TranslateString("information"), MessageBoxButtons.OK,MessageBoxIcon.Information); // DBGrid.CurrentCell = DBGrid.Rows[i].Cells["Price"]; // return; // } //} DBGrid.EndEdit(); BindingCollection <modVendorOrderList> list = (BindingCollection <modVendorOrderList>)DBGrid.DataSource; var p = (from c in list where c.Price <= 0 select c.ProductName).FirstOrDefault(); if (!string.IsNullOrEmpty(p)) { MessageBox.Show("请设置产品[" + p + "]的价格,必须>0", clsTranslate.TranslateString("information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } dalVendorOrderList dal = new dalVendorOrderList(); bool ret = dal.Save(list, out Util.emsg); if (ret) { MessageBox.Show("保存成功", clsTranslate.TranslateString("information"), MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; this.Dispose(); } else { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Faulure"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void bindGV() { DataView view = DBHelper.createGridView(this.getSQL()); DBGrid.DataSource = view; DBGrid.DataKeyNames = new string[] { "package_no" }; DBGrid.DataBind(); if (view.Count == 0) { Misc.Message(this.GetType(), ClientScript, "未找到符合条件的数据。"); return; } }
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; } }
void IReporter.ExportCurrentForm(IObjectHost objectHost, ReportExportFormat format) { DBGrid grid = (objectHost as DBGrid); if (grid == null) { return; } StiReport report = MakeReport(grid, format.CreateParam); report.Render(true); report.ExportDocument(GetExportFormat(format.ID), format.CreateParam.ExportFileName); }
void IReporter.DesignCurrentForm(IObjectHost objectHost) { DBGrid grid = (objectHost as DBGrid); if (grid == null) { return; } StiReport report = MakeReport(grid, _rcp); PrepareReport(report); report.Design(false); }
public static void ToExcel(this DBGrid a_dbg, bool isShowExcle = true) { GridView a_gv = a_dbg.MainView as GridView; //创建Excel对象 Application excel = new Application(); excel.Application.Workbooks.Add(true); //生成字段名称 for (int i = 0; i < a_gv.Columns.Count; i++) { if (!a_gv.Columns[i].Visible) { continue; } if (string.IsNullOrEmpty(a_gv.Columns[i].Caption) && string.IsNullOrEmpty(a_gv.Columns[i].FieldName)) { continue; } excel.Cells[1, i + 1] = a_gv.Columns[i].Caption; } //填充数据 for (int i = 0; i < a_gv.RowCount; i++) //循环行 { int j = 0; foreach (GridColumn col in a_gv.Columns) { if (!col.Visible) { continue; } if (string.IsNullOrEmpty(col.Caption) && string.IsNullOrEmpty(col.FieldName)) { continue; } excel.Cells[i + 2, j + 1] = Convert.ToString(a_gv.GetRowCellValue(i, col)); j++; } } //设置禁止弹出保存和覆盖的询问提示框 excel.Visible = isShowExcle; excel.DisplayAlerts = false; excel.AlertBeforeOverwriting = false; //保存到临时工作簿 //excel.Application.Workbooks.Add(true).Save(); //保存文件 //excel.Save("D:" + "\\234.xls"); //excel.Quit(); }
void IReporter.PrintCurrentForm(IObjectHost objectHost) { DBGrid grid = (objectHost as DBGrid); if (grid == null) { return; } StiReport report = MakeReport(grid, _rcp); PrepareReport(report); report.Render(true); report.Show(false); }
private void DBGrid_MouseDown(object sender, MouseEventArgs e) { if (txtEmployeeId.ReadOnly == true && e.Button == MouseButtons.Left) { DataGridView.HitTestInfo info = DBGrid.HitTest(e.X, e.Y); if (info.RowIndex >= 0) { DataGridViewRow dr = (DataGridViewRow)DBGrid.Rows[info.RowIndex]; if (dr != null) { DBGrid.DoDragDrop(dr, DragDropEffects.Copy); } } } }
private void toolClear_Click(object sender, EventArgs e) { if (DBGrid.RowCount == 0) { return; } DBGrid.EndEdit(); string selectionlist = string.Empty; for (int i = 0; i < DBGrid.RowCount; i++) { if (DBGrid.Rows[i].Cells[0].Value != null && Convert.ToBoolean(DBGrid.Rows[i].Cells[0].Value) == true) { if (string.IsNullOrEmpty(selectionlist)) { selectionlist = DBGrid.Rows[i].Cells[1].Value.ToString(); } else { selectionlist += "," + DBGrid.Rows[i].Cells[1].Value.ToString(); } } } if (string.IsNullOrEmpty(selectionlist)) { MessageBox.Show("请勾选您要的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show("您真的要清理这些产品资料?", clsTranslate.TranslateString("Confirm"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return; } bool ret = _dal.DeleteUselessProduct(selectionlist, out Util.emsg); if (ret) { LoadData(); } else { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void DBGridDataBind() { StringBuilder sql = new StringBuilder("select * from gen_part_package where 1=1"); if (DDLProject.SelectedValue == "0") { Misc.Message(this.GetType(), ClientScript, "请选择项目,再进行查询。"); return; } sql.Append(string.Format(" and project_id='{0}'", DDLProject.SelectedValue)); if (TxtDBbh.Text.Trim() != "") { sql.Append(string.Format(" and package_no like '{0}'", TxtDBbh.Text)); } if (TxtDBmc.Text.Trim() != "") { sql.Append(string.Format(" and package_name like '{0}'", TxtDBmc.Text)); } DBGrid.DataSource = DBHelper.createGridView(sql.ToString()); DBGrid.DataKeyNames = new string[] { "package_no" }; DBGrid.DataBind(); }
private void LoadData() { try { this.Cursor = Cursors.WaitCursor; DBGrid.toolCancelFrozen_Click(null, null); BindingCollection <modWarehouseInoutForm> list = _dal.GetIList(rbStatus0.Checked ? "0" : "1", string.Empty, 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(); ShowColor(); DBGrid.Columns["CostPrice"].Visible = false; for (int i = 0; i < list.Count; i++) { DBGrid.Rows[i].Cells["CostPrice"].Value = "*"; DBGrid.Columns["size"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid.Columns["qty"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid.Columns["CostPrice"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; } } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void LoadData() { try { this.Cursor = Cursors.WaitCursor; DBGrid.toolCancelFrozen_Click(null, null); string getwhere = string.Empty; if (rbStatus0.Checked) { getwhere = "and a.status=0"; } else { getwhere = "and a.status=1 and a.transfer_date between '" + dtpFrom.Value + "' and '" + dtpTo.Value.AddDays(1).AddSeconds(-1) + "'"; } BindingCollection <modWarehouseProductTransfer> list = _dal.GetIList(getwhere, 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(); } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void toolSelect_Click(object sender, EventArgs e) { if (DBGrid.RowCount == 0) { return; } DBGrid.EndEdit(); selectionlist = string.Empty; for (int i = 0; i < DBGrid.RowCount; i++) { if (DBGrid.Rows[i].Cells[0].Value != null && Convert.ToBoolean(DBGrid.Rows[i].Cells[0].Value) == true) { if (string.IsNullOrEmpty(selectionlist)) { selectionlist = DBGrid.Rows[i].Cells[1].Value.ToString(); } else { selectionlist += "," + DBGrid.Rows[i].Cells[1].Value.ToString(); } } } if (string.IsNullOrEmpty(selectionlist)) { MessageBox.Show("请勾选您要的数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (!toolCheckAll.Visible && selectionlist.IndexOf(",") > 0) { MessageBox.Show("您只能选择一项!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } this.DialogResult = DialogResult.OK; this.Dispose(); }
private void btnPost_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; DBGrid.EndEdit(); if (DBGrid.RowCount == 0) { MessageBox.Show("没有明细数据", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } for (int i = 0; i < DBGrid.RowCount; i++) { if (DBGrid.Rows[i].Cells[0].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[0].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Product id") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (DBGrid.Rows[i].Cells[4].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[4].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Qty") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (!Util.IsNumeric(DBGrid.Rows[i].Cells[4].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Qty") + clsTranslate.TranslateString(" must be a numeric!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (Convert.ToDecimal(DBGrid.Rows[i].Cells[4].Value.ToString()) <= 0) { MessageBox.Show(clsTranslate.TranslateString("Qty") + clsTranslate.TranslateString(" must > 0!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (DBGrid.Rows[i].Cells[5].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[5].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Price") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (!Util.IsNumeric(DBGrid.Rows[i].Cells[5].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Price") + clsTranslate.TranslateString(" must be a numeric!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } modSalesShipment mod = new modSalesShipment(); mod.ShipId = _dal.GetNewId(DateTime.Today); mod.ShipDate = DateTime.Today; mod.ShipType = "收营单"; //mod.No = txtNo.Text.Trim(); mod.AdFlag = 1; dalCustomerList dalcust = new dalCustomerList(); //mod.CustOrderNo = txtCustOrderNo.Text.Trim(); mod.CustName = "散客"; mod.CustId = clsLxms.GetDefaultCustId(); mod.PayMethod = "现金"; mod.SalesMan = Util.UserId; mod.OtherMny = 0; mod.KillMny = 0; mod.Currency = Util.Currency; dalAccCurrencyList dalcur = new dalAccCurrencyList(); modAccCurrencyList modcur = dalcur.GetItem(mod.Currency, out Util.emsg); mod.ExchangeRate = modcur.ExchangeRate; mod.DetailSum = decimal.Parse(txtAmount.Text); mod.UpdateUser = Util.UserId; mod.Status = 0; mod.ReceiveStatus = 1; mod.AccountNo = "现金"; mod.MakeDate = DateTime.Today; mod.ReceiveDate = DateTime.Today.ToString("yyyy-MM-dd"); mod.InvoiceStatus = 0; mod.InvoiceMny = 0; string detaillist = string.Empty; dalCustomerOrderList dalorder = new dalCustomerOrderList(); BindingCollection <modSalesShipmentDetail> list = new BindingCollection <modSalesShipmentDetail>(); for (int i = 0; i < DBGrid.RowCount; i++) { modSalesShipmentDetail modd = new modSalesShipmentDetail(); modd.Seq = i + 1; modd.ProductId = DBGrid.Rows[i].Cells[0].Value.ToString(); modd.ProductName = DBGrid.Rows[i].Cells[1].Value.ToString(); modd.Specify = DBGrid.Rows[i].Cells[8].Value.ToString(); modd.UnitNo = DBGrid.Rows[i].Cells[3].Value.ToString(); modd.Size = 1; modd.Qty = Convert.ToDecimal(DBGrid.Rows[i].Cells[4].Value.ToString()); modd.Price = Convert.ToDecimal(DBGrid.Rows[i].Cells[5].Value.ToString()); modd.SalesManMny = 0; modd.WarehouseId = clsLxms.GetDefaultWarehouseId(); list.Add(modd); } bool ret = _dal.Save("ADD", mod, list, out Util.emsg); if (ret) { this.DialogResult = DialogResult.OK; LoadHistory(); DBGrid.Rows.Clear(); txtQty.Text = "0"; txtAmount.Text = "0"; btnPreview_Click(null, null); txtProduct.Focus(); } else { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
public ActionExecuteForm(DBGrid grid, string actionID) : base(WinFormStyle.Dialog) { this.Add <Panel>(WinFormConfig.SinglePageForm); TableLayoutPanel tlpRows = this.Items["FormRowsPanel"].LinkedControl as TableLayoutPanel; TableLayoutPanel tp = tlpRows.Add <TableLayoutPanel>(new WinFormItem("WorkCells") { CellsSize = new Pair <int>(2, 1) }); tp.ColumnStyles[0].SizeType = SizeType.Percent; tp.ColumnStyles[0].Width = 38; tp.ColumnStyles[1].SizeType = SizeType.Percent; tp.ColumnStyles[1].Width = 62; int maxWidth = 480; _ai = ClientGate.GetActionInfo(actionID); this.Text = _ai.Name; foreach (var p in _ai.InterfaceParameters .Where(param => param.Value.Dirrect == ParamDirrect.Input) .OrderBy(param => param.Value.Position) .Select(param => param.Value)) { WinFormItem item = new WinFormItem(p.AttribName) { Caption = p.Name, DataType = MdbTypeMap.GetType(p.DataType), Width = p.DisplayWidth, DataSize = p.Width, Format = p.Format, SuperForm = p.SuperForm, SuperMethod = p.SuperMethod, ConstName = p.ConstName, PresentationType = Type.GetType(p.PresentationType), Value = p.DefaultValue }; if (!p.ListData.IsEmpty()) { string[] data = p.ListData.Split(','); string[] text = p.ListItems.Split(','); for (int i = 0; i < data.Length; i++) { item.Add(new WinFormItem(text[i]) { Caption = text[i], DataType = item.DataType, Value = data[i].CastAs(item.DataType) }); } item.Mask = "lock"; } switch (item.ConstName.ToLower()) { case "bs_datecurrent": item.Value = vbo.Date(); break; case "bs_datestart": item.Value = rth.DateStart; break; case "bs_datefinish": item.Value = rth.DateFinish; break; case "bs_username": item.Value = PathHelper.UserName; break; case "bs_selection": item.Value = string.Join(",", grid.CheckedRows.Select(r => r[grid.IdColName].ToString())); break; case "bs_objectname": item.Value = grid.SchemaName; break; default: if (item.ConstName.Left(1) == "=") { //!!! item.Value = Evaluator.Eval(item.ConstName.Substring(1), schema); } else { //!!! //string localSetting = schema[path + "ConstName"]; //if (localSetting.IndexOf(vbo.chrSep) > -1) // localSetting = dbs.GetSetting(localSetting); //else // localSetting = dbs.GetSetting(setPath + localSetting); //if (string.IsNullOrEmpty(localSetting)) // localSetting = dbs.GetSetting(schema["ObjectName"] + vbo.chrSep + "Setup" + vbo.chrSep + // schema[path + "ConstName"]); //if (!string.IsNullOrEmpty(localSetting)) // item.Value = localSetting; } break; } if (item.OriginalValue == null && grid.ParentRow != null && !string.IsNullOrEmpty(p.FieldName)) { try { item.Value = grid.ParentRow[p.FieldName]; } finally { if (vbo.IsEmpty(item.Value)) { item.Value = null; } } } int width = Math.Max(p.Name.Length, p.DisplayWidth) * (int)this.Font.SizeInPoints; if (width > maxWidth) { maxWidth = width; } tp.Add(item); } var btp = GetItem("MainPanel") .LinkedControl .Add <TableLayoutPanel>(WinFormConfig.StdButtons(OKCaption: "&Выполнить")); this.AcceptButton = null; this.Width = maxWidth; this.Height = (int)(this.Width / vbo.GoldenRatio); if (this.Parent != null) { this.StartPosition = FormStartPosition.CenterParent; } else { this.StartPosition = FormStartPosition.CenterScreen; } }
private void toolSave_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; DBGrid.EndEdit(); if (dtpFormDate.Value < Util.modperiod.StartDate) { MessageBox.Show("该日期的数据已锁定,不能更新数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); dtpFormDate.Focus(); return; } if (txtCustName.Tag == null) { MessageBox.Show(clsTranslate.TranslateString("Cust Id") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtCustName.Focus(); return; } if (string.IsNullOrEmpty(txtCustName.Text)) { MessageBox.Show(clsTranslate.TranslateString("Cust Name") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtCustName.Focus(); return; } if (clsLxms.GetParameterValue("NEED_QUOTATION_NO").CompareTo("T") == 0 && string.IsNullOrEmpty(txtNo.Text)) { MessageBox.Show(clsTranslate.TranslateString("No") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtNo.Focus(); return; } if (DBGrid.RowCount == 0) { MessageBox.Show("没有明细数据", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } for (int i = 0; i < DBGrid.RowCount; i++) { if (DBGrid.Rows[i].Cells[0].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[0].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Product id") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (DBGrid.Rows[i].Cells[1].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[1].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Product name") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (DBGrid.Rows[i].Cells[5].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[5].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Qty") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (!Util.IsNumeric(DBGrid.Rows[i].Cells[5].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Qty") + clsTranslate.TranslateString(" must be a numeric!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (Convert.ToDecimal(DBGrid.Rows[i].Cells[5].Value.ToString()) <= 0) { MessageBox.Show(clsTranslate.TranslateString("Qty") + clsTranslate.TranslateString(" must > 0!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (DBGrid.Rows[i].Cells[6].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[6].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Price") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (!Util.IsNumeric(DBGrid.Rows[i].Cells[6].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Price") + clsTranslate.TranslateString(" must be a numeric!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (Convert.ToDecimal(DBGrid.Rows[i].Cells[6].Value.ToString()) <= 0) { MessageBox.Show(clsTranslate.TranslateString("Price") + clsTranslate.TranslateString(" must > 0!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } modQuotationForm mod = new modQuotationForm(); mod.FormId = txtFormId.Text.Trim(); mod.FormDate = dtpFormDate.Value; mod.No = txtNo.Text.Trim(); mod.CustId = txtCustName.Tag.ToString(); mod.CustName = txtCustName.Text.Trim(); mod.Remark = txtRemark.Text.Trim(); mod.ContactPerson = txtContactPerson.Text.Trim(); mod.Currency = txtCurrency.Text.Trim(); mod.UpdateUser = Util.UserId; string detaillist = string.Empty; BindingCollection <modQuotationDetail> list = new BindingCollection <modQuotationDetail>(); for (int i = 0; i < DBGrid.RowCount; i++) { modQuotationDetail modd = new modQuotationDetail(); modd.Seq = i + 1; modd.ProductId = DBGrid.Rows[i].Cells[0].Value.ToString(); modd.ProductName = DBGrid.Rows[i].Cells[1].Value.ToString(); modd.Specify = DBGrid.Rows[i].Cells[2].Value == null ? string.Empty : DBGrid.Rows[i].Cells[2].Value.ToString(); modd.UnitNo = DBGrid.Rows[i].Cells[3].Value == null ? string.Empty : DBGrid.Rows[i].Cells[3].Value.ToString(); modd.Brand = DBGrid.Rows[i].Cells[4].Value == null ? string.Empty : DBGrid.Rows[i].Cells[4].Value.ToString(); modd.Qty = Convert.ToDecimal(DBGrid.Rows[i].Cells[5].Value.ToString()); modd.Price = Convert.ToDecimal(DBGrid.Rows[i].Cells[6].Value.ToString()); modd.Remark = DBGrid.Rows[i].Cells[7].Value == null ? string.Empty : DBGrid.Rows[i].Cells[7].Value.ToString(); list.Add(modd); } bool ret = _dal.Save(_action, mod, list, out Util.emsg); if (ret) { ini.IniWriteValue("QUOTATION", "CONTACT_PERSON", txtContactPerson.Text.Trim()); this.DialogResult = DialogResult.OK; this.Dispose(); } else { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void toolSave_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; DBGrid.EndEdit(); if (dtpFormDate.Value < Util.modperiod.StartDate) { MessageBox.Show("该日期的数据已锁定,不能更新数据!", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); dtpFormDate.Focus(); return; } if (DBGrid.RowCount == 0) { MessageBox.Show("没有明细数据", clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } for (int i = 0; i < DBGrid.RowCount; i++) { if (DBGrid.Rows[i].Cells[0].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[0].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Product id") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (DBGrid.Rows[i].Cells[1].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[1].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Product name") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (DBGrid.Rows[i].Cells[4].Value == null || string.IsNullOrEmpty(DBGrid.Rows[i].Cells[4].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Current Price") + clsTranslate.TranslateString(" can not be null!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else if (!Util.IsNumeric(DBGrid.Rows[i].Cells[4].Value.ToString())) { MessageBox.Show(clsTranslate.TranslateString("Current Price") + clsTranslate.TranslateString(" must be a numeric!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } modPriceAdjustForm mod = new modPriceAdjustForm(); mod.FormId = txtFormId.Text.Trim(); mod.FormDate = dtpFormDate.Value; mod.Remark = txtRemark.Text.Trim(); mod.UpdateUser = Util.UserId; mod.Status = 0; string detaillist = string.Empty; BindingCollection <modPriceAdjustDetail> list = new BindingCollection <modPriceAdjustDetail>(); for (int i = 0; i < DBGrid.RowCount; i++) { modPriceAdjustDetail modd = new modPriceAdjustDetail(); modd.Seq = i + 1; modd.ProductId = DBGrid.Rows[i].Cells[0].Value.ToString(); modd.ProductName = DBGrid.Rows[i].Cells[1].Value.ToString(); modd.Qty = Convert.ToDecimal(DBGrid.Rows[i].Cells[2].Value.ToString()); modd.CurrentPrice = Convert.ToDecimal(DBGrid.Rows[i].Cells[3].Value.ToString()); modd.TruePrice = Convert.ToDecimal(DBGrid.Rows[i].Cells[4].Value.ToString()); modd.CurrentMny = Convert.ToDecimal(DBGrid.Rows[i].Cells[5].Value.ToString()); modd.TrueMny = Convert.ToDecimal(DBGrid.Rows[i].Cells[6].Value.ToString()); modd.Differ = Convert.ToDecimal(DBGrid.Rows[i].Cells[7].Value.ToString()); modd.Remark = DBGrid.Rows[i].Cells[8].Value == null ? string.Empty : DBGrid.Rows[i].Cells[8].Value.ToString(); list.Add(modd); } bool ret = _dal.Save(_action, mod, list, out Util.emsg); if (ret) { this.DialogResult = DialogResult.OK; this.Dispose(); } else { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
private void DBGrid_RowValidating(object sender, DataGridViewCellCancelEventArgs e) { if (!rowChanged) { return; } try { this.Cursor = Cursors.WaitCursor; DataGridViewRow row = DBGrid.Rows[e.RowIndex]; string valResult = ValidateRowEntry(e); if (valResult.Length > 0) { row.ErrorText = valResult; e.Cancel = true; if (row.IsNewRow) { row.ErrorText = ""; DBGrid.CancelEdit(); } return; } string groupid = row.Cells[0].Value.ToString().ToUpper(); string groupdesc = row.Cells[1].Value.ToString(); int status = row.Cells[2].Value == null ? 0 : Convert.ToInt32(row.Cells[2].Value.ToString()); int? seq = Convert.ToInt32(row.Cells[3].Value.ToString()); modTaskGroup mod = new modTaskGroup(groupid, groupdesc, status, seq, Util.UserId, DateTime.Now); if (Convert.ToDateTime(row.Cells[5].Value).Year == 1) { bool ret = _dal.Insert(mod, out Util.emsg); if (!ret) { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Failure"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { row.Cells[0].Value = row.Cells[0].Value.ToString().ToUpper(); row.Cells[5].Value = DateTime.Now.ToString(); row.Tag = "1"; StatusLabel4.Text = "Add succeed!"; } } else { bool ret = _dal.Update(groupid, mod, out Util.emsg); if (!ret) { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Failure"), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { row.Cells[0].Value = row.Cells[0].Value.ToString().ToUpper(); row.Cells[5].Value = DateTime.Now.ToString(); StatusLabel4.Text = "Update succeed!"; } } rowChanged = false; } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } finally { this.Cursor = Cursors.Default; } }
protected void LoadData() { try { this.Cursor = Cursors.WaitCursor; string emsg = string.Empty; string statuslist = "9"; if (chkNotAudit.Checked) { statuslist += ",0"; } if (chkAudited.Checked) { statuslist += ",1"; } string custlist = string.Empty; if (lstCustomer.SelectedItems.Count > 0 && lstCustomer.SelectedItems.Count < lstCustomer.Items.Count) { for (int i = 0; i < lstCustomer.SelectedItems.Count; i++) { modCustomerList mod = (modCustomerList)lstCustomer.SelectedItems[i]; if (i == 0) { custlist = mod.CustId; } else { custlist += "," + mod.CustId; } } } DBGrid.toolCancelFrozen_Click(null, null); BindingCollection <modSalesManMny> list = _dal.GetSalesManMny(statuslist, string.Empty, custlist, string.Empty, cboSalesMan.SelectedValue.ToString(), txtProductName.Text.Trim(), dtpFrom.Text, dtpTo.Text, out emsg); DBGrid.DataSource = list; if (list != null && list.Count > 0) { AddComboBoxColumns(); GetDetailSum(); ShowColor(); DBGrid.Columns["Qty"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid.Columns["Price"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid.Columns["SumMny"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid.Columns["SalesManMny"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid.Columns["PaidSalesMny"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; DBGrid.ReadOnly = false; DBGrid.Columns["SalesManMny"].DefaultCellStyle.ForeColor = Color.Red; DBGrid.Columns["PaidSalesMny"].DefaultCellStyle.ForeColor = Color.Red; DBGrid.Columns["SalesManMny"].ReadOnly = false; DBGrid.Columns["PaidSalesMny"].ReadOnly = false; } else { if (!string.IsNullOrEmpty(Util.emsg)) { MessageBox.Show(Util.emsg, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(clsTranslate.TranslateString("No data found!"), clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } StatusLabel1.Text = "共 0 行数据, 合计金额为: " + string.Format("{0:C2}", 0); } } catch (Exception ex) { MessageBox.Show(ex.Message, clsTranslate.TranslateString("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information); } finally { this.Cursor = Cursors.Default; } }
public void TestAttachedDataView() { DataSession.Execute("create table TestForAttachedDataView { ID : Integer, Name : String, key { ID } };"); DataSession.Execute("insert row { 1 ID, 'Joe' Name } into TestForAttachedDataView;"); DataView LDataView = DataSession.OpenDataView("TestForAttachedDataView"); try { Form LForm = new Form(); try { DataSource LSource = new DataSource(); LSource.DataSet = LDataView; DBGrid LGrid = new DBGrid(); LGrid.Source = LSource; LGrid.Dock = DockStyle.Fill; LForm.Controls.Add(LGrid); LForm.Show(); Application.DoEvents(); if (!LDataView.IsEmpty()) { LDataView.First(); LDataView.Edit(); LDataView["Name"].AsString = "John"; LDataView.Refresh(); } Application.DoEvents(); LDataView.Insert(); LDataView["ID"].AsInt32 = 2; LDataView["Name"].AsString = "Jacob"; LDataView.Post(); Application.DoEvents(); //LDataView.Delete(); DataSession.Execute("delete TestForAttachedDataView where ID = 2"); LDataView.Refresh(); Application.DoEvents(); if (LDataView["ID"].AsInt32 != 1) { throw new Exception("Data View Refresh After Delete Failed"); } if (LDataView.IsEmpty()) { throw new Exception("Data View Delete Failed"); } } finally { LForm.Dispose(); } } finally { LDataView.Dispose(); } }
private void DBGridEmptyDataBind() { DBGrid.DataSource = null; DBGrid.DataBind(); }