Ejemplo n.º 1
0
        public bool FileSave()
        {
            string           rdl     = GetRdlText();
            string           sql     = this.rdlDesigner.ReportDocument.GetElementsByTagName("CommandText")[0].InnerXml;
            List <SqlColumn> columns = DesignerUtility.GetSqlColumns(sql);

            OpenPOS.Model.Reports.IRelatorio current = rdlDesigner.CurrentReport;

            if (current == null)
            {
                current = new OpenPOS.Data.Reports.Relatorio();
            }

            SaveDialogResult sdresult = SaveDialog.Show(current.Nome, current.Grupo == null ? (OpenPOS.GUID) "" : current.Grupo.GUID, columns, current);

            if (sdresult.DialogResult == DialogResult.OK)
            {
                current.Nome     = sdresult.Title;
                current.Grupo    = sdresult.Group;
                current.Filtros  = sdresult.Filtros;
                current.Script   = rdl;
                current.Template = sdresult.Template;
                if (_flagFileSaveAs)
                {
                    current.New = true;
                }

                current.Save();
                Editor.CurrentReport = current;
                return(true);
            }
            return(false);
        }
Ejemplo n.º 2
0
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            Graphics g          = e.Graphics;
            Color    BlockColor = Color.Empty;
            int      left       = RECTCOLOR_LEFT;

            if (e.State == DrawItemState.Selected || e.State == DrawItemState.None)
            {
                e.DrawBackground();
            }
            if (e.Index == -1)
            {
                BlockColor = SelectedIndex < 0 ? BackColor : DesignerUtility.ColorFromHtml(this.Text, Color.Empty);
            }
            else
            {
                BlockColor = DesignerUtility.ColorFromHtml((string)this.Items[e.Index], Color.Empty);
            }
            // Fill rectangle
            if (BlockColor.IsEmpty && this.Text.StartsWith("="))
            {
                g.DrawString("fx", this.Font, Brushes.Black, e.Bounds);
            }
            else
            {
                g.FillRectangle(new SolidBrush(BlockColor), left, e.Bounds.Top + RECTCOLOR_TOP, RECTCOLOR_WIDTH,
                                ItemHeight - 2 * RECTCOLOR_TOP);
            }
            base.OnDrawItem(e);
        }
Ejemplo n.º 3
0
 private void DBConnection_Validating(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (!DesignerUtility.TestConnection(this.GetDataConnection(), GetDataConnection()))
     {
         e.Cancel = true;
     }
 }
