コード例 #1
0
        public LotView(Site site)
        {
            //This represents if a new Lot is being created for a Site Object
            InitializeComponent();
            try
            {
                mLot = new Lot(db);

            }
            catch (Exception ex)
            {
                MessageBox.Show("Lot Object - " + msgCodes.GetString("M2101") + ex.Message, "Error - 2102", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            txtAddress.Text = site.GetAddress();
            txtCity.Text = site.GetCity();
            txtServiceSize.Text = ((site.GetServiceSize() == 0) ? "" : "" + site.GetServiceSize());
            unlockForm();
            this.Name = "NewLotView";
            mLot.SetAssociationID(site.GetSiteID());
            DataSet data = db.Select("*", Client.Table, Client.Fields.clientID.ToString() + " = '" + site.GetClientID() + "'");
            data.Read();
            Client client = new Client(data.GetRecordDataSet());
            mLot.SetRoughInValue(client.GetRoughInValue());
            mLot.SetServiceValue(client.GetServiceValue());
            mLot.SetFinalValue(client.GetFinalValue());

            totalPortions[0] = client.GetRoughInValue();
            totalPortions[1] = client.GetServiceValue();
            totalPortions[2] = client.GetFinalValue();
        }
コード例 #2
0
 /// <summary>
 /// Creates a site referencing the provided client.
 /// </summary>
 /// <param name="pClient"></param>
 public SiteView(Client pClient)
 {
     try
     {
         mSite = new Site(db);
         foreman = new SiteContact(SiteContact.ContactTypes.Foreman, mSite.GetSiteID());
         SuperVisor1 = new SiteContact(SiteContact.ContactTypes.Supervisor1, mSite.GetSiteID());
         SuperVisor2 = new SiteContact(SiteContact.ContactTypes.Supervisor2, mSite.GetSiteID());
         SupplyAuth = new SiteContact(SiteContact.ContactTypes.SupplyAuth, mSite.GetSiteID());
         mSite.SetClientID(pClient.GetClientID());
         mClient = pClient;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Site Object - " + msgCodes.GetString("M2101") + ex.Message, "Error - 2102", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     InitializeComponent();
     isModified = false;
     this.Name = "SiteNewSite";
     newSite = true;
 }
コード例 #3
0
 public InventoryTransactionView(Site site)
 {
     InitializeComponent();
     this.Name = "TransactionViewNewTransaction";
     isNewTransaction = true;
     txtReciever.Text = site.GetSiteName();
     displayOrHideForm();
     lockItemFields();
     ClearFields();
     db.BeginTransaction();
     mTransaction = new InventoryTransaction(site.GetSiteID());
     mTransaction.SetClientType(InventoryTransaction.ClientType.Builder);
 }
コード例 #4
0
        private void LoadSummary()
        {
            try
            {
                DataSet data = db.Select("SUM(" + LotService.Fields.Amount.ToString() + ")", LotService.Table, LotService.Fields.lotID.ToString() + " = '" + mLot.GetLotID() + "'");
                if (data.NumberOfRows() > 0)
                {
                    data.Read();
                    amtServices.Amount = Single.Parse(data.getString(0));
                }

                data = db.Select("SUM(" + LotExtra.Fields.TotalPrice.ToString() + ")", LotExtra.Table, LotExtra.Fields.lotID.ToString() + " = '" + mLot.GetLotID() + "'");
                data.Read();
                if (data.getString(0).Equals(DBNull.Value))
                {
                    amtExtras.Amount = Single.Parse(data.getString(0));
                }

                data = db.Select("SUM(" + TimeSheet.Fields.Hours.ToString() + " * " + TimeSheet.Fields.Wage.ToString() + ")", TimeSheet.Table, TimeSheet.Fields.lotID.ToString() + " = '" + mLot.GetLotID() + "'");
                data.Read();
                if (data.getString(0).Equals(DBNull.Value))
                {
                    amtLabour.Amount = Single.Parse(data.getString(0));
                }

                data = db.Select("*", Site.Table, Site.Fields.siteID.ToString() + " = '" + mLot.GetAssociationID() + "'");
                if (data.NumberOfRows() > 0)
                {
                    data.Read();
                    Site assocSite = new Site(data.GetRecordDataSet());
                    data = db.Select("Average", "lot_material_average", "assocID = '" + assocSite.GetSiteID() + "'");
                }
                else
                {
                    data = db.Select("Average", "lot_material_average", "assocID = '" + mLot.GetLotID() + "'");

                }
                data.Read();
                if (data.getString(0).Equals(DBNull.Value))
                {
                    amtMaterials.Amount = Single.Parse(data.getString(0));
                }

                if ((amtServices.Amount + amtExtras.Amount) > (amtLabour.Amount + amtMaterials.Amount))
                {
                    amtProfit.Amount = (amtServices.Amount + amtExtras.Amount) - (amtLabour.Amount + amtMaterials.Amount);
                    amtProfit.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1b9b0a"));
                }
                else
                {
                    amtProfit.Amount = (amtLabour.Amount + amtMaterials.Amount) - (amtServices.Amount + amtExtras.Amount);
                    amtProfit.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#cc3333"));
                }
            }
            catch (FormatException ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Loading Summary - " + msgCodes.GetString("M2102") + ex.Message, "Error - 2102", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
コード例 #5
0
 /// <summary>
 /// Loads an existing site and allows for reference to client.
 /// </summary>
 /// <param name="pSite"></param>
 /// <param name="pClient"></param>
 public SiteView(Site pSite, Client pClient)
 {
     mSite = pSite;
     mClient = pClient;
     try
     {
         foreman = mSite.GetSiteContact(SiteContact.ContactTypes.Foreman);
         SuperVisor1 = mSite.GetSiteContact(SiteContact.ContactTypes.Supervisor1);
         SuperVisor2 = mSite.GetSiteContact(SiteContact.ContactTypes.Supervisor2);
         SupplyAuth = mSite.GetSiteContact(SiteContact.ContactTypes.SupplyAuth);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Loading Site Contacts - " + msgCodes.GetString("M2102") + ex.Message, "Error - 2102", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     InitializeComponent();
     lockFields();
     this.Name = "SiteView" + mSite.GetSiteID();
     PopulateAllFields();
     cmdSaveEdit.IsEnabled = true;
     isModified = false;
 }