Beispiel #1
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5PR_SPR_1333 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();

            ORM_TMS_PRO_Project item = new ORM_TMS_PRO_Project();
            if (Parameter.TMS_PRO_ProjectID != Guid.Empty)
            {
                var result = item.Load(Connection, Transaction, Parameter.TMS_PRO_ProjectID);
                if (result.Status != FR_Status.Success || item.TMS_PRO_ProjectID == Guid.Empty)
                {
                    var error = new FR_Guid();
                    error.ErrorMessage = "No Such ID";
                    error.Status       = FR_Status.Error_Internal;
                    return(error);
                }
            }

            item.Description = Parameter.Description;
            item.Name        = Parameter.Name;
            item.IsArchived  = Parameter.IsArchived;
            item.Default_CostCenter_RefID = Parameter.Default_CostCenter_RefID;
            item.Tenant_RefID             = securityTicket.TenantID;
            item.Save(Connection, Transaction);

            ORM_TMS_PRO_Project_2_ProjectGroup.Query project2ProjectGroupQuery = new ORM_TMS_PRO_Project_2_ProjectGroup.Query();
            project2ProjectGroupQuery.TMS_PRO_Project_RefID = item.TMS_PRO_ProjectID;
            project2ProjectGroupQuery.Tenant_RefID          = securityTicket.TenantID;
            project2ProjectGroupQuery.IsDeleted             = false;
            ORM_TMS_PRO_Project_2_ProjectGroup project2ProjectGroup = new ORM_TMS_PRO_Project_2_ProjectGroup();

            var queryRes = ORM_TMS_PRO_Project_2_ProjectGroup.Query.Search(Connection, Transaction, project2ProjectGroupQuery);

            bool doesAssignmentExist = false;

            if (queryRes != null && queryRes.Count != 0)
            {
                project2ProjectGroup = queryRes.FirstOrDefault();
                doesAssignmentExist  = true;
            }


            if (Parameter.TMS_PRO_Project_Group_RefID != Guid.Empty)
            {
                project2ProjectGroup.TMS_PRO_Project_Group_RefID = Parameter.TMS_PRO_Project_Group_RefID;
                project2ProjectGroup.TMS_PRO_Project_RefID       = item.TMS_PRO_ProjectID;
                project2ProjectGroup.Tenant_RefID = securityTicket.TenantID;
                project2ProjectGroup.Save(Connection, Transaction);
            }
            else if (doesAssignmentExist)
            {
                project2ProjectGroup.IsDeleted = true;
                project2ProjectGroup.Save(Connection, Transaction);
            }

            return(new FR_Guid(item.TMS_PRO_ProjectID));

            #endregion UserCode
        }
Beispiel #2
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L3DT_SPDfDTID_1425 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();
            //Put your code here
            ORM_TMS_PRO_DeveloperTask devTask = ORM_TMS_PRO_DeveloperTask.Query.Search(Connection, Transaction, new ORM_TMS_PRO_DeveloperTask.Query()
            {
                TMS_PRO_DeveloperTaskID = Parameter.DeveloperTaskID,
                Tenant_RefID            = securityTicket.TenantID,
                IsDeleted = false
            }).Single();

            ORM_TMS_PRO_ProjectMember projMember = ORM_TMS_PRO_ProjectMember.Query.Search(Connection, Transaction, new ORM_TMS_PRO_ProjectMember.Query()
            {
                USR_Account_RefID = securityTicket.AccountID,
                Project_RefID     = devTask.Project_RefID,
                Tenant_RefID      = securityTicket.TenantID,
                IsDeleted         = false
            }).Single();

            ORM_TMS_PRO_Project project = ORM_TMS_PRO_Project.Query.Search(Connection, Transaction, new ORM_TMS_PRO_Project.Query()
            {
                TMS_PRO_ProjectID = devTask.Project_RefID,
                Tenant_RefID      = securityTicket.TenantID,
                IsDeleted         = false
            }).Single();

            if (Parameter.Delete)
            {
                ORM_TMS_PRO_Peers_Development subscription2Delete = ORM_TMS_PRO_Peers_Development.Query.Search(Connection, Transaction, new ORM_TMS_PRO_Peers_Development.Query()
                {
                    DeveloperTask_RefID = Parameter.DeveloperTaskID,
                    ProjectMember_RefID = projMember.TMS_PRO_ProjectMemberID,
                    Tenant_RefID        = securityTicket.TenantID,
                    IsDeleted           = false
                }).Single();
                subscription2Delete.IsDeleted = true;
                subscription2Delete.Save(Connection, Transaction);
            }
            else
            {
                ORM_TMS_PRO_Peers_Development newSubscription = new ORM_TMS_PRO_Peers_Development();
                newSubscription.Tenant_RefID        = securityTicket.TenantID;
                newSubscription.ProjectMember_RefID = projMember.TMS_PRO_ProjectMemberID;
                newSubscription.DeveloperTask_RefID = Parameter.DeveloperTaskID;
                newSubscription.Save(Connection, Transaction);
            }

            return(returnValue);

            #endregion UserCode
        }
Beispiel #3
0
        protected static FR_L5PR_GPFPID_1204 Execute(DbConnection Connection, DbTransaction Transaction, P_L5PR_GPFPID_1204 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5PR_GPFPID_1204();
            returnValue.Result = new L5PR_GPFPID_1204();
            //Put your code here
            L5PR_GPFT_1200 resultProject = new L5PR_GPFT_1200();

            ORM_TMS_PRO_Project.Query projectsQuery = new ORM_TMS_PRO_Project.Query();
            projectsQuery.TMS_PRO_ProjectID = Parameter.TMS_PRO_ProjectID;
            projectsQuery.IsDeleted         = false;
            projectsQuery.Tenant_RefID      = securityTicket.TenantID;
            List <ORM_TMS_PRO_Project> projects = ORM_TMS_PRO_Project.Query.Search(Connection, Transaction, projectsQuery);

            if (projects.Count == 0)
            {
                return(null);
            }

            ORM_TMS_PRO_Project project = projects.FirstOrDefault();

            ORM_TMS_PRO_Project_2_ProjectGroup.Query project2ProjectGroupQuery = new ORM_TMS_PRO_Project_2_ProjectGroup.Query();
            project2ProjectGroupQuery.TMS_PRO_Project_RefID = Parameter.TMS_PRO_ProjectID;
            project2ProjectGroupQuery.IsDeleted             = false;
            project2ProjectGroupQuery.Tenant_RefID          = securityTicket.TenantID;
            List <ORM_TMS_PRO_Project_2_ProjectGroup> project2ProjectGroup = ORM_TMS_PRO_Project_2_ProjectGroup.Query.Search(Connection, Transaction, project2ProjectGroupQuery);

            ORM_TMS_PRO_Project_2_ProjectGroup resultProject2ProjectGroup = new ORM_TMS_PRO_Project_2_ProjectGroup();

            if (project2ProjectGroup.Count != 0)
            {
                resultProject2ProjectGroup = project2ProjectGroup.FirstOrDefault();
            }

            resultProject.TMS_PRO_ProjectID = project.TMS_PRO_ProjectID;
            resultProject.Name        = project.Name;
            resultProject.Description = project.Description;
            resultProject.IsArchived  = project.IsArchived;
            resultProject.Default_CostCenter_RefID    = project.Default_CostCenter_RefID;
            resultProject.AssignmentID                = resultProject2ProjectGroup.AssignmentID;
            resultProject.TMS_PRO_Project_Group_RefID = resultProject2ProjectGroup.TMS_PRO_Project_Group_RefID;

            returnValue.Result.Project = resultProject;
            return(returnValue);

            #endregion UserCode
        }
