Exemple #1
0
        public object ValueFromXStr(DataSession session, string xStr)
        {
            if (StrUtils.IsNullOrEmpty(xStr) || xStr == "{{null}}")
            {
                return((object)null);
            }
            if (this.IsLink)
            {
                if (this.Association.Refs.Count > 1)
                {
                    throw new MetadataException("Невозможно получить связанный объект по идентификатору: для ассоциации определено более одного варианта связи.");
                }
                return((object)session[this.Association.Refs[0].RefClass][new DataId(xStr)]);
            }
            switch (this.DataType & DataType.BaseMask)
            {
            case DataType.Boolean:
                return((object)XStrUtils.ToBool(xStr, false));

            case DataType.Integer:
                return((object)XStrUtils.ToInt(xStr, 0));

            case DataType.Float:
                return((object)XStrUtils.ToDouble(xStr, 0.0));

            case DataType.Currency:
                return((object)XStrUtils.ToCurrency(xStr, 0M));

            case DataType.DateTime:
                return((object)XStrUtils.ToDateTime(xStr, DateTime.MinValue));

            case DataType.Binary:
                return((object)Convert.FromBase64String(xStr));

            default:
                return((object)XStrUtils.ToString(xStr, string.Empty));
            }
        }
Exemple #2
0
 private void CheckReading()
 {
     if (this.Object.SessionStateContainsAny(ObjectSessionState.Error | ObjectSessionState.Deleted))
     {
         this.Object.InvalidStateForOperation(string.Format("Ошибка получения {0}({1})", (object)this.Metadata.Name, (object)this.Metadata.Caption));
     }
     if (this.FValue != DataProperty.NotAssigned)
     {
         return;
     }
     if (this.Object.IsNull)
     {
         this.FValue = (object)null;
     }
     else if (this.Object.IsNew)
     {
         this.FValue = (object)null;
     }
     else
     {
         DataSession masterSession = this.Session.MasterSession;
         if (masterSession != null)
         {
             this.Load(masterSession[this.Object.Storage.Class][this.Object.Id][this.Metadata]);
         }
         else
         {
             this.Session.TraceUnplannedPropertyLoading(this.Metadata);
             this.Object.LoadNotAssignedProperties();
         }
         if (this.Object.SessionStateContainsAny(ObjectSessionState.Error))
         {
             this.Object.InvalidStateForOperation(string.Format("Ошибка получения {0}({1})", (object)this.Metadata.Name, (object)this.Metadata.Caption));
         }
     }
 }
Exemple #3
0
 internal ScriptLibraries(DataSession session) => this.FSession = session;
Exemple #4
0
 public abstract void GetNavigationLoadPlans(
     DataSession session,
     LoadPlan sourcePlan,
     LoadPlanList navigationPlans);
 public abstract void PrepareLoadPlan(LoadPlan plan, DataSession session);
 public ObjectViewScriptRuntime(DataSession session) => this.FCurrentUser = new ScriptRuntimeCurrentUser(session);
 public DeserializationSurrogate(DataSession session) => this.FSession = session;
 public override void PrepareLoadPlan(LoadPlan plan, DataSession session)
 {
 }
Exemple #9
0
 internal void Load(DataSession session, DataObjectList dstObjs, DataId[] ids) => this.Load(session, dstObjs, (ObjectListLoader) new ObjectListLoaderByIds(this.RootLoader, this.RootLoader.BasePlan.Class.IDProperty, ids));