Ejemplo n.º 1
0
        SOAPService.AttrValue __attrValue(SOAPService.Attribute a, string str, double v1, double v2, int op)
        {
            if (a != null)
            if (convert.IsString(str))
            {
                var v = new SOAPService.AttrValue();

                if ((a.Type == DataType.String) ||
                    (a.Type == DataType.Text) ||
                    (a.Type == DataType.Domain)) {
                    var vv = new SOAPService.StringValue();
                    vv.Text = str; v.Value = vv;
                } else
                if ((a.Type == DataType.Float) ||
                    (a.Type == DataType.Integer)) {
                    if (op > 0) {
                        var vv = new SOAPService.NumberValue();

                        if ((op == 1) || (op == 3)) {   // > >=
                            vv.Lower = (decimal)v1;
                            vv.IncludeLower = (op == 3);
                        } else

                        if ((op == 2) || (op == 4)) {   // < <=
                            vv.Upper = (decimal)v1;
                            vv.IncludeUpper = (op == 4);
                        }
                        else {
                            vv.Lower = (decimal)v1;
                            vv.Upper = (decimal)v2;
                            vv.IncludeLower = (op == 5) || (op == 8);
                            vv.IncludeUpper = (op == 5) || (op == 9);
                            vv.Inverval = (v1 < v2);
                        }

                        vv.Text = str;
                        v.Value = vv;
                    }
                    else {
                        decimal f;
                        if (decimal.TryParse(str, out f)) {
                            var vv = new SOAPService.NumberValue();
                            vv.Lower = f;
                            vv.Upper = f;
                            vv.IncludeLower = true;
                            vv.IncludeUpper = true;
                            vv.Inverval = false;

                            vv.Text = str;
                            v.Value = vv;
                        }
                    }
                }

                if (v.Value != null) {

                    v.Metadata = __metadata(obj.Offset, 2, a.Attr_Id);

                    if (a.Values == null)
                    a.Values = new List<AttrValue>();

                    a.Values.Add(v);
                    return v;
                }
            }

            return null;
        }
Ejemplo n.º 2
0
        SOAPService.AttrValue __datatype(int code, int loc, SOAPService.Attribute a)
        {
            SOAPService.AttrValue v = null;

            string acronym = a.CompositAttrCl_Id;
            var fe = new SOAPService.Feature() { Cl_Id = acronym, IsRealFeature = false };

            int offs = obj.Offset;

            if (loc == 0)
             fe.Metadata = __metadata(offs, 2, "");

            if ((loc >= 1) && (loc <= 3))
            {
                __baseShape(fe,obj,loc);
                if (!frst_Datatype(code)) return null;
            }

            int uc = 0;    // add feature
            if (IsUpdate) uc = obj.UpdateCode;

            fe.Key = obj.guid;

            var attrs = new List<SOAPService.Attribute>();
            addAttrs(acronym,attrs);

            if (attrs.Count > 0) {
                fe.Attributes = attrs;

                string key = db_fe(fe, offs, uc);

                if (key != null)
                if (key.Length > 0)
                {
                    v = new SOAPService.AttrValue();
                    var vv = new SOAPService.StringValue();
                    vv.Text = key; v.Value = vv;

                    if (a.Values == null)
                    a.Values = new List<SOAPService.AttrValue>();

                    a.Values.Add(v);
                }
            }

            return v;
        }