Beispiel #4
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5PR_DPR_1501 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
            ORM_TMS_PRO_Project item = new ORM_TMS_PRO_Project();
            if (Parameter.TMS_PRO_ProjectID != Guid.Empty)
            {
                var result = item.Load(Connection, Transaction, Parameter.TMS_PRO_ProjectID);
                if (result.Status != FR_Status.Success || item.TMS_PRO_ProjectID == Guid.Empty)
                {
                    var error = new FR_Guid();
                    error.ErrorMessage = "No Such ID";
                    error.Status       = FR_Status.Error_Internal;
                    return(error);
                }
            }


            ORM_TMS_PRO_Project_2_ProjectGroup.Query project2ProjectGroupQuery = new ORM_TMS_PRO_Project_2_ProjectGroup.Query();
            project2ProjectGroupQuery.TMS_PRO_Project_RefID = item.TMS_PRO_ProjectID;
            project2ProjectGroupQuery.Tenant_RefID          = securityTicket.TenantID;
            project2ProjectGroupQuery.IsDeleted             = false;
            ORM_TMS_PRO_Project_2_ProjectGroup project2ProjectGroup = new ORM_TMS_PRO_Project_2_ProjectGroup();

            var queryRes = ORM_TMS_PRO_Project_2_ProjectGroup.Query.Search(Connection, Transaction, project2ProjectGroupQuery);

            if (queryRes != null)
            {
                project2ProjectGroup           = queryRes.FirstOrDefault();
                project2ProjectGroup.IsDeleted = true;
                project2ProjectGroup.Save(Connection, Transaction);
            }


            item.IsDeleted = true;
            item.Save(Connection, Transaction);
            return(returnValue);

            #endregion UserCode
        }
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L3DT_SDT_0949 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
            Boolean multipleEdit;

            String   oldName                     = "";
            String   oldDescription              = "";
            Guid     oldPriority_RefID           = Guid.Empty;
            Guid     oldDeveloperTask_Type_RefID = Guid.Empty;
            double   oldEstimatedReqTime         = -1;
            DateTime oldCompletion_Deadline      = new DateTime();
            Boolean  oldIsBeingPrepared          = false;

            Guid Project_RefID = Guid.Empty;

            if (Parameter.Parent_RefID != Guid.Empty)
            {
                ORM_TMS_PRO_Feature.Query query = new ORM_TMS_PRO_Feature.Query();
                query.TMS_PRO_FeatureID = Parameter.Parent_RefID;

                var items = ORM_TMS_PRO_Feature.Query.Search(Connection, Transaction, query);
                Project_RefID = items.FirstOrDefault().Project_RefID;
            }

            foreach (var TMS_PRO_DeveloperTaskID in Parameter.TMS_PRO_DeveloperTaskIDList)
            {
                var item   = new CL1_TMS_PRO.ORM_TMS_PRO_DeveloperTask();
                var result = item.Load(Connection, Transaction, TMS_PRO_DeveloperTaskID);

                P_L3DT_GPfDT_1659 parameterPeers = new P_L3DT_GPfDT_1659();
                parameterPeers.DTaskID = item.TMS_PRO_DeveloperTaskID;

                List <L3DT_GPfDT_1659> dtaskPeers = cls_Get_Peers_for_DTaskID.Invoke(Connection, Transaction, parameterPeers, securityTicket).Result.ToList();


                if (Parameter.IsDeleted == true)
                {
                    #region Delete ORM_CMN_BPT_InvestedWorkTime

                    var involment_query = new ORM_TMS_PRO_DeveloperTask_Involvement.Query();
                    involment_query.DeveloperTask_RefID = item.TMS_PRO_DeveloperTaskID;
                    involment_query.IsDeleted           = false;

                    var involments = ORM_TMS_PRO_DeveloperTask_Involvement.Query.Search(Connection, Transaction, involment_query);

                    foreach (var involment in involments)
                    {
                        var dtinv_query = new ORM_TMS_PRO_DeveloperTask_Involvements_InvestedWorkTime.Query();
                        dtinv_query.TMS_PRO_DeveloperTask_Involvement_RefID = involment.TMS_PRO_DeveloperTask_InvolvementID;
                        dtinv_query.IsDeleted = false;

                        var dtinv = ORM_TMS_PRO_DeveloperTask_Involvements_InvestedWorkTime.Query.Search(Connection, Transaction, dtinv_query);

                        foreach (var dt in dtinv)
                        {
                            dt.IsDeleted = true;
                            dt.Save(Connection, Transaction);

                            var inv_query = new ORM_CMN_BPT_InvestedWorkTime.Query();
                            inv_query.CMN_BPT_InvestedWorkTimeID = dt.CMN_BPT_InvestedWorkTime_RefID;
                            inv_query.IsDeleted = false;

                            ORM_CMN_BPT_InvestedWorkTime.Query.SoftDelete(Connection, Transaction, inv_query);
                        }
                    }
                    #endregion

                    #region DeleteAssignments

                    ORM_TMS_PRO_Peers_Development.Query instance1 = new ORM_TMS_PRO_Peers_Development.Query();
                    instance1.DeveloperTask_RefID = TMS_PRO_DeveloperTaskID;
                    ORM_TMS_PRO_Peers_Development.Query.SoftDelete(Connection, Transaction, instance1);

                    ORM_TMS_PRO_Feature_2_DeveloperTask.Query instance2 = new ORM_TMS_PRO_Feature_2_DeveloperTask.Query();
                    instance2.DeveloperTask_RefID = TMS_PRO_DeveloperTaskID;
                    ORM_TMS_PRO_Feature_2_DeveloperTask.Query.SoftDelete(Connection, Transaction, instance2);

                    ORM_TMS_PRO_DeveloperTask_Involvement.Query instance3 = new ORM_TMS_PRO_DeveloperTask_Involvement.Query();
                    instance3.DeveloperTask_RefID = TMS_PRO_DeveloperTaskID;
                    ORM_TMS_PRO_DeveloperTask_Involvement.Query.SoftDelete(Connection, Transaction, instance3);

                    ORM_TMS_PRO_DeveloperTask_StatusHistory.Query instance4 = new ORM_TMS_PRO_DeveloperTask_StatusHistory.Query();
                    instance4.DeveloperTask_RefID = TMS_PRO_DeveloperTaskID;
                    ORM_TMS_PRO_DeveloperTask_StatusHistory.Query.SoftDelete(Connection, Transaction, instance4);

                    ORM_TMS_PRO_DeveloperTask_Recommendation.Query instance5 = new ORM_TMS_PRO_DeveloperTask_Recommendation.Query();
                    instance5.DeveloperTask_RefID = TMS_PRO_DeveloperTaskID;
                    ORM_TMS_PRO_DeveloperTask_Recommendation.Query.SoftDelete(Connection, Transaction, instance5);

                    ORM_CMN_PRO_Product_Release_2_DeveloperTask.Query instance6 = new ORM_CMN_PRO_Product_Release_2_DeveloperTask.Query();
                    instance6.TMS_PRO_DeveloperTask_RefID = TMS_PRO_DeveloperTaskID;
                    ORM_CMN_PRO_Product_Release_2_DeveloperTask.Query.SoftDelete(Connection, Transaction, instance6);

                    ORM_TMS_QuickTask.Query instance7 = new ORM_TMS_QuickTask.Query();
                    instance7.AssignedTo_DeveloperTask_RefID = TMS_PRO_DeveloperTaskID;
                    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);
                    }

                    #endregion

                    #region projectInfo

                    var project = new ORM_TMS_PRO_Project();
                    project.Load(Connection, Transaction, item.Project_RefID);

                    ORM_TMS_PRO_Project_Status ProjectStatus = new ORM_TMS_PRO_Project_Status();
                    ProjectStatus.Load(Connection, Transaction, project.Status_RefID);

                    Guid   language    = Parameter.LanguageID;
                    String statusLabel = ProjectStatus.Label.GetContent(language);
                    String projectName = project.Name.GetContent(language);

                    #endregion


                    item.IsDeleted = true;
                    item.Save(Connection, Transaction);
                }



                if (Parameter.IsArchived == true)
                {
                    item.IsArchived = true;
                    item.Save(Connection, Transaction);

                    continue;
                }


                #region ORM_TMS_PRO_Feature_2_DeveloperTask

                if (Parameter.Parent_RefID != Guid.Empty)
                {
                    ORM_TMS_PRO_Feature_2_DeveloperTask.Query assignquery = new ORM_TMS_PRO_Feature_2_DeveloperTask.Query();
                    assignquery.DeveloperTask_RefID = item.TMS_PRO_DeveloperTaskID;

                    List <ORM_TMS_PRO_Feature_2_DeveloperTask> assignments = ORM_TMS_PRO_Feature_2_DeveloperTask.Query.Search(Connection, Transaction, assignquery);
                    foreach (var assignment in assignments)
                    {
                        assignment.Feature_RefID = Parameter.Parent_RefID;
                        assignment.Save(Connection, Transaction);
                    }
                }
                #endregion

                if (Project_RefID != Guid.Empty)
                {
                    item.Project_RefID = Project_RefID;
                }

                if (Parameter.TMS_PRO_DeveloperTaskIDList.Length == 1)
                {
                    multipleEdit = false;

                    oldName        = item.Name;
                    oldDescription = item.Description;

                    item.Name        = Parameter.TaskName;
                    item.Description = Parameter.Description;

                    item.Priority_RefID           = Parameter.Priority_RefID;
                    item.DeveloperTask_Type_RefID = Parameter.DeveloperTask_Type_RefID;

                    item.DeveloperTime_RequiredEstimation_min = Parameter.DeveloperTime_RequiredEstimation_min;
                    item.Completion_Deadline = Parameter.Completion_Deadline;
                    item.IsBeingPrepared     = Parameter.IsBeingPrepared;
                    item.IsTaskEstimable     = Parameter.IsTaskEstimable;

                    #region ORM_CMN_PRO_Product_Release_2_DeveloperTask

                    if (Parameter.ReleaseID != Guid.Empty)
                    {
                        var revisionAssignment = new ORM_CMN_PRO_Product_Release_2_DeveloperTask();
                        revisionAssignment.AssignmentID = Guid.NewGuid();
                        revisionAssignment.CMN_PRO_Product_Release_RefID = Parameter.ReleaseID;
                        revisionAssignment.TMS_PRO_DeveloperTask_RefID   = item.TMS_PRO_DeveloperTaskID;
                        revisionAssignment.Creation_Timestamp            = DateTime.Now;
                        revisionAssignment.Tenant_RefID = securityTicket.TenantID;

                        revisionAssignment.Save(Connection, Transaction);
                    }
                    else
                    {
                        var query = new ORM_CMN_PRO_Product_Release_2_DeveloperTask.Query();
                        query.TMS_PRO_DeveloperTask_RefID = item.TMS_PRO_DeveloperTaskID;

                        ORM_CMN_PRO_Product_Release_2_DeveloperTask.Query.SoftDelete(Connection, Transaction, query);
                    }

                    #endregion
                }

                else
                {
                    multipleEdit = true;

                    if (Parameter.Priority_RefID != Guid.Empty)
                    {
                        item.Priority_RefID = Parameter.Priority_RefID;
                    }
                    if (Parameter.DeveloperTask_Type_RefID != Guid.Empty)
                    {
                        item.DeveloperTask_Type_RefID = Parameter.DeveloperTask_Type_RefID;
                    }
                    if (Parameter.DeveloperTime_RequiredEstimation_min != 0)
                    {
                        item.DeveloperTime_RequiredEstimation_min = Parameter.DeveloperTime_RequiredEstimation_min;
                    }
                    if (Parameter.Completion_Deadline != new DateTime())
                    {
                        item.Completion_Deadline = Parameter.Completion_Deadline;
                    }
                    if (Parameter.IsBeingPreparedIgnore == false)
                    {
                        item.IsBeingPrepared = Parameter.IsBeingPrepared;
                    }


                    if (Parameter.ReleaseIDIgnore == false)
                    {
                        #region ORM_CMN_PRO_Product_Release_2_DeveloperTask

                        if (Parameter.ReleaseID != Guid.Empty)
                        {
                            var revisionAssignment = new ORM_CMN_PRO_Product_Release_2_DeveloperTask();
                            revisionAssignment.AssignmentID = Guid.NewGuid();
                            revisionAssignment.CMN_PRO_Product_Release_RefID = Parameter.ReleaseID;
                            revisionAssignment.TMS_PRO_DeveloperTask_RefID   = item.TMS_PRO_DeveloperTaskID;
                            revisionAssignment.Creation_Timestamp            = DateTime.Now;
                            revisionAssignment.Tenant_RefID = securityTicket.TenantID;

                            revisionAssignment.Save(Connection, Transaction);
                        }
                        else
                        {
                            var query = new ORM_CMN_PRO_Product_Release_2_DeveloperTask.Query();
                            query.TMS_PRO_DeveloperTask_RefID = item.TMS_PRO_DeveloperTaskID;

                            ORM_CMN_PRO_Product_Release_2_DeveloperTask.Query.SoftDelete(Connection, Transaction, query);
                        }

                        #endregion
                    }
                }


                item.Save(Connection, Transaction);
            }


            return(returnValue);

            #endregion UserCode
        }
