コード例 #1
0
        internal void FromBooleanItem(BooleanItem bi)
        {
            this.SetAllNull();

            if (bi.Val != null) this.Val = bi.Val.Value;
            if (bi.Unused != null) this.Unused = bi.Unused.Value;
            if (bi.Calculated != null) this.Calculated = bi.Calculated.Value;
            if (bi.Caption != null) this.Caption = bi.Caption.Value;
            if (bi.PropertyCount != null) this.PropertyCount = bi.PropertyCount.Value;

            MemberPropertyIndex mpi;
            using (OpenXmlReader oxr = OpenXmlReader.Create(bi))
            {
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(MemberPropertyIndex))
                    {
                        // 0 is the default value.
                        mpi = (MemberPropertyIndex)oxr.LoadCurrentElement();
                        if (mpi.Val != null) this.MemberPropertyIndexes.Add(mpi.Val.Value);
                        else this.MemberPropertyIndexes.Add(0);
                    }
                }
            }
        }
コード例 #2
0
        public override DataItem LoadData(XElement element, UndoRedoManager undoRedo)
        {
            var item = new BooleanItem(this, undoRedo);

            bool val = Default;

            bool.TryParse(element.Value, out val);
            item.Value = val;

            foreach (var att in Attributes)
            {
                var      el      = element.Attribute(att.Name);
                DataItem attItem = null;

                if (el != null)
                {
                    attItem = att.LoadData(new XElement(el.Name, el.Value.ToString()), undoRedo);
                }
                else
                {
                    attItem = att.CreateData(undoRedo);
                }
                item.Attributes.Add(attItem);
            }

            return(item);
        }
コード例 #3
0
        public override DataItem LoadFromString(string data, UndoRedoManager undoRedo)
        {
            var item = new BooleanItem(this, undoRedo);

            bool val = Default;

            bool.TryParse(data, out val);
            item.Value = val;

            return(item);
        }
コード例 #4
0
        public override DataItem CreateData(UndoRedoManager undoRedo)
        {
            var item = new BooleanItem(this, undoRedo);

            item.Value = Default;

            foreach (var att in Attributes)
            {
                var attItem = att.CreateData(undoRedo);
                item.Attributes.Add(attItem);
            }

            return(item);
        }
コード例 #5
0
        internal void FromBooleanItem(BooleanItem bi)
        {
            this.SetAllNull();

            if (bi.Val != null)
            {
                this.Val = bi.Val.Value;
            }
            if (bi.Unused != null)
            {
                this.Unused = bi.Unused.Value;
            }
            if (bi.Calculated != null)
            {
                this.Calculated = bi.Calculated.Value;
            }
            if (bi.Caption != null)
            {
                this.Caption = bi.Caption.Value;
            }
            if (bi.PropertyCount != null)
            {
                this.PropertyCount = bi.PropertyCount.Value;
            }

            MemberPropertyIndex mpi;

            using (OpenXmlReader oxr = OpenXmlReader.Create(bi))
            {
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(MemberPropertyIndex))
                    {
                        // 0 is the default value.
                        mpi = (MemberPropertyIndex)oxr.LoadCurrentElement();
                        if (mpi.Val != null)
                        {
                            this.MemberPropertyIndexes.Add(mpi.Val.Value);
                        }
                        else
                        {
                            this.MemberPropertyIndexes.Add(0);
                        }
                    }
                }
            }
        }
コード例 #6
0
        internal BooleanItem ToBooleanItem()
        {
            BooleanItem bi = new BooleanItem();

            bi.Val = this.Val;
            if (this.Unused != null)
            {
                bi.Unused = this.Unused.Value;
            }
            if (this.Calculated != null)
            {
                bi.Calculated = this.Calculated.Value;
            }
            if (this.Caption != null && this.Caption.Length > 0)
            {
                bi.Caption = this.Caption;
            }
            if (this.PropertyCount != null)
            {
                bi.PropertyCount = this.PropertyCount.Value;
            }

            foreach (int i in this.MemberPropertyIndexes)
            {
                if (i != 0)
                {
                    bi.Append(new MemberPropertyIndex()
                    {
                        Val = i
                    });
                }
                else
                {
                    bi.Append(new MemberPropertyIndex());
                }
            }

            return(bi);
        }
コード例 #7
0
        internal BooleanItem ToBooleanItem()
        {
            var bi = new BooleanItem();

            bi.Val = Val;
            if (Unused != null)
            {
                bi.Unused = Unused.Value;
            }
            if (Calculated != null)
            {
                bi.Calculated = Calculated.Value;
            }
            if ((Caption != null) && (Caption.Length > 0))
            {
                bi.Caption = Caption;
            }
            if (PropertyCount != null)
            {
                bi.PropertyCount = PropertyCount.Value;
            }

            foreach (var i in MemberPropertyIndexes)
            {
                if (i != 0)
                {
                    bi.Append(new MemberPropertyIndex {
                        Val = i
                    });
                }
                else
                {
                    bi.Append(new MemberPropertyIndex());
                }
            }

            return(bi);
        }
コード例 #8
0
        public static void ThenICanSeeAValueOfInTheBooleanField(bool expectedValue, BooleanItem field, string fieldLocation)
        {
            var actualValue = fieldLocation == "field" ? XrmApp.Entity.GetValue(field) : XrmApp.Entity.GetHeaderValue(field);

            actualValue.Should().Be(expectedValue);
        }
コード例 #9
0
 public static void ThenICanSeeAValueOfInTheBooleanFieldOnTheQuickCreate(bool expectedValue, BooleanItem field)
 {
     XrmApp.QuickCreate.GetValue(field).Should().Be(expectedValue);
 }
コード例 #10
0
        internal BooleanItem ToBooleanItem()
        {
            BooleanItem bi = new BooleanItem();
            bi.Val = this.Val;
            if (this.Unused != null) bi.Unused = this.Unused.Value;
            if (this.Calculated != null) bi.Calculated = this.Calculated.Value;
            if (this.Caption != null && this.Caption.Length > 0) bi.Caption = this.Caption;
            if (this.PropertyCount != null) bi.PropertyCount = this.PropertyCount.Value;

            foreach (int i in this.MemberPropertyIndexes)
            {
                if (i != 0) bi.Append(new MemberPropertyIndex() { Val = i });
                else bi.Append(new MemberPropertyIndex());
            }

            return bi;
        }
コード例 #11
0
 public static void ThenICanSeeAValueOfInTheBooleanFieldOnTheBusinessProcessFlow(bool expectedValue, BooleanItem field)
 {
     XrmApp.BusinessProcessFlow.GetValue(field).Should().Be(expectedValue);
 }