using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CLIP.eForm.Consent.UI
{
    /// <summary>
    /// UI 관련 공통 클래스
    /// </summary>
    /// <remarks>    
    /// <p>----------------------------------------------------------------------------------------</p>
    /// <p>[HISTORY]</p>
    /// <p> 2016-06-21 : 최초작성</p>
    /// <p>----------------------------------------------------------------------------------------</p>
    /// </remarks> 
    public class CommonUtil
    {
        public static void AddNewColumnToDataGridView(DataGridView dataGrid, string headerText, string dataPropertyName, bool visibility, int colWidth = 100, DataGridViewContentAlignment textAlign = DataGridViewContentAlignment.MiddleLeft)
        {
            DataGridViewTextBoxColumn gridCol = new DataGridViewTextBoxColumn();
            gridCol.Name = dataPropertyName;
            gridCol.DefaultCellStyle.Alignment = textAlign;
            gridCol.HeaderText = headerText;
            gridCol.DataPropertyName = dataPropertyName;
            gridCol.Width = colWidth;
            gridCol.Visible = visibility;
            gridCol.ValueType = typeof(string);
            gridCol.ReadOnly = true;
            
            dataGrid.Columns.Add(gridCol);
        }

        public static void AddNewCheckBoxColumnToDataGridView(DataGridView dataGrid, string headerText, string dataPropertyName, bool visibility, int colWidth = 100, DataGridViewContentAlignment textAlign = DataGridViewContentAlignment.MiddleLeft)
        {
            DataGridViewCheckBoxColumn gridCol = new DataGridViewCheckBoxColumn();
            gridCol.Name = dataPropertyName;
            gridCol.DefaultCellStyle.Alignment = textAlign;
            gridCol.HeaderText = headerText;
            gridCol.DataPropertyName = dataPropertyName;
            gridCol.Width = colWidth;
            gridCol.Visible = visibility;
            gridCol.ValueType = typeof(string);
            gridCol.ReadOnly = false;

            dataGrid.Columns.Add(gridCol);
        }
    }
}