Beispiel #6
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L3SPFT_SPN_1100 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Guid();

            var item = new ORM_TMS_PRO_Project();
            if (Parameter.TMS_PRO_ProjectID != Guid.Empty)
            {
                item.Load(Connection, Transaction, Parameter.TMS_PRO_ProjectID);
            }

            if (Parameter.IsDeleted == true)
            {
                ORM_TMS_PRO_Project.Query query = new ORM_TMS_PRO_Project.Query();
                query.TMS_PRO_ProjectID = item.TMS_PRO_ProjectID;
                item.IsDeleted          = true;
                ORM_TMS_PRO_Project.Query.SoftDelete(Connection, Transaction, query);


                #region Delete ORM_TMS_PRO_BusinessTask
                ORM_TMS_PRO_BusinessTask.Query ORM_TMS_PRO_BusinessTaskquery = new ORM_TMS_PRO_BusinessTask.Query();
                ORM_TMS_PRO_BusinessTaskquery.Project_RefID = Parameter.TMS_PRO_ProjectID;
                ORM_TMS_PRO_BusinessTaskquery.IsArchived    = false;
                ORM_TMS_PRO_BusinessTaskquery.IsDeleted     = false;
                ORM_TMS_PRO_BusinessTask.Query.SoftDelete(Connection, Transaction, ORM_TMS_PRO_BusinessTaskquery);

                #endregion

                #region Delete ORM_TMS_PRO_BusinessTaskPackage

                ORM_TMS_PRO_BusinessTaskPackage.Query ORM_TMS_PRO_BusinessTaskPackagequery = new ORM_TMS_PRO_BusinessTaskPackage.Query();
                ORM_TMS_PRO_BusinessTaskPackagequery.Project_RefID = Parameter.TMS_PRO_ProjectID;
                ORM_TMS_PRO_BusinessTaskPackagequery.IsDeleted     = false;

                ORM_TMS_PRO_BusinessTaskPackage.Query.SoftDelete(Connection, Transaction, ORM_TMS_PRO_BusinessTaskPackagequery);


                #endregion

                #region Delete ORM_TMS_PRO_ProjectMember

                var ORM_TMS_PRO_ProjectMemberquery = new ORM_TMS_PRO_ProjectMember.Query();
                ORM_TMS_PRO_ProjectMemberquery.IsDeleted     = true;
                ORM_TMS_PRO_ProjectMemberquery.Project_RefID = Parameter.TMS_PRO_ProjectID;

                ORM_TMS_PRO_ProjectMember.Query.SoftDelete(Connection, Transaction, ORM_TMS_PRO_ProjectMemberquery);

                #endregion

                #region Delete ORM_TMS_PRO_BussinessTask_2_Feature
                var ORM_TMS_PRO_BussinessTask_2_Featurequery = new ORM_TMS_PRO_BusinessTask_2_Feature.Query();
                ORM_TMS_PRO_BussinessTask_2_Featurequery.Feature_RefID = Parameter.TMS_PRO_ProjectID;
                ORM_TMS_PRO_BussinessTask_2_Featurequery.IsDeleted     = true;
                ORM_TMS_PRO_BusinessTask_2_Feature.Query.SoftDelete(Connection, Transaction, ORM_TMS_PRO_BussinessTask_2_Featurequery);

                #endregion

                #region Delete ORM_TMS_PRO_Features
                var ORM_TMS_PRO_Featuresquery = new ORM_TMS_PRO_Feature.Query();
                ORM_TMS_PRO_Featuresquery.TMS_PRO_FeatureID = Parameter.TMS_PRO_ProjectID;
                ORM_TMS_PRO_Featuresquery.IsDeleted         = true;
                ORM_TMS_PRO_Feature.Query.SoftDelete(Connection, Transaction, ORM_TMS_PRO_Featuresquery);

                #endregion
                #region Delete ORM_TMS_DeveloperTasks
                var ORM_TMS_Developertaskquery = new ORM_TMS_PRO_DeveloperTask.Query();
                ORM_TMS_Developertaskquery.TMS_PRO_DeveloperTaskID = Parameter.TMS_PRO_ProjectID;
                ORM_TMS_Developertaskquery.IsDeleted = true;
                ORM_TMS_PRO_DeveloperTask.Query.SoftDelete(Connection, Transaction, ORM_TMS_Developertaskquery);
                #endregion
                return(returnValue);
            }

            if (Parameter.IsArchived == true)
            {
                #region archive Project
                //ORM_TMS_PRO_Project.Query searchQueryProject = new ORM_TMS_PRO_Project.Query();
                //searchQueryProject.TMS_PRO_ProjectID = item.TMS_PRO_ProjectID;
                //searchQueryProject.IsArchived = false;

                //ORM_TMS_PRO_Project.Query updateQueryProject = new ORM_TMS_PRO_Project.Query();
                //updateQueryProject.TMS_PRO_ProjectID = item.TMS_PRO_ProjectID;
                //updateQueryProject.IsArchived = true;

                //ORM_TMS_PRO_Project.Query.Update(Connection, Transaction, searchQueryProject, updateQueryProject);
                var project = ORM_TMS_PRO_Project.Query.Search(Connection, Transaction, new ORM_TMS_PRO_Project.Query()
                {
                    Tenant_RefID      = securityTicket.TenantID,
                    IsDeleted         = false,
                    TMS_PRO_ProjectID = Parameter.TMS_PRO_ProjectID
                }).Single();
                project.IsArchived = true;
                project.Save(Connection, Transaction);

                #endregion

                #region archive ORM_TMS_PRO_BusinessTask

                //ORM_TMS_PRO_BusinessTask.Query searchQueryBusinessTask = new ORM_TMS_PRO_BusinessTask.Query();
                //searchQueryBusinessTask.Project_RefID= item.TMS_PRO_ProjectID;
                //searchQueryBusinessTask.IsArchived = false;

                //ORM_TMS_PRO_BusinessTask.Query updateQueryBusinessTask = new ORM_TMS_PRO_BusinessTask.Query();
                //updateQueryBusinessTask.Project_RefID = item.TMS_PRO_ProjectID;
                //updateQueryBusinessTask.IsArchived = true;

                //ORM_TMS_PRO_BusinessTask.Query.Update(Connection, Transaction, searchQueryBusinessTask, updateQueryBusinessTask);

                var businesstaskList = ORM_TMS_PRO_BusinessTask.Query.Search(Connection, Transaction, new ORM_TMS_PRO_BusinessTask.Query()
                {
                    Tenant_RefID  = securityTicket.TenantID,
                    IsDeleted     = false,
                    Project_RefID = Parameter.TMS_PRO_ProjectID
                });

                foreach (var businesstaskitem in businesstaskList)
                {
                    businesstaskitem.IsArchived = true;
                    businesstaskitem.Save(Connection, Transaction);
                }

                #endregion

                #region archive ORM_TMS_PRO_Features

                //ORM_TMS_PRO_Feature.Query searchQueryFeature = new ORM_TMS_PRO_Feature.Query();
                //searchQueryFeature.Project_RefID = item.TMS_PRO_ProjectID;
                //searchQueryFeature.IsArchived = false;

                //ORM_TMS_PRO_Feature.Query updateQueryFeature = new ORM_TMS_PRO_Feature.Query();
                //updateQueryFeature.Project_RefID = item.TMS_PRO_ProjectID;
                //updateQueryFeature.IsArchived = true;

                //ORM_TMS_PRO_Feature.Query.Update(Connection, Transaction, searchQueryFeature, updateQueryFeature);

                var featureList = ORM_TMS_PRO_Feature.Query.Search(Connection, Transaction, new ORM_TMS_PRO_Feature.Query()
                {
                    Tenant_RefID  = securityTicket.TenantID,
                    IsDeleted     = false,
                    Project_RefID = Parameter.TMS_PRO_ProjectID
                });

                foreach (var feature in featureList)
                {
                    feature.IsArchived = true;
                    feature.Save(Connection, Transaction);
                }


                #endregion

                #region archive ORM_TMS_DeveloperTasks

                var devTaskList = ORM_TMS_PRO_DeveloperTask.Query.Search(Connection, Transaction, new ORM_TMS_PRO_DeveloperTask.Query()
                {
                    Tenant_RefID  = securityTicket.TenantID,
                    Project_RefID = item.TMS_PRO_ProjectID,
                    IsDeleted     = false
                });
                foreach (var devTask in devTaskList)
                {
                    devTask.IsArchived = true;
                    devTask.Save(Connection, Transaction);
                }
                //ORM_TMS_PRO_DeveloperTask.Query searchQueryDeveloperTask = new ORM_TMS_PRO_DeveloperTask.Query();
                //searchQueryDeveloperTask.Project_RefID = item.TMS_PRO_ProjectID;
                //searchQueryDeveloperTask.IsArchived = false;

                //ORM_TMS_PRO_DeveloperTask.Query updateQueryDeveloperTask = new ORM_TMS_PRO_DeveloperTask.Query();
                //updateQueryDeveloperTask.Project_RefID = item.TMS_PRO_ProjectID;
                //updateQueryDeveloperTask.IsArchived = true;

                //ORM_TMS_PRO_DeveloperTask.Query.Update(Connection, Transaction, searchQueryDeveloperTask, updateQueryDeveloperTask);
                #endregion
            }

            if (Parameter.TMS_PRO_ProjectID == Guid.Empty)
            {
                item.TMS_PRO_ProjectID = Guid.NewGuid();

                #region Define Documents

                var structureHeader = new ORM_DOC_Structure_Header();
                structureHeader.DOC_Structure_HeaderID = Guid.NewGuid();
                structureHeader.Label        = Parameter.Name_DictID.Contents.FirstOrDefault().Content;
                structureHeader.Tenant_RefID = securityTicket.TenantID;
                var structureStatusSave = structureHeader.Save(Connection, Transaction);

                item.DOC_Structure_Header_RefID = structureHeader.DOC_Structure_HeaderID;

                #endregion

                #region ORM_TMS_PRO_ProjectMember

                #region ProjectMemberID

                String gpmProjectMember = EnumUtils.GetEnumDescription(ERightsPackage.ProjectMember);

                var parameter = new P_L2RP_GRPfGPM_1150();
                parameter.GlobalPropertyMatchingID = gpmProjectMember;

                var projectMemberID = cls_Get_RightPackage_for_GlobalPropertyMatchingID.Invoke(Connection, Transaction, parameter, securityTicket).Result;

                #endregion

                #region ProjectManagerID

                String gpmProjectManager = EnumUtils.GetEnumDescription(ERightsPackage.ProjectManager);

                parameter = new P_L2RP_GRPfGPM_1150();
                parameter.GlobalPropertyMatchingID = gpmProjectManager;

                var projectManagerID = cls_Get_RightPackage_for_GlobalPropertyMatchingID.Invoke(Connection, Transaction, parameter, securityTicket).Result;

                #endregion

                var projectMember = new ORM_TMS_PRO_ProjectMember();

                projectMember.Project_RefID     = item.TMS_PRO_ProjectID;
                projectMember.USR_Account_RefID = securityTicket.AccountID;
                projectMember.IsDeleted         = false;
                projectMember.Tenant_RefID      = securityTicket.TenantID;
                projectMember.IsOwner           = true;
                projectMember.Save(Connection, Transaction);

                ORM_TMS_PRO_Members_2_RightPackage assignment_member = new ORM_TMS_PRO_Members_2_RightPackage();
                assignment_member.ACC_RightsPackage_RefID = projectMemberID.TMS_PRO_ACC_RightsPackageID;
                assignment_member.ProjectMember_RefID     = projectMember.TMS_PRO_ProjectMemberID;
                assignment_member.IsDeleted    = false;
                assignment_member.Tenant_RefID = securityTicket.TenantID;
                assignment_member.Save(Connection, Transaction);

                ORM_TMS_PRO_Members_2_RightPackage assignment_manager = new ORM_TMS_PRO_Members_2_RightPackage();
                assignment_manager.ACC_RightsPackage_RefID = projectManagerID.TMS_PRO_ACC_RightsPackageID;
                assignment_manager.ProjectMember_RefID     = projectMember.TMS_PRO_ProjectMemberID;
                assignment_manager.IsDeleted    = false;
                assignment_manager.Tenant_RefID = securityTicket.TenantID;
                assignment_manager.Save(Connection, Transaction);
                #endregion

                item.Tenant_RefID = securityTicket.TenantID;
            }
            if (Parameter.Name_DictID != null)
            {
                item.Name = Parameter.Name_DictID;
            }
            if (Parameter.Description_DictID != null)
            {
                item.Description = Parameter.Description_DictID;
            }
            if (Parameter.Status_RefID != null)
            {
                item.Status_RefID = Parameter.Status_RefID;
            }
            if (Parameter.Color != null)
            {
                item.Color = Parameter.Color;
            }



            return(new FR_Guid(item.Save(Connection, Transaction), item.TMS_PRO_ProjectID));

            #endregion UserCode
        }
