Ejemplo n.º 1
0
        public bool Handle(IAttributeModifier modifier, ObjectCardContext context)
        {
            var isObjectModification = context.EditiedObject != null;

            if (context.IsReadOnly)
            {
                return(false);
            }

            if (_tripleNumberTextAttr == null)
            {
                return(false);
            }

            foreach (var item in _tripleNumberTextAttr)
            {
                if (context.AttributesValues.TryGetValue(item.NumberAttr, out var attr))
                {
                    if (attr is decimal n)
                    {
                        var st    = n.ToString(CultureInfo.CurrentCulture);
                        var kop   = string.Empty;
                        var split = st.Split('.');
                        if (split.Length == 2)
                        {
                            kop = split[1];
                        }
                        var split1 = st.Split(',');
                        if (split1.Length == 2)
                        {
                            kop = split1[1];
                        }

                        var t = Math.Truncate(n);
                        var j = decimal.ToInt32(t);

                        var s = RusNumber.Str(j).Trim();

                        if (!string.IsNullOrEmpty(kop))
                        {
                            s = s + " " + kop + " копеек";
                        }

                        var s2 = n.ToString("N");

                        var pos       = s2.LastIndexOf(',');
                        var substring = s2.Substring(0, pos);

                        modifier.SetValue(item.StrAttr, s);
                        modifier.SetValue(item.StrNumberAttr, substring + " рублей " + kop + " копеек");
                    }
                }
            }

            return(true);
        }
Ejemplo n.º 2
0
        public bool Handle(IAttributeModifier modifier, ObjectCardContext context)
        {
            var isObjectModification = context.EditiedObject != null;

            if (isObjectModification || context.IsReadOnly)
            {
                return(false);
            }
            if (_doc == null)
            {
                return(false);
            }
            var docProp = _doc.GetProps();

            foreach (var pairPilotKompasAttr in _pairPilotKompasAttrs)
            {
                var val = docProp.FirstOrDefault(x => x.Name == pairPilotKompasAttr.NamePropKompas)?.Value;
                if (val != null)
                {
                    modifier.SetValue(pairPilotKompasAttr.NameAttrPilot, ValueTextClear(val));
                }
            }
            return(true);
        }
 public bool Handle(IAttributeModifier modifier, ObjectCardContext context)
 {
     throw new NotImplementedException();
 }