private void btEdit_Click(object sender, EventArgs e) { int hendl = (this.grid.FocusedView as ColumnView).FocusedRowHandle; if (this.gridViewOrgns.IsValidRowHandle(hendl) & hendl != DevExpress.XtraGrid.GridControl.AutoFilterRowHandle) { MDataSet.OrganizationRow OrganizationRow = (organizationBindingSource.DataSource as MDataSet.OrganizationDataTable).FindByID(((int)this.gridViewOrgns.GetFocusedRowCellValue(this.colID))); FormDialog dform = new FormDialog(); dform.panel.Controls.Add(new UCOrganizationRow(OrganizationRow, MainForm.ActionDialog.Edit) ); if (DialogResult.OK == dform.ShowDialog(this)) { this.organizationBindingSource.EndEdit(); this.btSave.Enabled = true; } else { OrganizationRow.RejectChanges(); } } }
public DataRow AddProduct() { DataRow ProductRow = (productBindingSource.AddNew() as DataRowView).Row; FormDialog dform = new FormDialog(); dform.panel.Controls.Add(new ucProductRow(ProductRow, MainForm.ActionDialog.Edit)); if (DialogResult.OK == dform.ShowDialog(this)) { this.productBindingSource.EndEdit(); // this.SaveToBaseDirectoryModifed( ProductRow.Table.Select(null, null, DataViewRowState.Added)); } else { productBindingSource.CurrencyManager.CancelCurrentEdit(); } return ProductRow; }
private void gridViewProduct_Click(object sender, EventArgs e) /*создать новую строку, указатель на нее в ReceiptDetailRowAdd для редактирования*/ { if (this.gridViewProduct.IsValidRowHandle(this.gridViewProduct.FocusedRowHandle) & this.gridViewProduct.State == GridState.Normal & !this.gridViewProduct.IsFilterRow(this.gridViewProduct.FocusedRowHandle)) { FormDialog _formDialog = new FormDialog(); _formDialog.AcceptButton = null; _formDialog.Text = "Добавить стоку"; MDataSet.ReceiptDetailRow sourceRow = ((this.receiptDetailBindingSource.AddNew() as DataRowView).Row as MDataSet.ReceiptDetailRow); int _idproduct = Convert.ToInt32(((this.productBindingSource.CurrencyManager.Current as DataRowView).Row as DataRow)["ID"]); MDataSet.ProductRow productRow = this.mDataSet.Product.FindByID(_idproduct); if (productRow==null) { ((this.productBindingSource.CurrencyManager.Current as DataRowView).Row as FullDataSet.ProductRow).SetModified(); this.mDataSet.Product.Merge(_productTable.GetChanges()); ((this.productBindingSource.CurrencyManager.Current as DataRowView).Row as FullDataSet.ProductRow).AcceptChanges(); productRow = this.mDataSet.Product.FindByID(_idproduct); } if ((sourceRow != null)&(productRow!=null)) { ReceiptDetailRowAdd _receiptDetailRowAdd = new ReceiptDetailRowAdd(sourceRow, productRow); _formDialog.panel.Controls.Add(_receiptDetailRowAdd); if (DialogResult.OK == _formDialog.ShowDialog(this)) { this.receiptDetailBindingSource.EndEdit(); } else { this.receiptDetailBindingSource.CancelEdit(); } } } }
private void btAdd_Click(object sender, EventArgs e) { DataRow ProductRow = (productBindingSource.AddNew() as DataRowView).Row; FormDialog dform = new FormDialog(); dform.panel.Controls.Add(new ucProductRow(ProductRow, MainForm.ActionDialog.Edit)); if (DialogResult.OK == dform.ShowDialog(this)) { this.productBindingSource.EndEdit(); this.btSave.Enabled = true; } else { productBindingSource.CurrencyManager.CancelCurrentEdit(); } }
private void gridViewProduct_Click(object sender, EventArgs e) /*создать новую строку, указатель на нее в ReceiptDetailRowAdd для редактирования*/ { if (this.gridViewProduct.IsValidRowHandle(this.gridViewProduct.FocusedRowHandle) & this.gridViewProduct.State == GridState.Normal & !this.gridViewProduct.IsFilterRow(this.gridViewProduct.FocusedRowHandle)) { FormDialog _formDialog = new FormDialog(); _formDialog.AcceptButton = null; _formDialog.Text = "Добавить стоку"; MDataSet.ReceiptDetailRow sourceRow = ((this.receiptDetailBindingSource.AddNew() as DataRowView).Row as MDataSet.ReceiptDetailRow); int _idproduct = Convert.ToInt32(((this.productBindingSource.CurrencyManager.Current as DataRowView).Row as DataRow)["ID"]); MDataSet.ProductRow productRow = this.mDataSet.Product.FindByID(_idproduct); if (productRow == null) { ((this.productBindingSource.CurrencyManager.Current as DataRowView).Row as FullDataSet.ProductRow).SetModified(); this.mDataSet.Product.Merge(_productTable.GetChanges()); ((this.productBindingSource.CurrencyManager.Current as DataRowView).Row as FullDataSet.ProductRow).AcceptChanges(); productRow = this.mDataSet.Product.FindByID(_idproduct); } if ((sourceRow != null) & (productRow != null)) { ReceiptDetailRowAdd _receiptDetailRowAdd = new ReceiptDetailRowAdd(sourceRow, productRow); _formDialog.panel.Controls.Add(_receiptDetailRowAdd); if (DialogResult.OK == _formDialog.ShowDialog(this)) { this.receiptDetailBindingSource.EndEdit(); } else { this.receiptDetailBindingSource.CancelEdit(); } } } }
private void btAdd_Click(object sender, EventArgs e) { MDataSet.OrganizationRow OrganizationRow = (organizationBindingSource.AddNew() as DataRowView).Row as MDataSet.OrganizationRow; FormDialog dform = new FormDialog(); dform.panel.Controls.Add(new UCOrganizationRow(OrganizationRow, MainForm.ActionDialog.Edit)); if (DialogResult.OK == dform.ShowDialog(this)) { this.organizationBindingSource.EndEdit(); this.btSave.Enabled = true; } else { organizationBindingSource.CurrencyManager.CancelCurrentEdit(); } }
private void btViewDict_Click(object sender, EventArgs e) { if (this.ValidateChildren()) { FormDialog dform = new FormDialog(); dform.Text = "Справочник : группы"; UCSimpleDirectory ucSimpleDirectory = new UCSimpleDirectory((this.bindingSource.DataSource as DataView).Table.ParentRelations[0].ParentTable); dform.panel.Controls.Add(ucSimpleDirectory); if (DialogResult.OK == dform.ShowDialog(this)) { MessageBox.Show(ucSimpleDirectory.gridView.GetDataRow(ucSimpleDirectory.gridView.GetSelectedRows()[0])["ID"].ToString()); // (this.Controls.Find((sender as Button).Tag.ToString() + "lookUpEdit", true)[0] as DevExpress.XtraEditors.LookUpEdit).EditValue = ucSimpleDirectory.gridView.GetDataRow(ucSimpleDirectory.gridView.GetSelectedRows()[0])["ID"]; } } }
public DataRow AddProduct() { DataRow ProductRow = (productBindingSource.AddNew() as DataRowView).Row; FormDialog dform = new FormDialog(); dform.panel.Controls.Add(new ucProductRow(ProductRow, MainForm.ActionDialog.Edit)); if (DialogResult.OK == dform.ShowDialog(this)) { this.productBindingSource.EndEdit(); // this.SaveToBaseDirectoryModifed( ProductRow.Table.Select(null, null, DataViewRowState.Added)); } else { productBindingSource.CurrencyManager.CancelCurrentEdit(); } return(ProductRow); }
private void gridViewReceiptDetail_Click(object sender, EventArgs e) { if (this.gridViewReceiptDetail.IsValidRowHandle(this.gridViewReceiptDetail.FocusedRowHandle) & this.gridViewReceiptDetail.State == GridState.Normal & !this.gridViewReceiptDetail.IsFilterRow(this.gridViewReceiptDetail.FocusedRowHandle)) { FormDialog _formDialog = new FormDialog(); _formDialog.AcceptButton = null; _formDialog.Text = "Изменить стоку"; MDataSet.ReceiptDetailRow sourceRow = ((this.receiptDetailBindingSource.CurrencyManager.Current as DataRowView).Row as MDataSet.ReceiptDetailRow); ReceiptDetailRowAdd _receiptDetailRowAdd = new ReceiptDetailRowAdd(sourceRow, (sourceRow.GetParentRow("Product_ReceiptDetail") as MDataSet.ProductRow)); _formDialog.panel.Controls.Add(_receiptDetailRowAdd); if (DialogResult.OK == _formDialog.ShowDialog(this)) { this.receiptDetailBindingSource.EndEdit(); } else { this.receiptDetailBindingSource.CancelEdit(); } } }
private void btSimpleDirectory_Click(object sender, EventArgs e) { FormDialog dform = new FormDialog(); dform.Text = this.toolTip1.GetToolTip((sender as Control)).ToString(); int _id =Convert.ToInt32( (this.Controls.Find((sender as Button).Tag.ToString()+"lookUpEdit", true)[0] as DevExpress.XtraEditors.LookUpEdit).EditValue); DataTable _table = (this.productBindingSource.DataSource as DataRow).Table.DataSet.Tables[(sender as Button).Tag.ToString()]; UCSimpleDirectory ucSimpleDirectory = new UCSimpleDirectory(_table,_id); ucSimpleDirectory.btClose.Visible = false; dform.panel.Controls.Add(ucSimpleDirectory); ucSimpleDirectory.bindingSource.CurrencyManager.Position = ucSimpleDirectory.bindingSource.Find("ID", _id); if (DialogResult.OK == dform.ShowDialog(this)) { (this.Controls.Find((sender as Button).Tag.ToString()+"lookUpEdit", true)[0] as DevExpress.XtraEditors.LookUpEdit).EditValue = ucSimpleDirectory.gridView.GetDataRow(ucSimpleDirectory.gridView.GetSelectedRows()[0])["ID"]; } }
// private void btEdit_Click(object sender, EventArgs e) { this.receiptMasterBindingSource.EndEdit(); if (!this.SaveChanges()) { return; } FormDialog _formDialog = new FormDialog(); _formDialog.Text = "№ " + _curentReceiptMasterRow.Number.ToString() + " " + _curentReceiptMasterRow.OrganizationRow.ShortName.ToString(); _formDialog.AcceptButton = null; ReceiptDetailByRef _peceiptDetail = new ReceiptDetailByRef(_curentReceiptMasterRow, (this.ParentForm as MainForm).fullDataSet.Product, (this.ParentForm as MainForm)); _formDialog.panel.Controls.Add(_peceiptDetail); if (DialogResult.Cancel == _formDialog.ShowDialog(this)) { this.receiptDetailBindingSource.CancelEdit(); } }
private void btSimpleDirectory_Click(object sender, EventArgs e) { FormDialog dform = new FormDialog(); dform.Text = this.toolTip1.GetToolTip((sender as Control)).ToString(); int _id = Convert.ToInt32((this.Controls.Find((sender as Button).Tag.ToString() + "lookUpEdit", true)[0] as DevExpress.XtraEditors.LookUpEdit).EditValue); DataTable _table = (this.productBindingSource.DataSource as DataRow).Table.DataSet.Tables[(sender as Button).Tag.ToString()]; UCSimpleDirectory ucSimpleDirectory = new UCSimpleDirectory(_table, _id); ucSimpleDirectory.btClose.Visible = false; dform.panel.Controls.Add(ucSimpleDirectory); ucSimpleDirectory.bindingSource.CurrencyManager.Position = ucSimpleDirectory.bindingSource.Find("ID", _id); if (DialogResult.OK == dform.ShowDialog(this)) { (this.Controls.Find((sender as Button).Tag.ToString() + "lookUpEdit", true)[0] as DevExpress.XtraEditors.LookUpEdit).EditValue = ucSimpleDirectory.gridView.GetDataRow(ucSimpleDirectory.gridView.GetSelectedRows()[0])["ID"]; } }
private void btUcGroupDirectory_Click(object sender, EventArgs e) { /*У сендера имя - имя_таблицы_lookupEdit */ FormDialog dform = new FormDialog(); dform.Text = this.toolTip1.GetToolTip((sender as Control)).ToString(); DataTable _table = (this.productBindingSource.DataSource as DataRow).Table.DataSet.Tables[(sender as Button).Tag.ToString()]; UcGroupDirectory ucGroupDirectory = new UcGroupDirectory(_table); ucGroupDirectory.errorProvider1.DataSource = (this.productBindingSource.DataSource as DataRow).Table.DataSet; ucGroupDirectory.btClose.Visible = false; dform.panel.Controls.Add(ucGroupDirectory); int rowHandle = ucGroupDirectory.gridView.LocateByValue(0, ucGroupDirectory.gridView.Columns["ID"], (this.Controls.Find((sender as Button).Tag.ToString() + "lookUpEdit", true)[0] as DevExpress.XtraEditors.LookUpEdit).EditValue); if (rowHandle != GridControl.InvalidRowHandle) { ucGroupDirectory.gridView.FocusedRowHandle = rowHandle; ucGroupDirectory.gridView.FocusedColumn = ucGroupDirectory.gridView.Columns["Name"]; } if (DialogResult.OK == dform.ShowDialog(this)) { (this.Controls.Find((sender as Button).Tag.ToString() + "lookUpEdit", true)[0] as DevExpress.XtraEditors.LookUpEdit).EditValue = ucGroupDirectory.gridView.GetDataRow(ucGroupDirectory.gridView.GetSelectedRows()[0])["ID"]; } }
private void btAddProduct_Click(object sender, EventArgs e) { DataRow res = this.AddProduct(); if( res.RowState== DataRowState.Added) { Label _name = new Label(); TextBox _id = new TextBox(); _id.ReadOnly = true; _id.SelectAll(); _name.AutoSize = true; _name.DataBindings.Add(new Binding ("Text",res,"Name")); _id.DataBindings.Add(new Binding("Text", res, "Id")); _id.Location = new Point(5,25); _name.Location = new Point(5, 5); FormDialog _frmDialog = new FormDialog(); _frmDialog.btCancel.Visible = false; _frmDialog.Text = "Добавлен товар "; _frmDialog.panel.Controls.Add(_name); _frmDialog.panel.Controls.Add(_id); _frmDialog.ShowDialog(this); } }
private void btAdd_Click(object sender, EventArgs e) { DataRow ProductRow = (productBindingSource.AddNew() as DataRowView).Row ; FormDialog dform = new FormDialog(); dform.panel.Controls.Add(new ucProductRow(ProductRow, MainForm.ActionDialog.Edit)); if (DialogResult.OK == dform.ShowDialog(this)) { this.productBindingSource.EndEdit(); this.btSave.Enabled = true; } else { productBindingSource.CurrencyManager.CancelCurrentEdit(); } }
private void btEdit_Click(object sender, EventArgs e) { int hendl = (this.grid.FocusedView as ColumnView).FocusedRowHandle; if (this.gridViewMainProduct.IsValidRowHandle(hendl) & hendl != DevExpress.XtraGrid.GridControl.AutoFilterRowHandle) { // MDataSet.ProductRow pr = ((this.productBindingSource.CurrencyManager.Current as DataRowView).Row as MDataSet.ProductRow); DataRow pr = ((this.productBindingSource.CurrencyManager.Current as DataRowView).Row ); FormDialog dform = new FormDialog(); dform.Text = "Карточка товара"; dform.panel.Controls.Add(new ucProductRow((pr as DataRow), MainForm.ActionDialog.Edit)); if (DialogResult.OK == dform.ShowDialog(this)) { this.productBindingSource.CurrencyManager.EndCurrentEdit(); this.grid.Focus(); this.gridViewMainProduct.FocusedRowHandle = hendl; } else { this.productBindingSource.CurrencyManager.CancelCurrentEdit(); } } }
private void btSelToTradePutlet_Click(object sender, EventArgs e) { FormDialog formDialog = new FormDialog(); SelectTradePutlet selectTradePutlet = new SelectTradePutlet(); selectTradePutlet.tradePutletBindingSource.DataSource = this.mDataSet.TradePutlet; selectTradePutlet.tradePutletBindingSource.ResetBindings(false); formDialog.panel.Controls.Add(selectTradePutlet); if (formDialog.ShowDialog(this) == DialogResult.OK) { try { (this.ParentForm as MainForm).receiptMasterTableAdapter.ReceiptMasterSellCommand(this.CurentReceiptMasterRow.ID, (int)selectTradePutlet.lookUpEdit.EditValue); (this.ParentForm as MainForm).RefreshData(this._curentReceiptMasterRow); (this.ParentForm as MainForm).RefreshData(this.mDataSet.Remains as DataTable); } catch (Exception err) { MessageBox.Show(err.Message); } this.btClose_Click(sender,e); } }
// private void btEdit_Click(object sender, EventArgs e) { this.receiptMasterBindingSource.EndEdit(); if (!this.SaveChanges()) return; FormDialog _formDialog = new FormDialog(); _formDialog.Text = "№ " + _curentReceiptMasterRow.Number.ToString() + " " + _curentReceiptMasterRow.OrganizationRow.ShortName.ToString(); _formDialog.AcceptButton = null; ReceiptDetailByRef _peceiptDetail = new ReceiptDetailByRef(_curentReceiptMasterRow,(this.ParentForm as MainForm).fullDataSet.Product,(this.ParentForm as MainForm)); _formDialog.panel.Controls.Add(_peceiptDetail); if (DialogResult.Cancel == _formDialog.ShowDialog(this)) { this.receiptDetailBindingSource.CancelEdit(); } }