123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- using System.Data;
- using Common;
- using Infrastructure;
- using LitJson;
- using Microsoft.Extensions.Localization;
- using Model;
- using Model.Customer;
- using NuGet.Packaging;
- using Services;
- using System.Linq;
- using System.Net.Mime;
- using System.Text.RegularExpressions;
- namespace Util
- {
- public class CopyProject
- {
- //发奖入口
- public static void Copy(int fromProjectId, int toProjectId)
- {
- var projectService = App.GetService<IPriProjectService>();
- var listService = App.GetService<IPriListService>();
- var listAmountSetService = App.GetService<IPriListAmountSetService>();
- var loopSetService = App.GetService<IPriLoopSetService>();
- var conditionService = App.GetService<IPriConditionService>();
- var prizeInFieldService = App.GetService<IPriPrizeInFieldService>();
- var prizeInQueryFieldService = App.GetService<IPriPrizeInQueryFieldService>();
- var prizeInSetService = App.GetService<IPriPrizeInSetService>();
- var prizeInTableService = App.GetService<IPriPrizeInTableService>();
- var prizeObjectFieldService = App.GetService<IPriPrizeObjectFieldService>();
- var prizeObjectTableService = App.GetService<IPriPrizeObjectTableService>();
- var projectParamService = App.GetService<IPriProjectParamService>();
- var queryFieldService = App.GetService<IPriQueryFieldService>();
- var queryTableService = App.GetService<IPriQueryTableService>();
- var recursionStartConditionService = App.GetService<IPriRecursionStartConditionService>();
- var recursionStartFieldService = App.GetService<IPriRecursionStartFieldService>();
- var recursionStartReturnFieldService = App.GetService<IPriRecursionStartReturnFieldService>();
- var recursionStartTableService = App.GetService<IPriRecursionStartTableService>();
- var returnFieldService = App.GetService<IPriReturnFieldService>();
- var list = listService.GetList(m => m.projectId == fromProjectId);
- foreach(var subList in list)
- {
- subList.projectId = toProjectId;
- int listId = listService.InsertReturnIdentity(subList);
- var listAmountSet = listAmountSetService.GetList(m => m.listId == subList.id);
- foreach(var subListAmountSet in listAmountSet)
- {
- subListAmountSet.projectId = toProjectId;
- subListAmountSet.listId = listId;
- listAmountSetService.InsertReturnIdentity(subListAmountSet);
- }
- var loopSet = loopSetService.GetList(m => m.listId == subList.id);
- foreach(var subLoopSet in loopSet)
- {
- subLoopSet.projectId = toProjectId;
- subLoopSet.listId = listId;
- int loopSetId = loopSetService.InsertReturnIdentity(subLoopSet);
- var recursionStartCondition = recursionStartConditionService.GetList(m => m.loopSetId == subLoopSet.id);
- foreach(var subRecursionStartCondition in recursionStartCondition)
- {
- subRecursionStartCondition.projectId = toProjectId;
- subRecursionStartCondition.loopSetId = loopSetId;
- recursionStartConditionService.InsertReturnIdentity(subRecursionStartCondition);
- }
- }
- var condition = conditionService.GetList(m => m.listId == subList.id);
- foreach(var subCondition in condition)
- {
- subCondition.projectId = toProjectId;
- subCondition.listId = listId;
- conditionService.InsertReturnIdentity(subCondition);
- }
- var prizeInTable = prizeInTableService.GetList(m => m.listId == subList.id);
- foreach(var subPrizeInTable in prizeInTable)
- {
- subPrizeInTable.projectId = toProjectId;
- subPrizeInTable.listId = listId;
- int prizeInTableId = prizeInTableService.InsertReturnIdentity(subPrizeInTable);
- var prizeInQueryField = prizeInQueryFieldService.GetList(m => m.inTableId == subPrizeInTable.id);
- foreach(var subPrizeInQueryField in prizeInQueryField)
- {
- subPrizeInQueryField.inTableId = prizeInTableId;
- prizeInQueryFieldService.InsertReturnIdentity(subPrizeInQueryField);
- }
- var prizeInField = prizeInFieldService.GetList(m => m.inTableId == subPrizeInTable.id);
- foreach(var subPrizeInField in prizeInField)
- {
- subPrizeInField.inTableId = prizeInTableId;
- prizeInFieldService.InsertReturnIdentity(subPrizeInField);
- }
- }
- var recursionStartTable = recursionStartTableService.GetList(m => m.listId == subList.id);
- foreach(var subRecursionStartTable in recursionStartTable)
- {
- subRecursionStartTable.projectId = toProjectId;
- subRecursionStartTable.listId = listId;
- int recursionStartTableId = recursionStartTableService.InsertReturnIdentity(subRecursionStartTable);
- var recursionStartField = recursionStartFieldService.GetList(m => m.objectTableId == subRecursionStartTable.id);
- foreach(var subRecursionStartField in recursionStartField)
- {
- subRecursionStartField.objectTableId = recursionStartTableId;
- recursionStartFieldService.InsertReturnIdentity(subRecursionStartField);
- }
- var recursionStartReturnField = recursionStartReturnFieldService.GetList(m => m.objectTableId == subRecursionStartTable.id);
- foreach(var subRecursionStartReturnField in recursionStartReturnField)
- {
- subRecursionStartReturnField.objectTableId = recursionStartTableId;
- recursionStartReturnFieldService.InsertReturnIdentity(subRecursionStartReturnField);
- }
- }
- }
- var projectParam = projectParamService.GetList(m => m.projectId == fromProjectId);
- foreach(var subProjectParam in projectParam)
- {
- subProjectParam.projectId = toProjectId;
- projectParamService.InsertReturnIdentity(subProjectParam);
- }
- var queryTable = queryTableService.GetList(m => m.projectId == fromProjectId);
- foreach(var subQueryTable in queryTable)
- {
- subQueryTable.projectId = toProjectId;
- int tableId = queryTableService.InsertReturnIdentity(subQueryTable);
-
- var queryField = queryFieldService.GetList(m => m.queryTableId == subQueryTable.id);
- foreach(var subQueryField in queryField)
- {
- subQueryField.queryTableId = tableId;
- queryFieldService.InsertReturnIdentity(subQueryField);
- }
- var returnField = returnFieldService.GetList(m => m.queryTableId == subQueryTable.id);
- foreach(var subReturnField in returnField)
- {
- subReturnField.queryTableId = tableId;
- returnFieldService.InsertReturnIdentity(subReturnField);
- }
- }
- }
- }
- }
|