コード例 #1
0
ファイル: FrmCategories.cs プロジェクト: pmateus91/Recipes
        public void FillGrid()
        {
            DataTable dt = ConvertListToDataTable.ConvertTo <Category>(_service.GetALL());

            gvResultCategories.DataSource = dt;
            VisualAspectGrid();
        }
コード例 #2
0
ファイル: FrmRecipesInsert.cs プロジェクト: pmateus91/Recipes
        private void FillComboBoxes()
        {
            //DataTable dtCategory = ConvertListToDataTable.ConvertTo<Category>(_cService.GetALL());
            //cbCategory.DataSource = dtCategory;
            //foreach (Category name in _cService.GetALL())
            //{
            //    cbCategory.Items.Add(name);
            //}
            List <Category> categories    = _cService.GetALL();
            var             categoriesArr = categories.ToArray();

            cbCategory.Items.AddRange(categoriesArr);

            cbCategory.DisplayMember = "Name";
            //cbCategory.ValueMember = "ID";

            DataTable dtIngredients = ConvertListToDataTable.ConvertTo <Ingredient>(_iService.GetALL());

            cbIngredients.DataSource = dtIngredients;

            //foreach (Ingredient ingredient in _iService.GetALL())
            //{
            //    cbIngredients.Items.Add(ingredient);
            //}
            cbIngredients.DisplayMember = "Name";
            cbIngredients.ValueMember   = "ID";


            foreach (var item in Enum.GetValues(typeof(Difficulty)))
            {
                cbDifficulty.Items.Add(item);
            }
        }
コード例 #3
0
 public void FillGrid()
 {
     if (_title == "Categorias - Alterar")
     {
         lblTitle.Text = "――――――   ALTERAR   ――――――";
         DataTable dt = ConvertListToDataTable.ConvertTo <Category>(_service.GetALL());
         gvResultCategories.DataSource = dt;
         VisualAspectGrid();
     }
     else
     {
         lblTitle.Text  = "――――――   ELIMINAR   ――――――";
         btUpdate.Text  = "Eliminar";
         btUpdate.Image = Properties.Resources.delete;
         DataTable dt = ConvertListToDataTable.ConvertTo <Category>(_service.GetALL());
         gvResultCategories.DataSource = dt;
         VisualAspectGrid();
     }
 }
コード例 #4
0
        private void FillComboBoxes()
        {
            if (!Page.IsPostBack)
            {
                List <Ingredient> ingredients = _iService.GetALL();

                cbIngredients.DataSource     = ingredients;
                cbIngredients.DataTextField  = "Name";
                cbIngredients.DataValueField = "ID";
                cbIngredients.DataBind();

                List <Category> categories = _cService.GetALL();
                cbCategory.DataSource     = categories;
                cbCategory.DataTextField  = "Name";
                cbCategory.DataValueField = "ID";
                cbCategory.DataBind();

                foreach (var item in Enum.GetValues(typeof(Difficulty)))
                {
                    cbDifficulty.Items.Add(item.ToString());
                }
            }
        }
コード例 #5
0
ファイル: Default.aspx.cs プロジェクト: pmateus91/Recipes
 protected void Page_Load(object sender, EventArgs e)
 {
     _service = new Categories_Services();
     this.rptCategory.DataSource = _service.GetALL();
     this.rptCategory.DataBind();
 }