Ejemplo n.º 4
0
        private void SetColor(ComboBox cbColor)
        {
            ColorDialog cd = new ColorDialog();

            cd.AnyColor = true;
            cd.FullOpen = true;

            cd.CustomColors = RdlDesigner.GetCustomColors();
            cd.Color        = DesignerUtility.ColorFromHtml(cbColor.Text, System.Drawing.Color.Empty);

            try
            {
                if (cd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                RdlDesigner.SetCustomColors(cd.CustomColors);
                cbColor.Text = ColorTranslator.ToHtml(cd.Color);
            }
            finally
            {
                cd.Dispose();
            }

            return;
        }
Ejemplo n.º 5
0
        private void tvTablesColumns_ExpandTable(TreeNode tNode)
        {
            if (tNode.Parent == null)   // Check for Tables or Views
            {
                return;
            }

            if (tNode.FirstNode.Text != "")     // Have we already filled it out?
            {
                return;
            }

            // Need to obtain the column information for the requested table/view
            // suppress redraw until tree view is complete
            tvTablesColumns.BeginUpdate();

            string           sql        = "SELECT * FROM " + DesignerUtility.NormalizeSqlName(tNode.Text);
            List <SqlColumn> tColumns   = DesignerUtility.GetSqlColumns(_Draw, _DataSource, sql);
            bool             bFirstTime = true;

            foreach (SqlColumn sc in tColumns)
            {
                if (bFirstTime)
                {
                    bFirstTime           = false;
                    tNode.FirstNode.Text = sc.Name;
                }
                else
                {
                    tNode.Nodes.Add(sc.Name);
                }
            }

            tvTablesColumns.EndUpdate();
        }
Ejemplo n.º 6
0
        internal string GetReportParameterDefaultValue(string parameterExpression)
        {
            var root = _doc.DocumentElement;

            XmlNode rNode   = _doc.LastChild;
            XmlNode rpsNode = DesignXmlDraw.FindNextInHierarchy(rNode, "ReportParameters");

            if (rpsNode == null)
            {
                return(null);
            }

            var parameterName = DesignerUtility.ExtractParameterNameFromParameterExpression(parameterExpression);

            var parameter = rpsNode.ChildNodes.Cast <XmlNode>()
                            .FirstOrDefault(n => n.Attributes["Name"].Value == parameterName);

            if (parameter == null)
            {
                //ERROR, parameter not found;
                return(null);
            }

            var defaultValue = parameter.ChildNodes.Cast <XmlNode>()
                               .FirstOrDefault(n => n.Name == "DefaultValue");

            if (defaultValue == null)
            {
                // ERROR, no default value;
                return(null);
            }

            // selecting DefaultValue/Values/Value
            return(defaultValue.FirstChild.FirstChild.InnerText);
        }
Ejemplo n.º 7
0
 private void bTestConnection_Click(object sender, System.EventArgs e)
 {
     if (DesignerUtility.TestConnection(this.cbDataProvider.Text, tbConnection.Text))
     {
         MessageBox.Show(Strings.DialogDatabase_Show_ConnectionSuccessful, Strings.DesignerUtility_Show_TestConnection);
     }
 }
Ejemplo n.º 8
0
 private void bTestConnection_Click(object sender, System.EventArgs e)
 {
     if (DesignerUtility.TestConnection(this.cbDataProvider.Text, tbConnection.Text))
     {
         MessageBox.Show("Connection succeeded!", "Test Connection");
     }
 }
Ejemplo n.º 9
0
        private void bRefresh_Click(object sender, System.EventArgs e)
        {
            // Need to clear all the fields and then replace with the columns
            //   of the SQL statement
            List <SqlColumn> cols = DesignerUtility.GetSqlColumns(tbSQL.Text);

            if (cols == null || cols.Count <= 0)
            {
                return;                         // something didn't work right
            }
            _dsv.Fields.Rows.Clear();
            string[] rowValues = new string[4];
            foreach (SqlColumn sc in cols)
            {
                rowValues[0] = sc.Name;
                rowValues[1] = sc.Name;
                rowValues[2] = "";
                DataGridViewComboBoxColumn TypeColumn = (dgFields.Columns[3] as DataGridViewComboBoxColumn);
                if (!TypeColumn.Items.Contains(sc.DataType.FullName))
                {
                    TypeColumn.Items.Add(sc.DataType.FullName);
                }
                rowValues[3] = sc.DataType.FullName;
                _dsv.Fields.Rows.Add(rowValues);
            }
        }
Ejemplo n.º 10
0
        private void bColor_Click(object sender, System.EventArgs e)
        {
            ColorDialog cd = new ColorDialog();

            cd.AnyColor = true;
            cd.FullOpen = true;

            cd.CustomColors = RdlDesigner.GetCustomColors();
            cd.Color        =
                DesignerUtility.ColorFromHtml(cbColor.Text, System.Drawing.Color.Black);
            try
            {
                if (cd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                RdlDesigner.SetCustomColors(cd.CustomColors);
                if (sender == this.bColor)
                {
                    cbColor.Text = ColorTranslator.ToHtml(cd.Color);
                }
            }
            finally
            {
                cd.Dispose();
            }
            return;
        }
Ejemplo n.º 11
0
 void SetPadding(string l, PropertyExpr pe)
 {
     if (!_pri.IsExpression(pe.Expression))
     {
         DesignerUtility.ValidateSize(pe.Expression, true, false);
     }
     SetStyleValue(l, pe.Expression);
 }
Ejemplo n.º 12
0
 void SetPadding(string l, PropertyExpr pe, bool bMinus) //Josh: Eddited to allow negative padding on top and left
 {
     if (!_pri.IsExpression(pe.Expression))
     {
         DesignerUtility.ValidateSize(pe.Expression, true, /*false*/ bMinus);
     }
     SetStyleValue(l, pe.Expression);
 }
Ejemplo n.º 13
0
        private void bLoad_Click(object sender, System.EventArgs e)
        {
            // Load the data from the SQL; we append the data to what already exists
            try
            {
                // Obtain the connection information
                XmlNode rNode  = _Draw.GetReportNode();
                XmlNode dsNode = _Draw.GetNamedChildNode(rNode, "DataSources");
                if (dsNode == null)
                {
                    return;
                }
                XmlNode datasource = null;
                foreach (XmlNode dNode in dsNode)
                {
                    if (dNode.Name != "DataSource")
                    {
                        continue;
                    }
                    XmlAttribute nAttr = dNode.Attributes["Name"];
                    if (nAttr == null)                          // shouldn't really happen
                    {
                        continue;
                    }
                    if (nAttr.Value != _dsv.DataSourceName)
                    {
                        continue;
                    }
                    datasource = dNode;
                    break;
                }
                if (datasource == null)
                {
                    MessageBox.Show(string.Format("Datasource '{0}' not found.", _dsv.DataSourceName), "Load Failed");
                    return;
                }
                string dataSourceReference = _Draw.GetElementValue(datasource, "DataSourceReference", null);
                if (dataSourceReference != null)
                {                       // todo: should support datasourcereference here as well
                    MessageBox.Show(string.Format("Datasource '{0}' contains a DataSourceReference.   This is not currently supported.", _dsv.DataSourceName), "Load Failed");
                    return;
                }

                XmlNode cpNode     = DesignXmlDraw.FindNextInHierarchy(datasource, "ConnectionProperties", "ConnectString");
                string  connection = cpNode == null? "": cpNode.InnerText;

                XmlNode datap        = DesignXmlDraw.FindNextInHierarchy(datasource, "ConnectionProperties", "DataProvider");
                string  dataProvider = datap == null? "": datap.InnerText;

                // Populate the data table
                DesignerUtility.GetSqlData(dataProvider, connection, _dsv.CommandText, null, _DataTable);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Load Failed");
            }
        }
        // Fill out tvTablesColumns
        private void DoSqlSchema()
        {
            // TODO be more efficient and remember schema info;
            //   need to mark changes to connections
            if (tvTablesColumns.Nodes.Count > 0)
            {
                return;
            }

            // suppress redraw until tree view is complete
            tvTablesColumns.BeginUpdate();

            // Get the schema information
            List <SqlSchemaInfo> si     = DesignerUtility.GetSchemaInfo();
            TreeNode             ndRoot = new TreeNode("Tables");

            tvTablesColumns.Nodes.Add(ndRoot);
            bool bView = false;

            foreach (SqlSchemaInfo ssi in si)
            {
                if (!bView && ssi.Type == "VIEW")
                {       // Switch over to views
                    ndRoot = new TreeNode("Views");
                    tvTablesColumns.Nodes.Add(ndRoot);
                    bView = true;
                }

                // Add the node to the tree
                TreeNode aRoot = new TreeNode(ssi.Name);
                ndRoot.Nodes.Add(aRoot);
                aRoot.Nodes.Add("");
            }

            // Now do parameters
            //if (lbParameters.Items.Count > 0)
            //{
            //    ndRoot = new TreeNode("Parameters");
            //    tvTablesColumns.Nodes.Add(ndRoot);
            //    foreach (ReportParm rp in lbParameters.Items)
            //    {
            //        string paramName;

            //        // force the name to start with @
            //        if (rp.Name[0] == '@')
            //            paramName = rp.Name;
            //        else
            //            paramName = "@" + rp.Name;

            //        // Add the node to the tree
            //        TreeNode aRoot = new TreeNode(paramName);
            //        ndRoot.Nodes.Add(aRoot);
            //    }
            //}

            tvTablesColumns.EndUpdate();
        }
Ejemplo n.º 15
0
        static internal bool GetConnnectionInfo(DesignXmlDraw d, string ds, out string dataProvider, out string connection)
        {
            XmlNode dsNode = d.DataSourceName(ds);

            dataProvider = null;
            connection   = null;
            if (dsNode == null)
            {
                return(false);
            }

            string dataSourceReference = d.GetElementValue(dsNode, "DataSourceReference", null);

            if (dataSourceReference != null)
            {
                //  This is not very pretty code since it is assuming the structure of the windows parenting.
                //    But there isn't any other way to get this information from here.
                Control  p  = d;
                MDIChild mc = null;
                while (p != null && !(p is RdlDesigner))
                {
                    if (p is MDIChild)
                    {
                        mc = (MDIChild)p;
                    }

                    p = p.Parent;
                }
                if (p == null || mc == null || mc.SourceFile == null)
                {
                    MessageBox.Show(Strings.DataSetRowsCtl_ShowC_UnableLocateDSR);
                    return(false);
                }
                Uri filename = new Uri(Path.GetDirectoryName(mc.SourceFile.LocalPath) + Path.DirectorySeparatorChar + dataSourceReference);
                if (!DesignerUtility.GetSharedConnectionInfo((RdlDesigner)p, filename.LocalPath, out dataProvider, out connection))
                {
                    return(false);
                }
            }
            else
            {
                XmlNode dp = DesignXmlDraw.FindNextInHierarchy(dsNode, "ConnectionProperties", "DataProvider");
                if (dp == null)
                {
                    return(false);
                }
                dataProvider = dp.InnerText;
                dp           = DesignXmlDraw.FindNextInHierarchy(dsNode, "ConnectionProperties", "ConnectString");
                if (dp == null)
                {
                    return(false);
                }
                connection = dp.InnerText;
            }
            return(true);
        }
Ejemplo n.º 16
0
        private void bGetFilename_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "Data source reference files (*.dsr)|*.dsr" +
                         "|All files (*.*)|*.*";
            ofd.FilterIndex = 1;
            if (tbFilename.Text.Length > 0)
            {
                ofd.FileName = tbFilename.Text;
            }
            else
            {
                ofd.FileName = "*.dsr";
            }

            ofd.Title        = "Specify Data Source Reference File Name";
            ofd.DefaultExt   = "dsr";
            ofd.AddExtension = true;

            try
            {
                if (_FileName != null)
                {
                    ofd.InitialDirectory = Path.GetDirectoryName(_FileName.LocalPath);
                }
            }
            catch
            {
            }
            try
            {
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        string dsr = DesignerUtility.RelativePathTo(
                            Path.GetDirectoryName(_FileName.LocalPath), Path.GetDirectoryName(ofd.FileName));

                        string f = Path.GetFileNameWithoutExtension(ofd.FileName);

                        tbFilename.Text = dsr == "" ? f : dsr + Path.DirectorySeparatorChar + f;
                    }
                    catch
                    {
                        tbFilename.Text = Path.GetFileNameWithoutExtension(ofd.FileName);
                    }
                }
            }
            finally
            {
                ofd.Dispose();
            }
        }
