Пример #1
0
 private void refreshLocations()
 {
     currentPerson.Locations = ComplexQueryHelper.GetLocationsForPerson(currentPerson.Email);
     available = BusinessLayer.Classes.Location.Select().Except(currentPerson.Locations).ToList();
     dgvAvailable.DataSource = new AggregatedPropertyBindingList <Location>(available);
     dgvUsed.DataSource      = new AggregatedPropertyBindingList <Location>(currentPerson.Locations);
 }
Пример #2
0
        private void btnSaveLists_Click(object sender, EventArgs e)
        {
            List <Product> itemsToAdd    = location.Products.Except(oldCopy.Products).ToList();
            List <Product> itemsToDelete = oldCopy.Products.Except(location.Products).ToList();

            ComplexQueryHelper.UpdateProductsForLocation(location, itemsToAdd, itemsToDelete);
        }
Пример #3
0
        private void btnSaveConfig_Click(object sender, EventArgs e)
        {
            var diff = component.Configurations.Except(oldCopy.Configurations);

            ComplexQueryHelper.AddConfigurationsForComponent(component, diff.ToList());
            MessageBox.Show("Component configuration updated", "Modification status");
        }
Пример #4
0
 private void refetchComponents()
 {
     product.Components                = ComplexQueryHelper.GetComponentsForProduct(product);
     dgvUsedComponents.DataSource      = new AggregatedPropertyBindingList <Comp>(product.Components);
     availableComponents               = getAvailableComponents(product.Components, Comp.Select());
     dgvAvailableComponents.DataSource = new AggregatedPropertyBindingList <Comp>(availableComponents);
 }
Пример #5
0
        private void dgvProducts_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            //Ensure that the click was not on the title cells
            if (e.RowIndex > -1)
            {
                string id = (sender as DataGridView).Rows[e.RowIndex].Cells["Id"].Value.ToString();

                Product clickedItem = products.Find(p => p.Id == id);
                if (clickedItem != null)
                {
                    frmProductDetails frm = new frmProductDetails(ref location, ref clickedItem);
                    Utils.ShowForm(this, frm, dgvProducts, () =>
                    {
                        if (location == null)
                        {
                            products = Product.Select();
                        }
                        else
                        {
                            products = ComplexQueryHelper.GetProductsForLocation(location);
                        }
                        dgvProducts.DataSource = products;
                    });
                }
            }
        }
Пример #6
0
 public frmTask()
 {
     InitializeComponent();
     CenterToScreen();
     tasks = ComplexQueryHelper.GetCompleteTaskDetails();
     createColumnHeadings();
     bindDataGridView();
 }
Пример #7
0
        private void btnSaveUsed_Click(object sender, EventArgs e)
        {
            List <ProductCategory> newItems     = contractType.ProductCategories.Except(oldCopy.ProductCategories).ToList();
            List <ProductCategory> deletedItems = oldCopy.ProductCategories.Except(contractType.ProductCategories).ToList();

            ComplexQueryHelper.UpdateProductCategoriesForContractType(contractType, newItems, deletedItems);
            MessageBox.Show("Product Categories updated");
        }
Пример #8
0
 public frmSchedule()
 {
     InitializeComponent();
     CenterToScreen();
     createDataGridViewColumns();
     employees = ComplexQueryHelper.GetAllTechnicians();
     bindFields();
 }
Пример #9
0
        private void btnSaveLists_Click(object sender, EventArgs e)
        {
            List <Location> itemsToAdd    = currentPerson.Locations.Except(oldCopy.Locations).ToList();
            List <Location> itemsToDelete = oldCopy.Locations.Except(currentPerson.Locations).ToList();

            ComplexQueryHelper.UpdateLocationsForPerson(currentPerson, itemsToAdd, itemsToDelete);
            MessageBox.Show("Locations Updated", "Modification status", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Пример #10
0
        private void button9_Click(object sender, EventArgs e)
        {
            List <Comp> itemsToAdd    = product.Components.Except(oldCopy.Components).ToList();
            List <Comp> itemsToDelete = oldCopy.Components.Except(product.Components).ToList();

            ComplexQueryHelper.UpdateComponentsForProduct(product, itemsToAdd, itemsToDelete);
            MessageBox.Show("Product Component composition updated", "Modification status");
        }
Пример #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            IEnumerable <string> brokenRules;
            string msg     = "Invalid input.  Please check the Error box";
            bool   isValid = false;

            if (newCity)
            {
                City c = new City(0, cmbCity.Text);
                if (c.IsUnique() && c.Validate(out brokenRules))
                {
                    c.Insert();
                    location.Street.City      = c;
                    location.Street.FK_CityID = c.Id;
                }
            }

            if (newStreet)
            {
                Street s = new Street(0, cmbStreet.Text, txtAreaCode.Text, location.Street.City);
                s.FK_CityID = location.Street.City.Id;

                if (s.IsUnique() && s.Validate(out brokenRules))
                {
                    s.Insert();
                    location.Street      = s;
                    location.FK_StreetID = s.Id;
                }
            }

            if (location.Validate(out brokenRules))
            {
                isValid = true;
                if (insert)
                {
                    //Insert a new location for a person only if the person object has been set
                    if (person != null)
                    {
                        ComplexQueryHelper.InsertLocationForPerson(ref person, location);
                    }
                    else
                    {
                        location.Insert();
                    }
                    msg = "Location Inserted";
                }
                else
                {
                    location.Update();
                    msg = "Location Updated";
                }
                edit = insert = false;
                toggleControlsEnable(false);
            }

            lstError.DataSource = brokenRules.ToList();
            MessageBox.Show(msg, "Modification Status", MessageBoxButtons.OK, isValid ? MessageBoxIcon.Information : MessageBoxIcon.Error);
        }
Пример #12
0
        private void btnManageProducts_Click(object sender, EventArgs e)
        {
            List <Product> products = ComplexQueryHelper.GetProductsForLocation(location);
            frmProduct     frm      = new frmProduct();

            frm.FormClosed += (s, eventArgs) =>
            {
                Show();
            };
            frm.Show();
            Hide();
        }
Пример #13
0
 private void initialise(Schedule schedule, bool insert)
 {
     InitializeComponent();
     CenterToScreen();
     nudCost.Maximum = decimal.MaxValue;
     nudCost.Minimum = decimal.MinValue;
     createDataGridColumns();
     this.insert   = insert;
     this.schedule = schedule;
     schedule.DeepCopyInto(ref oldCopy);
     employees = ComplexQueryHelper.GetAllTechnicians();
     tasks     = StoredProcedureHelper.GetUnassginedTasksWithContracts();
     //If a task has already been assigned and the task is in view mode, add the task to the list of available tasks
     if (schedule.FK_TaskId != "" && !insert)
     {
         tasks.Add(new TaskWithContract("", schedule.Task));
     }
     bindFields(schedule);
     setFieldsEnable(insert);
 }
Пример #14
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtEmail.Text == "" || txtPassword.Text == "")
            {
                MessageBox.Show("The email and password fields may not be empy", "Input error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                Employee result = ComplexQueryHelper.ValidLogin(txtEmail.Text, txtPassword.Text);

                if (result != null)
                {
                    frmMenu frm = new frmMenu(result);
                    frm.Show();
                    frm.FormClosed += (s, events) => Show();
                    Hide();
                }
                else
                {
                    MessageBox.Show("Invalid credentials", "Invalid login", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #15
0
 private void updateLocationsTable()
 {
     locations = ComplexQueryHelper.GetLocationsForPerson(lstClients.Text);
     dgvLocation.DataSource = new AggregatedPropertyBindingList <Location>(locations);
 }