コード例 #1
0
ファイル: NewBuild.cs プロジェクト: nbucket/bounce
 public NewBuild(IVisualStudio vs, INUnit nunit, IWebServer webServer)
 {
     Vs = vs;
     NUnit = nunit;
     NUnit.NUnitConsolePath = @".\References\NUnit\nunit-console.exe";
     WebServer = webServer;
 }
コード例 #2
0
ファイル: NewBuild.cs プロジェクト: dlsteuer/bounce
 public NewBuild(IVisualStudio vs, INUnit nunit, IWebServer webServer)
 {
     Vs    = vs;
     NUnit = nunit;
     NUnit.NUnitConsolePath = @".\References\NUnit\nunit-console.exe";
     WebServer = webServer;
 }
コード例 #3
0
        protected virtual decimal ConvertValue(decimal value, string from, string to)
        {
            if (from == to)
            {
                return(value);
            }

            bool   reverse = false;
            INUnit unit    = INUnit.UK.ByGlobal.Find(Base, from, to);

            if (unit == null)
            {
                unit    = INUnit.UK.ByGlobal.Find(Base, to, from);
                reverse = true;
            }

            if (unit == null)
            {
                throw new PXException(IN.Messages.ConversionNotFound, from, to);
            }

            decimal result = INUnitAttribute.ConvertValue(value, unit, INPrecision.NOROUND, reverse);

            return(decimal.Round(result, 6, MidpointRounding.AwayFromZero));
        }
コード例 #4
0
 private static void ConvertUOM(PXCache cache, int?inventoryID, string sourceUom, string destinationUom, bool viceVersa, ref decimal cost)
 {
     if (sourceUom != destinationUom && cost != 0)
     {
         INUnit conversion = INUnit.UK.ByInventory.FindDirty(cache.Graph, inventoryID, viceVersa ? sourceUom : destinationUom);
         if (conversion == null)
         {
             throw new PXUnitConversionException();
         }
         cost = INUnitAttribute.Convert(cache, conversion, cost, INPrecision.UNITCOST, viceVersa);
     }
 }
コード例 #5
0
        public static decimal ConvertGlobalUnits(PXGraph graph, string from, string to, decimal weight)
        {
            bool reverse = false;

            if (from == to)
            {
                return(weight);
            }

            decimal result = 0;

            INUnit unit = PXSelect <INUnit,
                                    Where <INUnit.unitType, Equal <INUnitType.global>,
                                           And <INUnit.fromUnit, Equal <Required <INUnit.fromUnit> >,
                                                And <INUnit.toUnit, Equal <Required <INUnit.toUnit> > > > > > .Select(graph, from, to);

            if (unit == null)
            {
                unit = PXSelect <INUnit,
                                 Where <INUnit.unitType, Equal <INUnitType.global>,
                                        And <INUnit.fromUnit, Equal <Required <INUnit.fromUnit> >,
                                             And <INUnit.toUnit, Equal <Required <INUnit.toUnit> > > > > > .Select(graph, to, from);

                reverse = true;
            }

            if (unit == null)
            {
                throw new PXException(Messages.ConversionForCarrierUOMNotFound, from, to);
            }

            decimal unitRate = reverse ? (1 / unit.UnitRate.Value) : unit.UnitRate.Value;

            if (unit.UnitMultDiv == MultDiv.Divide)
            {
                if (unit.UnitRate > 0)
                {
                    result = weight / unitRate;
                }
            }
            else
            {
                result = weight * unitRate;
            }

            return(decimal.Round(result, 6, MidpointRounding.AwayFromZero));
        }
コード例 #6
0
		protected virtual void AssignInventoryConversions(InventoryItemMaintBase graph, IEnumerable<INUnit> templateItemConvs)
		{
			INUnit[] itemConvs = graph.itemunits.Select().RowCast<INUnit>().ToArray();
			foreach (INUnit templateItemConv in templateItemConvs)
			{
				INUnit itemConv =
					itemConvs.FirstOrDefault(ic
						=> ic.FromUnit == templateItemConv.FromUnit
						&& ic.ToUnit == templateItemConv.ToUnit)
					?? graph.itemunits.Insert(new INUnit { FromUnit = templateItemConv.FromUnit });
				var copy = (INUnit)graph.itemunits.Cache.CreateCopy(itemConv);

				graph.itemunits.Cache.RestoreCopy(copy, templateItemConv);

				var excludeFields = new Type[]
				{
					typeof(INUnit.recordID),
					typeof(INUnit.inventoryID),
					typeof(INUnit.Tstamp),
					typeof(INUnit.createdByID),
					typeof(INUnit.createdByScreenID),
					typeof(INUnit.createdDateTime),
					typeof(INUnit.lastModifiedByID),
					typeof(INUnit.lastModifiedByScreenID),
					typeof(INUnit.lastModifiedDateTime),
				};

				foreach (Type excludeField in excludeFields)
				{
					graph.itemunits.Cache.SetValue(copy, excludeField.Name,
						graph.itemunits.Cache.GetValue(itemConv, excludeField.Name));
				}

				itemConv = graph.itemunits.Update(copy);
			}
		}
コード例 #7
0
ファイル: NUnitTestRunner.cs プロジェクト: vigoo/bari
 public NUnitTestRunner(INUnit nunit)
 {
     this.nunit = nunit;
 }
コード例 #8
0
 public NUnitTestRunner(INUnit nunit)
 {
     this.nunit = nunit;
 }