Ejemplo n.º 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();
        }
Ejemplo n.º 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;
 }
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
0
        public LotView(Client client)
        {
            //This represents if a Client is directly creating a Lot Obj
            InitializeComponent();
            try
            {
                mLot = new Lot(db);

            }
            catch (Exception ex)
            {
                MessageBox.Show("Lot Object - " + msgCodes.GetString("M2101") + ex.Message, "Error - 2102", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            unlockForm();
            this.Name = "NewLotView";
            mLot.SetAssociationID(client.GetClientID());
            mLot.SetRoughInValue(client.GetRoughInValue());
            mLot.SetServiceValue(client.GetServiceValue());
            mLot.SetFinalValue(client.GetFinalValue());

            totalPortions[0] = client.GetRoughInValue();
            totalPortions[1] = client.GetServiceValue();
            totalPortions[2] = client.GetFinalValue();
        }
Ejemplo n.º 5
0
 private void UILoadDataSet(DataSet clientsData)
 {
     this.Clients.Children.Clear();
     if (clientsData.NumberOfRows() != 0)
     {
         bool doneBuilders = false;
         while (clientsData.Read())
         {
             Client client = new Client(clientsData.GetRecordDataSet());
             TextBlock block = new TextBlock();
             block.Text = client.GetName();
             block.Name = "Client" + client.GetClientID();
             clientsTable.Add(block.Name, client);
             Color forground = new Color();
             forground.ScA = 1;
             forground.ScR = 1;
             forground.ScG = 1;
             forground.ScB = 1;
             block.Foreground = new SolidColorBrush(forground);
             block.FontSize = 14;
             block.MouseEnter += TextBlock_MouseEnter;
             block.MouseLeave += TextBlock_MouseLeave;
             block.MouseDown += TextBlock_DoubleClick;
             if (!doneBuilders & client.GetClientType() == 1)
             {
                 Thickness padding = new Thickness();
                 padding.Top = 15;
                 block.Padding = padding;
                 doneBuilders = true;
             }
             this.Clients.Children.Add(block);
         }
     }
     else
     {
         MessageBox.Show("There are currently no clients in the System. Please create a client.", "No Clients Exist!", MessageBoxButton.OK, MessageBoxImage.Error);
         MainWindow.RemoveTab(this.Name);
     }
 }
        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);
                }
            }
        }