Beispiel #7
0
        protected static FR_L3NO_GNwUiCoiC_1032_Array Execute(DbConnection Connection, DbTransaction Transaction, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L3NO_GNwUiCoiC_1032_Array();
            //Put your code here
            List <L3NO_GNwUiCoiC_1032> notes = new List <L3NO_GNwUiCoiC_1032>();
            //************************************************************************************************//
            #region GETTING NOTES CREATED BY USER

            var ProjectNotesCreatedByCurrentUser = cls_Get_All_ProjectNotes_Created_by_AccountID.Invoke(Connection, Transaction, securityTicket).Result.ToList();

            foreach (var item in ProjectNotesCreatedByCurrentUser)
            {
                L3NO_GNwUiCoiC_1032 note = new L3NO_GNwUiCoiC_1032();
                note.NoteID = item.CMN_NoteID;
                //setting project info
                L3NO_GNwUiCoiC_1032c projectInfo = new L3NO_GNwUiCoiC_1032c();

                projectInfo.ProjectID = item.Project_RefID;
                var project = ORM_TMS_PRO_Project.Query.Search(Connection, Transaction, new ORM_TMS_PRO_Project.Query()
                {
                    Tenant_RefID      = securityTicket.TenantID,
                    TMS_PRO_ProjectID = item.Project_RefID,
                    IsDeleted         = false
                }).SingleOrDefault();
                if (project != null)
                {
                    projectInfo.ProjectName = project.Name;
                    note.ProjectInfo        = projectInfo;
                    note.ProjectNoteID      = item.TMS_PRO_Project_NoteID;
                    note.CurrentVersionID   = item.Current_NoteRevision_RefID;
                    //setting collaborators info
                    List <L3NO_GNwUiCoiC_1032a> collaboratorsInfo = new List <L3NO_GNwUiCoiC_1032a>();

                    var collaboratorsForProjectNoteID = ORM_TMS_PRO_Project_Note_Collaborators.Query.Search(Connection, Transaction, new ORM_TMS_PRO_Project_Note_Collaborators.Query()
                    {
                        Tenant_RefID      = securityTicket.TenantID,
                        ProjectNote_RefID = item.TMS_PRO_Project_NoteID,
                        IsDeleted         = false
                    });

                    foreach (var collaborator in collaboratorsForProjectNoteID)
                    {
                        L3NO_GNwUiCoiC_1032a collInfo = new L3NO_GNwUiCoiC_1032a();
                        collInfo.AccountID      = collaborator.Account_RefID;
                        collInfo.CollaboratorID = collaborator.TMS_PRO_Project_Note_CollaboratorID;

                        P_L2AI_GAPIfAI_1627 userParameter = new P_L2AI_GAPIfAI_1627();
                        userParameter.AccountRefID = collaborator.Account_RefID;
                        var userinfo = cls_Get_Account_PersonalInformation_for_AccountID.Invoke(Connection, Transaction, userParameter, securityTicket).Result;
                        collInfo.FirstAndLastName = userinfo.FirstName + " " + userinfo.LastName;
                        collaboratorsInfo.Add(collInfo);
                    }
                    note.CollaboratorsInfo = collaboratorsInfo.ToArray();
                    //setting tags info
                    List <L3NO_GNwUiCoiC_1032b> tagsInfo      = new List <L3NO_GNwUiCoiC_1032b>();
                    P_L3N_GTfPNID_1415          tagsParameter = new P_L3N_GTfPNID_1415();
                    tagsParameter.ProjectNoteID = item.TMS_PRO_Project_NoteID;
                    var tagsForProjectNoteID = cls_Get_Tags_for_ProjectNoteID.Invoke(Connection, Transaction, tagsParameter, securityTicket).Result.ToList();
                    foreach (var tag in tagsForProjectNoteID)
                    {
                        L3NO_GNwUiCoiC_1032b tagInfo = new L3NO_GNwUiCoiC_1032b();
                        tagInfo.TagID    = tag.TMS_PRO_TagID;
                        tagInfo.TagValue = tag.TagValue;
                        tagsInfo.Add(tagInfo);
                    }
                    note.TagsInfo = tagsInfo.ToArray();
                    //setting current note version
                    var lastnoterevision = ORM_CMN_NoteRevision.Query.Search(Connection, Transaction, new ORM_CMN_NoteRevision.Query()
                    {
                        Tenant_RefID       = securityTicket.TenantID,
                        CMN_NoteRevisionID = item.Current_NoteRevision_RefID,
                        IsDeleted          = false
                    });
                    if (lastnoterevision != null && lastnoterevision.Count != 0)
                    {
                        note.NoteVersion = lastnoterevision.First().Version.ToString();
                    }
                    else
                    {
                        note.NoteVersion = "1";
                    }

                    //setting all note revisions

                    List <L3NO_GNwUiCoiC_1032d> noteRevisionsInfo = new List <L3NO_GNwUiCoiC_1032d>();

                    P_L3N_GNRfNID_1559 revisionsParameter = new P_L3N_GNRfNID_1559();
                    revisionsParameter.NoteID = item.CMN_NoteID;
                    var noteRevisionsForNote = cls_Get_NoteRevisions_for_NoteID.Invoke(Connection, Transaction, revisionsParameter, securityTicket).Result.ToList();
                    foreach (var noteRevision in noteRevisionsForNote)
                    {
                        L3NO_GNwUiCoiC_1032d noteRevisionInfo = new L3NO_GNwUiCoiC_1032d();
                        noteRevisionInfo.NoteRevisionID         = noteRevision.CMN_NoteRevisionID;
                        noteRevisionInfo.NoteRevisionContent    = noteRevision.Content;
                        noteRevisionInfo.NoteRevisionCreatedOn  = noteRevision.Creation_Timestamp;
                        noteRevisionInfo.NoteRevisionModifiedOn = noteRevision.Modification_Timestamp;
                        noteRevisionInfo.NoteRevisionTitle      = noteRevision.Title;
                        noteRevisionInfo.NoteRevisionVersion    = noteRevision.Version;
                        noteRevisionInfo.NoteRevisionCreatorID  = noteRevision.CreatedBy_BusinessParticipant_RefID;

                        var revisionCreator = ORM_CMN_BPT_BusinessParticipant.Query.Search(Connection, Transaction, new ORM_CMN_BPT_BusinessParticipant.Query()
                        {
                            //TODO: For future publish,if creator business participant is deleted, do not display his name and offer collaborators option to delete note revision and note
                            Tenant_RefID = securityTicket.TenantID,
                            CMN_BPT_BusinessParticipantID = noteRevision.CreatedBy_BusinessParticipant_RefID
                        }).SingleOrDefault();
                        if (revisionCreator != null)
                        {
                            noteRevisionInfo.NoteRevisionCreatorFirstAndLastName = revisionCreator.DisplayName;
                        }
                        noteRevisionsInfo.Add(noteRevisionInfo);
                    }
                    note.NoteRevisionInfo = noteRevisionsInfo.ToArray();

                    var NoteCreator = ORM_CMN_BPT_BusinessParticipant.Query.Search(Connection, Transaction, new ORM_CMN_BPT_BusinessParticipant.Query()
                    {
                        //TODO: For future publish,if creator business participant is deleted, do not display his name and offer collaborators option to delete note
                        CMN_BPT_BusinessParticipantID = item.CreatedBy_BusinessParticipant_RefID,
                        Tenant_RefID = securityTicket.TenantID
                    }).SingleOrDefault();
                    L3NO_GNwUiCoiC_1032e noteCreator = new L3NO_GNwUiCoiC_1032e();
                    ORM_USR_Account      user        = ORM_USR_Account.Query.Search(Connection, Transaction, new ORM_USR_Account.Query()
                    {
                        BusinessParticipant_RefID = item.CreatedBy_BusinessParticipant_RefID,
                        IsDeleted    = false,
                        Tenant_RefID = securityTicket.TenantID
                    }).SingleOrDefault();
                    if (user != null)
                    {
                        noteCreator.CreatorID = user.USR_AccountID;
                        P_L2AI_GAPIfAI_1627 personalInfoParameter = new P_L2AI_GAPIfAI_1627();
                        personalInfoParameter.AccountRefID = user.USR_AccountID;
                        var personalInfoForUser = cls_Get_Account_PersonalInformation_for_AccountID.Invoke(Connection, Transaction, personalInfoParameter, securityTicket).Result;
                        if (personalInfoForUser != null)
                        {
                            noteCreator.CreatorFirstAndLastName = personalInfoForUser.FirstName + " " + personalInfoForUser.LastName;
                        }
                    }
                    note.NoteCreatorInfo = noteCreator;
                    note.LastEdited      = item.Modification_Timestamp;
                    note.CreatedOn       = item.Creation_Timestamp;
                    notes.Add(note);
                }
            }
            #endregion
            //************************************************************************************************//
            #region GETTING NOTES WHERE USER IS COLLABORATOR

            var ProjectNotesWhereCurrentUserIsCollaborator = cls_Get_All_ProjectNotes_Where_Current_User_is_Collaborator.Invoke(Connection, Transaction, securityTicket).Result.ToList();
            foreach (var item in ProjectNotesWhereCurrentUserIsCollaborator)
            {
                L3NO_GNwUiCoiC_1032 note = new L3NO_GNwUiCoiC_1032();
                note.NoteID = item.CMN_NoteID;
                //setting project info
                L3NO_GNwUiCoiC_1032c projectInfo = new L3NO_GNwUiCoiC_1032c();

                projectInfo.ProjectID = item.Project_RefID;
                ORM_TMS_PRO_Project project = ORM_TMS_PRO_Project.Query.Search(Connection, Transaction, new ORM_TMS_PRO_Project.Query()
                {
                    Tenant_RefID      = securityTicket.TenantID,
                    TMS_PRO_ProjectID = item.Project_RefID,
                    IsDeleted         = false
                }).SingleOrDefault();
                if (project != null)
                {
                    projectInfo.ProjectName = project.Name;
                    note.ProjectInfo        = projectInfo;
                    note.ProjectNoteID      = item.TMS_PRO_Project_NoteID;
                    note.CurrentVersionID   = item.Current_NoteRevision_RefID;
                    //setting collaborators info
                    List <L3NO_GNwUiCoiC_1032a> collaboratorsInfo = new List <L3NO_GNwUiCoiC_1032a>();

                    var collaboratorsForProjectNoteID = ORM_TMS_PRO_Project_Note_Collaborators.Query.Search(Connection, Transaction, new ORM_TMS_PRO_Project_Note_Collaborators.Query()
                    {
                        Tenant_RefID      = securityTicket.TenantID,
                        ProjectNote_RefID = item.TMS_PRO_Project_NoteID,
                        IsDeleted         = false
                    });

                    foreach (var collaborator in collaboratorsForProjectNoteID)
                    {
                        L3NO_GNwUiCoiC_1032a collInfo = new L3NO_GNwUiCoiC_1032a();
                        collInfo.AccountID      = collaborator.Account_RefID;
                        collInfo.CollaboratorID = collaborator.TMS_PRO_Project_Note_CollaboratorID;

                        P_L2AI_GAPIfAI_1627 userParameter = new P_L2AI_GAPIfAI_1627();
                        userParameter.AccountRefID = collaborator.Account_RefID;
                        var userinfo = cls_Get_Account_PersonalInformation_for_AccountID.Invoke(Connection, Transaction, userParameter, securityTicket).Result;
                        collInfo.FirstAndLastName = userinfo.FirstName + " " + userinfo.LastName;
                        collaboratorsInfo.Add(collInfo);
                    }
                    note.CollaboratorsInfo = collaboratorsInfo.ToArray();
                    //setting tags info
                    List <L3NO_GNwUiCoiC_1032b> tagsInfo      = new List <L3NO_GNwUiCoiC_1032b>();
                    P_L3N_GTfPNID_1415          tagsParameter = new P_L3N_GTfPNID_1415();
                    tagsParameter.ProjectNoteID = item.TMS_PRO_Project_NoteID;
                    var tagsForProjectNoteID = cls_Get_Tags_for_ProjectNoteID.Invoke(Connection, Transaction, tagsParameter, securityTicket).Result.ToList();
                    foreach (var tag in tagsForProjectNoteID)
                    {
                        L3NO_GNwUiCoiC_1032b tagInfo = new L3NO_GNwUiCoiC_1032b();
                        tagInfo.TagID    = tag.TMS_PRO_TagID;
                        tagInfo.TagValue = tag.TagValue;
                        tagsInfo.Add(tagInfo);
                    }
                    note.TagsInfo = tagsInfo.ToArray();
                    //setting current note version
                    var lastnoterevision = ORM_CMN_NoteRevision.Query.Search(Connection, Transaction, new ORM_CMN_NoteRevision.Query()
                    {
                        Tenant_RefID       = securityTicket.TenantID,
                        CMN_NoteRevisionID = item.Current_NoteRevision_RefID,
                        IsDeleted          = false
                    });
                    if (lastnoterevision != null && lastnoterevision.Count != 0)
                    {
                        note.NoteVersion = lastnoterevision.First().Version.ToString();
                    }
                    else
                    {
                        note.NoteVersion = "1";
                    }
                    //setting all note revisions
                    List <L3NO_GNwUiCoiC_1032d> noteRevisionsInfo = new List <L3NO_GNwUiCoiC_1032d>();

                    P_L3N_GNRfNID_1559 revisionsParameter = new P_L3N_GNRfNID_1559();
                    revisionsParameter.NoteID = item.CMN_NoteID;
                    var noteRevisionsForNote = cls_Get_NoteRevisions_for_NoteID.Invoke(Connection, Transaction, revisionsParameter, securityTicket).Result.ToList();
                    foreach (var noteRevision in noteRevisionsForNote)
                    {
                        L3NO_GNwUiCoiC_1032d noteRevisionInfo = new L3NO_GNwUiCoiC_1032d();
                        noteRevisionInfo.NoteRevisionID         = noteRevision.CMN_NoteRevisionID;
                        noteRevisionInfo.NoteRevisionContent    = noteRevision.Content;
                        noteRevisionInfo.NoteRevisionCreatedOn  = noteRevision.Creation_Timestamp;
                        noteRevisionInfo.NoteRevisionModifiedOn = noteRevision.Modification_Timestamp;
                        noteRevisionInfo.NoteRevisionTitle      = noteRevision.Title;
                        noteRevisionInfo.NoteRevisionVersion    = noteRevision.Version;
                        noteRevisionInfo.NoteRevisionCreatorID  = noteRevision.CreatedBy_BusinessParticipant_RefID;

                        var revisionCreator = ORM_CMN_BPT_BusinessParticipant.Query.Search(Connection, Transaction, new ORM_CMN_BPT_BusinessParticipant.Query()
                        {
                            IsDeleted = false,
                            CMN_BPT_BusinessParticipantID = noteRevision.CreatedBy_BusinessParticipant_RefID
                        }).SingleOrDefault();
                        if (revisionCreator != null)
                        {
                            noteRevisionInfo.NoteRevisionCreatorFirstAndLastName = revisionCreator.DisplayName;
                        }
                        noteRevisionsInfo.Add(noteRevisionInfo);
                    }
                    note.NoteRevisionInfo = noteRevisionsInfo.ToArray();

                    var NoteCreator = ORM_CMN_BPT_BusinessParticipant.Query.Search(Connection, Transaction, new ORM_CMN_BPT_BusinessParticipant.Query()
                    {
                        IsDeleted = false,
                        CMN_BPT_BusinessParticipantID = item.CreatedBy_BusinessParticipant_RefID
                    }).SingleOrDefault();
                    L3NO_GNwUiCoiC_1032e noteCreator = new L3NO_GNwUiCoiC_1032e();
                    ORM_USR_Account      user        = ORM_USR_Account.Query.Search(Connection, Transaction, new ORM_USR_Account.Query()
                    {
                        BusinessParticipant_RefID = item.CreatedBy_BusinessParticipant_RefID,
                        IsDeleted    = false,
                        Tenant_RefID = securityTicket.TenantID
                    }).SingleOrDefault();
                    if (user != null)
                    {
                        noteCreator.CreatorID = user.USR_AccountID;
                        P_L2AI_GAPIfAI_1627 personalInfoParameter = new P_L2AI_GAPIfAI_1627();
                        personalInfoParameter.AccountRefID = user.USR_AccountID;
                        var personalInfoForUser = cls_Get_Account_PersonalInformation_for_AccountID.Invoke(Connection, Transaction, personalInfoParameter, securityTicket).Result;
                        if (personalInfoForUser != null)
                        {
                            noteCreator.CreatorFirstAndLastName = personalInfoForUser.FirstName + " " + personalInfoForUser.LastName;
                        }
                    }

                    note.NoteCreatorInfo = noteCreator;
                    note.LastEdited      = item.Modification_Timestamp;
                    note.CreatedOn       = item.Creation_Timestamp;
                    notes.Add(note);
                }
            }

            #endregion
            //************************************************************************************************//
            returnValue.Result = notes.ToArray();

            return(returnValue);

            #endregion UserCode
        }
