Пример #1
0
        private void Fill()
        {
            CWCarModelsLogic models = new CWCarModelsLogic(manager);
            CWCategoriesLogic categories = new CWCategoriesLogic(manager);

            CategoriesCB.DisplayMember = "Name";
            CategoriesCB.ValueMember = "ID";
            CategoriesCB.DataSource = categories.GetAll();

            if (mode == "edit")
            {
                CWCarModel model = models.Get(Convert.ToInt32(id));
                if (model != null)
                {
                    NameTB.Text = model.Name;
                    BrandImagePB.SizeMode = PictureBoxSizeMode.Zoom;

                    _image = Helpers.ImageOperations.ByteArrayToImage(model.Image);
                    image = model.Image;
                    BrandImagePB.Image = _image;
                    foreach (object category in CategoriesCB.Items)
                    {
                        if (((CWCategory)category).ID == model.CategoryID)
                        {
                            CategoriesCB.SelectedItem = category;
                        }
                    }
                }
            }
        }
Пример #2
0
 private void DeleteSB_Click(object sender, EventArgs e)
 {
     CWCategoriesLogic Categories = new CWCategoriesLogic(manager);
     Categories.Delete(Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value));
     manager.Save();
     Fill();
 }
Пример #3
0
        private void Fill()
        {
            CWCarsLogic       cars       = new CWCarsLogic(manager);
            CWCategoriesLogic categories = new CWCategoriesLogic(manager);

            CategoriesCB.DisplayMember = "Name";
            CategoriesCB.ValueMember   = "ID";
            CategoriesCB.DataSource    = categories.GetAll();

            FillBrands();


            if (mode == "edit")
            {
                CWCar car = cars.Get(Convert.ToInt32(id));
                if (car != null)
                {
                    foreach (object category in CategoriesCB.Items)
                    {
                        if (((CWCategory)category).ID == car.CategoryID)
                        {
                            CategoriesCB.SelectedItem = category;
                        }
                    }
                }
            }
        }
Пример #4
0
        private void Fill()
        {
            CWCarModelsLogic  models     = new CWCarModelsLogic(manager);
            CWCategoriesLogic categories = new CWCategoriesLogic(manager);

            CategoriesCB.DisplayMember = "Name";
            CategoriesCB.ValueMember   = "ID";
            CategoriesCB.DataSource    = categories.GetAll();


            if (mode == "edit")
            {
                CWCarModel model = models.Get(Convert.ToInt32(id));
                if (model != null)
                {
                    NameTB.Text           = model.Name;
                    BrandImagePB.SizeMode = PictureBoxSizeMode.Zoom;

                    _image             = Helpers.ImageOperations.ByteArrayToImage(model.Image);
                    image              = model.Image;
                    BrandImagePB.Image = _image;
                    foreach (object category in CategoriesCB.Items)
                    {
                        if (((CWCategory)category).ID == model.CategoryID)
                        {
                            CategoriesCB.SelectedItem = category;
                        }
                    }
                }
            }
        }
Пример #5
0
 private void Fill()
 {
     CWCategoriesLogic Categories = new CWCategoriesLogic(manager);
     DataGV.AutoGenerateColumns = false;
     DataGV.DataSource = Categories.GetAll();
     DataGV.Update();
 }
Пример #6
0
 private void DeleteSB_Click(object sender, EventArgs e)
 {
     CWCategoriesLogic Categories = new CWCategoriesLogic(manager);
     Categories.Delete(Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value));
     manager.Save();
     Fill();
 }
Пример #7
0
        private void Fill()
        {

            CWCategoriesLogic Categories = new CWCategoriesLogic(manager);
            DataGV.AutoGenerateColumns = false;
            DataGV.DataSource = Categories.GetAll();
            DataGV.Update();

        }
Пример #8
0
        private void Fill()
        {
            CWCarsLogic       cars       = new CWCarsLogic(manager);
            CWCategoriesLogic categories = new CWCategoriesLogic(manager);



            FillBrands();
        }
Пример #9
0
        private void Fill()
        {
            CWCategoriesLogic categories = new CWCategoriesLogic(manager);

            if (mode == "edit")
            {
                CWCategory category = categories.Get(Convert.ToInt32(id));
                if (category != null)
                {
                    NameTB.Text = category.Name;
                }
            }
        }
Пример #10
0
        private void Fill()
        {
            CWCategoriesLogic categories = new CWCategoriesLogic(manager);

            if (mode == "edit")
            {
                CWCategory category = categories.Get(Convert.ToInt32(id));
                if (category != null)
                {
                    NameTB.Text = category.Name;

                }
            }
        }
Пример #11
0
        /// <summary>
        /// заповнення категорій автомобілів
        /// </summary>
        public void FillCategories()
        {
            CWCategoriesLogic categories = new CWCategoriesLogic(manager);

            CarCategoriesCB.DisplayMember = "Name";
            CarCategoriesCB.ValueMember   = "ID";

            CWCategory c0 = new CWCategory();

            c0.ID   = -1;
            c0.Name = "-не обрано-";
            CarCategoriesCB.Items.Add(c0);
            foreach (CWCategory category in categories.GetAll())
            {
                CarCategoriesCB.Items.Add(category);
            }
        }
Пример #12
0
        private void SaveBt_Click(object sender, EventArgs e)
        {
            CWCategoriesLogic categories = new CWCategoriesLogic(manager);


            if (mode == "new")
            {
                categories.Create(NameTB.Text, null, null);
            }
            if (mode == "edit")
            {
                categories.Update(Convert.ToInt32(id), NameTB.Text, null, null);
            }
            manager.Save();

            this.Close();
        }
Пример #13
0
        private void SaveBt_Click(object sender, EventArgs e)
        {
            CWCategoriesLogic categories = new CWCategoriesLogic(manager);

            if (mode == "new")
            {

                categories.Create(NameTB.Text, null, null);
            }
            if (mode == "edit")
            {

                categories.Update(Convert.ToInt32(id), NameTB.Text, null, null);
            }
            manager.Save();

            this.Close();
        }
Пример #14
0
        /// <summary>
        /// заповнення категорій автомобілів
        /// </summary>
        public void FillCategories()
        {
            CWCategoriesLogic categories = new CWCategoriesLogic(manager);

            CarCategoriesCB.DisplayMember = "Name";
            CarCategoriesCB.ValueMember = "ID";

            CWCategory c0 = new CWCategory();
            c0.ID = -1;
            c0.Name = "-не обрано-";
            CarCategoriesCB.Items.Add(c0);
            foreach (CWCategory category in categories.GetAll())
            {
                CarCategoriesCB.Items.Add(category);
            }
        }
Пример #15
0
        private void Fill()
        {
            CWCarsLogic cars = new CWCarsLogic(manager);
            CWCategoriesLogic categories = new CWCategoriesLogic(manager);

            CategoriesCB.DisplayMember = "Name";
            CategoriesCB.ValueMember = "ID";
            CategoriesCB.DataSource = categories.GetAll();

            FillBrands();

            if (mode == "edit")
            {
                CWCar car = cars.Get(Convert.ToInt32(id));
                if (car != null)
                {
                    foreach (object category in CategoriesCB.Items)
                    {
                        if (((CWCategory)category).ID == car.CategoryID)
                        {
                            CategoriesCB.SelectedItem = category;
                        }
                    }

                }
            }
        }
Пример #16
0
        private void Fill()
        {
            CWCarsLogic cars = new CWCarsLogic(manager);
            CWCategoriesLogic categories = new CWCategoriesLogic(manager);

            FillBrands();
        }