private JProperty ParseValue(Mix.Cms.Lib.ViewModels.MixAttributeSetValues.ImportViewModel item) { switch (item.get_DataType()) { case 0: case 4: case 5: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 19: case 20: case 21: { Label0: return new JProperty(item.get_AttributeFieldName(), item.get_StringValue()); } case 1: { return new JProperty(item.get_AttributeFieldName(), (object)item.get_DateTimeValue()); } case 2: { return new JProperty(item.get_AttributeFieldName(), (object)item.get_DateTimeValue()); } case 3: { return new JProperty(item.get_AttributeFieldName(), (object)item.get_DateTimeValue()); } case 6: { return new JProperty(item.get_AttributeFieldName(), (object)item.get_DoubleValue()); } case 18: { return new JProperty(item.get_AttributeFieldName(), (object)item.get_BooleanValue()); } case 22: { return new JProperty(item.get_AttributeFieldName(), (object)item.get_IntegerValue()); } case 23: { return new JProperty(item.get_AttributeFieldName(), new JArray()); } default: { goto Label0; } } }
public override MixAttributeSetData ParseModel(MixCmsContext _context = null, IDbContextTransaction _transaction = null) { if (string.IsNullOrEmpty(this.get_Id())) { this.set_Id(Guid.NewGuid().ToString()); this.set_CreatedDateTime(DateTime.get_UtcNow()); } stackVariable5 = this.get_Fields(); if (stackVariable5 == null) { dummyVar0 = stackVariable5; stackVariable5 = new List<Mix.Cms.Lib.ViewModels.MixAttributeFields.UpdateViewModel>(); } this.set_Fields(stackVariable5); this.set_Values(new List<Mix.Cms.Lib.ViewModels.MixAttributeSetValues.ImportViewModel>()); V_1 = this.get_Fields().GetEnumerator(); try { while (V_1.MoveNext()) { V_2 = V_1.get_Current(); stackVariable15 = new Mix.Cms.Lib.ViewModels.MixAttributeSetValues.ImportViewModel(); stackVariable15.set_AttributeFieldId(V_2.get_Id()); stackVariable15.set_AttributeFieldName(V_2.get_Name()); stackVariable15.set_StringValue(V_2.get_DefaultValue()); stackVariable15.set_Priority(V_2.get_Priority()); stackVariable15.set_Field(V_2); V_3 = stackVariable15; V_3.set_Priority(V_2.get_Priority()); V_3.set_DataType(V_2.get_DataType()); V_3.set_AttributeSetName(V_2.get_AttributeSetName()); if (this.get_Data().get_Item(V_3.get_AttributeFieldName()) != null && V_3.get_Field().get_DataType() != 23) { this.ParseModelValue(this.get_Data().get_Item(V_3.get_AttributeFieldName()), V_3); } this.get_Values().Add(V_3); } } finally { ((IDisposable)V_1).Dispose(); } return this.ParseModel(_context, _transaction); }
private void ParseModelValue(JToken property, Mix.Cms.Lib.ViewModels.MixAttributeSetValues.ImportViewModel item) { switch (item.get_Field().get_DataType()) { case 0: case 4: case 5: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 17: case 19: case 20: case 21: { Label0: item.set_StringValue(Newtonsoft.Json.Linq.Extensions.Value<string>(property)); break; } case 1: { item.set_DateTimeValue(Newtonsoft.Json.Linq.Extensions.Value<DateTime?>(property)); item.set_StringValue(Newtonsoft.Json.Linq.Extensions.Value<string>(property)); return; } case 2: { item.set_DateTimeValue(Newtonsoft.Json.Linq.Extensions.Value<DateTime?>(property)); item.set_StringValue(Newtonsoft.Json.Linq.Extensions.Value<string>(property)); return; } case 3: { item.set_DateTimeValue(Newtonsoft.Json.Linq.Extensions.Value<DateTime?>(property)); item.set_StringValue(Newtonsoft.Json.Linq.Extensions.Value<string>(property)); return; } case 6: { item.set_DoubleValue(Newtonsoft.Json.Linq.Extensions.Value<double?>(property)); item.set_StringValue(Newtonsoft.Json.Linq.Extensions.Value<string>(property)); return; } case 16: { V_0 = Newtonsoft.Json.Linq.Extensions.Value<string>(property); if (!StringExtension.IsBase64(V_0)) { item.set_StringValue(V_0); return; } stackVariable37 = new Mix.Cms.Lib.ViewModels.MixMedias.UpdateViewModel(); stackVariable37.set_Specificulture(this.get_Specificulture()); stackVariable37.set_Status(2); stackVariable41 = new FileViewModel(); stackVariable41.set_FileStream(V_0); stackVariable41.set_Extension(".png"); stackVariable41.set_Filename(Guid.NewGuid().ToString()); stackVariable41.set_FileFolder("Attributes"); stackVariable37.set_MediaFile(stackVariable41); V_2 = ((ViewModelBase<MixCmsContext, MixMedia, Mix.Cms.Lib.ViewModels.MixMedias.UpdateViewModel>)stackVariable37).SaveModel(true, null, null); if (!V_2.get_IsSucceed()) { break; } item.set_StringValue(V_2.get_Data().get_FullPath()); this.get_Data().set_Item(item.get_AttributeFieldName(), JToken.op_Implicit(item.get_StringValue())); return; } case 18: { item.set_BooleanValue(Newtonsoft.Json.Linq.Extensions.Value<bool?>(property)); stackVariable68 = item; stackVariable70 = Newtonsoft.Json.Linq.Extensions.Value<string>(property); if (stackVariable70 != null) { stackVariable71 = stackVariable70.ToLower(); } else { dummyVar0 = stackVariable70; stackVariable71 = null; } stackVariable68.set_StringValue(stackVariable71); return; } case 22: { item.set_IntegerValue(Newtonsoft.Json.Linq.Extensions.Value<int?>(property)); item.set_StringValue(Newtonsoft.Json.Linq.Extensions.Value<string>(property)); return; } case 23: { item.set_StringValue(Newtonsoft.Json.Linq.Extensions.Value<string>(property)); return; } default: { goto Label0; } } return; }