Ejemplo n.º 1
0
            protected override void VisitType(VBType node)
            {
                Prefix("T:");
                VisitBaseQualifier(node.ContainingNamespace);
                VisitBaseQualifier(node.ContainingType);
                if (node.IsPrimitive)
                {
                    Code.Append(node.TypeCode.ToString());
                    return;
                }
                Code.Append(node.Name);

                if (inCoreType)
                {
                    if (node.TypeParameters.Count > 0)
                    {
                        Code.Append("`" + node.TypeParameters.Count);
                    }
                }
                else
                {
                    // If we're in a parameter, include its concrete type arguments
                    if (node.TypeArguments.Count > 0)
                    {
                        Code.Append("{");
                        VisitCommaList(node.TypeArguments);
                        Code.Append("}");
                    }
                }
            }
Ejemplo n.º 2
0
 ///<summary>Gets the total number of type parameters in this type's outer generic types.</summary>
 static int PreTypeParamCount(VBType type)
 {
     if (type.ContainingType == null)
     {
         return(0);
     }
     return(PreTypeParamCount(type.ContainingType) + type.ContainingType.TypeParameters.Count);
 }
Ejemplo n.º 3
0
        public VBRequestDocumentModel(
            string documentNo,
            DateTimeOffset date,
            DateTimeOffset realizationEstimationDate,
            int suppliantUnitId,
            string suppliantUnitCode,
            string suppliantUnitName,
            int suppliantDivisionId,
            string suppliantDivisionCode,
            string suppliantDivisionName,
            int currencyId,
            string currencyCode,
            string currencySymbol,
            string currencyDescription,
            double currencyRate,
            string purpose,
            decimal amount,
            bool isPosted,
            bool isCompleted,
            VBType type,
            bool isInklaring,
            string noBl,
            string noPo,
            string typePurchasing
            )
        {
            DocumentNo = documentNo;
            Date       = date;
            RealizationEstimationDate = realizationEstimationDate;
            CurrencyId          = currencyId;
            CurrencyCode        = currencyCode;
            CurrencySymbol      = currencySymbol;
            CurrencyRate        = currencyRate;
            CurrencyDescription = currencyDescription;
            Purpose             = purpose;
            Amount         = amount;
            IsPosted       = isPosted;
            ApprovalStatus = ApprovalStatus.Draft;
            IsCompleted    = isCompleted;
            Type           = type;

            SuppliantUnitId       = suppliantUnitId;
            SuppliantUnitCode     = suppliantUnitCode;
            SuppliantUnitName     = suppliantUnitName;
            SuppliantDivisionId   = suppliantDivisionId;
            SuppliantDivisionCode = suppliantDivisionCode;
            SuppliantDivisionName = suppliantDivisionName;
            IsInklaring           = isInklaring;
            NoBL           = noBl;
            NoPO           = noPo;
            TypePurchasing = typePurchasing;
        }
Ejemplo n.º 4
0
 protected override void VisitTypeParameter(VBType node)
 {
     // Method type parameters get two backticks
     if (node.ContainingType == null)
     {
         Code.Append("``" + node.TypeParameterPosition);
     }
     else
     {
         // Type type parameter indices include parameters from the type's outer types.
         Code.Append("`" + (PreTypeParamCount(node.ContainingType) + node.TypeParameterPosition).ToString());
     }
 }
Ejemplo n.º 5
0
        public void Should_Success_Instantiate()
        {
            string RqstNo = "RqstNo";
            //string VBCategory = "VBCategory";
            VBType         VBCategory    = VBType.WithPO;
            DateTimeOffset RqstDate      = DateTimeOffset.Now;
            Unit           uvm           = new Unit();
            string         Appliciant    = "Appliciant";
            string         RealNo        = "RealNo";
            DateTimeOffset RealDate      = DateTimeOffset.Now;
            DateTimeOffset?VerDate       = DateTimeOffset.Now;
            string         DiffStatus    = "DiffStatus";
            string         Status        = "Status";
            decimal        DiffAmount    = 100;
            DateTimeOffset?ClearanceDate = DateTimeOffset.Now;
            bool           IsPosted      = true;

            ClearaceVBViewModel cvvm = new ClearaceVBViewModel();

            cvvm.RqstNo        = RqstNo;
            cvvm.VBCategory    = VBCategory;
            cvvm.RqstDate      = RqstDate;
            cvvm.Unit          = uvm;
            cvvm.Appliciant    = Appliciant;
            cvvm.RealNo        = RealNo;
            cvvm.RealDate      = RealDate;
            cvvm.VerDate       = VerDate;
            cvvm.DiffStatus    = DiffStatus;
            cvvm.Status        = Status;
            cvvm.Unit          = uvm;
            cvvm.DiffAmount    = DiffAmount;
            cvvm.ClearanceDate = ClearanceDate;
            cvvm.IsPosted      = IsPosted;


            Assert.Equal(RqstNo, cvvm.RqstNo);
            Assert.Equal(VBCategory, cvvm.VBCategory);
            Assert.Equal(RqstDate, cvvm.RqstDate);
            Assert.Equal(uvm, cvvm.Unit);
            Assert.Equal(Appliciant, cvvm.Appliciant);
            Assert.Equal(RealNo, cvvm.RealNo);
            Assert.Equal(RealDate, cvvm.RealDate);
            Assert.Equal(VerDate, cvvm.VerDate);
            Assert.Equal(DiffStatus, cvvm.DiffStatus);
            Assert.Equal(Status, cvvm.Status);
            Assert.Equal(uvm, cvvm.Unit);
            Assert.Equal(DiffAmount, cvvm.DiffAmount);
            Assert.Equal(ClearanceDate, cvvm.ClearanceDate);
            Assert.Equal(IsPosted, cvvm.IsPosted);
        }
