public InventoryTransactionView(Lot lot)
 {
     InitializeComponent();
     this.Name = "TransactionViewNewTransaction";
     isNewTransaction = true;
     txtReciever.Text = lot.LotDisplayName();
     displayOrHideForm();
     lockItemFields();
     ClearFields();
     db.BeginTransaction();
     mTransaction = new InventoryTransaction(lot.GetLotID());
     mTransaction.SetClientType(InventoryTransaction.ClientType.Client);
 }
예제 #2
0
 private void dgLots_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     if (e.ClickCount == 2)
     {
         if (dgLots.SelectedIndex > -1)
         {
             LotBinding obj = (LotBinding)dgLots.SelectedCells[0].Item;
             itemRecords.SeekToPrimaryKey(obj.lotID);
             Lot mLot = new Lot(itemRecords.GetRecordDataSet());
             MainWindow.OpenTab(new LotView(mLot), (Image)App.iconSet["home"], mLot.LotDisplayName());
         }
     }
 }
        private void dgLotsCompleted_MouseDown(object sender, MouseButtonEventArgs e)
        {
                if (e.ClickCount == 2)
                {
                    if (dgLotsCompleted.SelectedCells.Count > 0)
                    {
                            LotBinding obj = (LotBinding)dgLotsCompleted.SelectedCells[0].Item;
                            itemRecords.SeekToPrimaryKey(obj.lotID);
                            Lot lotObj = new Lot(itemRecords.GetRecordDataSet());
                            MainWindow.OpenTab(new LotView(lotObj), (Image)App.iconSet["home"], lotObj.LotDisplayName());

                    }
                }
            
        }
 private void dgHours_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (dgHours.SelectedItem != null)
     {
         LotServicesBilledBinding obj = (LotServicesBilledBinding)dgHours.SelectedItem;
         try
         {
             DataSet data = db.Select("*", Lot.Table, Lot.Fields.lotID.ToString() + " = '" + obj.lotID + "'");
             if (data.NumberOfRows() == 1)
             {
                 data.Read();
                 Lot lot = new Lot(data.GetRecordDataSet());
                 MainWindow.OpenTab(new LotView(lot), (Image)App.iconSet["home"], lot.LotDisplayName());
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Error loading selected lot - " + msgCodes.GetString("M2102") + " " + ex.Message, "Error - 2102", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
 }
        private void dgLabourHours_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (dgLabourHours.SelectedItem != null)
            {
                try
                {
                    if (cmboType.SelectedItem.Equals(builderItem))
                    {
                        SiteMaterialCostsBinding obj = (SiteMaterialCostsBinding)dgLabourHours.SelectedItem;
                        DataSet data = db.Select("*", Site.Table, Site.Fields.siteID.ToString() + " = '" + obj.siteID + "'");
                        if (data.NumberOfRows() == 1)
                        {
                            data.Read();
                            Site site = new Site(data.GetRecordDataSet());

                            data = db.Select("*", Client.Table, Client.Fields.clientID.ToString() + " = '" + site.GetClientID() + "'");
                            data.Read();
                            Client client = new Client(data.GetRecordDataSet());

                            MainWindow.OpenTab(new SiteView(site, client), (Image)App.iconSet["symbol-site"], site.GetSiteName());
                        }
                    }
                    else
                    {
                        LotMaterialCostsBinding obj = (LotMaterialCostsBinding)dgLabourHours.SelectedItem;
                        DataSet data = db.Select("*", Lot.Table, Lot.Fields.lotID.ToString() + " = '" + obj.lotID + "'");
                        if (data.NumberOfRows() == 1)
                        {
                            data.Read();
                            Lot lot = new Lot(data.GetRecordDataSet());
                            MainWindow.OpenTab(new LotView(lot), (Image)App.iconSet["home"], lot.LotDisplayName());
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error loading selected lot/site - " + msgCodes.GetString("M2102") + " " + ex.Message, "Error - 2102", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
 private void LoadTransaction()
 {
     ClearFields();
     try
     {
         if (mTransaction.GetClientType().Equals(InventoryTransaction.ClientType.Inventory))
         {
             isRestock = true;
             txtReciever.Text = "Inventory";
         }
         else
         {
             DataSet data = db.Select("*", Site.Table, Site.Fields.siteID.ToString() + " = '" + mTransaction.GetAssocID() + "'");
             if (data.NumberOfRows() > 0)
             {
                 data.Read();
                 Site site = new Site(data.GetRecordDataSet());
                 txtReciever.Text = site.GetSiteName();
             }
             else
             {
                 data = db.Select("*", Lot.Table, Lot.Fields.lotID.ToString() + " = '" + mTransaction.GetAssocID() + "'");
                 if (data.NumberOfRows() > 0)
                 {
                     data.Read();
                     Lot lot = new Lot(data.GetRecordDataSet());
                     txtReciever.Text = lot.LotDisplayName();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Loading Transaction Failed - " + msgCodes.GetString("M2102") + ex.Message, "Error - 2102", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     isTransactionLocked = true;
     dpTransactionDate.Text = mTransaction.GetDateOfTransaction().ToShortDateString();
     dpTransactionDate.IsReadOnly = true;
     LoadDateGrid();
 }