Exemplo n.º 1
0
        /// <summary>
        /// Load this Simple type from the .NET schema
        /// </summary>
        /// <param name="type">The type to load</param>
        public void Load(System.Xml.Schema.XmlSchemaSimpleType type)
        {
            if (type == null)
            {
                return;
            }
            this.Name           = type.Name;
            this.Namespace      = type.QualifiedName != null ? type.QualifiedName.Namespace : Schema.TargetNamespace;
            this.SystemType     = type.Datatype.ValueType;
            this.systemTypeCode = type.Datatype.TypeCode;
            this.Type           = SimpleType.Extension;

            // Deal with an enum
            if (type.Content is System.Xml.Schema.XmlSchemaSimpleTypeList)
            {
                Type = SimpleType.Enum;

                System.Xml.Schema.XmlSchemaSimpleTypeList stl = type.Content as System.Xml.Schema.XmlSchemaSimpleTypeList;

                this.SystemType     = stl.BaseItemType.Datatype.ValueType;
                this.systemTypeCode = stl.BaseItemType.Datatype.TypeCode;

                System.Xml.Schema.XmlSchemaObjectCollection listitems = null;

                if (stl.ItemType != null && stl.ItemType.Content is System.Xml.Schema.XmlSchemaSimpleTypeRestriction) // Restriction meaning this is an enum
                {
                    listitems = (stl.ItemType.Content as System.Xml.Schema.XmlSchemaSimpleTypeRestriction).Facets;
                }
                else if (stl.BaseItemType.Content is System.Xml.Schema.XmlSchemaSimpleTypeUnion)
                {
                    listitems = new System.Xml.Schema.XmlSchemaObjectCollection();
                    foreach (System.Xml.Schema.XmlSchemaObject so in (stl.BaseItemType.Content as System.Xml.Schema.XmlSchemaSimpleTypeUnion).BaseMemberTypes)
                    {
                        if (so is System.Xml.Schema.XmlSchemaSimpleType)
                        {
                            foreach (System.Xml.Schema.XmlSchemaObject o in ((so as System.Xml.Schema.XmlSchemaSimpleType).Content as System.Xml.Schema.XmlSchemaSimpleTypeRestriction).Facets)
                            {
                                listitems.Add(o);
                            }
                        }
                    }
                }

                // TODO: Can lists appear somewhere else?

                // Iterate through the restrictions
                if (listitems != null)
                {
                    foreach (System.Xml.Schema.XmlSchemaObject o in listitems)
                    {
                        if (o is System.Xml.Schema.XmlSchemaEnumerationFacet)
                        {
                            Restrictions.Add((o as System.Xml.Schema.XmlSchemaEnumerationFacet).Value);
                        }
                    }
                }
            }

            //Debugger.Break();
        }
Exemplo n.º 2
0
            private void ImportValueOfRestriction(Regex restrictionPairRegex, string sRestrictionName)
            {
                var keyValue = restrictionPairRegex.Match(_expression);

                if (keyValue.Success)
                {
                    var regValue   = new LineRestrictionValueRegex();
                    var matchValue = regValue.Match(keyValue.Value);
                    if (!matchValue.Success)
                    {
                        throw new Exception("Ошибка при вычислении значения выражения: " + _expression);
                    }
                    string value; // значение ограничения
                    try
                    {
                        value = matchValue.Value.TrimStart('=');
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("Ошибка при вычислении значения ограничения: " + _expression, ex);
                    }
                    try
                    {
                        Restrictions.Add(sRestrictionName, value);
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("Ошибка при добавлении ограничения в коллекцию:" + _expression, ex);
                    }
                }
            }
Exemplo n.º 3
0
        public CleavageRule(string rule)
        {
            cterm = rule[0] == 'C';
            int    tmp = rule.IndexOf("-");
            string cleaveSite;

            if (tmp == -1)
            {
                cleaveSite   = rule.Substring(2);
                restrictions = new HashSet <char>();
            }
            else
            {
                cleaveSite   = rule.Substring(2, tmp - 2);
                restrictions = new HashSet <char>();
                foreach (char cc in rule.Substring(tmp + 1))
                {
                    Restrictions.Add(cc);
                }
            }
            cleaveageSites = new HashSet <char>();
            foreach (char c in cleaveSite)
            {
                CleaveageSites.Add(c);
            }
        }
