Esempio n. 1
0
        protected override Filter CreateItemFromXmlNode(System.Xml.XmlNode xmlNode)
        {
            Filter filter = new Filter();

            filter.Name        = xmlNode.GetAttributeValueIf("Name");
            filter.Description = xmlNode.GetAttributeValueIf("Description");
            string connection = xmlNode.GetNodeValueIf("Connection");

            if (ReportConfig.ConnectionManager.ItemCollection.ContainsKey(connection))
            {
                filter.Connection = ReportConfig.ConnectionManager.ItemCollection[connection];
            }

            XmlNodeList list = xmlNode.SelectNodes("Fields/Field");

            for (int i = 0; i < list.Count; i++)
            {
                QVField field = new QVField();
                field.Name       = list[i].GetAttributeValueIf("Name");
                field.Expression = list[i].GetAttributeValueIf("Expression");
                XmlNodeList valueList = list[i].SelectNodes("Value");
                for (int j = 0; j < valueList.Count; j++)
                {
                    FieldValue value = new FieldValue();
                    value.Value     = valueList[j].GetNodeValueIf();
                    value.Number    = double.Parse(valueList[j].GetAttributeValueIf("Number"));
                    value.IsNumeric = bool.Parse(valueList[j].GetAttributeValueIf("IsNumeric"));
                    field.Values.Add(value);
                }

                filter.Fields.Add(field.Name, field);
            }

            list = xmlNode.SelectNodes("Variables/Variable");
            for (int i = 0; i < list.Count; i++)
            {
                QvVariable variable = new QvVariable();
                variable.Name       = list[i].GetAttributeValueIf("Name");
                variable.Expression = list[i].GetAttributeValueIf("Expression");
                variable.Value      = list[i].GetNodeValueIf();

                filter.Variables.Add(variable.Name, variable);
            }

            return(filter);
        }
Esempio n. 2
0
 protected void VariableDelete(QvVariable variable)
 {
     if (variable == null)
     {
         MessageBox.Show("Please select an variable.");
         return;
     }
     if (MessageBox.Show("Do you want to delete the variable " + variable.Name, "Delete", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
     {
         Filter filter = this.ReportItem as Filter;
         filter.Variables.Remove(variable.Name);
     }
 }
 private string GetValueFromExpression(QvVariable item)
 {
     if (item.HasExpression)
     {
         return DateFunctions.GetValueFromExpression(item.Expression).ToString("yyyy/MM/dd");
     }
     else
     {
         return item.Value;
     }
 }
Esempio n. 4
0
        protected void VariableAdd(QvVariable variable)
        {
            if(string.IsNullOrWhiteSpace(variable.Name))
            {
                 MessageBox.Show("The name can not be empty.");
                 return;
            }

            if (string.IsNullOrWhiteSpace(variable.Value) && string.IsNullOrWhiteSpace(variable.Expression))
            {
                MessageBox.Show("Value or Expression can not be empty.");
                return;
            }

            Filter filter = this.ReportItem as Filter;

            if (filter.Variables.ContainsKey(variable.Name))
            {
                MessageBox.Show("The same name variable exists, cannot add.");
                return;
            }

            filter.Variables.Add(variable.Name, variable);

            this.NewVariable = new QvVariable();
        }