Ejemplo n.º 6
0
 protected override void VisitArray(VBType node)
 {
     VisitIfNotNull(node.ElementType);
     if (node.Rank == 1)
     {
         Code.Append("[]");
         return;
     }
     Code.Append("[");
     for (int i = 0; i < node.Rank; i++)
     {
         if (i > 0)
         {
             Code.Append(",");
         }
         Code.Append("0:");                          // I think VBType can only be an SZArray
     }
     Code.Append("]");
 }
Ejemplo n.º 7
0
        public VBRealizationDocumentExpeditionModel(
            int vbRealizationId,
            int vbId,
            string vbNo,
            string vbRealizationNo,
            DateTimeOffset vbRealizationDate,
            string vbRequestName,
            int unitId,
            string unitName,
            int divisionId,
            string divisionName,
            decimal vbAmount,
            decimal vbRealizationAmount,
            string currencyCode,
            double currencyRate,
            string purpose,
            VBType vbType
            )
        {
            VBRealizationId     = vbRealizationId;
            VBId                = vbId;
            VBNo                = vbNo;
            VBRealizationNo     = vbRealizationNo;
            VBRealizationDate   = vbRealizationDate;
            VBRequestName       = vbRequestName;
            UnitId              = unitId;
            UnitName            = unitName;
            DivisionId          = divisionId;
            DivisionName        = divisionName;
            VBAmount            = vbAmount;
            VBRealizationAmount = vbRealizationAmount;
            CurrencyCode        = currencyCode;
            CurrencyRate        = currencyRate;
            VBType              = vbType;
            Purpose             = purpose;

            Position = VBRealizationPosition.PurchasingToVerification;
        }
Ejemplo n.º 8
0
 protected override void VisitAnonymousType(VBType node)
 {
     Code.Append("vb#AnonymousType");
 }
Ejemplo n.º 9
0
 ///<summary>Gets the total number of type parameters in this type's outer generic types.</summary>
 static int PreTypeParamCount(VBType type)
 {
     if (type.ContainingType == null)
         return 0;
     return PreTypeParamCount(type.ContainingType) + type.ContainingType.TypeParameters.Count;
 }
Ejemplo n.º 10
0
 // New Ctor With Index
 public VBRequestDocumentModel(string documentNo, DateTimeOffset date, DateTimeOffset realizationEstimationDate, int suppliantUnitId, string suppliantUnitCode, string suppliantUnitName,
                               int suppliantDivisionId, string suppliantDivisionCode, string suppliantDivisionName, int currencyId, string currencyCode, string currencySymbol, string currencyDescription,
                               double currencyRate, string purpose, decimal amount, bool isPosted, bool isCompleted, VBType type, int index, bool isInklaring, string noBl, string noPo, string typePurchasing)
     : this(documentNo, date, realizationEstimationDate, suppliantUnitId, suppliantUnitCode, suppliantUnitName, suppliantDivisionId, suppliantDivisionCode, suppliantDivisionName,
            currencyId, currencyCode, currencySymbol, currencyDescription, currencyRate, purpose, amount, isPosted, isCompleted, type, isInklaring, noBl, noPo, typePurchasing)
 {
     Index = index;
 }
Ejemplo n.º 11
0
            protected override void VisitType(VBType node)
            {
                Prefix("T:");
                VisitBaseQualifier(node.ContainingNamespace);
                VisitBaseQualifier(node.ContainingType);
                if (node.IsPrimitive) {
                    Code.Append(node.TypeCode.ToString());
                    return;
                }
                Code.Append(node.Name);

                if (inCoreType) {
                    if (node.TypeParameters.Count > 0)
                        Code.Append("`" + node.TypeParameters.Count);
                } else {
                    // If we're in a parameter, include its concrete type arguments
                    if (node.TypeArguments.Count > 0) {
                        Code.Append("{");
                        VisitCommaList(node.TypeArguments);
                        Code.Append("}");
                    }
                }
            }
