private void SetValue(RDLParameter param, FilterSets value)
        {
            try
            {
                string pvalue = string.IsNullOrEmpty(value.ColumnValue) ? value.DefaultValue : value.ColumnValue;
                param.DbType = (DbType)ExtensionMethods.GetEnumValue(typeof(DbType), value.DataType);
                switch (param.DbType)
                {
                case DbType.DateTime:
                    CultureInfo provider = CultureInfo.InvariantCulture;
                    param.Value = DateTime.ParseExact(pvalue, ExtensionMethods.GridDateFormatArray, provider, DateTimeStyles.None).ToString(ExtensionMethods.DateFormat);
                    break;

                case DbType.Int16:
                    param.Value = Convert.ToInt16(pvalue);
                    break;

                case DbType.Int32:
                    param.Value = Convert.ToInt32(pvalue);
                    break;

                case DbType.Int64:
                    param.Value = Convert.ToInt64(pvalue);
                    break;

                case DbType.Double:
                    param.Value = Convert.ToDouble(pvalue);
                    break;

                case DbType.Decimal:
                    param.Value = Convert.ToDecimal(pvalue);
                    break;

                case DbType.Boolean:
                    param.Value = Convert.ToBoolean(pvalue);
                    break;

                default:
                    param.Value = pvalue;
                    break;
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
        public void LoadFilterTable(DataColumnCollection dcCollection, List <ReportSuiteColumnValueViewModel> reportColumnList)
        {
            FilterSetList = new List <FilterSets>();
            FilterSets newFilter;
            bool       HasParent = false;

            #region Filter Parameter Column
            if (reportColumnList.Any())
            {
                #region if report column exists
                foreach (var rp in Parameters)
                {
                    var reportColumn = reportColumnList.Find(item => item.ColumnId == rp.Name);
                    if (reportColumn != null)
                    {
                        if (!string.IsNullOrEmpty(reportColumn.ParentColumns))
                        {
                            AddOtherColumnToFilterTable(dcCollection, reportColumnList, reportColumn.ParentColumns, false);
                            HasParent = true;
                        }
                        else
                        {
                            HasParent = false;
                        }
                    }
                    AddParameterColumnToFilterTable(dcCollection, reportColumnList, rp, reportColumn, HasParent);
                }
                #endregion
            }
            else
            {
                foreach (var rp in Parameters)
                {
                    var reportColumn = reportColumnList.Find(item => item.ColumnId == rp.Name);
                    HasParent = false;
                    AddParameterColumnToFilterTable(dcCollection, reportColumnList, rp, reportColumn, HasParent);
                }
            }
            #endregion
            #region Add Other Column
            foreach (DataColumn dc in dcCollection)
            {
                var reportColumn = reportColumnList.Find(item => item.ColumnId == dc.ColumnName);
                HasParent = reportColumn != null && !string.IsNullOrEmpty(reportColumn.ParentColumns);
                AddOtherColumnToFilterTable(dcCollection, reportColumnList, dc.ColumnName, HasParent);
            }
            #endregion
            #region Add Empty Column
            foreach (string tableName in BodyTablesName)
            {
                newFilter = new FilterSets
                {
                    ColumnName  = "Expression",
                    DataType    = "Expression",
                    TableName   = tableName,
                    OrAnd       = "And",
                    Operators   = "=",
                    IsParameter = false
                };
                FilterSetList.Add(newFilter);
                break;
            }
            #endregion
        }
        public void AddOtherColumnToFilterTable(DataColumnCollection dcCollection, List <ReportSuiteColumnValueViewModel> reportColumnList, string ColumnName, bool HasParent)
        {
            FilterSets newFilter;
            RDLColumn  rc;

            try
            {
                #region Add Other Column
                string[] strColumnArr = ColumnName.Split(',');
                foreach (string strColumn in strColumnArr)
                {
                    if (strColumn.Equals("UserCode", StringComparison.OrdinalIgnoreCase))
                    {
                        if (!FilterSetList.Any(x => x.ColumnName == strColumn))
                        {
                            newFilter = new FilterSets
                            {
                                ColumnName   = strColumn,
                                DataType     = "System.Int32",
                                TableName    = string.Empty,
                                OrAnd        = "And",
                                Operators    = "=",
                                ColumnValue  = UserCode,
                                DefaultValue = UserCode,
                                IsHidden     = true
                            };

                            FilterSetList.Add(newFilter);
                        }
                    }
                    else
                    {
                        rc = Fields.Find(x => x.Name == strColumn);
                        var reportColumn = reportColumnList.Find(x => x.ColumnId == strColumn);
                        if (rc != null)
                        {
                            if (!FilterSetList.Any(item => item.ColumnName == strColumn && (item.TableName == "Parameter" || item.TableName == rc.TableName)))
                            {
                                if (reportColumn != null)
                                {
                                    if (!string.IsNullOrEmpty(reportColumn.ParentColumns))
                                    {
                                        AddOtherColumnToFilterTable(dcCollection, reportColumnList, reportColumn.ParentColumns, false);
                                        #region Add Filter Set
                                        newFilter = new FilterSets
                                        {
                                            ColumnName  = rc.Name,
                                            DataType    = rc.DataType,
                                            TableName   = rc.TableName,
                                            OrAnd       = "And",
                                            Operators   = "=",
                                            IsParameter = false,
                                            HasParent   = true
                                        };

                                        if (reportColumn != null)
                                        {
                                            newFilter.DefaultValue           = reportColumn.DefaultValue ?? string.Empty;
                                            newFilter.ParentColumn           = reportColumn.ParentColumns ?? string.Empty;
                                            newFilter.DAOClass               = reportColumn.DaoClass ?? string.Empty;
                                            newFilter.MethodName             = reportColumn.MethodName ?? string.Empty;
                                            newFilter.ValueColumnId          = reportColumn.ValueColumnId ?? string.Empty;
                                            newFilter.DisplayColumnId        = reportColumn.DisplayColumnId ?? string.Empty;
                                            newFilter.IsMultipleSelection    = reportColumn.IsMultipleSelection;
                                            newFilter.ShowAdditionalColumn   = reportColumn.ShowAdditionalColumn;
                                            newFilter.AdditionalColumnId     = reportColumn.AdditionalColumnId ?? string.Empty;
                                            newFilter.AdditionalColumnHeader = reportColumn.AdditionalColumnHeader ?? string.Empty;
                                            newFilter.ColumnWidth            = reportColumn.ColumnWidth ?? string.Empty;
                                        }
                                        if (rc.DataType == "Boolean" || rc.DataType == "System.Boolean")
                                        {
                                            newFilter.ColumnValue  = "false";
                                            newFilter.DefaultValue = "false";
                                        }

                                        FilterSetList.Add(newFilter);
                                        #endregion
                                    }
                                    else
                                    {
                                        #region Add Filter Set
                                        newFilter = new FilterSets
                                        {
                                            ColumnName  = rc.Name,
                                            DataType    = rc.DataType,
                                            TableName   = rc.TableName,
                                            OrAnd       = "And",
                                            Operators   = "=",
                                            IsParameter = false,
                                            HasParent   = HasParent
                                        };

                                        if (reportColumn != null)
                                        {
                                            newFilter.DefaultValue           = reportColumn.DefaultValue ?? string.Empty;
                                            newFilter.ParentColumn           = reportColumn.ParentColumns ?? string.Empty;
                                            newFilter.DAOClass               = reportColumn.DaoClass ?? string.Empty;
                                            newFilter.MethodName             = reportColumn.MethodName ?? string.Empty;
                                            newFilter.ValueColumnId          = reportColumn.ValueColumnId ?? string.Empty;
                                            newFilter.DisplayColumnId        = reportColumn.DisplayColumnId ?? string.Empty;
                                            newFilter.IsMultipleSelection    = reportColumn.IsMultipleSelection;
                                            newFilter.ShowAdditionalColumn   = reportColumn.ShowAdditionalColumn;
                                            newFilter.AdditionalColumnId     = reportColumn.AdditionalColumnId ?? string.Empty;
                                            newFilter.AdditionalColumnHeader = reportColumn.AdditionalColumnHeader ?? string.Empty;
                                            newFilter.ColumnWidth            = reportColumn.ColumnWidth ?? string.Empty;
                                        }
                                        if (rc.DataType == "Boolean" || rc.DataType == "System.Boolean")
                                        {
                                            newFilter.ColumnValue  = "false";
                                            newFilter.DefaultValue = "false";
                                        }

                                        FilterSetList.Add(newFilter);
                                        #endregion
                                    }
                                }
                                else
                                {
                                    #region Add Filter Set
                                    newFilter = new FilterSets
                                    {
                                        ColumnName  = rc.Name,
                                        DataType    = rc.DataType,
                                        TableName   = rc.TableName,
                                        OrAnd       = "And",
                                        Operators   = "=",
                                        IsParameter = false,
                                        HasParent   = HasParent
                                    };

                                    if (reportColumn != null)
                                    {
                                        newFilter.DefaultValue           = reportColumn.DefaultValue ?? string.Empty;
                                        newFilter.ParentColumn           = reportColumn.ParentColumns ?? string.Empty;
                                        newFilter.DAOClass               = reportColumn.DaoClass ?? string.Empty;
                                        newFilter.MethodName             = reportColumn.MethodName ?? string.Empty;
                                        newFilter.ValueColumnId          = reportColumn.ValueColumnId ?? string.Empty;
                                        newFilter.DisplayColumnId        = reportColumn.DisplayColumnId ?? string.Empty;
                                        newFilter.IsMultipleSelection    = reportColumn.IsMultipleSelection;
                                        newFilter.ShowAdditionalColumn   = reportColumn.ShowAdditionalColumn;
                                        newFilter.AdditionalColumnId     = reportColumn.AdditionalColumnId ?? string.Empty;
                                        newFilter.AdditionalColumnHeader = reportColumn.AdditionalColumnHeader ?? string.Empty;
                                        newFilter.ColumnWidth            = reportColumn.ColumnWidth ?? string.Empty;
                                    }
                                    if (rc.DataType == "Boolean" || rc.DataType == "System.Boolean")
                                    {
                                        newFilter.ColumnValue  = "false";
                                        newFilter.DefaultValue = "false";
                                    }
                                    FilterSetList.Add(newFilter);
                                    #endregion
                                }
                            }
                        }
                        else
                        {
                            #region Add Filter Column Not in report
                            if (!FilterSetList.Any(x => x.ColumnName == strColumn))
                            {
                                if (reportColumn != null)
                                {
                                    if (!string.IsNullOrEmpty(reportColumn.ParentColumns))
                                    {
                                        AddOtherColumnToFilterTable(dcCollection, reportColumnList, reportColumn.ParentColumns, false);
                                        #region Add Filter Set
                                        newFilter = new FilterSets
                                        {
                                            ColumnName        = strColumn,
                                            DataType          = "System.String",
                                            TableName         = string.Empty,
                                            OrAnd             = "And",
                                            Operators         = "=",
                                            IsParameter       = false,
                                            HasParent         = true,
                                            ExtraFilterColumn = true
                                        };

                                        if (reportColumn != null)
                                        {
                                            newFilter.DefaultValue           = reportColumn.DefaultValue ?? string.Empty;
                                            newFilter.ParentColumn           = reportColumn.ParentColumns ?? string.Empty;
                                            newFilter.DAOClass               = reportColumn.DaoClass ?? string.Empty;
                                            newFilter.MethodName             = reportColumn.MethodName ?? string.Empty;
                                            newFilter.ValueColumnId          = reportColumn.ValueColumnId ?? string.Empty;
                                            newFilter.DisplayColumnId        = reportColumn.DisplayColumnId ?? string.Empty;
                                            newFilter.IsMultipleSelection    = reportColumn.IsMultipleSelection;
                                            newFilter.ShowAdditionalColumn   = reportColumn.ShowAdditionalColumn;
                                            newFilter.AdditionalColumnId     = reportColumn.AdditionalColumnId ?? string.Empty;
                                            newFilter.AdditionalColumnHeader = reportColumn.AdditionalColumnHeader ?? string.Empty;
                                            newFilter.ColumnWidth            = reportColumn.ColumnWidth ?? string.Empty;
                                        }

                                        FilterSetList.Add(newFilter);
                                        #endregion
                                    }
                                    else
                                    {
                                        #region Add Filter Set
                                        newFilter = new FilterSets
                                        {
                                            ColumnName        = strColumn,
                                            DataType          = "System.String",
                                            TableName         = string.Empty,
                                            OrAnd             = "And",
                                            Operators         = "=",
                                            IsParameter       = false,
                                            HasParent         = HasParent,
                                            ExtraFilterColumn = true
                                        };

                                        if (reportColumn != null)
                                        {
                                            newFilter.DefaultValue           = reportColumn.DefaultValue ?? string.Empty;
                                            newFilter.ParentColumn           = reportColumn.ParentColumns ?? string.Empty;
                                            newFilter.DAOClass               = reportColumn.DaoClass ?? string.Empty;
                                            newFilter.MethodName             = reportColumn.MethodName ?? string.Empty;
                                            newFilter.ValueColumnId          = reportColumn.ValueColumnId ?? string.Empty;
                                            newFilter.DisplayColumnId        = reportColumn.DisplayColumnId ?? string.Empty;
                                            newFilter.IsMultipleSelection    = reportColumn.IsMultipleSelection;
                                            newFilter.ShowAdditionalColumn   = reportColumn.ShowAdditionalColumn;
                                            newFilter.AdditionalColumnId     = reportColumn.AdditionalColumnId ?? string.Empty;
                                            newFilter.AdditionalColumnHeader = reportColumn.AdditionalColumnHeader ?? string.Empty;
                                            newFilter.ColumnWidth            = reportColumn.ColumnWidth ?? string.Empty;
                                        }

                                        FilterSetList.Add(newFilter);
                                        #endregion
                                    }
                                }
                            }
                            #endregion
                        }
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void AddParameterColumnToFilterTable(DataColumnCollection dcCollection, List <ReportSuiteColumnValueViewModel> reportColumnList, RDLParameter rp, ReportSuiteColumnValueViewModel reportColumn, Boolean HasParent)
        {
            FilterSets newFilter;
            RDLColumn  rc;

            try
            {
                #region Add Parameter Column
                rc = Fields.Find(item => item.Name == rp.Name);
                if (!FilterSetList.Any(item => item.ColumnName == rp.Name && (item.TableName == "Parameter" || item.TableName == rc.TableName)))
                {
                    newFilter = new FilterSets
                    {
                        ColumnName  = rp.Name,
                        DataType    = rp.DbType.ToString(),
                        TableName   = "Parameter",
                        OrAnd       = "And",
                        Operators   = "=",
                        Caption     = "***",
                        IsParameter = true,
                        HasParent   = HasParent
                    };

                    if (rp.Name.Equals("UserCode", StringComparison.OrdinalIgnoreCase))
                    {
                        newFilter.ColumnValue  = UserCode;
                        newFilter.DefaultValue = UserCode;
                    }
                    else
                    {
                        newFilter.DefaultValue = rp.DefaultValue == null ? string.Empty : rp.DefaultValue.ToString();
                    }

                    if (reportColumn != null)
                    {
                        newFilter.DefaultValue           = reportColumn.DefaultValue ?? string.Empty;
                        newFilter.ParentColumn           = reportColumn.ParentColumns ?? string.Empty;
                        newFilter.DAOClass               = reportColumn.DaoClass ?? string.Empty;
                        newFilter.MethodName             = reportColumn.MethodName ?? string.Empty;
                        newFilter.ValueColumnId          = reportColumn.ValueColumnId ?? string.Empty;
                        newFilter.DisplayColumnId        = reportColumn.DisplayColumnId ?? string.Empty;
                        newFilter.ShowAdditionalColumn   = reportColumn.ShowAdditionalColumn;
                        newFilter.AdditionalColumnId     = reportColumn.AdditionalColumnId ?? string.Empty;
                        newFilter.AdditionalColumnHeader = reportColumn.AdditionalColumnHeader ?? string.Empty;
                        newFilter.ColumnWidth            = reportColumn.ColumnWidth ?? string.Empty;
                        newFilter.IsMultipleSelection    = reportColumn.IsMultipleSelection;
                    }

                    if (newFilter.DataType == "Boolean" || newFilter.DataType == "System.Boolean")
                    {
                        newFilter.ColumnValue = "false";
                    }

                    FilterSetList.Add(newFilter);
                }
                #endregion
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }