public ReceiptDetailByRef(MDataSet.ReceiptMasterRow source,DataTable tableProduct,MainForm mainform) { InitializeComponent(); _mainForm = mainform; _productTable = tableProduct; _isNds = source.StockRowByFK_ReceiptMaster_Stock.IsNDS; this.mDataSet = source.Table.DataSet as MDataSet; this.productBindingSource.DataSource = new DataView(_productTable, "IsNds=" + _isNds.ToString(),"Name",DataViewRowState.OriginalRows); this.productBindingSource.ResetBindings(true); // this.productBindingSource.DataSource = this.mDataSet.Product.Select("IsNds=" + source.StockRowByFK_ReceiptMaster_Stock.IsNDS.ToString() ); this.receiptMasterBindingSource.DataSource = source; this.receiptMasterBindingSource.ResetBindings(true); this.receiptMasterBindingSourceView.DataSource = source.Table; this.receiptMasterBindingSourceView.ResetBindings(true); this.receiptMasterBindingSourceView.CurrencyManager.Position= this.receiptMasterBindingSourceView.Find("ID", source.ID); this.receiptDetailBindingSource.DataSource = this.receiptMasterBindingSourceView; this.receiptDetailBindingSource.DataMember = "ReceiptMaster_ReceiptDetail"; this.receiptDetailBindingSource.ResetBindings(true); }
public UCOrganizationRow(MDataSet.OrganizationRow organizationRow, MainForm.ActionDialog actionDialog) { InitializeComponent(); this.mDataSet =organizationRow.Table.DataSet as MDataSet; this.organizationBindingSource.DataSource = organizationRow; }
public ReceiptRowOrganization(MDataSet.ReceiptMasterRow source, int currentID) { //** receiptMasterBindingSource - таблица *// InitializeComponent(); _curentReceiptMasterRow = source; this.mDataSet = source.Table.DataSet as MDataSet; this.receiptMasterBindingSource.DataSource =new DataView(source.Table,"ID="+_curentReceiptMasterRow.ID.ToString(),null,DataViewRowState.CurrentRows); this.receiptMasterBindingSource.ResetBindings(false); this.tradePutletBindingSource.DataSource = this.mDataSet.TradePutlet; this.tradePutletBindingSource.ResetBindings(false); _viewModifedOriginal = new DataView(source.Table, "ID=" + _curentReceiptMasterRow.ID.ToString(), null, DataViewRowState.ModifiedOriginal); _viewModifedOriginal.ListChanged += new ListChangedEventHandler(_viewModifedOriginal_ListChanged); _viewChangesReceiptDetail = new DataView(this.mDataSet.ReceiptDetail, "ReceiptMasterRef=" + _curentReceiptMasterRow.ID.ToString(), null, DataViewRowState.Added | DataViewRowState.Deleted | DataViewRowState.ModifiedCurrent); _viewChangesReceiptDetail.ListChanged+=new ListChangedEventHandler(_viewChangesReceiptDetail_ListChanged); (this.receiptMasterBindingSource.DataSource as DataView).ListChanged += new ListChangedEventHandler(_viewChangesReceiptDetail_ListChanged); this.organizationBindingSource.DataSource = this.mDataSet.Organization; this.organizationBindingSource.ResetBindings(false); this.stockBindingSource.DataSource = this.mDataSet.Stock; this.productBindingSource.DataSource = this.mDataSet.Product; this.receiptDetailBindingSource.DataSource = this.receiptMasterBindingSource; this.receiptDetailBindingSource.DataMember = "ReceiptMaster_ReceiptDetail"; this.receiptDetailBindingSource.ResetBindings(true); if (source.ID < 0) { this.panelNumber.Enabled = false; this.btMove.Visible = false; } if (_curentReceiptMasterRow.GetReceiptDetailRows().Length == 0) { this.btMove.Visible = false; // this.btPrintAkt.Visible = false; } this.AuthorLabel.Text = "Автор :" + _curentReceiptMasterRow.AuthorCreate.ToString(); }
public ucProductRow(MDataSet.ProductRow productRow,MainForm.ActionDialog actionDialog) { InitializeComponent(); this.mDataSet = productRow.Table.DataSet as MDataSet; this.productBindingSource.DataSource = productRow; this.packingBindingSource.DataSource = this.mDataSet.Packing; this.storageConditionBindingSource.DataSource = this.mDataSet.StorageCondition; this.substanceBindingSource.DataSource = this.mDataSet.Substance; this.farmGroupLevel2BindingSource.DataSource = this.mDataSet.FarmGroupLevel2; this.unitBindingSource.DataSource = this.mDataSet.Unit; _state = actionDialog; }
public UCProductAll(MDataSet source) { InitializeComponent(); productBindingSource.DataSource = source.Product; this.unitBindingSource.DataSource = source.Unit; this.storageConditionBindingSource.DataSource = source.StorageCondition; this.substanceBindingSource.DataSource = source.Substance; this.farmGroupLevel2BindingSource.DataSource = source.FarmGroupLevel2; this.packingBindingSource.DataSource = source.Packing; _changes = new DataView(source.Product, null, null, DataViewRowState.Added | DataViewRowState.ModifiedCurrent | DataViewRowState.Deleted); _changes.ListChanged+=new ListChangedEventHandler(_changes_ListChanged); }
/*MDataset, новые приходные документы */ public bool FillTableNewDocuments(MDataSet.ReceiptMasterDataTable source) { MDataSet.ReceiptMasterDataTable _tmpMaster = new MDataSet.ReceiptMasterDataTable(); MDataSet.ReceiptDetailDataTable _tmpDetail = new MDataSet.ReceiptDetailDataTable(); try { this.receiptMasterTableAdapter.Fill(_tmpMaster); this.receiptDetailTableAdapter.Fill(_tmpDetail); } catch (SqlException sqlerr) { if (sqlerr.Class < 17) { MessageBox.Show(sqlerr.Message); } else caughtGlobalError(sqlerr); Log("FillTableNewDocuments(MDataSet.ReceiptMasterDataTable source) ERROR" + sqlerr.Message + " " + sqlerr.Source + sqlerr.InnerException.Message); return false; } catch (Exception err) { MessageBox.Show(err.Message); Log("FillTableNewDocuments(MDataSet.ReceiptMasterDataTable source) ERROR" + err.Message + " " + err.Source + err.InnerException.Message); return false; } finally { this.mDataSet.ReceiptMaster.Merge(_tmpMaster); this.mDataSet.ReceiptDetail.Merge(_tmpDetail); } return true; }
public bool SaveToBase(MDataSet.InvoiceDetailRow sourceRow) { if (sourceRow.HasErrors) return false; if ((sourceRow.RowState == DataRowState.Detached)|(sourceRow.RowState==DataRowState.Unchanged)) return true; if (_changesInvoiceDetail.Count == 0) return true; MDataSet.InvoiceMasterRow _invoiceMasterRow; _invoiceMasterRow = sourceRow.InvoiceMasterRow; /*если после Update полей на сервере*/ if ((sourceRow.RowState == DataRowState.Modified)&sourceRow.HasVersion(DataRowVersion.Current)) { if (Convert.ToInt32(sourceRow["ID", DataRowVersion.Original]) != Convert.ToInt32(sourceRow["ID", DataRowVersion.Current])) return true; } //*Если удаление *// if (sourceRow.RowState==DataRowState.Deleted) _invoiceMasterRow = this.mDataSet.InvoiceMaster.FindByID(Convert.ToInt32((sourceRow as MDataSet.InvoiceDetailRow)["InvoiceMasterRef", DataRowVersion.Original])); MDataSet.RemainsDataTable _rem = new MDataSet.RemainsDataTable(); try { int res = this.invoiceDetailTableAdapter.Update(sourceRow); if (sourceRow.RemainsRow != null) { this.RemainsTableAdapter.FillByReceiptDetailRef(_rem, sourceRow.RemainsRow.ReceiptDetailRef); } else { this.RemainsTableAdapter.FillNew(_rem); } this.mDataSet.Remains.Merge(_rem); this.actionStatusLabel.Text = "Успешно обновлена строка"; } catch (DBConcurrencyException dbcx) { this.onInvoiceDetailDBCError(dbcx); this.actionStatusLabel.Text = "Ошибка совмесного доступа"; return false; } catch (SqlException sqlerr) { if (sqlerr.Class < 17) { OnInvoiceDetailSQLError(sqlerr,sourceRow); } else caughtGlobalError(sqlerr); Log("SaveToBase(MDataSet.InvoiceDetailRow sourceRow) ERROR" + sqlerr.Message + " " + sqlerr.Source ); return false; } catch (Exception err) { MessageBox.Show(err.Message); Log("SaveToBase(MDataSet.InvoiceDetailRow sourceRow) ERROR" + err.Message + " " + err.Source); return false; } finally { RefreshData(_invoiceMasterRow,false); } return true; }
public bool SaveToBase(MDataSet.InvoiceMasterRow sourceRow) { try { int res = this.invoiceMasterTableAdapter.Update(sourceRow); } catch (DBConcurrencyException dbcx) { this.onInvoiceMasterDBCError(dbcx); return false; } catch (SqlException sqlerr) { if (sqlerr.Class < 17) { OnInvoiceMasterSQLError(sqlerr,sourceRow); } else caughtGlobalError(sqlerr); Log("SaveToBase(MDataSet.InvoiceMasterRow sourceRow) ERROR" + sqlerr.Message + " " + sqlerr.Source + sqlerr.InnerException.Message); return false; } catch (Exception err) { MessageBox.Show(err.Message); Log("SaveToBase(MDataSet.InvoiceMasterRow sourceRow) ERROR" + err.Message + " " + err.Source + err.InnerException.Message); return false; } finally { RefreshData(sourceRow.Table as MDataSet.InvoiceMasterDataTable); } return true; }
public static System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(System.Xml.Schema.XmlSchemaSet xs) { MDataSet ds = new MDataSet(); System.Xml.Schema.XmlSchemaComplexType type = new System.Xml.Schema.XmlSchemaComplexType(); System.Xml.Schema.XmlSchemaSequence sequence = new System.Xml.Schema.XmlSchemaSequence(); xs.Add(ds.GetSchemaSerializable()); System.Xml.Schema.XmlSchemaAny any = new System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; return type; }
private void OnReceiptMasterSQLError(SqlException sqlerr, MDataSet.ReceiptMasterRow sourceRow) { MessageBox.Show(sqlerr.Message, "SqlException"); }
public bool RefreshData(MDataSet.RemainsRow sourceRow) { MDataSet.RemainsDataTable _RemainsDataTable = new MDataSet.RemainsDataTable(); try { this.RemainsTableAdapter.FillByReceiptDetailRef(_RemainsDataTable, sourceRow.ReceiptDetailRef); } catch (Exception err) { MessageBox.Show(err.Message); Log("(MDataSet.RemainsRow sourceRow) " + err.Message + " " + err.Source + err.InnerException.Message); return false; } finally { this.mDataSet.Remains.Merge(_RemainsDataTable); } return true; }
public bool RefreshData(MDataSet.InvoiceDetailRow sourceRow) { MDataSet.InvoiceDetailDataTable _invoiceDetailDataTable = new MDataSet.InvoiceDetailDataTable(); try { this.invoiceDetailTableAdapter.FillByInvoiceMasterRef(_invoiceDetailDataTable,sourceRow.InvoiceMasterRef); } catch (Exception err) { MessageBox.Show(err.Message); Log("RefreshData (MDataSet.InvoiceDetailRow sourceRow) " + err.Message + " " + err.Source + err.InnerException.Message); return false; } finally { this.mDataSet.InvoiceDetail.Merge(_invoiceDetailDataTable, true); } return true; }
public bool RefreshData(MDataSet.InvoiceMasterRow sourceRow,bool isMerge) { MDataSet.InvoiceMasterDataTable _invoiceMasterDataTable=new MDataSet.InvoiceMasterDataTable(); try { this.invoiceMasterTableAdapter.FillNew(_invoiceMasterDataTable); } catch (Exception err) { MessageBox.Show(err.Message); Log("RefreshData(MDataSet.InvoiceMasterRow sourceRow) " + err.Message + " " + err.Source + err.InnerException.Message); return false; } finally { this.mDataSet.InvoiceMaster.Merge(_invoiceMasterDataTable); } return true; }
/*FillNew + Merge + FillDetailsById*/ public bool RefreshData(MDataSet.ReceiptMasterRow sourceRow) { MDataSet.ReceiptMasterDataTable _ReceiptMasterDataTable = new MDataSet.ReceiptMasterDataTable(); MDataSet.ReceiptDetailDataTable _ReceiptDetailDataTable = new MDataSet.ReceiptDetailDataTable(); MDataSet.ProductDataTable _productDataTable = new MDataSet.ProductDataTable(); // MDataSet.ReceiptRemainsDataTable _ReceiptRemainsDataTable = new MDataSet.ReceiptRemainsDataTable(); try { this.productTableAdapter.FillByReceiptId(_productDataTable, sourceRow.ID); this.receiptMasterTableAdapter.FillNew(_ReceiptMasterDataTable); this.receiptDetailTableAdapter.FillByReceiptMasterRef(_ReceiptDetailDataTable, sourceRow.ID); } catch (Exception err) { MessageBox.Show(err.Message); Log("RefreshData(MDataSet.ReceiptMasterRow sourceRow) ERROR" + err.Message + " " + err.Source + err.InnerException.Message); return false; } finally { this.mDataSet.Product.Merge(_productDataTable); this.mDataSet.ReceiptMaster.Merge(_ReceiptMasterDataTable); this.mDataSet.ReceiptDetail.Merge(_ReceiptDetailDataTable); this.mDataSet.ReceiptMaster.AcceptChanges(); this.mDataSet.ReceiptDetail.AcceptChanges(); this.mDataSet.ReceiptMaster.AcceptChanges(); } return true; }
/*MDataset, документы на складе, из открытого периода, новые, X дней*/ public bool FillTableStockDocuments(MDataSet.ReceiptMasterDataTable source,DateTime begin) { MDataSet.ReceiptMasterDataTable _tmpMaster = new MDataSet.ReceiptMasterDataTable(); MDataSet.ReceiptDetailDataTable _tmpDetail = new MDataSet.ReceiptDetailDataTable(); MDataSet.ProductDataTable _prod = new MDataSet.ProductDataTable(); try { this.receiptMasterTableAdapter.FillByPeriod(_tmpMaster,begin); /* foreach(DataRow masRow in _tmpMaster ) { MDataSet.ManufacturerDataTable _man = new MDataSet.ManufacturerDataTable(); this.manufacturerTableAdapter.FillByReceiptMasterRef(_man, (masRow as MDataSet.ReceiptMasterRow).ID); this.productTableAdapter.FillByReceiptId(_prod, (masRow as MDataSet.ReceiptMasterRow).ID); // this.manufacturerTableAdapter.FillByReceiptMasterRef(_man , (masRow as MDataSet.ReceiptMasterRow).ID); this.mDataSet.Product.Merge(_prod); this.mDataSet.Manufacturer.Merge(_man); } this.receiptDetailTableAdapter.FillByPeriod(_tmpDetail, begin); this.mDataSet.ReceiptDetail.Merge(_tmpDetail);*/ this.mDataSet.ReceiptMaster.Merge(_tmpMaster); } catch (SqlException sqlerr) { if (sqlerr.Class < 17) { MessageBox.Show(sqlerr.Message); } else caughtGlobalError(sqlerr); Log("FillTableStockDocuments(MDataSet.ReceiptMasterDataTable source) ERROR" + sqlerr.Message + " " + sqlerr.Source + sqlerr.InnerException.Message); return false; } catch (Exception err) { DataRow[] dr = this.mDataSet.Manufacturer.GetErrors(); DataColumn[] dc = dr[0].GetColumnsInError(); MessageBox.Show(err.Message); Log("FillTableStockDocuments(MDataSet.ReceiptMasterDataTable source) ERROR" + err.Message + " " + err.Source ); return false; } finally { } return true; }
public bool FillTableStockDocuments(MDataSet.InvoiceMasterDataTable source, int numPeriods) { MDataSet.InvoiceMasterDataTable _tmpMaster = new MDataSet.InvoiceMasterDataTable(); // MDataSet.InvoiceDetailDataTable _tmpDetail = new MDataSet.InvoiceDetailDataTable(); try { this.invoiceMasterTableAdapter.FillByPeriodNum(_tmpMaster, numPeriods); } catch (SqlException sqlerr) { if (sqlerr.Class < 17) { MessageBox.Show(sqlerr.Message); } else caughtGlobalError(sqlerr); Log("FillTableStockDocuments(MDataSet.InvoiceMasterDataTable source) ERROR" + sqlerr.Message + " " + sqlerr.Source + sqlerr.InnerException.Message); return false; } catch (Exception err) { MessageBox.Show(err.Message); Log("FillTableStockDocuments(MDataSet.InvoiceMasterDataTable source) ERROR" + err.Message + " " + err.Source + err.InnerException.Message); return false; } finally { this.mDataSet.InvoiceMaster.Merge(_tmpMaster); } return true; }
private bool OnInvoiceDetailSQLError(SqlException sqlerr,MDataSet.InvoiceDetailRow row) { decimal _oldQnt = row.Quantity; RefreshData(row.RemainsRow); // если нулевой остаток if (row.RemainsRow.QuantityRemains == 0) { MessageBox.Show("Уже нет товара на складе!"); row.RejectChanges(); return true; } else { // уменьшить до кол-ва остатка и снова сохранить try { row.ClearErrors(); row.Quantity = row.RemainsRow.QuantityRemains; } catch(Exception ex) { MessageBox.Show(ex.Message); row.RejectChanges(); return false; } finally { decimal ed = _oldQnt - row.Quantity; MessageBox.Show("Не удалось выписать: "+ed.ToString()); } return true; } }
public UCOrganizationAll(MDataSet source) { InitializeComponent(); organizationBindingSource.DataSource = source.Organization; _changes = new DataView(source.Organization,null,null,DataViewRowState.ModifiedCurrent); }
private void OnInvoiceMasterSQLError(SqlException sqlerr, MDataSet.InvoiceMasterRow sourceRow) { throw new Exception("The method or operation is not implemented."); }
public static System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(System.Xml.Schema.XmlSchemaSet xs) { System.Xml.Schema.XmlSchemaComplexType type = new System.Xml.Schema.XmlSchemaComplexType(); System.Xml.Schema.XmlSchemaSequence sequence = new System.Xml.Schema.XmlSchemaSequence(); MDataSet ds = new MDataSet(); xs.Add(ds.GetSchemaSerializable()); System.Xml.Schema.XmlSchemaAny any1 = new System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); System.Xml.Schema.XmlSchemaAny any2 = new System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); System.Xml.Schema.XmlSchemaAttribute attribute1 = new System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); System.Xml.Schema.XmlSchemaAttribute attribute2 = new System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "PeriodsDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; return type; }
public bool SaveToBaseDeletedDetails(MDataSet.ReceiptMasterRow sourceRow) { // DataView _receiptDeleted = new DataView(this.mDataSet.ReceiptDetail, "ReceiptMasterRef=" + sourceRow.ID.ToString(), DataViewRowState.Deleted); DataRow[] _rows = this.mDataSet.ReceiptDetail.GetChanges(DataRowState.Deleted).Select("ReceiptMasterRef=" + sourceRow.ID.ToString()); try { this.receiptDetailTableAdapter.Update(_rows); } catch (DBConcurrencyException dbcx) { this.onReceiptDetailDBCError(dbcx); return false; } catch (SqlException sqlerr) { if (sqlerr.Class < 17) { OnReceiptDetailSQLError(sqlerr, sourceRow); } else caughtGlobalError(sqlerr); Log("SaveToBaseDeletedDetails ERROR" + sqlerr.Message + " " + sqlerr.Source + sqlerr.InnerException.Message); return false; } catch (Exception err) { MessageBox.Show(err.Message); Log("SaveToBaseDeletedDetails ERROR" + err.Message + " " + err.Source + err.InnerException.Message); return false; } finally { } return true; }
public bool SaveToBase(MDataSet.ReceiptMasterRow sourceRow) { try { int res = this.receiptMasterTableAdapter.Update(sourceRow); } catch (DBConcurrencyException dbcx) { this.onReceiptMasterDBCError(dbcx); } catch (SqlException sqlerr) { if (sqlerr.Class < 17) { OnReceiptMasterSQLError(sqlerr, sourceRow); } else caughtGlobalError(sqlerr); Log("SaveToBase(MDataSet.ReceiptMasterRow sourceRow) ERROR" + sqlerr.Message + " " + sqlerr.Source + sqlerr.InnerException.Message); return false; } catch (Exception err) { MessageBox.Show(err.Message); Log("SaveToBase(MDataSet.ReceiptMasterRow sourceRow) ERROR" + err.Message + " " + err.Source + err.InnerException.Message); return false; } finally { } if (sourceRow.RowState== DataRowState.Detached) return true; /*Сохранить дочерние*/ try { int res = this.receiptDetailTableAdapter.Update(this.mDataSet.ReceiptDetail); } catch (DBConcurrencyException dbcx) { this.onReceiptDetailDBCError(dbcx); return false; } catch (SqlException sqlerr) { if (sqlerr.Class < 17) { OnReceiptDetailSQLError(sqlerr, sourceRow); } else caughtGlobalError(sqlerr); Log("SaveToBase(MDataSet.ReceiptMasterRow sourceRow) ERROR" + sqlerr.Message + " " + sqlerr.Source); return false; } catch (Exception err) { MessageBox.Show(err.Message); Log("SaveToBase(MDataSet.ReceiptMasterRow sourceRow) ERROR" + err.Message + " " + err.Source + err.InnerException.Message); return false; } finally { // RefreshData(sourceRow); } return true; }
public ReceiptMasterNewAll(MDataSet source) { InitializeComponent(); this.mDataSet = source; this.receiptMasterBindingSource.DataSource = new DataView(this.mDataSet.ReceiptMaster, "DocumentTypeRef=0", null, DataViewRowState.CurrentRows); this.receiptMasterBindingSource.ResetBindings(false); this.productBindingSource.DataSource = this.mDataSet.Product; this.organizationBindingSource.DataSource = this.mDataSet.Organization; this.stockBindingSource.DataSource = this.mDataSet.Stock; // _viewChangesReceiptDetail.ListChanged += new ListChangedEventHandler(_viewChangesReceiptDetail_ListChanged); _changesMaster = new DataView(this.mDataSet.ReceiptMaster, "DocumentTypeRef=0", null, DataViewRowState.Added | DataViewRowState.Deleted | DataViewRowState.ModifiedCurrent); _changesDetail = new DataView(this.mDataSet.ReceiptDetail,"DocumentTypeRef=0", null, DataViewRowState.Added | DataViewRowState.Deleted | DataViewRowState.ModifiedCurrent); _changesMaster.ListChanged+=new ListChangedEventHandler(_changesMaster_ListChanged); _changesDetail.ListChanged += new ListChangedEventHandler(_changesMaster_ListChanged); // (this.receiptMasterBindingSource.DataSource as DataView).ListChanged += new ListChangedEventHandler(_viewChangesReceiptDetail_ListChanged); }