Ejemplo n.º 17
0
        public void Apply()
        {
            XmlNode rNode = _Draw.GetReportNode();

            _Draw.SetElement(rNode, "Width", DesignerUtility.MakeValidSize(tbWidth.Text, false));
            _Draw.SetElement(rNode, "Author", tbReportAuthor.Text);
            _Draw.SetElement(rNode, "Description", tbReportDescription.Text);
            _Draw.SetElement(rNode, "PageWidth", tbPageWidth.Text);
            _Draw.SetElement(rNode, "PageHeight", tbPageHeight.Text);
            _Draw.SetElement(rNode, "RollPaper", this.chkRollPaper.Checked ? "true" : "false");
            if (tbMarginLeft.Text.Trim().Length > 0)
            {
                _Draw.SetElement(rNode, "LeftMargin", tbMarginLeft.Text);
            }
            else
            {
                _Draw.RemoveElement(rNode, "LeftMargin");
            }
            if (tbMarginRight.Text.Trim().Length > 0)
            {
                _Draw.SetElement(rNode, "RightMargin", tbMarginRight.Text);
            }
            else
            {
                _Draw.RemoveElement(rNode, "RightMargin");
            }
            if (tbMarginBottom.Text.Trim().Length > 0)
            {
                _Draw.SetElement(rNode, "BottomMargin", tbMarginBottom.Text);
            }
            else
            {
                _Draw.RemoveElement(rNode, "BottomMargin");
            }
            if (tbMarginTop.Text.Trim().Length > 0)
            {
                _Draw.SetElement(rNode, "TopMargin", tbMarginTop.Text);
            }
            else
            {
                _Draw.RemoveElement(rNode, "TopMargin");
            }
            // Page header settings
            XmlNode phNode = _Draw.GetCreateNamedChildNode(rNode, "PageHeader");

            _Draw.SetElement(phNode, "PrintOnFirstPage", this.chkPHFirst.Checked ? "true" : "false");
            _Draw.SetElement(phNode, "PrintOnLastPage", this.chkPHLast.Checked ? "true" : "false");
            // Page footer settings
            XmlNode pfNode = _Draw.GetCreateNamedChildNode(rNode, "PageFooter");

            _Draw.SetElement(pfNode, "PrintOnFirstPage", this.chkPFFirst.Checked ? "true" : "false");
            _Draw.SetElement(pfNode, "PrintOnLastPage", this.chkPFLast.Checked ? "true" : "false");
        }