Beispiel #8
0
        protected static FR_Bool Execute(DbConnection Connection, DbTransaction Transaction, P_L3FE_SPF_1527 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_Bool();

            ORM_TMS_PRO_Feature       Feature       = new ORM_TMS_PRO_Feature();
            ORM_TMS_PRO_Project       Project       = new ORM_TMS_PRO_Project();
            ORM_TMS_PRO_ProjectMember ProjectMember = new ORM_TMS_PRO_ProjectMember();


            foreach (P_L3FE_SPF_1527a asgn in Parameter.Assignments)
            {
                var  item            = new ORM_TMS_PRO_Peers_Feature();
                Guid projectMemberID = Guid.Empty;

                if (asgn.AssignmentID != Guid.Empty)
                {
                    var result = item.Load(Connection, Transaction, asgn.AssignmentID);
                    if (result.Status != FR_Status.Success || item.AssignmentID == Guid.Empty)
                    {
                        var error = new FR_Bool(false);
                        error.ErrorMessage = "No Such ID";
                        error.Status       = FR_Status.Error_Internal;
                        return(error);
                    }

                    projectMemberID = item.ProjectMember_RefID;
                }

                if (asgn.IsDeleted == true)
                {
                    item.IsDeleted = true;
                }

                //Creation specific parameters (Tenant, Account ... )
                if (asgn.AssignmentID == Guid.Empty)
                {
                    item.Tenant_RefID        = securityTicket.TenantID;
                    item.ProjectMember_RefID = Parameter.AssignedBy_ProjectMemberID;
                }

                item.Feature_RefID = Parameter.Feature_RefID;

                item.ProjectMember_RefID = asgn.ProjectMember_RefID;

                item.Save(Connection, Transaction);


                #region SubItems

                var task2featureQuery = new ORM_TMS_PRO_Feature_2_DeveloperTask.Query();
                task2featureQuery.Feature_RefID = item.Feature_RefID;

                var         task2feature = ORM_TMS_PRO_Feature_2_DeveloperTask.Query.Search(Connection, Transaction, task2featureQuery);
                List <Guid> taskIds      = task2feature.Select(t => t.DeveloperTask_RefID).Distinct().ToList();

                foreach (Guid currentTask in taskIds)
                {
                    P_L3DT_SPDT_1644 subscribeParam = new P_L3DT_SPDT_1644();
                    subscribeParam.DeveloperTask_RefID = currentTask;

                    P_L3DT_SPDT_1644a assignment = new P_L3DT_SPDT_1644a();

                    if (asgn.IsDeleted)
                    {
                        P_L3DT_GDTIaSfDT_1654 dtaskParam = new P_L3DT_GDTIaSfDT_1654();
                        dtaskParam.DTaskID = currentTask;
                        dtaskParam.IsBeingPrepared_Only = false;
                        FR_L3DT_GDTIaSfDT_1654 dtasKResult = cls_Get_DeveloperTaskInfo_and_Subscriptions_for_DTaskID.Invoke(Connection, Transaction, dtaskParam, securityTicket);
                        if (dtasKResult != null && dtasKResult.Result != null)
                        {
                            assignment.AssignmentID = dtasKResult.Result.PeersDevelopmentAssignmentID;
                            assignment.IsDeleted    = true;
                        }
                    }

                    else
                    {
                        subscribeParam.AssignedBy_ProjectMemberID = Parameter.AssignedBy_ProjectMemberID;
                        assignment.ProjectMember_RefID            = asgn.ProjectMember_RefID;
                    }
                    subscribeParam.Assignments = new P_L3DT_SPDT_1644a[] { assignment };
                    cls_Save_TMS_PRO_Peers_Development.Invoke(Connection, Transaction, subscribeParam, securityTicket);
                }



                #endregion
            }



            return(returnValue);

            #endregion UserCode
        }
