Пример #1
0
        public static Operation GetOperation(string href, string operationName)
        {
            RequestMethodType restRequest = GetRestRequestMethodType(href);
            RequestMethodType kvpRequest  = GetKvpRequestMethodType($"{href}?");

            RequestMethodType[] requestMethodTypes = new RequestMethodType[]
            {
                restRequest, kvpRequest
            };
            ItemsChoiceType1[] itemsChoiceType1s = new ItemsChoiceType1[]
            {
                ItemsChoiceType1.Get, ItemsChoiceType1.Get
            };
            HTTP http = new HTTP()
            {
                Items            = requestMethodTypes,
                ItemsElementName = itemsChoiceType1s
            };
            DCP DCP = new DCP()
            {
                Item = http
            };

            DCP[] DCPs = new DCP[]
            {
                DCP
            };
            Operation operation = new Operation()
            {
                name = operationName,
                DCP  = DCPs
            };

            return(operation);
        }
        public static AdjustableOrAdjustedDate CreateUnadjustedDate(DateTime unadjustedDate, BusinessDayAdjustments businessDayAdjustments)
        {
            var date           = new AdjustableOrAdjustedDate();
            var identifiedDate = ProductTypeHelper.IdentifiedDateHelper.Create(ItemsChoiceType1.unadjustedDate.ToString(), unadjustedDate);

            object[]           items;
            ItemsChoiceType1[] itemsElementName;
            if (businessDayAdjustments != null)
            {
                items               = new object[2];
                items[0]            = identifiedDate;
                items[1]            = businessDayAdjustments;
                itemsElementName    = new ItemsChoiceType1[2];
                itemsElementName[0] = ItemsChoiceType1.unadjustedDate;
                itemsElementName[1] = ItemsChoiceType1.dateAdjustments;
            }
            else
            {
                items               = new object[1];
                items[0]            = identifiedDate;
                itemsElementName    = new ItemsChoiceType1[1];
                itemsElementName[0] = ItemsChoiceType1.unadjustedDate;
            }
            date.Items            = items;
            date.ItemsElementName = itemsElementName;
            return(date);
        }
Пример #3
0
        private T AddNewObject <T>(ItemsChoiceType1 type) where T : class, new()
        {
            T t = new T();

            lock (this)
            {
                this.itemsElementNameField.Add(type);
                this.itemsField.Add(t);
            }
            return(t);
        }
Пример #4
0
 private T GetObjectArray <T>(int p, ItemsChoiceType1 type) where T : class
 {
     lock (this)
     {
         int pos = GetObjectIndex(type, p);
         if (pos < 0 || pos >= this.itemsField.Count)
         {
             return(null);
         }
         return(itemsField[pos] as T);
     }
 }
Пример #5
0
        private T InsertNewObject <T>(ItemsChoiceType1 type, int p) where T : class, new()
        {
            T t = new T();

            lock (this)
            {
                int pos = GetObjectIndex(type, p);
                this.itemsElementNameField.Insert(pos, type);
                this.itemsField.Insert(pos, t);
            }
            return(t);
        }
Пример #6
0
        static T getRowProperty <T>(Row row, ItemsChoiceType1 itemsChoiceType)
        {
            int choiceElementIndex = getChoiceElementIndex(row, itemsChoiceType);

            if (choiceElementIndex == -1)
            {
                return(default(T));
            }
            else
            {
                return((T)row.AnyIntuitObjects[choiceElementIndex]);
            }
        }
Пример #7
0
 private void RemoveObject(ItemsChoiceType1 type, int p)
 {
     lock (this)
     {
         int pos = GetObjectIndex(type, p);
         if (pos < 0 || pos >= this.itemsField.Count)
         {
             return;
         }
         itemsElementNameField.RemoveAt(pos);
         itemsField.RemoveAt(pos);
     }
 }