Ejemplo n.º 18
0
 private void cbDataProvider_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     if (cbDataProvider.Text == "ODBC")
     {
         lODBC.Visible = cbOdbcNames.Visible = true;
         DesignerUtility.FillOdbcNames(cbOdbcNames);
     }
     else
     {
         lODBC.Visible = cbOdbcNames.Visible = false;
     }
 }
Ejemplo n.º 19
0
        private void bTestConnection_Click(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(this.cbDataProvider.Text))
            {
                MessageBox.Show(Strings.DialogDatabase_ShowD_SelectDataProvider, Strings.DesignerUtility_Show_TestConnection, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (DesignerUtility.TestConnection(this.cbDataProvider.Text, tbConnection.Text))
            {
                MessageBox.Show(Strings.DialogDatabase_Show_ConnectionSuccessful, Strings.DesignerUtility_Show_TestConnection);
            }
        }
Ejemplo n.º 20
0
        private void bTestConnection_Click(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(this.cbDataProvider.Text))
            {
                MessageBox.Show("Please select a Data Provider before testing.", "Test Connection", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (DesignerUtility.TestConnection(this.cbDataProvider.Text, tbConnection.Text))
            {
                MessageBox.Show("Connection succeeded!", "Test Connection");
            }
        }
Ejemplo n.º 21
0
        private void bTestConnection_Click(object sender, System.EventArgs e)
        {
            string cType = GetDataProvider();

            if (cType == null)
            {
                return;
            }

            if (DesignerUtility.TestConnection(cType, GetDataConnection()))
            {
                MessageBox.Show("Connection successful!", "Test Connection");
            }
        }
        private void tbSize_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            TextBox tb = sender as TextBox;

            if (tb == null)
            {
                return;
            }

            try { DesignerUtility.ValidateSize(tb.Text, false, false); }
            catch (Exception ex)
            {
                e.Cancel = true;
                MessageBox.Show(string.Format(Strings.ReportCtl_Show_SizeInvalid, tb.Text, ex.Message), tb.Tag + " " + Strings.ReportCtl_Show_Field_Invalid);
            }
        }
Ejemplo n.º 23
0
        private void tbSize_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            TextBox tb = sender as TextBox;

            if (tb == null)
            {
                return;
            }

            try { DesignerUtility.ValidateSize(tb.Text, false, false); }
            catch (Exception ex)
            {
                e.Cancel = true;
                MessageBox.Show(string.Format("Size value of {0} is invalid.\r\n", tb.Text, ex.Message), tb.Tag + " Field Invalid");
            }
        }
