private void CreateComboBox()
        {
            List <Producer> producers  = producerBLL.GetAllProducer();
            List <Category> categories = categoryBLL.GetAllCategory();

            cbx_Producer.DisplayMember = "Text";
            cbx_Producer.ValueMember   = "Value";

            foreach (var producer in producers)
            {
                cbx_Producer.Items.Add(new ComboBoxItem()
                {
                    Text  = producer.Name,
                    Value = producer.Id
                });
            }

            cbx_Category.DisplayMember = "Text";
            cbx_Category.ValueMember   = "Value";

            foreach (var category in categories)
            {
                cbx_Category.Items.Add(new ComboBoxItem()
                {
                    Text  = category.Name,
                    Value = category.Id
                });
            }
            cbx_Category.SelectedIndex = 0;
        }
Esempio n. 2
0
        public frmAddProduct()
        {
            InitializeComponent();
            DateTime dt = DateTime.Now;

            this.dtinputModificationDate.Format       = DevComponents.Editors.eDateTimePickerFormat.Custom;
            this.dtinputModificationDate.CustomFormat = "dd/MM/yyyy";
            this.dtinputModificationDate.Value        = dt;

            CategoryBLL     ctgrBLL     = new CategoryBLL();
            List <Category> lstCategory = ctgrBLL.GetAllCategory();

            foreach (Category ctgr in lstCategory)
            {
                this.cmbxCategory.Items.Add(ctgr.Id + " - " + ctgr.Name);
            }
        }
Esempio n. 3
0
        private void setAllDataToDataGridView()
        {
            // Reset Datagridview
            this.grwCategory.Rows.Clear();
            CategoryBLL     ctgrBLL     = new CategoryBLL();
            List <Category> lstCategory = ctgrBLL.GetAllCategory();

            foreach (Category ctgr in lstCategory)
            {
                string[] strDataAdd = new string[3];
                strDataAdd[0] = ctgr.Id;
                strDataAdd[1] = ctgr.Name;
                strDataAdd[2] = ctgr.ModificationDate.ToString("dd/MM/yyyy");

                this.grwCategory.Rows.Add(strDataAdd);
            }

            this.grwCategory.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.grwCategory.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.grwCategory.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
        }
 // GET: CategoryPro
 public ActionResult Index()
 {
     return(PartialView("_MenuCategoryPro", catebll.GetAllCategory()));
 }
 public ActionResult Create()
 {
     ViewBag.supp    = new SelectList(catebll.GetAllSppulier(), "SupplierID", "CompanyName");
     ViewBag.danhmuc = new SelectList(catebll.GetAllCategory(), "CategoryID", "CategoryName");
     return(View());
 }
        public void SetViewBag(int?selectedID = null)
        {
            var category = CategoryBLL.GetAllCategory();

            ViewBag.Category = new SelectList(category, "ID", "Name", selectedID);
        }