Exemplo n.º 4
0
        public void AddRestriction(RestrictionTypes type, object value)
        {
            Parameter   parameter   = new Parameter(this, value);
            Restriction restriction = new Restriction(this, parameter, type);

            Parameters.Add(parameter);
            Restrictions.Add(restriction);
        }
        public void AddEmployeeForm_AddRestriction(object e)
        {
            DateTime today          = DateTime.Today;
            var      newRestriction = new RestrictionModel();

            newRestriction.Name      = _selectedRestriction.Name;
            newRestriction.EndDate   = _newRestrictionEndDate;
            newRestriction.Id        = _selectedRestriction.Id;
            newRestriction.BeginDate = today;
            Restrictions.Add(newRestriction);
        }
Exemplo n.º 6
0
        public void AddRestriction(Tables.Restriction restriction)
        {
            var existingUser = Users.FirstOrDefault(x => x.Id == restriction.UserId);

            if (existingUser != null)
            {
                Restrictions.Add(restriction);
                SaveChanges();
                existingUser.Restricted = true;
                SaveChanges();
            }
        }
Exemplo n.º 7
0
        private void OnLineGraphsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
            {
                foreach (GraphModel viewModel in e.NewItems)
                {
                    LineGraph lineGraph = this.AddLineGraph(viewModel.PointDataSource, viewModel.Color, 1, viewModel.Name);
                    lineGraph.Name = viewModel.Name;
                    lineGraphLines.Add(lineGraph);
                }
                break;
            }

            case System.Collections.Specialized.NotifyCollectionChangedAction.Move:
            {
                break;
            }

            case System.Collections.Specialized.NotifyCollectionChangedAction.Remove:
            {
                foreach (var oldItem in e.OldItems)
                {
                    foreach (LineGraph line in lineGraphLines)
                    {
                        if (((GraphModel)oldItem).Name == line.Name)
                        {
                            Children.Remove(line);
                            lineGraphLines.Remove(line);
                        }
                    }
                }
                break;
            }

            case System.Collections.Specialized.NotifyCollectionChangedAction.Replace:
            {
                bool bTemp = false;
                foreach (GraphModel viewModel in e.NewItems)
                {
                    foreach (LineGraph line in lineGraphLines)
                    {
                        if (Children.Contains(line) && line.Name == viewModel.Name)
                        {
                            Children.Remove(line);
                            lineGraphLines.Remove(line);
                            bTemp = true;
                            break;
                        }
                    }

                    if (bTemp)
                    {
                        LineGraph lineGraph = this.AddLineGraph(viewModel.PointDataSource, viewModel.Color, 1, viewModel.Name);
                        lineGraph.Name = viewModel.Name;
                        lineGraphLines.Add(lineGraph);
                        bTemp = false;
                    }
                }
                break;
            }

            case System.Collections.Specialized.NotifyCollectionChangedAction.Reset:
            {
                Restrictions.Clear();
                Children.RemoveAll(typeof(LineGraph));
                lineGraphLines.Clear();
                break;
            }
            }

            double min = double.MaxValue, max = double.MinValue;

            foreach (var graphModel in LineGraphs)
            {
                if (graphModel.MaxValue > max)
                {
                    max = graphModel.MaxValue;
                }
                if (graphModel.MinValue < min)
                {
                    min = graphModel.MinValue;
                }
            }

            Restrictions.Clear();

            if (min != double.MaxValue && max != double.MinValue && max > min)
            {
                Restrictions.Add(new ViewportAxesRangeRestriction {
                    YRange = new DisplayRange(min, max)
                });
            }
            //Viewport.FitToView();
            Viewport.Visible = new DataRect(new DateTimeAxis().ConvertToDouble(DateTime.Now.AddHours(-23)), 0, new DateTimeAxis().ConvertToDouble(DateTime.MinValue.AddHours(23.5)), 100);
        }
Exemplo n.º 8
0
 public void Restrict(Restriction restriction)
 {
     Restrictions.Add(restriction);
 }
Exemplo n.º 9
0
 public void Add(TagRestrictions restrictions)
 {
     Restrictions.Add(restrictions.Tag, restrictions);
 }
Exemplo n.º 10
0
 public override void RpcDoAction()
 {
     Restrictions.Add(restriction);
     puncher.enabled = true;
     StartCoroutine(RotateMe());
 }