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);
            }
        }
        private void LoadReportParameters()
        {
            try
            {
                Parameters.Clear();
                XmlNodeList  xmlParameters = GetCustomNodeList("ReportParameter");
                RDLParameter rpParam       = null;

                foreach (XmlNode xmlParam in xmlParameters)
                {
                    rpParam = new RDLParameter
                    {
                        Name   = xmlParam.Attributes["Name"].InnerText,
                        DbType = (DbType)ExtensionMethods.GetEnumValue(typeof(DbType), xmlParam["DataType"].InnerText),
                        Prompt = xmlParam["Prompt"].InnerText,
                        Value  = xmlParam["Prompt"].InnerText
                    };

                    try
                    {
                        rpParam.DefaultValue = xmlParam["DefaultValue"].InnerText;
                    }
                    catch
                    {
                        if (rpParam.DbType == DbType.Boolean)
                        {
                            rpParam.DefaultValue = false;
                        }
                    }
                    Parameters.Add(rpParam);
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
        private void LoadReportDataSet()
        {
            try
            {
                DsReport.Tables.Clear();
                Fields.Clear();
                XmlNodeList  xmlDataSet   = GetCustomNodeList("DataSet");
                XmlNodeList  ndSearchList = null;
                RDLTable     rtTable      = null;
                RDLParameter sqlParam     = null;
                RDLColumn    ReportColumn = null;

                foreach (XmlNode xmlTable in xmlDataSet)
                {
                    rtTable           = new RDLTable();
                    rtTable.TableName = xmlTable.Attributes["Name"].InnerText;
                    try
                    {
                        rtTable.CommandType = (CommandType)ExtensionMethods.GetEnumValue(typeof(CommandType), xmlTable["Query"]["CommandType"].InnerText);
                    }
                    catch { rtTable.CommandType = CommandType.Text; }
                    //
                    rtTable.CommandText = xmlTable["Query"]["CommandText"].InnerText;
                    //For Parameters
                    try
                    {
                        ndSearchList = xmlTable["Query"]["QueryParameters"].ChildNodes;
                    }
                    catch { ndSearchList = null; }
                    if (ndSearchList != null)
                    {
                        foreach (XmlNode xmlParam in ndSearchList)
                        {
                            sqlParam        = new RDLParameter();
                            sqlParam.Name   = xmlParam.Attributes["Name"].InnerText;
                            sqlParam.Prompt = GetSQLParamField(xmlParam["Value"].InnerText).ToString();
                            rtTable.Parameters.Add(sqlParam);
                        }
                    }
                    //
                    //For Fields
                    try
                    {
                        ndSearchList = xmlTable["Fields"].ChildNodes;
                    }
                    catch { ndSearchList = null; }

                    if (ndSearchList != null)
                    {
                        foreach (XmlNode xmlColumn in ndSearchList)
                        {
                            ReportColumn           = new RDLColumn();
                            ReportColumn.TableName = rtTable.TableName;
                            ReportColumn.Name      = xmlColumn.Attributes["Name"].Value;
                            try
                            {
                                ReportColumn.DataType = xmlColumn["rd:TypeName"].InnerText;
                            }
                            catch
                            {
                                ReportColumn.DataType = "System.Calculate";
                            }
                            //
                            rtTable.Columns.Add(ReportColumn);
                            if (BodyTablesName.Contains(rtTable.TableName))
                            {
                                Fields.Add(ReportColumn);
                            }
                        }
                    }

                    DsReport.Tables.Add(rtTable);
                }
            }
            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;
            }
        }