Пример #8
0
 static int getChoiceElementIndex(Row row, ItemsChoiceType1 itemsChoiceType)
 {
     if (row.ItemsElementName != null)
     {
         for (int itemsChoiceTypeIndex = 0; itemsChoiceTypeIndex < row.ItemsElementName.Count(); itemsChoiceTypeIndex++)
         {
             if (row.ItemsElementName[itemsChoiceTypeIndex] == itemsChoiceType)
             {
                 return(itemsChoiceTypeIndex);
             }
         }
     }
     return(-1);
 }
        public static AdjustableOrAdjustedDate CreateUnadjustedDate(DateTime unadjustedDate)
        {
            var date           = new AdjustableOrAdjustedDate();
            var identifiedDate = ProductTypeHelper.IdentifiedDateHelper.Create(ItemsChoiceType1.unadjustedDate.ToString(), unadjustedDate);
            var items          = new object[1];

            items[0]   = identifiedDate;
            date.Items = items;
            var itemsElementName = new ItemsChoiceType1[1];

            itemsElementName[0]   = ItemsChoiceType1.unadjustedDate;
            date.ItemsElementName = itemsElementName;
            return(date);
        }
Пример #10
0
        private static AdjustableOrAdjustedDate CreateAdjustedDate(DateTime adjustedDate)
        {
            var date           = new AdjustableOrAdjustedDate();
            var identifiedDate = CreateIdentifiedDate("AdjustedDate", adjustedDate);
            var items          = new object[1];

            items[0]   = identifiedDate;
            date.Items = items;
            var itemsElementName = new ItemsChoiceType1[1];

            itemsElementName[0]   = ItemsChoiceType1.adjustedDate;
            date.ItemsElementName = itemsElementName;
            return(date);
        }
Пример #11
0
 private List <T> GetObjectList <T>(ItemsChoiceType1 type) where T : class
 {
     lock (this)
     {
         List <T> list = new List <T>();
         for (int i = 0; i < itemsElementNameField.Count; i++)
         {
             if (itemsElementNameField[i] == type)
             {
                 list.Add(itemsField[i] as T);
             }
         }
         return(list);
     }
 }
Пример #12
0
 private int SizeOfArray(ItemsChoiceType1 type)
 {
     lock (this)
     {
         int size = 0;
         for (int i = 0; i < itemsElementNameField.Count; i++)
         {
             if (itemsElementNameField[i] == type)
             {
                 size++;
             }
         }
         return(size);
     }
 }
Пример #13
0
        private static Operation CreateOperation(string operationName, string parameterName, params string[] parameterValues)
        {
            Operation node = new Operation();

            node.name = operationName;
            List <DCP> dcpList = new List <DCP>();
            DCP        dcp     = new DCP();

            dcp.Item = new HTTP();

            //GET
            ItemsChoiceType1 ictGet = new ItemsChoiceType1();

            ictGet = ItemsChoiceType1.Get;
            List <ItemsChoiceType1> listIct = new List <ItemsChoiceType1>();

            listIct.Add(ictGet);
            List <RequestMethodType> reqMethods = new List <RequestMethodType>();
            RequestMethodType        reqMethod  = new RequestMethodType();

            reqMethod.href = ServiceData.ServiceUrlWithQuestionMark();
            reqMethods.Add(reqMethod);


            //POST
            ItemsChoiceType1 ictPost = new ItemsChoiceType1();

            ictPost = new ItemsChoiceType1();
            ictPost = ItemsChoiceType1.Post;
            listIct.Add(ictPost);
            reqMethod      = new RequestMethodType();
            reqMethod.href = ServiceData.ServiceUrl(true);
            reqMethods.Add(reqMethod);
            dcp.Item.Items            = reqMethods.ToArray();
            dcp.Item.ItemsElementName = listIct.ToArray();
            dcpList.Add(dcp);
            node.DCP = dcpList.ToArray();
            if (parameterName != String.Empty)
            {
                List <DomainType> lstDomains = new List <DomainType>();
                lstDomains.Add(CreateParameter(parameterName, parameterValues));
                node.Parameter = lstDomains.ToArray();
            }
            return(node);
        }