Beispiel #9
0
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L6DT_ADTbD_1314 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            //Leave UserCode region to enable user code saving
            #region UserCode
            var returnValue = new FR_Guid();

            #region Assigned

            var assignedParam = new P_L2DT_GDTSfGPM_1121();
            assignedParam.GlobalPropertyMatchingID = EnumUtils.GetEnumDescription(EDeveloperTaskHistory.Assigned);

            var assignedID = cls_Get_DeveloperTaskStatus_for_GlobalPropertyMatchingID.Invoke(Connection, Transaction, assignedParam, securityTicket).Result;

            #endregion

            #region GetProjectMemeberID and AssignmentID
            P_L3DT_GPMaAfDTaA_1326 param1 = new P_L3DT_GPMaAfDTaA_1326();
            param1.DTaskID = Parameter.DeveloperTask_RefID;

            L3DT_GPMaAfDTaA_1326 result1 = cls_Get_ProjectMemberID_and_AssignmentID_for_DTaskID_and_AccountID.Invoke(Connection, Transaction, param1, securityTicket).Result;
            #endregion

            #region ORM_DeveloperTask_2_ProjectMember

            #region cls_Get_AssignedTaskCount_for_Account

            L3DT_GATCfA_1333 result2 = cls_Get_AssignedTaskCount_for_Account.Invoke(Connection, Transaction, securityTicket).Result;

            if (result2 == null)
            {
                result2           = new L3DT_GATCfA_1333();
                result2.TaskCount = 0;
            }

            #endregion

            var assignItem = new ORM_TMS_PRO_DeveloperTask_Involvement();
            if (result1.TMS_PRO_DeveloperTask_InvolvementID != Guid.Empty)
            {
                assignItem.Load(Connection, Transaction, result1.TMS_PRO_DeveloperTask_InvolvementID);
            }
            else
            {
                assignItem.TMS_PRO_DeveloperTask_InvolvementID = Guid.NewGuid();
                assignItem.Tenant_RefID = securityTicket.TenantID;
            }
            assignItem.ProjectMember_RefID = result1.TMS_PRO_ProjectMemberID;
            assignItem.DeveloperTask_RefID = Parameter.DeveloperTask_RefID;
            assignItem.OrderSequence       = result2.TaskCount + 1;
            assignItem.IsActive            = false;
            assignItem.IsArchived          = false;
            assignItem.IsDeleted           = false;
            assignItem.Developer_CompletionTimeEstimation_min = Parameter.Developer_TimeEstimation_min;

            assignItem.Save(Connection, Transaction);

            #endregion

            #region ORM_TMS_PRO_DeveloperTask

            var developerTask = new ORM_TMS_PRO_DeveloperTask();
            if (Parameter.DeveloperTask_RefID != Guid.Empty)
            {
                developerTask.Load(Connection, Transaction, Parameter.DeveloperTask_RefID);
            }

            developerTask.GrabbedByMember_RefID = result1.TMS_PRO_ProjectMemberID;

            developerTask.Save(Connection, Transaction);

            #endregion

            #region ORM_DeveloperTask_StatusHistory

            ORM_TMS_PRO_DeveloperTask_StatusHistory statusHistory = new ORM_TMS_PRO_DeveloperTask_StatusHistory();

            statusHistory.DeveloperTask_RefID             = Parameter.DeveloperTask_RefID;
            statusHistory.DeveloperTask_Status_RefID      = assignedID.TMS_PRO_DeveloperTask_StatusID;
            statusHistory.TriggeredBy_ProjectMember_RefID = result1.TMS_PRO_ProjectMemberID;
            statusHistory.CreatedFor_ProjectMember_RefID  = Guid.Empty;
            statusHistory.Comment      = "Estimated time: " + Parameter.Developer_TimeEstimation_min + "[min]";
            statusHistory.Tenant_RefID = securityTicket.TenantID;

            statusHistory.Save(Connection, Transaction);

            #endregion ORM_DeveloperTask_StatusHistory

            #region projectInfo

            var project = new ORM_TMS_PRO_Project();
            project.Load(Connection, Transaction, developerTask.Project_RefID);

            ORM_TMS_PRO_Project_Status ProjectStatus = new ORM_TMS_PRO_Project_Status();
            ProjectStatus.Load(Connection, Transaction, project.Status_RefID);

            Guid   language    = Parameter.LanguageID;
            String statusLabel = ProjectStatus.Label.GetContent(language);
            String projectName = project.Name.GetContent(language);

            #endregion

            returnValue.Result = assignItem.TMS_PRO_DeveloperTask_InvolvementID;

            #region MailSandout

            //try
            //{


            //    L3US_GAAPI_1057 userInfo = cls_Get_ActiveAccount_PersonalInformation.Invoke(Connection, Transaction, securityTicket).Result;
            //    String frontHost = WebConfigurationManager.AppSettings["FrontHost"].ToString();
            //    String seeDetailsLink = String.Format((String)HttpContext.GetGlobalResourceObject("Global", "Mail_br_and_link"), frontHost, "DTask", developerTask.TMS_PRO_DeveloperTaskID);
            //    String unsubscribeLink = String.Format((String)HttpContext.GetGlobalResourceObject("Global", "Mail_Unsubscribe_Link"), frontHost, "dtask", developerTask.TMS_PRO_DeveloperTaskID.ToString());
            //    String subject = String.Format((String)HttpContext.GetGlobalResourceObject("Global", "Mail_AssignDeveloperTaskByDeveloper_subject"), projectName, statusLabel, developerTask.IdentificationNumber, developerTask.Name);

            //    P_L3DT_GPfDT_1659 prm = new P_L3DT_GPfDT_1659();
            //    prm.DTaskID = developerTask.TMS_PRO_DeveloperTaskID;

            //    List<L3DT_GPfDT_1659> ress = cls_Get_Peers_for_DTaskID.Invoke(Connection, Transaction, prm, securityTicket).Result.ToList();

            //    P_L3US_GUIfA_1241 usParameter = new P_L3US_GUIfA_1241();
            //    usParameter.UserAccountID = securityTicket.AccountID;
            //    L3US_GUIfA_1241 emailInfo = cls_Get_UserInformation_for_AccountID.Invoke(Connection, Transaction, usParameter, securityTicket).Result;

            //    MailMessage mail = DanuTaskMailGenerator.formatMailMessage(false, false, EnumMailTypes.DTask);

            //    foreach (var x in ress.Select(s => s.PrimaryEmail).Distinct())
            //    {
            //        if (!mail.To.Contains(new MailAddress(x)))
            //            mail.To.Add(x);
            //    }

            //    mail.Subject = subject;
            //    mail.Body = mail.Body.Replace("{ProjectName}", projectName);
            //    mail.Body = mail.Body.Replace("{Role}", String.Format((String)HttpContext.GetGlobalResourceObject("Global", "Developer")));
            //    mail.Body = mail.Body.Replace("{status}", statusLabel);
            //    mail.Body = mail.Body.Replace("{DTaskNumber}", "D" + developerTask.IdentificationNumber);
            //    mail.Body = mail.Body.Replace("{DTaskName}", developerTask.Name);
            //    mail.Body = mail.Body.Replace("{action}", String.Format((String)HttpContext.GetGlobalResourceObject("Global", "Mail_DTask_AssignedbyDeveloper")));
            //    mail.Body = mail.Body.Replace("{FirstName}", userInfo.FirstName);
            //    mail.Body = mail.Body.Replace("{LastName}", userInfo.LastName);
            //    mail.Body = mail.Body.Replace("{userName}", userInfo.Username);
            //    mail.Body = mail.Body.Replace("{UserFullName}", userInfo.FirstName + " " + userInfo.LastName);
            //    mail.Body = mail.Body.Replace("{bodyText}", String.Format((String)HttpContext.GetGlobalResourceObject("Global", "Mail_DTask_AssignedDTask")) + " " + developerTask.Name + String.Format((String)HttpContext.GetGlobalResourceObject("Global", "Mail_inProject")) + " " + projectName + String.Format((String)HttpContext.GetGlobalResourceObject("Global", "Mail_DTaskAssignedToHimself")));
            //    DateTime dateToDisplay = DateTime.Now;
            //    mail.Body = mail.Body.Replace("{date}", dateToDisplay.ToShortDateString());
            //    mail.Body = mail.Body.Replace("{time}", dateToDisplay.ToShortTimeString());
            //    mail.Body = mail.Body.Replace("{itemType}", String.Format((String)HttpContext.GetGlobalResourceObject("Global", "Mail_DeveloperTask")));
            //    mail.Body = mail.Body.Replace("{ItemName}", developerTask.Name);
            //    mail.Body = mail.Body.Replace("$$$seeDetailsLink$$$", seeDetailsLink);
            //    mail.Body = mail.Body.Replace("$$$unsubscribeLink$$$", unsubscribeLink);
            //    if (mail.To.Count > 0)
            //    {
            //        SmtpClient smtpClient = new SmtpClient();
            //        smtpClient.Send(mail);
            //    }
            //}
            //catch
            //{

            //}

            #endregion

            return(returnValue);

            #endregion UserCode
        }
        protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L6DT_DDTbD_0958 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

            #region Deassigned

            var deassignedParam = new P_L2DT_GDTSfGPM_1121();
            deassignedParam.GlobalPropertyMatchingID = EnumUtils.GetEnumDescription(EDeveloperTaskHistory.Deassigned);

            var deassignedID = cls_Get_DeveloperTaskStatus_for_GlobalPropertyMatchingID.Invoke(Connection, Transaction, deassignedParam, securityTicket).Result;

            #endregion

            #region Delete Assignement

            ORM_TMS_PRO_DeveloperTask_Involvement assignment = new ORM_TMS_PRO_DeveloperTask_Involvement();
            assignment.Load(Connection, Transaction, Parameter.AssigmentID);
            assignment.IsActive  = false;
            assignment.IsDeleted = true;

            assignment.Save(Connection, Transaction);

            #endregion

            #region Update Developer Task

            ORM_TMS_PRO_DeveloperTask task = new ORM_TMS_PRO_DeveloperTask();
            task.Load(Connection, Transaction, assignment.DeveloperTask_RefID);

            task.GrabbedByMember_RefID = Guid.Empty;

            task.Save(Connection, Transaction);

            #endregion

            #region Create Developer Task Status History

            ORM_TMS_PRO_DeveloperTask_StatusHistory statusHistory = new ORM_TMS_PRO_DeveloperTask_StatusHistory();

            statusHistory.TMS_PRO_DeveloperTask_StatusHistoryID = Guid.NewGuid();
            statusHistory.DeveloperTask_RefID             = assignment.DeveloperTask_RefID;
            statusHistory.DeveloperTask_Status_RefID      = deassignedID.TMS_PRO_DeveloperTask_StatusID;
            statusHistory.TriggeredBy_ProjectMember_RefID = assignment.ProjectMember_RefID;
            statusHistory.CreatedFor_ProjectMember_RefID  = Guid.Empty;
            statusHistory.Comment            = "Task has been deasigned.";
            statusHistory.Creation_Timestamp = DateTime.Now.AddSeconds(6);
            statusHistory.Tenant_RefID       = securityTicket.TenantID;

            statusHistory.Save(Connection, Transaction);

            #endregion

            #region projectInfo

            var project = new ORM_TMS_PRO_Project();
            project.Load(Connection, Transaction, task.Project_RefID);

            ORM_TMS_PRO_Project_Status ProjectStatus = new ORM_TMS_PRO_Project_Status();
            ProjectStatus.Load(Connection, Transaction, project.Status_RefID);

            Guid   language    = Parameter.LanguageID;
            String statusLabel = ProjectStatus.Label.GetContent(language);
            String projectName = project.Name.GetContent(language);


            #endregion
            //TO DO:
            #region MailSandout

            //try
            //{


            //    var dt2pm = new ORM_TMS_PRO_DeveloperTask_Involvement();
            //    dt2pm.Load(Connection, Transaction, Parameter.AssigmentID);

            //    var projectMember = new ORM_TMS_PRO_ProjectMember();
            //    projectMember.Load(Connection, Transaction, dt2pm.ProjectMember_RefID);

            //    P_L3US_GUIfA_1241 userParam = new P_L3US_GUIfA_1241();
            //    userParam.UserAccountID = projectMember.USR_Account_RefID;

            //    L3US_GUIfA_1241 devInfo = cls_Get_UserInformation_for_AccountID.Invoke(Connection, Transaction, userParam, securityTicket).Result;

            //    String frontHost = WebConfigurationManager.AppSettings["FrontHost"].ToString();
            //    String unsubscribeLink = String.Format((String)HttpContext.GetGlobalResourceObject("Global", "Mail_Unsubscribe_Link"), frontHost, "dtask", task.TMS_PRO_DeveloperTaskID.ToString());
            //    String seeDetailsLink = String.Format((String)HttpContext.GetGlobalResourceObject("Global", "Mail_br_and_link"), frontHost, "DTask", task.TMS_PRO_DeveloperTaskID);
            //    String subject = String.Format((String)HttpContext.GetGlobalResourceObject("Global", "Mail_DeasignDeveloperTask_subject"), projectName, statusLabel, task.IdentificationNumber, task.Name);
            //    P_L3DT_GPfDT_1659 prm = new P_L3DT_GPfDT_1659();
            //    prm.DTaskID = task.TMS_PRO_DeveloperTaskID;


            //    List<L3DT_GPfDT_1659> ress = cls_Get_Peers_for_DTaskID.Invoke(Connection, Transaction, prm, securityTicket).Result.ToList();

            //    P_L3US_GUIfA_1241 usParameter = new P_L3US_GUIfA_1241();
            //    usParameter.UserAccountID = securityTicket.AccountID;
            //    L3US_GUIfA_1241 emailInfo = cls_Get_UserInformation_for_AccountID.Invoke(Connection, Transaction, usParameter, securityTicket).Result;

            //    MailMessage mail = DanuTaskMailGenerator.formatMailMessage(true, false, EnumMailTypes.DTask);

            //    foreach (var x in ress.Select(s => s.PrimaryEmail).Distinct())
            //    {
            //        if (!mail.To.Contains(new MailAddress(x)))
            //            mail.To.Add(x);
            //    }

            //    mail.Subject = subject;
            //    mail.Body = mail.Body.Replace("{ProjectName}", projectName);
            //    mail.Body = mail.Body.Replace("{Role}", String.Format((String)HttpContext.GetGlobalResourceObject("Global", "Developer")));
            //    mail.Body = mail.Body.Replace("{status}", statusLabel);
            //    mail.Body = mail.Body.Replace("{DTaskNumber}", "D" + task.IdentificationNumber);
            //    mail.Body = mail.Body.Replace("{DTaskName}", task.Name);
            //    mail.Body = mail.Body.Replace("{action}", String.Format((String)HttpContext.GetGlobalResourceObject("Global", "Mail_DTask_Deassigned")));
            //    mail.Body = mail.Body.Replace("{FirstName}", devInfo.FirstName);
            //    mail.Body = mail.Body.Replace("{LastName}", devInfo.LastName);
            //    mail.Body = mail.Body.Replace("{userName}", devInfo.Username);
            //    mail.Body = mail.Body.Replace("{bodyText}", String.Format((String)HttpContext.GetGlobalResourceObject("Global", "Mail_DTask_DeassignedDTask")) + " " + task.Name + String.Format((String)HttpContext.GetGlobalResourceObject("Global", "Mail_inProject")) + " " + projectName + " " + String.Format((String)HttpContext.GetGlobalResourceObject("Global", "Mail_Dtask_Deassigned_to")));
            //    mail.Body = mail.Body.Replace("{UserFullName}", devInfo.FirstName + " " + devInfo.LastName);
            //    DateTime dateToDisplay = DateTime.Now;
            //    mail.Body = mail.Body.Replace("{date}", dateToDisplay.ToShortDateString());
            //    mail.Body = mail.Body.Replace("{time}", dateToDisplay.ToShortTimeString());
            //    mail.Body = mail.Body.Replace("{itemType}", String.Format((String)HttpContext.GetGlobalResourceObject("Global", "Mail_DeveloperTask")));
            //    mail.Body = mail.Body.Replace("{ItemName}", task.Name);
            //    mail.Body = mail.Body.Replace("{commentText}", "Task has been deasigned.");
            //    mail.Body = mail.Body.Replace("$$$seeDetailsLink$$$", seeDetailsLink);
            //    mail.Body = mail.Body.Replace("$$$unsubscribeLink$$$", unsubscribeLink);
            //    if (mail.To.Count > 0)
            //    {
            //        SmtpClient smtpClient = new SmtpClient();
            //        smtpClient.Send(mail);
            //    }
            //}
            //catch
            //{

            //}

            #endregion

            return(returnValue);

            #endregion UserCode
        }