//////////////////////////////////////////////////////////////////////////////////////////// // Public //////////////////////////////////////////////////////////////////////////////////////////// public void myInit() { // Setup the TransactionDataset this.tDataSet = new TransactionDataSet(); this.tDataSet.myInit(); // Setup this dataset this.lineTA = new LineItemTableAdapter(); this.lineTA.ClearBeforeFill = true; this.envelopeLineViewTA = new EnvelopeLineViewTableAdapter(); this.envelopeLineViewTA.ClearBeforeFill = true; this.LineItem.ColumnChanged += new System.Data.DataColumnChangeEventHandler(LineItem_ColumnChanged); this.LineItem.TableNewRow += new System.Data.DataTableNewRowEventHandler(LineItem_TableNewRow); this.stayOut = false; // Reference the tables in the transactionDataSet this.Account = this.tDataSet.Account; this.Envelope = this.tDataSet.Envelope; this.LineType = this.tDataSet.LineType; // Setup the error finder. this.e_Finder = new BackgroundWorker(); this.e_Finder.RunWorkerCompleted += new RunWorkerCompletedEventHandler(e_Finder_RunWorkerCompleted); this.e_Finder.DoWork += new DoWorkEventHandler(e_Finder_DoWork); }
public TransactionDataSet GetListDataSet() { var myDataSet = new TransactionDataSet(); var serNo = 1; foreach (var line in TransactionLines) { myDataSet.TransactionList.Rows.Add( "Store: " + line.WarehouseName, "On Date: " + line.TransactionDateString, BusinessPartner + " Name: " + line.DisplayName, "Transaction Number: " + line.TransactionNumber, line.TransactionStatus, serNo, line.ItemCode, line.ItemDisplayName, "", 0, 0, line.EachPrice, line.Unit, line.LinePrice, 0); serNo++; } return(myDataSet); }
//act public TransactionDataSet_Tests() { s1 = ScriptTransactionParser.Parse(filepath1 + s1FileName + extension); s2 = ScriptTransactionParser.Parse(filepath2 + s2FileName + extension); tdS = new TransactionDataSet(s1, s2); tdS.CreateTransactionTables(); }
private void uscRemoveStock_Load(object sender, EventArgs e) { Common.FillProducts(cmbProducts, true, "Select"); Common.FillWareHouses(cmbWareHouse, true, "Select"); dsTransaction = new TransactionDataSet(); dtTransactionDetails = dsTransaction.TransactionDetails; dtTransactionStockInformation = dsTransaction.TransactionStockInformation; dgvTransactionDetails.AutoGenerateColumns = false; dgvTransactionDetails.DataSource = dtTransactionDetails; }
public TransactionDataSet GetListDataSet2() { var myDataSet = new TransactionDataSet(); var selectedCompany = new CompanyService(true).GetCompany(); var SelectedTransaction = SelectedMember.LastSubscription; try { #region Fields var brCode = new BarcodeProcess(); var tranNumberbarcode = ImageToByteArray(brCode.GetBarcode(SelectedTransaction.SubscriptionNumber, 320, 40, true), ImageFormat.Bmp); var subTotal = SelectedTransaction.AmountPaid / (decimal)1.15; var tax = Convert.ToDecimal((subTotal * ((decimal)0.15)).ToString("N2")); string reciptNo = SelectedTransaction.ReceiptNumber, prefix = ""; int recLen = 10 - reciptNo.Length; while (recLen != 0) { prefix = prefix + "0"; recLen--; } reciptNo = prefix + reciptNo; #endregion #region Header myDataSet.TransactionHeader.Rows.Add( reciptNo, tranNumberbarcode, SelectedMember.TinNumber, SelectedMember.DisplayName, SelectedMember.Number, SelectedMember.SexAmharic, SelectedTransaction.SubscribedDateString + "(" + ReportUtility.GetEthCalendarFormated(SelectedTransaction.SubscribedDate, "/") + ")", "", subTotal, "VAT (" + 15 + "%)", tax, subTotal + tax, "linknumber1" ); #endregion #region Client Address myDataSet.ClientDetail.Rows.Add( selectedCompany.Header, selectedCompany.Footer, selectedCompany.Address.AddressDetail, selectedCompany.Address.SubCity, selectedCompany.Address.Kebele, selectedCompany.Address.HouseNumber, selectedCompany.Address.Mobile, selectedCompany.Address.AlternateMobile, selectedCompany.Address.Fax, selectedCompany.Address.PrimaryEmail, selectedCompany.Address.AlternateEmail, selectedCompany.TinNumber, selectedCompany.VatNumber, "CASH", "CASH", Singleton.User.FullName.ToUpper(), "linknumber1"); #endregion #region BPAddress myDataSet.BPAddress.Rows.Add( SelectedMember.Address.AddressDetail, SelectedMember.Address.SubCity, SelectedMember.Address.Kebele, SelectedMember.Address.HouseNumber, SelectedMember.Address.Mobile, SelectedMember.Address.AlternateMobile, SelectedMember.Address.Fax, SelectedMember.Address.PrimaryEmail, SelectedMember.Address.AlternateEmail, "linknumber1"); #endregion #region Lines myDataSet.TransactionLine.Rows.Add( "1", "00" + SelectedTransaction.FacilitySubscription.Facility.Id.ToString(), SelectedTransaction.FacilitySubscription.PackageName, "", "Gym", "Pcs", subTotal, 1, subTotal, 0, "linknumber1"); #endregion } catch (Exception exception) { MessageBox.Show("Can't get data for the report" + Environment.NewLine + exception.Message, "Can't get data", MessageBoxButton.OK, MessageBoxImage.Error); } return(myDataSet); }
public TransactionDataSet GetListDataSet() { var myDataSet = new TransactionDataSet(); try { #region Fields var brCode = new BarcodeProcess(); var tranNumberbarcode = ImageToByteArray(brCode.GetBarcode(SelectedTransaction.TransactionNumber, 320, 40, true), ImageFormat.Bmp); var tax = Convert.ToDecimal((SelectedTransaction.TotalCost * (Singleton.Setting.TaxPercent * (decimal)0.01)).ToString("N2")); #endregion #region Header myDataSet.TransactionHeader.Rows.Add( SelectedTransaction.FiscalNumber, tranNumberbarcode, SelectedTransaction.Warehouse.DisplayName, SelectedTransaction.BusinessPartner.DisplayName, SelectedTransaction.BusinessPartner.TinNumber, SelectedTransaction.BusinessPartner.VatNumber, SelectedTransaction.TransactionDateString + "(" + ReportUtility.getEthCalendarFormated(SelectedTransaction.TransactionDate, "/") + ")", SelectedTransaction.Status, SelectedTransaction.TotalCost, EnumUtil.GetEnumDesc(Singleton.Setting.TaxType) + " (" + Singleton.Setting.TaxPercent + "%)", tax, SelectedTransaction.TotalCost + tax, "linknumber1" ); #endregion #region Client Address myDataSet.ClientDetail.Rows.Add( SelectedTransaction.Warehouse.Header, SelectedTransaction.Warehouse.Footer, SelectedTransaction.Warehouse.Address.StreetAddress, SelectedTransaction.Warehouse.Address.SubCity, SelectedTransaction.Warehouse.Address.Kebele, SelectedTransaction.Warehouse.Address.HouseNumber, SelectedTransaction.Warehouse.Address.Telephone, SelectedTransaction.Warehouse.Address.Mobile, SelectedTransaction.Warehouse.Address.Fax, SelectedTransaction.Warehouse.Address.PrimaryEmail, SelectedTransaction.Warehouse.Address.AlternateEmail, SelectedTransaction.Warehouse != null ? SelectedTransaction.Warehouse.TinNumber : "", SelectedTransaction.Warehouse != null ? SelectedTransaction.Warehouse.VatNumber : "", PaymentMethod, PaymentMethod, "", "linknumber1"); #endregion #region BPAddress myDataSet.BPAddress.Rows.Add( SelectedTransaction.BusinessPartner.Addresses.FirstOrDefault().Address.StreetAddress, SelectedTransaction.BusinessPartner.Addresses.FirstOrDefault().Address.SubCity, SelectedTransaction.BusinessPartner.Addresses.FirstOrDefault().Address.Kebele, SelectedTransaction.BusinessPartner.Addresses.FirstOrDefault().Address.HouseNumber, SelectedTransaction.BusinessPartner.Addresses.FirstOrDefault().Address.Telephone, SelectedTransaction.BusinessPartner.Addresses.FirstOrDefault().Address.Mobile, SelectedTransaction.BusinessPartner.Addresses.FirstOrDefault().Address.Fax, SelectedTransaction.BusinessPartner.Addresses.FirstOrDefault().Address.PrimaryEmail, SelectedTransaction.BusinessPartner.Addresses.FirstOrDefault().Address.AlternateEmail, "linknumber1"); #endregion #region Lines var serNo = 1; foreach (var line in TransactionLines) { myDataSet.TransactionLine.Rows.Add( serNo, line.Item.ItemCode, string.IsNullOrEmpty(line.Item.Description) ? line.Item.DisplayName : line.Item.Description, "", line.Item.Category.DisplayName, line.Item.UnitOfMeasure.DisplayName, line.EachPrice, line.Unit, line.LinePrice, 0, "linknumber1"); serNo++; } #endregion } catch (Exception exception) { MessageBox.Show("Can't get data for the report" + Environment.NewLine + exception.Message, "Can't get data", MessageBoxButton.OK, MessageBoxImage.Error); } return(myDataSet); }
private void btnFinish_Click(object sender, EventArgs e) { if (ActionType == WhistlingPalms.ActionType.Addition.ToString()) { try { TransactionDataSet ds = ((uscAddStock)uscTransactionDetails).dsTransaction; if (ds.TransactionDetails.Rows.Count <= 0) { MessageBox.Show("Please add atleast one item details for the transaction", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var transactionOptions = new TransactionOptions(); transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; transactionOptions.Timeout = TimeSpan.MaxValue; using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, transactionOptions)) { InventoryStoreDataSetTableAdapters.tblTransactionTableAdapter adpTransaction = new InventoryStoreDataSetTableAdapters.tblTransactionTableAdapter(); InventoryStoreDataSetTableAdapters.tblTransactionDetailsTableAdapter adpTransactionDetails = new InventoryStoreDataSetTableAdapters.tblTransactionDetailsTableAdapter(); InventoryStoreDataSetTableAdapters.tblTransactionStockInformationTableAdapter adpTransactionStock = new InventoryStoreDataSetTableAdapters.tblTransactionStockInformationTableAdapter(); InventoryStoreDataSetTableAdapters.tblInventoryTableAdapter adpInventory = new InventoryStoreDataSetTableAdapters.tblInventoryTableAdapter(); int?ClientID = null; if ((int)cmbClient.SelectedValue > 0) { ClientID = (int)cmbClient.SelectedValue; } int TransactionID = Convert.ToInt32(adpTransaction.InsertTransaction(txtTransactionDetails.Text.Trim(), dtpTransactionDate.Value, (int)cmbTransactionType.SelectedValue, txtRemarks.Text.Trim(), txtOrderNo.Text.Trim(), ClientID)); if (TransactionID > 0) { foreach (TransactionDataSet.TransactionDetailsRow dr in ds.TransactionDetails.Rows) { int?ToWareHouseID = null; if (!dr.IsToWareHouseIDNull()) { ToWareHouseID = dr.ToWareHouseID; } int TransactionDetailID = Convert.ToInt32(adpTransactionDetails.InsertTransactionDetails(TransactionID, dr.ProductID, dr.FromWareHouseID, ToWareHouseID, dr.TransactQuantity, dr.TransactCost, dr.TotalCost)); if (TransactionDetailID > 0) { foreach (TransactionDataSet.TransactionStockInformationRow tsr in ds.TransactionStockInformation.Rows) { if (tsr.TransactionDetailID == dr.TransactionDetailID) { int TransactionStockID = adpTransactionStock.Insert(TransactionDetailID, tsr.Cost, tsr.OldQuantity, tsr.NewQuantity, tsr.IsFromWareHouse); if (TransactionStockID > 0) { int retval; if (tsr.OldQuantity == 0) { retval = adpInventory.Insert(dr.ProductID, dr.FromWareHouseID, tsr.Cost, tsr.NewQuantity); } else { retval = adpInventory.UpdateQuantity(tsr.NewQuantity, dr.ProductID, dr.FromWareHouseID, tsr.Cost); } if (retval <= 0) { throw new Exception("Unable to update into Inventory Table"); } } else { throw new Exception("Unable to insert into Transaction Stock Change Information"); } } } } else { throw new Exception("Unable to insert into Transaction Details"); } } } else { throw new Exception("Unable to insert into Transaction Master"); } ts.Complete(); this.Close(); } } catch (Exception ex) { MessageBox.Show("Failed to Insert Transaction. Error Details:" + Environment.NewLine + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (ActionType == WhistlingPalms.ActionType.Deduction.ToString()) { try { TransactionDataSet ds = ((uscRemoveStock)uscTransactionDetails).dsTransaction; if (ds.TransactionDetails.Rows.Count <= 0) { MessageBox.Show("Please add atleast one item details for the transaction", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var transactionOptions = new TransactionOptions(); transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; transactionOptions.Timeout = TimeSpan.MaxValue; using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, transactionOptions)) { InventoryStoreDataSetTableAdapters.tblTransactionTableAdapter adpTransaction = new InventoryStoreDataSetTableAdapters.tblTransactionTableAdapter(); InventoryStoreDataSetTableAdapters.tblTransactionDetailsTableAdapter adpTransactionDetails = new InventoryStoreDataSetTableAdapters.tblTransactionDetailsTableAdapter(); InventoryStoreDataSetTableAdapters.tblTransactionStockInformationTableAdapter adpTransactionStock = new InventoryStoreDataSetTableAdapters.tblTransactionStockInformationTableAdapter(); InventoryStoreDataSetTableAdapters.tblInventoryTableAdapter adpInventory = new InventoryStoreDataSetTableAdapters.tblInventoryTableAdapter(); int?ClientID = null; if ((int)cmbClient.SelectedValue > 0) { ClientID = (int)cmbClient.SelectedValue; } int TransactionID = Convert.ToInt32(adpTransaction.InsertTransaction(txtTransactionDetails.Text.Trim(), dtpTransactionDate.Value, (int)cmbTransactionType.SelectedValue, txtRemarks.Text.Trim(), txtOrderNo.Text.Trim(), ClientID)); if (TransactionID > 0) { foreach (TransactionDataSet.TransactionDetailsRow dr in ds.TransactionDetails.Rows) { int?ToWareHouseID = null; if (!dr.IsToWareHouseIDNull()) { ToWareHouseID = dr.ToWareHouseID; } int TransactionDetailID = Convert.ToInt32(adpTransactionDetails.InsertTransactionDetails(TransactionID, dr.ProductID, dr.FromWareHouseID, ToWareHouseID, dr.TransactQuantity, dr.TransactCost, dr.TotalCost)); if (TransactionDetailID > 0) { foreach (TransactionDataSet.TransactionStockInformationRow tsr in ds.TransactionStockInformation.Rows) { if (tsr.TransactionDetailID == dr.TransactionDetailID && tsr.TransactQuantity > 0) { int TransactionStockID = adpTransactionStock.Insert(TransactionDetailID, tsr.Cost, tsr.OldQuantity, tsr.NewQuantity, tsr.IsFromWareHouse); if (TransactionStockID > 0) { int retval; if (tsr.NewQuantity == 0) { retval = adpInventory.DeleteInventoryEntry(dr.ProductID, dr.FromWareHouseID, tsr.Cost); } else { retval = adpInventory.UpdateQuantity(tsr.NewQuantity, dr.ProductID, dr.FromWareHouseID, tsr.Cost); } if (retval <= 0) { throw new Exception("Unable to update into Inventory Table"); } } else { throw new Exception("Unable to insert into Transaction Stock Change Information"); } } } } else { throw new Exception("Unable to insert into Transaction Details"); } } } else { throw new Exception("Unable to insert into Transaction Master"); } ts.Complete(); this.Close(); } } catch (Exception ex) { MessageBox.Show("Failed to Insert Transaction. Error Details:" + Environment.NewLine + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (ActionType == WhistlingPalms.ActionType.Transfer.ToString()) { try { TransactionDataSet ds = ((uscTransferStock)uscTransactionDetails).dsTransaction; if (ds.TransactionDetails.Rows.Count <= 0) { MessageBox.Show("Please add atleast one item details for the transaction", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var transactionOptions = new TransactionOptions(); transactionOptions.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; transactionOptions.Timeout = TimeSpan.MaxValue; using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, transactionOptions)) { InventoryStoreDataSetTableAdapters.tblTransactionTableAdapter adpTransaction = new InventoryStoreDataSetTableAdapters.tblTransactionTableAdapter(); InventoryStoreDataSetTableAdapters.tblTransactionDetailsTableAdapter adpTransactionDetails = new InventoryStoreDataSetTableAdapters.tblTransactionDetailsTableAdapter(); InventoryStoreDataSetTableAdapters.tblTransactionStockInformationTableAdapter adpTransactionStock = new InventoryStoreDataSetTableAdapters.tblTransactionStockInformationTableAdapter(); InventoryStoreDataSetTableAdapters.tblInventoryTableAdapter adpInventory = new InventoryStoreDataSetTableAdapters.tblInventoryTableAdapter(); int?ClientID = null; if ((int)cmbClient.SelectedValue > 0) { ClientID = (int)cmbClient.SelectedValue; } int TransactionID = Convert.ToInt32(adpTransaction.InsertTransaction(txtTransactionDetails.Text.Trim(), dtpTransactionDate.Value, (int)cmbTransactionType.SelectedValue, txtRemarks.Text.Trim(), txtOrderNo.Text.Trim(), ClientID)); if (TransactionID > 0) { foreach (TransactionDataSet.TransactionDetailsRow dr in ds.TransactionDetails.Rows) { int? ToWareHouseID = null; decimal?TransactCost = null; decimal?TotalCost = null; if (!dr.IsToWareHouseIDNull()) { ToWareHouseID = dr.ToWareHouseID; } if (!dr.IsTotalCostNull()) { TotalCost = dr.TotalCost; } if (!dr.IsTransactCostNull()) { TransactCost = dr.TransactCost; } int TransactionDetailID = Convert.ToInt32(adpTransactionDetails.InsertTransactionDetails(TransactionID, dr.ProductID, dr.FromWareHouseID, ToWareHouseID, dr.TransactQuantity, TransactCost, TotalCost)); if (TransactionDetailID > 0) { foreach (TransactionDataSet.TransactionStockInformationRow tsr in ds.TransactionStockInformation.Rows) { if (tsr.TransactionDetailID == dr.TransactionDetailID && tsr.TransactQuantity > 0 && tsr.IsFromWareHouse == true) { int TransactionStockID = adpTransactionStock.Insert(TransactionDetailID, tsr.Cost, tsr.OldQuantity, tsr.NewQuantity, tsr.IsFromWareHouse); if (TransactionStockID > 0) { int retval; if (tsr.NewQuantity == 0) { retval = adpInventory.DeleteInventoryEntry(dr.ProductID, dr.FromWareHouseID, tsr.Cost); } else { retval = adpInventory.UpdateQuantity(tsr.NewQuantity, dr.ProductID, dr.FromWareHouseID, tsr.Cost); } if (retval <= 0) { throw new Exception("Unable to update into Inventory Table"); } } else { throw new Exception("Unable to insert into Transaction Stock Change Information"); } } else if (tsr.TransactionDetailID == dr.TransactionDetailID && tsr.TransactQuantity > 0 && tsr.IsFromWareHouse == false) { int TransactionStockID = adpTransactionStock.Insert(TransactionDetailID, tsr.Cost, tsr.OldQuantity, tsr.NewQuantity, tsr.IsFromWareHouse); if (TransactionStockID > 0) { int retval; if (tsr.OldQuantity == 0) { retval = adpInventory.Insert(dr.ProductID, dr.ToWareHouseID, tsr.Cost, tsr.NewQuantity); } else { retval = adpInventory.UpdateQuantity(tsr.NewQuantity, dr.ProductID, dr.ToWareHouseID, tsr.Cost); } if (retval <= 0) { throw new Exception("Unable to update into Inventory Table"); } } else { throw new Exception("Unable to insert into Transaction Stock Change Information"); } } } } else { throw new Exception("Unable to insert into Transaction Details"); } } } else { throw new Exception("Unable to insert into Transaction Master"); } ts.Complete(); this.Close(); } } catch (Exception ex) { MessageBox.Show("Failed to Insert Transaction. Error Details:" + Environment.NewLine + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public RequestComparerPage(Script s1, Script s2) { InitializeComponent(); DataContext = this; var transDataSet = new TransactionDataSet(s1, s2); if (!transDataSet.CreateTransactionTables()) { MessageBox.Show("The transaction count or names of these two scripts do not match"); } if (transDataSet.DataSet.Tables != null) { ColorDispenser colorDispenser = new ColorDispenser(55); foreach (DataTable table in transDataSet.DataSet.Tables) { #region stackpanelOption Stack_Panel.Children.Add(new TextBlock() { Text = "\n" + table.TableName, FontSize = 13.5 //HorizontalAlignment = HorizontalAlignment.Center }); DockPanel dockPanelNames = new DockPanel() { HorizontalAlignment = HorizontalAlignment.Stretch, LastChildFill = true }; var fontSize = 12; var foreGround = Brushes.White; var backGround = Brushes.DarkGray; var blockMargin = new Thickness(4.5, 0, 0, 0); var nameBlockLeft = new TextBlock() { Text = table.Columns[0].ColumnName, FontSize = fontSize, Foreground = foreGround, Background = backGround, Width = 750, }; var nameBlockRight = new TextBlock() { Text = table.Columns[1].ColumnName, FontSize = fontSize, Foreground = foreGround, Background = backGround, Margin = blockMargin }; DockPanel.SetDock(nameBlockLeft, Dock.Left); DockPanel.SetDock(nameBlockRight, Dock.Right); dockPanelNames.Children.Add(nameBlockLeft); dockPanelNames.Children.Add(nameBlockRight); Stack_Panel.Children.Add(dockPanelNames); foreach (DataRow row in table.Rows) { var leftRequest = row[0] as Request; var rightRequest = row[1] as Request; DockPanel dockPanelValues = new DockPanel(); var valueBlockLeft = new TextBlock() { Text = leftRequest.GetRequestString(), FontSize = fontSize, Width = 750, Background = new SolidColorBrush(colorDispenser.GetColorBySeed(leftRequest.MatchingId)) }; var valueBlockRight = new TextBlock() { Text = rightRequest.GetRequestString(), FontSize = fontSize, Background = new SolidColorBrush(colorDispenser.GetColorBySeed(rightRequest.MatchingId)), Margin = blockMargin }; DockPanel.SetDock(valueBlockLeft, Dock.Left); DockPanel.SetDock(valueBlockRight, Dock.Right); dockPanelValues.Children.Add(valueBlockLeft); dockPanelValues.Children.Add(valueBlockRight); Stack_Panel.Children.Add(dockPanelValues); colorDispenser.Reset(); } #endregion } } else { MessageBox.Show("Dataset Tables are null"); } }