예제 #1
0
        public EditCenter(MenegerC main, Record center = null)
        {
            this.main   = main;
            this.center = center;
            InitializeComponent();

            if (center != null)
            {
                name.Text              = center.name;
                coeff.Text             = center.priceCoefficient;
                price.Text             = center.price;
                city.Text              = center.city;
                floors.Text            = center.floors;
                pavilionsQuantity.Text = center.pavilionsQuantity;
                foreach (ComboBoxItem item in state.Items)
                {
                    if (item.Content.ToString() == center.state)
                    {
                        state.SelectedItem = item;
                    }
                }
                if (center.center.image != null)
                {
                    System.Drawing.Image img = ByteArrayToImage(center.center.image);
                    image.Source = GetImageStream(img);
                    picture      = img;
                }
            }
        }
예제 #2
0
        public ShoppingCenter(MenegerC main)
        {
            this.main = main;
            InitializeComponent();

            centers.SelectedIndex = 0;

            var c = main.main.db.ShoppingCenter
                    .OrderBy(p => p.city)
                    .ThenBy(p => p.state);



            foreach (dataBase.ShoppingCenter center in c)
            {
                Record record = new Record();
                record.name              = center.centerName;
                record.state             = center.state;
                record.pavilionsQuantity = center.pavilionsQuantity.ToString();
                record.city              = center.city;
                record.price             = center.price.ToString();
                record.floors            = center.floors.ToString();
                record.priceCoefficient  = center.priceCoefficient.ToString();
                record.center            = center;
                centers.Items.Add(record);
            }

            foreach (dataBase.ShoppingCenter city in main.main.db.ShoppingCenter)
            {
                bool check = true;
                foreach (ComboBoxItem i in cityFilter.Items)
                {
                    if (i.Content.ToString() == city.city)
                    {
                        check = false;
                    }
                }
                if (check)
                {
                    ComboBoxItem item = new ComboBoxItem();
                    item.Content = city.city;
                    cityFilter.Items.Add(item);
                }
            }
        }