public override object Clone()
        {
            HunColumnBase column = base.Clone() as HunColumnBase;

            column.Required = this.Required;

            return(column);
        }
Пример #2
0
        public bool CheckRequired(out string columnHeaderText)
        {
            columnHeaderText = string.Empty;

            foreach (DataGridViewRow row in this.Rows)
            {
                bool hasValue        = false;
                bool existsEmptyCell = false;

                foreach (DataGridViewCell cell in row.Cells)
                {
                    if (!(cell.OwningColumn is HunColumnBase))
                    {
                        continue;
                    }

                    HunColumnBase column = cell.OwningColumn as HunColumnBase;

                    if (!string.IsNullOrEmpty(cell.Value?.ToString()))
                    {
                        hasValue = true;
                    }

                    if (column.Required && string.IsNullOrEmpty(cell.Value?.ToString()) && !existsEmptyCell)
                    {
                        columnHeaderText = column.HeaderText;
                        existsEmptyCell  = true;
                    }
                }

                if (hasValue && existsEmptyCell)
                {
                    return(false);
                }
            }

            return(true);
        }