Exemplo n.º 1
0
        private void SaveHeaderNameSetting()
        {
            listGeneralIndividual = new List <GeneralIndividualName>();

            // loop all row
            foreach (DataGridViewRow row in gridView.Rows)
            {
                // get value General
                int        generalColValue  = row.Cells[0].Value == null ? -1 : (int)row.Cells[0].Value;
                string     generalNameValue = row.Cells[1].FormattedValue.ToString().Trim();
                HeaderName hdGeneral        = new HeaderName(generalColValue, generalNameValue);

                // get value individual
                int        individualColValue  = row.Cells[2].Value == null ? -1 : (int)row.Cells[2].Value;
                string     individualNameValue = row.Cells[2].FormattedValue.ToString().Trim();
                HeaderName hdIndividual        = new HeaderName(individualColValue, individualNameValue);

                GeneralIndividualName item = new GeneralIndividualName(hdGeneral, hdIndividual);

                listGeneralIndividual.Add(item);
            }

            SettingHeaderName settingHeaderName = new SettingHeaderName(listHeaderNameGeneral, listHeaderNameIndividual, listGeneralIndividual);

            // convert to json
            string jsonData = JsonConvert.SerializeObject(settingHeaderName);

            // save json
            SaveFile(jsonData);
        }
Exemplo n.º 2
0
        private List <int> GetListHeaderNameChecked()
        {
            listColGeneralByIndividualSelected = new List <int>();

            List <int> colChecked = new List <int>();

            // loop find item combobox selected
            for (int i = 0; i < listGeneralIndividual.Count; i++)
            {
                GeneralIndividualName item = listGeneralIndividual[i];
                if (item.NameIndividual.Column > -1)
                {
                    // add col individual selected
                    colChecked.Add(item.NameIndividual.Column);

                    // add col general selected by individual
                    listColGeneralByIndividualSelected.Add(item.NameGeneral.Column);
                }
            }

            return(colChecked);
        }