Beispiel #1
0
        public void fillGridView()
        {
            string json = bussinesline.read();

            if (!json.Equals("[]"))
            {
                dataGrid.DataSource          = Tools.Util.convertToDataTable(json);
                dataGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

                this.dataGrid.Columns["active"].Visible     = true;
                this.dataGrid.Columns["created_at"].Visible = false;
                this.dataGrid.Columns["updated_at"].Visible = false;
                this.dataGrid.Columns["__v"].Visible        = false;
                this.dataGrid.Columns["_id"].Visible        = false;

                dataGrid.Columns["number"].DisplayIndex      = 0;
                dataGrid.Columns["number"].HeaderText        = "Número";
                dataGrid.Columns["description"].DisplayIndex = 2;
                dataGrid.Columns["description"].HeaderText   = "Descripción";
                dataGrid.Columns["description"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
                dataGrid.Columns["name"].DisplayIndex        = 1;
                dataGrid.Columns["name"].HeaderText          = "Nombre";
                dataGrid.Columns["name"].AutoSizeMode        = DataGridViewAutoSizeColumnMode.DisplayedCells;
                dataGrid.Columns["active"].DisplayIndex      = 3;
                dataGrid.Columns["active"].HeaderText        = "Status";
            }
        }
Beispiel #2
0
        private void loadComboboxBussinesLines()
        {
            Lineanegocio        bussinesline = new Lineanegocio();
            string              json         = bussinesline.read();
            List <Lineanegocio> x            = JsonConvert.DeserializeObject <List <Lineanegocio> >(json.Replace("_id", "id"));

            if (!json.Equals("[]"))
            {
                Dictionary <String, String> datasource = new Dictionary <string, string>();
                foreach (Lineanegocio p in x)
                {
                    datasource.Add(p.Id, p.Name);
                }
                cmbBussinesline.DataSource    = new BindingSource(datasource, null);
                cmbBussinesline.DisplayMember = "Value";
                cmbBussinesline.ValueMember   = "Key";
            }
        }