Пример #1
0
        public static double?ConvertValue(double value, Guid FromUoMID, Guid ToUoMID, Guid OrganizationId)
        {
            Micajah.Common.Bll.MeasureUnit           mu   = Micajah.Common.Bll.MeasureUnit.Create(FromUoMID, OrganizationId);
            Micajah.Common.Bll.MeasureUnitCollection UoMs = mu.GetConvertUnits();
            var cmu = UoMs.Where(u => u.MeasureUnitId == ToUoMID).ToList();

            if (cmu.Count <= 0)
            {
                return(null);
            }
            return(cmu[0].ConversionFactor * value);
        }
Пример #2
0
 public static List <Micajah.Common.Bll.MeasureUnit> GetConvertedUoMs(Guid?ParentUoMID, Guid OrganizationId)
 {
     Micajah.Common.Bll.MeasureUnitCollection UoMs = null;
     if (ParentUoMID == null)
     {
         UoMs = Micajah.Common.Bll.MeasureUnitCollection.GetUnits(OrganizationId);
     }
     else
     {
         Micajah.Common.Bll.MeasureUnit mu = Micajah.Common.Bll.MeasureUnit.Create((Guid)ParentUoMID, OrganizationId);
         UoMs = mu.GetConvertUnits();
         UoMs.Add(mu);
         UoMs.SortByName();
     }
     return(UoMs.ToList());
 }