Пример #14
0
 private void SetObject <T>(ItemsChoiceType1 type, int p, T obj) where T : class
 {
     lock (this)
     {
         int pos = GetObjectIndex(type, p);
         if (pos < 0 || pos >= this.itemsField.Count)
         {
             return;
         }
         if (this.itemsField[pos] is T)
         {
             this.itemsField[pos] = obj;
         }
         else
         {
             throw new Exception(string.Format(@"object types are difference, itemsField[{0}] is {1}, and parameter obj is {2}",
                                               pos, this.itemsField[pos].GetType().Name, typeof(T).Name));
         }
     }
 }
Пример #15
0
        private int GetObjectIndex(ItemsChoiceType1 type, int p)
        {
            int index = -1;
            int pos   = 0;

            for (int i = 0; i < itemsElementNameField.Count; i++)
            {
                if (itemsElementNameField[i] == type)
                {
                    if (pos == p)
                    {
                        index = i;
                        break;
                    }
                    else
                    {
                        pos++;
                    }
                }
            }
            return(index);
        }
Пример #16
0
        private void HandleHeaders(ServiceDescription wsdl, BindingOperationType op2, ItemsChoiceType1 type, MessageBinding mb, SoapVersion v)
        {
            if (op2.Items == null)
                return;

            for (int i = 0; i < op2.Items.Length; i++)
            {
                var curr = op2.Items[i] as BindingOperationMessageType;
                if (curr == null)
                    continue;

                if (op2.ItemsElementName[i] != type)
                    continue;

                if (curr.Items == null)
                    continue;

                var headers = curr.Items.Where(s => s.LocalName == "header"
                    && s.NamespaceURI == "http://www.w3.org/ns/wsdl/soap");
                foreach (var n in headers)
                {
                    var header = v == SoapVersion.Soap11 ? new SoapHeaderBinding() : new Soap12HeaderBinding();
                    header.Use = SoapBindingUse.Literal;

                    if (n.Attributes["element"] == null)
                        return;

                    var qName = new XmlQualifiedName(n.Attributes["element"].Value);
                    const string partName = "H";
                    header.Message = CreateMessage(wsdl, String.Format("{0}Header_{1}", [email protected], unique++), qName, partName);
                    header.Part = partName;

                    mb.Extensions.Add(header);
                }

            }
        }
Пример #17
0
        public Note() { } //Here for Xml (De)Serialization

        public Note(string staff, Pitch pitch, NoteType noteType, string voice = "1")
        {
            Items = new object[2]; /*At the very least a Pitch / Rest and duration*/
            ItemsElementName = new ItemsChoiceType1[2];
            Voice = voice;
            Staff = staff;
            Pitch = pitch;
            Duration = 1024; 
            NoteType = noteType;
            Stem = new Stem { Value = StemValue.Up };
            Instrument = new Instrument { Id = "P1-I1" };
        }
