protected static FR_Base Execute(DbConnection Connection, DbTransaction Transaction, P_L2FE_SF_1202 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { //Leave UserCode region to enable user code saving #region UserCode var returnValue = new FR_Base(); //Put your code here var item = new ORM_TMS_PRO_Feature(); if (Parameter.FeatureID != Guid.Empty) { var result = item.Load(Connection, Transaction, Parameter.FeatureID); if (result.Status != FR_Status.Success || item.TMS_PRO_FeatureID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } } #region Single Delete if (Parameter.IsDeleted == true && Parameter.ActionType.Equals("DeleteSingle")) { ORM_TMS_PRO_Feature.Query searchQuery = new ORM_TMS_PRO_Feature.Query(); searchQuery.TMS_PRO_FeatureID = Parameter.FeatureID; ORM_TMS_PRO_Feature.Query.SoftDelete(Connection, Transaction, searchQuery); item.IsDeleted = true; item.Save(Connection, Transaction); DeleteTags(Connection, Transaction, Parameter.FeatureID, securityTicket); FR_Base retVal = new FR_Base(); retVal.Status = FR_Status.Success; return(retVal); } #endregion #region Multiple Delete if (Parameter.IsDeleted == true && Parameter.ActionType.Equals("DeleteMultiple")) { foreach (var featureID in Parameter.FeaturesToDelete) { ORM_TMS_PRO_Feature.Query searchQuery = new ORM_TMS_PRO_Feature.Query(); searchQuery.TMS_PRO_FeatureID = Guid.Parse(featureID); ORM_TMS_PRO_Feature.Query.SoftDelete(Connection, Transaction, searchQuery); DeleteTags(Connection, Transaction, Guid.Parse(featureID), securityTicket); } FR_Base retVal = new FR_Base(); retVal.Status = FR_Status.Success; return(retVal); } #endregion #region Add New Feature if (Parameter.IsDeleted == false && Parameter.ActionType.Equals("NewFeature")) { FR_Base retVal = new FR_Base(); ORM_TMS_PRO_Feature NewFeature = new ORM_TMS_PRO_Feature(); NewFeature.TMS_PRO_FeatureID = Guid.NewGuid(); NewFeature.IdentificationNumber = cls_Get_NewFeatureIdentifier.Invoke(Connection, Transaction, securityTicket).Result.Identifier; NewFeature.Name = Parameter.Name; NewFeature.Description = Parameter.Description; NewFeature.IsDeleted = false; NewFeature.IsArchived = false; NewFeature.Feature_Deadline = Parameter.Feature_Deadline; NewFeature.Type_RefID = Guid.Empty; NewFeature.Status_RefID = Guid.Empty; NewFeature.Component_RefID = Guid.Empty; NewFeature.DOC_Structure_Header_RefID = Guid.Empty; NewFeature.Parent_RefID = Parameter.Parent_RefID; NewFeature.Project_RefID = Parameter.Project_RefID; NewFeature.Tenant_RefID = securityTicket.TenantID; NewFeature.CreatedByAccount_RefID = securityTicket.AccountID; if (SaveTagsForFeature(Connection, Transaction, NewFeature.TMS_PRO_FeatureID, Parameter.Tags, securityTicket).Status == FR_Status.Error_Internal) { retVal.Status = FR_Status.Error_Internal; return(retVal); } NewFeature.Save(Connection, Transaction); retVal.Status = FR_Status.Success; return(retVal); } #endregion #region Edit Feature if (Parameter.IsDeleted == false && Parameter.ActionType.Equals("EditFeature")) { ORM_TMS_PRO_Feature.Query featureSearchQuery = new ORM_TMS_PRO_Feature.Query(); featureSearchQuery.TMS_PRO_FeatureID = Parameter.FeatureID; ORM_TMS_PRO_Feature FeatureItem = ORM_TMS_PRO_Feature.Query.Search(Connection, Transaction, featureSearchQuery).FirstOrDefault(); FeatureItem.Name = Parameter.Name; FeatureItem.Description = Parameter.Description; FeatureItem.Project_RefID = Parameter.Project_RefID; FeatureItem.Parent_RefID = Parameter.Parent_RefID; FeatureItem.Feature_Deadline = Parameter.Feature_Deadline; SaveTagsFor_EditedFeature(Connection, Transaction, Parameter.FeatureID, Parameter.Tags, securityTicket); FeatureItem.Save(Connection, Transaction); FR_Base retVal = new FR_Base(); retVal.Status = FR_Status.Success; return(retVal); } #endregion return(returnValue); #endregion UserCode }
protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L3FE_SF_0927 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { //Leave UserCode region to enable user code saving #region UserCode var returnValue = new FR_Guid(); //Put your code here String oldName = ""; String oldDescription = ""; #region Get_Project Guid Project_RefID = Guid.Empty; if (Parameter.Parent_RefID != Guid.Empty) { ORM_TMS_PRO_BusinessTask.Query query = new ORM_TMS_PRO_BusinessTask.Query(); query.TMS_PRO_BusinessTaskID = Parameter.Parent_RefID; var items = ORM_TMS_PRO_BusinessTask.Query.Search(Connection, Transaction, query); Project_RefID = items.FirstOrDefault().Project_RefID; } #endregion foreach (var TMS_PRO_FeatureID in Parameter.TMS_PRO_FeatureIDList) { var item = new ORM_TMS_PRO_Feature(); var result = item.Load(Connection, Transaction, TMS_PRO_FeatureID); oldName = ""; oldDescription = ""; P_L3FE_GPfF_1445 peersParameter = new P_L3FE_GPfF_1445(); peersParameter.FeatureID = item.TMS_PRO_FeatureID; List <L3FE_GPfF_1445> featurePeers = cls_Get_Peers_for_Feature.Invoke(Connection, Transaction, peersParameter, securityTicket).Result.ToList(); if (Parameter.IsDeleted == true) { #region DeleteAssignments ORM_TMS_PRO_Feature.Query instance1 = new ORM_TMS_PRO_Feature.Query(); instance1.TMS_PRO_FeatureID = TMS_PRO_FeatureID; ORM_TMS_PRO_Feature.Query.SoftDelete(Connection, Transaction, instance1); ORM_TMS_PRO_BusinessTask_2_Feature.Query instance2 = new ORM_TMS_PRO_BusinessTask_2_Feature.Query(); instance2.Feature_RefID = TMS_PRO_FeatureID; ORM_TMS_PRO_BusinessTask_2_Feature.Query.SoftDelete(Connection, Transaction, instance2); ORM_TMS_PRO_Peers_Feature.Query instance3 = new ORM_TMS_PRO_Peers_Feature.Query(); instance3.Feature_RefID = TMS_PRO_FeatureID; instance3.IsDeleted = false; ORM_TMS_PRO_Peers_Feature.Query.SoftDelete(Connection, Transaction, instance3); ORM_TMS_PRO_Feature_2_DeveloperTask.Query instance4 = new ORM_TMS_PRO_Feature_2_DeveloperTask.Query(); instance4.Feature_RefID = TMS_PRO_FeatureID; List <ORM_TMS_PRO_Feature_2_DeveloperTask> assignmentResult = ORM_TMS_PRO_Feature_2_DeveloperTask.Query.Search(Connection, Transaction, instance4); var DTasks = assignmentResult.Select(i => i.DeveloperTask_RefID).ToArray(); ORM_TMS_QuickTask.Query instance7 = new ORM_TMS_QuickTask.Query(); instance7.AssignedTo_Feature_RefID = TMS_PRO_FeatureID; var quicktasks = ORM_TMS_QuickTask.Query.Search(Connection, Transaction, instance7); foreach (var quicktask in quicktasks) { var param = new P_L3QT_SQT_0905(); param.TMS_QuickTaskID = quicktask.TMS_QuickTaskID; param.IsDeleted = true; cls_Save_TMS_QuickTask.Invoke(Connection, Transaction, param, securityTicket); } P_L3DT_SDT_0949 DTParam = new P_L3DT_SDT_0949(); DTParam.TMS_PRO_DeveloperTaskIDList = DTasks; DTParam.IsDeleted = true; DTParam.SendEmail = false; cls_Save_TMS_PRO_DeveloperTask.Invoke(Connection, Transaction, DTParam, securityTicket); #endregion continue; } if (Parameter.IsArchived == true) { ORM_TMS_PRO_Feature_2_DeveloperTask.Query instance3 = new ORM_TMS_PRO_Feature_2_DeveloperTask.Query(); instance3.Feature_RefID = TMS_PRO_FeatureID; List <ORM_TMS_PRO_Feature_2_DeveloperTask> assignmentResult = ORM_TMS_PRO_Feature_2_DeveloperTask.Query.Search(Connection, Transaction, instance3); var DTasks = assignmentResult.Select(i => i.DeveloperTask_RefID).ToArray(); P_L3DT_SDT_0949 DTParam = new P_L3DT_SDT_0949(); DTParam.TMS_PRO_DeveloperTaskIDList = DTasks; DTParam.IsArchived = true; DTParam.SendEmail = false; cls_Save_TMS_PRO_DeveloperTask.Invoke(Connection, Transaction, DTParam, securityTicket); item.IsArchived = true; item.Save(Connection, Transaction); continue; } #region ORM_BusinessTask_2_Feature ORM_TMS_PRO_BusinessTask_2_Feature.Query assignquery = new ORM_TMS_PRO_BusinessTask_2_Feature.Query(); assignquery.Feature_RefID = item.TMS_PRO_FeatureID; List <ORM_TMS_PRO_BusinessTask_2_Feature> assignments = ORM_TMS_PRO_BusinessTask_2_Feature.Query.Search(Connection, Transaction, assignquery); foreach (var assignment in assignments) { assignment.BusinessTask_RefID = Parameter.Parent_RefID; assignment.Save(Connection, Transaction); } #endregion item.Project_RefID = Project_RefID; if (Parameter.TMS_PRO_FeatureIDList.Length == 1) { if (Parameter.FeatureName != null && item.Name.GetContent(Parameter.LanguageID) != Parameter.FeatureName.GetContent(Parameter.LanguageID)) { oldName = item.Name.GetContent(Parameter.LanguageID); item.Name = Parameter.FeatureName; } if (Parameter.Description != null && item.Description.GetContent(Parameter.LanguageID) != Parameter.Description.GetContent(Parameter.LanguageID)) { oldDescription = item.Description.GetContent(Parameter.LanguageID); item.Description = Parameter.Description; } } #region mailSendout #endregion if (Parameter.Parent_RefID != Guid.Empty) { item.Parent_RefID = Parameter.Parent_RefID; } if (Parameter.Type_RefID != Guid.Empty) { item.Type_RefID = Parameter.Type_RefID; } if (Parameter.Status_RefID != Guid.Empty) { item.Status_RefID = Parameter.Status_RefID; } if (Parameter.Feature_Deadline != new DateTime()) { item.Feature_Deadline = Parameter.Feature_Deadline; } item.Save(Connection, Transaction); } return(returnValue); #endregion UserCode }