Пример #1
0
 private void btnAdd_Click(object sender, RoutedEventArgs e)
 {
     SupplierBrandResource.SupplierBrand s = new SupplierBrandResource.SupplierBrand();
     s.SupplierBrandID = 0;
     s.BrandStateID    = loginstate;
     s.Active          = true;
     br.SQSSupplierBrand.Add(s);
 }
Пример #2
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Windows.Controls.DataGridRow row = (Microsoft.Windows.Controls.DataGridRow)(dataGrid1.ItemContainerGenerator.ContainerFromItem(dataGrid1.SelectedItem));
            SupplierBrandResource.SupplierBrand    s   = (SupplierBrandResource.SupplierBrand)row.Item;
            bool exists = false;

            if (s.SupplierBrandName != null && s.SupplierBrandName.Trim() != "")
            {
                if (s.SupplierBrandID == 0)
                {
                    if (!SupplierBrandExists(s))
                    {
                        exists = false;
                    }
                    else
                    {
                        exists = true;
                    }
                }

                if (exists)
                {
                    MessageBox.Show("This brand already exists.");
                }
                else
                {
                    try
                    {
                        br.SaveSupplierBrand(s);
                        if (row.DetailsVisibility == Visibility.Visible)
                        {
                            row.DetailsVisibility = Visibility.Collapsed;
                        }
                        btnSearch_Click(null, null);
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            else
            {
                MessageBox.Show("Please enter a question text.");
            }
        }
Пример #3
0
 private bool SupplierBrandExists(SupplierBrandResource.SupplierBrand s)
 {
     return(br.SupplierBrandExists(s.SupplierBrandName, s.BrandStateID));
 }