Пример #18
0
        public Note(Note note)
        {
            if (note.Items != null)
            {
                Items = new object[note.Items.Length];
                Array.Copy(note.Items, Items, note.Items.Length);
            }

            if (note.ItemsElementName != null)
            {
                ItemsElementName = new ItemsChoiceType1[note.ItemsElementName.Length];
                Array.Copy(note.ItemsElementName, ItemsElementName, note.ItemsElementName.Length);
            }

            if (note.Beam != null)
            {
                Beam = new Beam[note.Beam.Length];
                Array.Copy(note.Beam, Beam, note.Beam.Length);
            }

            if (note.Notations != null)
            {
                Notations = new Notations[note.Notations.Length];
                Array.Copy(note.Notations, Notations, note.Notations.Length);
            }

            if (note.Lyrics != null)
            {
                Lyrics = new lyric[note.Lyrics.Length];
                Array.Copy(note.Lyrics, Lyrics, note.Lyrics.Length); 
            }

            Instrument = note.Instrument;
            Footnote = note.Footnote;
            Level = note.Level;
            Voice = note.Voice;
            NoteType = note.NoteType;
            Dot = note.Dot;
            Accidental = note.Accidental;
            TimeModification = note.TimeModification;
            Stem = note.Stem;
            NoteHead = note.NoteHead;
            Staff = note.Staff;
            DefaultX = note.DefaultX;
            DefaultXSpecified = note.DefaultXSpecified;
            DefaultY = note.DefaultY;
            DefaultYSpecified = note.DefaultXSpecified;
            RelativeX = note.RelativeX;
            RelativeXSpecified = note.RelativeXSpecified;
            RelativeY = note.RelativeY;
            RelativeYSpecified = note.RelativeYSpecified;
            FontFamily = note.FontFamily;
            FontStyle = note.FontStyle;
            FontStyleSpecified = note.FontStyleSpecified;
            FontSize = note.FontSize;
            FontWeight = note.FontWeight;
            FontWeightSpecified = note.FontWeightSpecified;
            Color = note.Color;
            PrintDot = note.PrintDot;
            PrintDotSpecified = note.PrintDotSpecified;
            PrintLyric = note.PrintLyric;
            PrintLyricSpecified = note.PrintLyricSpecified;
            Dynamics = note.Dynamics;
            DynamicsSpecified = note.DynamicsSpecified;
            EndDynamics = note.EndDynamics;
            EndDynamicsSpecified = note.EndDynamicsSpecified;
            Attack = note.Attack;
            AttackSpecified = note.AttackSpecified;
            Release = note.Release;
            ReleaseSpecified = note.ReleaseSpecified;
            TimeOnly = note.TimeOnly;
            Pizzicato = note.Pizzicato;
            PizzicatoSpecified = note.PizzicatoSpecified;
        }
Пример #19
0
        private void HandleHeaders(ServiceDescription wsdl, BindingOperationType op2, ItemsChoiceType1 type, MessageBinding mb, SoapVersion v)
        {
            if (op2.Items == null)
            {
                return;
            }

            for (int i = 0; i < op2.Items.Length; i++)
            {
                var curr = op2.Items[i] as BindingOperationMessageType;
                if (curr == null)
                {
                    continue;
                }

                if (op2.ItemsElementName[i] != type)
                {
                    continue;
                }

                if (curr.Items == null)
                {
                    continue;
                }

                var headers = curr.Items.Where(s => s.LocalName == "header" &&
                                               s.NamespaceURI == "http://www.w3.org/ns/wsdl/soap");
                foreach (var n in headers)
                {
                    var header = v == SoapVersion.Soap11 ? new SoapHeaderBinding() : new Soap12HeaderBinding();
                    header.Use = SoapBindingUse.Literal;

                    if (n.Attributes["element"] == null)
                    {
                        return;
                    }

                    var          qName    = new XmlQualifiedName(n.Attributes["element"].Value);
                    const string partName = "H";
                    header.Message = CreateMessage(wsdl, String.Format("{0}Header_{1}", [email protected], unique++), qName, partName);
                    header.Part    = partName;

                    mb.Extensions.Add(header);
                }
            }
        }
 public static Boolean Contains(AdjustableOrAdjustedDate adjustableOrAdjustedDate, ItemsChoiceType1 item, out object dateOrBusinessConvention)
 {
     dateOrBusinessConvention = null;
     if (adjustableOrAdjustedDate.Items == null)
     {
         return(false);
     }
     if (adjustableOrAdjustedDate.ItemsElementName != null)
     {
         for (var i = 0; i < adjustableOrAdjustedDate.ItemsElementName.Length; i++)
         {
             if (adjustableOrAdjustedDate.ItemsElementName[i] != item)
             {
                 continue;
             }
             dateOrBusinessConvention = adjustableOrAdjustedDate.Items[i];
             return(true);
         }
         return(false);
     }
     return(false);
 }