Ejemplo n.º 12
0
 protected override void VisitTypeParameter(VBType node)
 {
     // Method type parameters get two backticks
     if (node.ContainingType == null)
         Code.Append("``" + node.TypeParameterPosition);
     else
         // Type type parameter indices include parameters from the type's outer types.
         Code.Append("`" + (PreTypeParamCount(node.ContainingType) + node.TypeParameterPosition).ToString());
 }
Ejemplo n.º 13
0
 protected override void VisitPointer(VBType node)
 {
     VisitIfNotNull(node.ElementType);
     Code.Append("*");
 }
Ejemplo n.º 14
0
 protected override void VisitStructure(VBType node)
 {
     base.VisitStructure(node);
 }
Ejemplo n.º 15
0
 protected override void VisitArray(VBType node)
 {
     VisitIfNotNull(node.ElementType);
     if (node.Rank == 1) {
         Code.Append("[]");
         return;
     }
     Code.Append("[");
     for (int i = 0; i < node.Rank; i++) {
         if (i > 0)
             Code.Append(",");
         Code.Append("0:");	// I think VBType can only be an SZArray
     }
     Code.Append("]");
 }
Ejemplo n.º 16
0
 protected override void VisitAnonymousType(VBType node)
 {
     Code.Append("vb#AnonymousType");
 }
Ejemplo n.º 17
0
 protected override void VisitPointer(VBType node)
 {
     VisitIfNotNull(node.ElementType);
     Code.Append("*");
 }
Ejemplo n.º 18
0
 protected override void VisitStructure(VBType node)
 {
     base.VisitStructure(node);
 }
Ejemplo n.º 19
0
        private static string ToIndexId(Symbol symbol, ISourceFile file)
        {
            VBParameter vBParameter = symbol as VBParameter;

            if (vBParameter != null)
            {
                return(null);
            }
            VBMember vBMember = symbol as VBMember;

            if (vBMember != null)
            {
                if (vBMember.IsFunctionResultLocal)
                {
                    return(null);
                }
                while (vBMember.ContainingMember != null)
                {
                    vBMember = vBMember.ContainingMember;
                }
                if (vBMember.IsProperty && vBMember.Name == "Value" && vBMember.ContainingType != null && vBMember.ContainingType.Name == "InternalXmlHelper")
                {
                    return(null);                    // "vb.XmlPropertyExtensionValue";
                }
                if (vBMember.IsProperty && vBMember.SourceFile != null && vBMember.SourceFile.IsSolutionExtension)
                {
                    if (vBMember.Name == "Computer")
                    {
                        return("T:Microsoft.VisualBasic.Devices." + vBMember.Name);
                    }
                    if (vBMember.Name == "User")
                    {
                        return("T:Microsoft.VisualBasic.ApplicationServices." + vBMember.Name);
                    }
                    if (vBMember.Name == "Application")
                    {
                        return(null);                        //"My." + vBMember.Name;
                    }
                    if (vBMember.ReturnType != null && vBMember.ReturnType.BaseClass != null)
                    {
                        return("T:Microsoft.VisualBasic.ApplicationServices." + vBMember.ReturnType.BaseClass.Name);
                    }
                    return(null);                    //"My." + vBMember.Name;
                }
                else
                {
                    if (vBMember.IsSynthetic || (vBMember.IsField && vBMember.SourceFile != null))
                    {
                        symbol = vBMember.ReturnType;
                    }
                    else
                    {
                        VBType containingType = vBMember.ContainingType;
                        if (containingType != null && (containingType.IsAnonymousType || containingType.IsAnonymousDelegate))
                        {
                            return(null);                            // "vb.AnonymousType";
                        }
                    }
                }
            }
            VBType vBType = symbol as VBType;

            while (vBType != null)
            {
                if (vBType.IsArray || vBType.IsPointer)
                {
                    vBType = vBType.ElementType;
                }
                else
                {
                    if (vBType.DefiningType == null)
                    {
                        break;
                    }
                    vBType = vBType.DefiningType;
                    if (vBType == file.Host.RuntimeInfo.NullableType)
                    {
                        return(null);                        //"vb.Nullable";
                    }
                }
            }
            if (vBType != null)
            {
                if (vBType.IsPrimitive)
                {
                    return("T:System." + vBType.TypeCode.ToString());                    // "vb." + vBType.Name;
                }
                if (vBType.IsAnonymousType || vBType.IsAnonymousDelegate)
                {
                    return(null);                    //"vb.AnonymousType";
                }
                if (vBType == file.Binder.ResolveType("System.Runtime.CompilerServices.ExtensionAttribute", 0))
                {
                    return(null);                    //"vb.ExtensionMethods";
                }
            }
            if (symbol is VBNamespace)
            {
                return(null);
            }

            if (symbol != null)
            {
                // CodeBuilder adds unavoidable spaces; IndexIds never have spaces.
                return(symbol.ToString(new IndexIdSymbolFormatter()).Replace(" ", ""));
            }
            return(null);
        }