Ejemplo n.º 24
0
        public bool IsValid()
        {
            XmlNode ri = this._ReportItems[0] as XmlNode;

            if (tbName.Enabled && fName)
            {
                string nerr = _Draw.NameError(ri, this.tbName.Text);
                if (nerr != null)
                {
                    MessageBox.Show(nerr, "Name");
                    return(false);
                }
            }
            string name = "";

            try
            {                   // allow minus if Line and only one item selected
                bool bMinus = ri.Name == "Line" && tbName.Enabled? true: false;
                if (fLeft)
                {
                    name = "Left";
                    DesignerUtility.ValidateSize(this.tbLeft.Text, true, false);
                }
                if (fTop)
                {
                    name = "Top";
                    DesignerUtility.ValidateSize(this.tbTop.Text, true, false);
                }
                if (fWidth)
                {
                    name = "Width";
                    DesignerUtility.ValidateSize(this.tbWidth.Text, true, bMinus);
                }
                if (fHeight)
                {
                    name = "Height";
                    DesignerUtility.ValidateSize(this.tbHeight.Text, true, bMinus);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, name + " Size is Invalid");
                return(false);
            }

            return(true);
        }
Ejemplo n.º 25
0
 public bool IsValid()
 {
     if (fFontSize)
     {
         try
         {
             if (!this.cbFontSize.Text.Trim().StartsWith("="))
             {
                 DesignerUtility.ValidateSize(this.cbFontSize.Text, false, false);
             }
         }
         catch (Exception e)
         {
             MessageBox.Show(e.Message, Strings.FontCtl_Show_InvalidFontSize);
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 26
0
		private void bRefresh_Click(object sender, System.EventArgs e)
		{
			// Need to clear all the fields and then replace with the columns 
			//   of the SQL statement
			List<SqlColumn> cols = DesignerUtility.GetSqlColumns(_Draw, cbDataSource.Text, tbSQL.Text);
			if (cols == null || cols.Count <= 0)
				return;				// something didn't work right
			
			_dsv.Fields.Rows.Clear();
			string[] rowValues = new string[4];
			foreach (SqlColumn sc in cols)
			{
				rowValues[0] = sc.Name;
				rowValues[1] = sc.Name;
				rowValues[2] = "";
                rowValues[3] = sc.DataType.FullName;
				_dsv.Fields.Rows.Add(rowValues);
			}
		}
        private void tvTablesColumns_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            TreeNode node = tvTablesColumns.GetNodeAt(e.X, e.Y);

            if (node == null || node.Parent == null)
            {
                return;
            }

            string dragText;

            if (tbSQL.Text == "")
            {
                if (node.Parent.Parent == null)
                {                                      // select table; generate full select for table
                    tvTablesColumns_ExpandTable(node); // make sure we've obtained the columns

                    dragText = "SELECT ";
                    TreeNode next = node.FirstNode;
                    while (true)
                    {
                        dragText += DesignerUtility.NormalizeSqlName(next.Text);
                        next      = next.NextNode;
                        if (next == null)
                        {
                            break;
                        }
                        dragText += ", ";
                    }
                    dragText += (" FROM " + DesignerUtility.NormalizeSqlName(node.Text));
                }
                else
                {       // select column; generate select of that column
                    dragText = "SELECT " + DesignerUtility.NormalizeSqlName(node.Text) + " FROM " + DesignerUtility.NormalizeSqlName(node.Parent.Text);
                }
            }
            else
            {
                dragText = node.Text;
            }

            tvTablesColumns.DoDragDrop(dragText, DragDropEffects.Copy);
        }
Ejemplo n.º 28
0
        public bool IsValid()
        {
            try
            {
                if (fWidth)
                {
                    DesignerUtility.ValidateSize(this.tbColumnWidth.Text, true, false);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Width is Invalid");
                return(false);
            }

            if (fHidden)
            {
                string vh = this.tbHidden.Text.Trim();
                if (vh.Length > 0)
                {
                    if (vh.StartsWith("="))
                    {
                    }
                    else
                    {
                        vh = vh.ToLower();
                        switch (vh)
                        {
                        case "true":
                        case "false":
                            break;

                        default:
                            MessageBox.Show(String.Format("{0} must be an expression or 'true' or 'false'", tbHidden.Text), "Hidden is Invalid");
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
        public bool IsValid()
        {
            try
            {
                if (fHeight)
                {
                    DesignerUtility.ValidateSize(this.tbRowHeight.Text, true, false);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Strings.TableRowCtl_Show_HeightInvalid);
                return(false);
            }

            if (fHidden)
            {
                string vh = this.tbHidden.Text.Trim();
                if (vh.Length > 0)
                {
                    if (vh.StartsWith("="))
                    {
                    }
                    else
                    {
                        vh = vh.ToLower();
                        switch (vh)
                        {
                        case "true":
                        case "false":
                            break;

                        default:
                            MessageBox.Show(String.Format(Strings.TableRowCtl_Show_ExpressionTrueFalse, tbHidden.Text), Strings.TableRowCtl_Show_HiddenInvalid);
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
        private void bTestConnection_Click(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(this.cbDataProvider.Text))
            {
                MessageBox.Show(Strings.DialogDatabase_ShowD_SelectDataProvider, Strings.DesignerUtility_Show_TestConnection, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            var connectionString = tbConnection.Text;

            if (tbConnection.Text.StartsWith("=Parameters!"))
            {
                connectionString = _Draw.GetReportParameterDefaultValue(tbConnection.Text);
            }

            if (DesignerUtility.TestConnection(this.cbDataProvider.Text, connectionString))
            {
                MessageBox.Show(Strings.DialogDatabase_Show_ConnectionSuccessful, Strings.DesignerUtility_Show_TestConnection);
            }
        }