Skip to content

Commit 5948098

Browse files
committed
Merge branch 'netcore'
# Conflicts: # eFormAPI/eFormAPI/eFormAPI.Web.csproj # eFormAPI/eFormAPI/packages.config
2 parents f2a0166 + 9c254ec commit 5948098

File tree

4 files changed

+70
-18
lines changed

4 files changed

+70
-18
lines changed

eFormAPI/eFormAPI/Controllers/EntitySearchController.cs

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ public OperationResult CreateEntityGroup(AdvEntitySearchableGroupEditModel editM
5151
var nextItemUid = entityGroup.EntityGroupItemLst.Count;
5252
foreach (var entityItem in editModel.AdvEntitySearchableItemModels)
5353
{
54-
entityGroup.EntityGroupItemLst.Add(new EntityItem(entityItem.Name,
55-
entityItem.Description, nextItemUid.ToString(), Constants.WorkflowStates.Created));
54+
core.EntitySearchItemCreate(entityGroup.Id, entityItem.Name, entityItem.Description, nextItemUid.ToString());
55+
56+
//entityGroup.EntityGroupItemLst.Add(new EntityItem(entityItem.Name,
57+
// entityItem.Description, nextItemUid.ToString(), Constants.WorkflowStates.Created));
5658
nextItemUid++;
5759
}
58-
core.EntityGroupUpdate(entityGroup);
60+
//core.EntityGroupUpdate(entityGroup);
5961
}
6062
return new OperationResult(true, LocaleHelper.GetString("ParamCreatedSuccessfully", groupCreate.MicrotingUUID));
6163
}
@@ -73,9 +75,34 @@ public OperationResult UpdateEntityGroup(AdvEntitySearchableGroupEditModel editM
7375
{
7476
var core = _coreHelper.GetCore();
7577
var entityGroup = core.EntityGroupRead(editModel.GroupUid);
76-
entityGroup.EntityGroupItemLst = editModel.AdvEntitySearchableItemModels;
77-
entityGroup.Name = editModel.Name;
78-
core.EntityGroupUpdate(entityGroup);
78+
79+
if (editModel.AdvEntitySearchableItemModels.Any())
80+
{
81+
var nextItemUid = entityGroup.EntityGroupItemLst.Count;
82+
List<int> currentIds = new List<int>();
83+
84+
foreach (var entityItem in editModel.AdvEntitySearchableItemModels)
85+
{
86+
if (string.IsNullOrEmpty(entityItem.MicrotingUUID))
87+
{
88+
EntityItem et = core.EntitySearchItemCreate(entityGroup.Id, entityItem.Name, entityItem.Description, nextItemUid.ToString());
89+
currentIds.Add(et.Id);
90+
}
91+
else
92+
{
93+
core.EntityItemUpdate(entityItem.Id, entityItem.Name, entityItem.Description, entityItem.EntityItemUId, entityItem.DisplayIndex);
94+
currentIds.Add(entityItem.Id);
95+
}
96+
nextItemUid++;
97+
}
98+
foreach (EntityItem entityItem in entityGroup.EntityGroupItemLst)
99+
{
100+
if (!currentIds.Contains(entityItem.Id))
101+
{
102+
core.EntityItemDelete(entityItem.Id);
103+
}
104+
}
105+
}
79106
return new OperationResult(true, LocaleHelper.GetString("ParamUpdatedSuccessfully", editModel.GroupUid));
80107
}
81108
catch (Exception)

eFormAPI/eFormAPI/Controllers/EntitySelectController.cs

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@ public OperationResult CreateEntityGroup(AdvEntitySelectableGroupEditModel editM
5151
var nextItemUid = entityGroup.EntityGroupItemLst.Count;
5252
foreach (var entityItem in editModel.AdvEntitySelectableItemModels)
5353
{
54-
entityGroup.EntityGroupItemLst.Add(new EntityItem(entityItem.Name,
55-
entityItem.Description, nextItemUid.ToString(), Constants.WorkflowStates.Created));
54+
core.EntitySelectItemCreate(entityGroup.Id, entityItem.Name, entityItem.DisplayIndex, nextItemUid.ToString());
55+
//entityGroup.EntityGroupItemLst.Add(new EntityItem(entityItem.Name,
56+
// entityItem.Description, nextItemUid.ToString(), Constants.WorkflowStates.Created));
5657
nextItemUid++;
5758
}
58-
core.EntityGroupUpdate(entityGroup);
59+
//core.EntityGroupUpdate(entityGroup);
5960
}
6061
return new OperationResult(true, LocaleHelper.GetString("ParamCreatedSuccessfully", groupCreate.MicrotingUUID));
6162
}
@@ -73,9 +74,33 @@ public OperationResult UpdateEntityGroup(AdvEntitySelectableGroupEditModel editM
7374
{
7475
var core = _coreHelper.GetCore();
7576
var entityGroup = core.EntityGroupRead(editModel.GroupUid);
76-
entityGroup.EntityGroupItemLst = editModel.AdvEntitySelectableItemModels;
77-
entityGroup.Name = editModel.Name;
78-
core.EntityGroupUpdate(entityGroup);
77+
78+
if (editModel.AdvEntitySelectableItemModels.Any())
79+
{
80+
var nextItemUid = entityGroup.EntityGroupItemLst.Count;
81+
List<int> currentIds = new List<int>();
82+
foreach (EntityItem entityItem in editModel.AdvEntitySelectableItemModels)
83+
{
84+
if (string.IsNullOrEmpty(entityItem.MicrotingUUID))
85+
{
86+
EntityItem et = core.EntitySelectItemCreate(entityGroup.Id, entityItem.Name, entityItem.DisplayIndex, nextItemUid.ToString());
87+
currentIds.Add(et.Id);
88+
}
89+
else
90+
{
91+
core.EntityItemUpdate(entityItem.Id, entityItem.Name, entityItem.Description, entityItem.EntityItemUId, entityItem.DisplayIndex);
92+
currentIds.Add(entityItem.Id);
93+
}
94+
nextItemUid++;
95+
}
96+
foreach (EntityItem entityItem in entityGroup.EntityGroupItemLst)
97+
{
98+
if (!currentIds.Contains(entityItem.Id))
99+
{
100+
core.EntityItemDelete(entityItem.Id);
101+
}
102+
}
103+
}
79104
return new OperationResult(true, LocaleHelper.GetString("ParamUpdatedSuccessfully", editModel.GroupUid));
80105
}
81106
catch (Exception)

eFormAPI/eFormAPI/eFormAPI.Web.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,11 @@
130130
<Reference Include="Microsoft.Owin.Security.OAuth, Version=3.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
131131
<HintPath>..\packages\Microsoft.Owin.Security.OAuth.3.1.0\lib\net45\Microsoft.Owin.Security.OAuth.dll</HintPath>
132132
</Reference>
133-
<Reference Include="Microting.eForm, Version=3.0.20.0, Culture=neutral, processorArchitecture=MSIL">
134-
<HintPath>..\packages\Microting.eForm.3.0.20\lib\net45\Microting.eForm.dll</HintPath>
133+
<Reference Include="Microting.eForm, Version=3.0.27.0, Culture=neutral, processorArchitecture=MSIL">
134+
<HintPath>..\packages\Microting.eForm.3.0.27\lib\net45\Microting.eForm.dll</HintPath>
135135
</Reference>
136-
<Reference Include="Microting.eFormApi.BasePn, Version=1.1.28.0, Culture=neutral, processorArchitecture=MSIL">
137-
<HintPath>..\packages\Microting.eFormApi.BasePn.1.1.28\lib\net461\Microting.eFormApi.BasePn.dll</HintPath>
136+
<Reference Include="Microting.eFormApi.BasePn, Version=1.1.29.0, Culture=neutral, processorArchitecture=MSIL">
137+
<HintPath>..\packages\Microting.eFormApi.BasePn.1.1.29\lib\net461\Microting.eFormApi.BasePn.dll</HintPath>
138138
</Reference>
139139
<Reference Include="MySql.Data, Version=6.9.12.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
140140
<HintPath>..\packages\MySql.Data.6.9.12\lib\net45\MySql.Data.dll</HintPath>

eFormAPI/eFormAPI/packages.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
<package id="Microsoft.Owin.Security.Cookies" version="3.1.0" targetFramework="net46" />
3737
<package id="Microsoft.Owin.Security.OAuth" version="3.1.0" targetFramework="net46" />
3838
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net46" />
39-
<package id="Microting.eForm" version="3.0.20" targetFramework="net461" />
40-
<package id="Microting.eFormApi.BasePn" version="1.1.28" targetFramework="net461" />
39+
<package id="Microting.eForm" version="3.0.27" targetFramework="net461" />
40+
<package id="Microting.eFormApi.BasePn" version="1.1.29" targetFramework="net461" />
4141
<package id="Modernizr" version="2.8.3" targetFramework="net46" />
4242
<package id="MySql.Data" version="6.9.12" targetFramework="net461" />
4343
<package id="MySql.Data.Entity" version="6.9.12" targetFramework="net461" />

0 commit comments

Comments
 (0)