Пример #1
0
 public async void Check_Matter_Exists()
 {
     var matterMetadataVM = new MatterMetdataVM()
     {
         Client = new Client()
         {
             Url = "https://msmatter.sharepoint.com/sites/microsoft"
         },
         Matter = new Matter()
         {
             Name = "New Matter",
             MatterGuid = "e224f0ba891492dc05bf97d73f8b2934"
         },
         HasErrorOccurred = false
     };
     using (var testClient = testServer.CreateClient().AcceptJson())
     {
         var response = await testClient.PostAsJsonAsync("http://localhost:58775/api/v1/matter/checkmatterexists", matterMetadataVM);
         var result = response.Content.ReadAsJsonAsync<GenericResponseVM>().Result;
         Assert.NotNull(result);
     }
 }
Пример #2
0
        public async void Create_Matter()
        {
            #region Create Matter Data
            string matterGuid = "1C0B1194EBF746DE829B8432A130EED3";

            var userIds = new List<string>();
            userIds.Add("txtAssign1");

            var blockUserNames = new List<string>();
            blockUserNames.Add("*****@*****.**");

            var assignUserNames = new List<IList<string>>();
            var userNames = new List<string>();
            userNames.Add("Premchand peddakotla");
            userNames.Add("");
            assignUserNames.Add(userNames);


            var assignUserEmails = new List<IList<string>>();
            var userEmails = new List<string>();
            userEmails.Add("*****@*****.**");
            userEmails.Add("");
            assignUserEmails.Add(userNames);

            var roles = new List<string>();
            roles.Add("Responsible Attorney");

            var folderNames = new List<string>();
            folderNames.Add("Emails");
            folderNames.Add("Documents");


            var matterMetaDataVM = new MatterMetdataVM()
            {
                Matter = new Matter()
                {
                    Name = "Matter For Debugging Unit",
                    Id = "Debug12341",
                    Description = "Matter for debugging Unit",
                    Conflict = new Conflict()
                    {
                        Identified = "True",
                        CheckBy = "*****@*****.**",
                        CheckOn = "05/03/2016",
                        SecureMatter = "True"
                    },
                    BlockUserNames = blockUserNames,
                    AssignUserNames = assignUserNames,
                    AssignUserEmails = assignUserEmails,
                    Roles = roles,
                    MatterGuid = matterGuid,
                    FolderNames = folderNames
                },
                Client = new Client()
                {
                    Id = "100001",
                    Name = "Microsoft",
                    Url = "https://msmatter.sharepoint.com/sites/microsoft"
                },
                MatterConfigurations = new MatterConfigurations()
                {
                    IsConflictCheck = true,
                    IsMatterDescriptionMandatory = true,
                    IsCalendarSelected = true,
                    IsTaskSelected = true
                },
                UserIds = userIds
            };
            #endregion

            #region Assign Content Type
            var contentTypes = new List<string>();
            contentTypes.Add("Copyright");
            contentTypes.Add("Patent");


            var assignContentTypeMetadata = new MatterMetadata()
            {
                Matter = new Matter()
                {
                    Name = "Matter For Debugging Unit",
                    Id = "Debug12341",
                    ContentTypes = contentTypes,
                    DefaultContentType = "Copyright",
                    MatterGuid =  matterGuid
                },
                Client = new Client()
                {
                    Url= "https://msmatter.sharepoint.com/sites/microsoft",
                    Name="Microsoft",
                    Id = "100001"
                },
                PracticeGroupTerm = new PracticeGroupTerm()
                {
                    TermName= "Litigation",
                    Id= "084887e6-3705-466c-823b-207563388464"
                },
                AreaTerm = new AreaTerm()
                {
                    TermName= "Intellectual Property",
                    Id= "162fb199-2f04-498d-a7ac-329a077bca9f"
                },
                SubareaTerm = new SubareaTerm()
                {
                    TermName = "Copyright",
                    Id = "15c5b16c-150b-4bf5-8470-59dfa951dcf8"
                }

            };

            #endregion

            #region Assign User Permission
            var permissions = new List<string>();
            permissions.Add("Full Control");


            var assignUserPermissionMetadataVM = new MatterMetdataVM()
            {
                Client = new Client()
                {
                    Url= "https://msmatter.sharepoint.com/sites/microsoft"
                },
                Matter = new Matter()
                {
                    Name= "Matter For Debugging Unit",
                    Permissions= permissions,
                    AssignUserNames= assignUserNames,
                    AssignUserEmails= assignUserEmails,
                    MatterGuid = matterGuid
                },
                MatterConfigurations = new MatterConfigurations()
                {
                    IsCalendarSelected = true,
                    IsTaskSelected = true
                }
            };
            #endregion

            #region Create Matter Landing Page
            var createMatterLandingPage = new MatterMetdataVM()
            {
                Client = new Client()
                {
                    Url = "https://msmatter.sharepoint.com/sites/microsoft"
                },
                MatterConfigurations = new MatterConfigurations()
                {
                    IsConflictCheck = true,
                    IsMatterDescriptionMandatory = true,
                    IsCalendarSelected = true,
                    IsRSSSelected = true,
                    IsTaskSelected = true
                },
                Matter = new Matter()
                {
                    Name = "Matter For Debugging Unit",                    
                    Description = "Matter for debugging Unit",
                    AssignUserNames = assignUserNames,
                    AssignUserEmails = assignUserEmails,
                    BlockUserNames = blockUserNames,
                    Conflict = new Conflict()
                    {
                        Identified = "True",
                        CheckBy = "*****@*****.**",
                        CheckOn = "05/03/2016",
                        SecureMatter = "True"
                    },
                    Permissions = permissions,
                    MatterGuid = matterGuid                    
                }
            };
            #endregion

            #region Update Matter Metadata
            
            var ct = new List<string>();
            ct.Add("Copyright");
            ct.Add("");

            var uploadBlockedUsers = new List<string>();
            var docTemplateCount = new List<string>();
            docTemplateCount.Add("1");

            var matterMetadata = new MatterMetdataVM()
            {
                Client = new Client()
                {
                    Id = "100001",
                    Name = "Microsoft",
                    Url = "https://msmatter.sharepoint.com/sites/microsoft"
                },
                Matter = new Matter()
                {
                    Name = "Matter For Debugging Unit",
                    Id = "Debug12341",
                    Description = "Matter for debugging Unit",
                    Conflict = new Conflict()
                    {
                        Identified = "True",
                        CheckBy = "*****@*****.**",
                        CheckOn = "05/03/2016",
                        SecureMatter = "True"
                    },
                    BlockUserNames = blockUserNames,
                    AssignUserNames = assignUserNames,
                    AssignUserEmails = assignUserEmails,
                    Roles = roles,
                    MatterGuid = matterGuid,
                    ContentTypes= ct,
                    DefaultContentType= "Copyright",
                    Permissions= permissions,
                    DocumentTemplateCount= docTemplateCount
                },
                MatterConfigurations = new MatterConfigurations()
                {
                    IsConflictCheck=true,
                    IsMatterDescriptionMandatory=true
                },
                MatterDetails = new MatterDetails()
                {
                    //PracticeGroup = "Litigation;",
                    //AreaOfLaw= "Intellectual Property;",
                    //SubareaOfLaw= "Copyright;",
                    ResponsibleAttorney= "SaiKiran Gudala;",
                    ResponsibleAttorneyEmail= "[email protected];",
                    UploadBlockedUsers= uploadBlockedUsers,
                    TeamMembers= "SaiKiran Gudala;",
                    RoleInformation= "{\"Responsible Attorney\":\"Venkat M([email protected])\"}"
                },
                MatterProvisionFlags = new MatterProvisionFlags()
                {
                    SendEmailFlag = true,
                    MatterLandingFlag = "true"
                }
            };
            #endregion

            using (var testClient = testServer.CreateClient().AcceptJson())
            {
                var response = await testClient.PostAsJsonAsync("http://localhost:58775/api/v1/matter/create", matterMetaDataVM);
                var result = response.Content.ReadAsJsonAsync<GenericResponseVM>().Result;
                if(result.IsError==false)
                {
                    //Call Assign Content Type API
                    response = await testClient.PostAsJsonAsync("http://localhost:58775/api/v1/matter/assigncontenttype", assignContentTypeMetadata);
                    result = response.Content.ReadAsJsonAsync<GenericResponseVM>().Result;
                }

                if (result.IsError == false)
                {
                    //Call Assign Content Type API
                    response = await testClient.PostAsJsonAsync("http://localhost:58775/api/v1/matter/assignuserpermissions", assignUserPermissionMetadataVM);
                    result = response.Content.ReadAsJsonAsync<GenericResponseVM>().Result;
                }

                if (result.IsError == false)
                {
                    //Call Assign Content Type API
                    response = await testClient.PostAsJsonAsync("http://localhost:58775/api/v1/matter/createlandingpage", createMatterLandingPage);
                    result = response.Content.ReadAsJsonAsync<GenericResponseVM>().Result;
                }

                if (result.IsError == false)
                {
                    //Call Assign Content Type API
                    response = await testClient.PostAsJsonAsync("http://localhost:58775/api/v1/matter/UpdateMetadata", matterMetadata);
                    result = response.Content.ReadAsJsonAsync<GenericResponseVM>().Result;
                }
                Assert.NotNull(result);
            }
        }
Пример #3
0
        public GenericResponseVM CreateMatterLandingPage(MatterMetdataVM matterMetadataVM)
        {
            var client = matterMetadataVM.Client;
            var matter = matterMetadataVM.Matter;
            var matterConfigurations = matterMetadataVM.MatterConfigurations;
            GenericResponseVM genericResponseVM = null;
            int matterLandingPageId;
            var matterInformation = new MatterInformationVM()
            {
                Client = client,
                Matter = matter
            };

            genericResponseVM = validationFunctions.IsMatterValid(matterInformation, int.Parse(ServiceConstants.PROVISIONMATTER_MATTER_LANDING_PAGE), matterConfigurations);

            if (genericResponseVM != null)
            {
                return ServiceUtility.GenericResponse(genericResponseVM.Code, genericResponseVM.Value);
            }
            //// Create Matter Landing Web Part Page
            string pageName = string.Format(CultureInfo.InvariantCulture, "{0}{1}", matter.MatterGuid, ServiceConstants.ASPX_EXTENSION);
            using (ClientContext clientContext = spoAuthorization.GetClientContext(client.Url))
            {
                matterLandingPageId = matterRepositoy.CreateWebPartPage(clientContext, pageName, ServiceConstants.DefaultLayout,
                    ServiceConstants.MasterPageGallery, matterSettings.MatterLandingPageRepositoryName, matter.Name);
                if (0 <= matterLandingPageId)
                {
                    Uri uri = new Uri(client.Url);
                    SharePoint.Client.Web web = clientContext.Web;

                    bool isCopyRoleAssignment = CopyRoleAssignment(matter.Conflict.Identified, matter.Conflict.SecureMatter);
                    matterRepositoy.BreakItemPermission(clientContext, matterSettings.MatterLandingPageRepositoryName, matterLandingPageId, isCopyRoleAssignment);
                    matterRepositoy.SetItemPermission(clientContext, matter.AssignUserEmails, matterSettings.MatterLandingPageRepositoryName,
                        matterLandingPageId, matter.Permissions);
                    //// Configure All Web Parts
                    string[] webParts = matterRepositoy.ConfigureXMLCodeOfWebParts(client, matter, clientContext,
                        pageName, uri, web, matterConfigurations);
                    Microsoft.SharePoint.Client.File file = web.GetFileByServerRelativeUrl(string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{4}", uri.AbsolutePath, ServiceConstants.FORWARD_SLASH, matterSettings.MatterLandingPageRepositoryName.Replace(ServiceConstants.SPACE, string.Empty), ServiceConstants.FORWARD_SLASH, pageName));
                    clientContext.Load(file);
                    clientContext.ExecuteQuery();
                    LimitedWebPartManager limitedWebPartManager = file.GetLimitedWebPartManager(PersonalizationScope.Shared);
                    WebPartDefinition webPartDefinition = null;
                    string[] zones = { ServiceConstants.HEADER_ZONE, ServiceConstants.TOP_ZONE, ServiceConstants.RIGHT_ZONE, ServiceConstants.TOP_ZONE,
                        ServiceConstants.RIGHT_ZONE, ServiceConstants.RIGHT_ZONE, ServiceConstants.FOOTER_ZONE,
                        ServiceConstants.RIGHT_ZONE, ServiceConstants.RIGHT_ZONE };
                    matterRepositoy.AddWebPart(clientContext, limitedWebPartManager, webPartDefinition, webParts, zones);
                    return genericResponseVM;
                }
                else
                {
                    return ServiceUtility.GenericResponse(errorSettings.ErrorCodeMatterLandingPageExists, errorSettings.ErrorCodeMatterLandingPageExists);
                }
            }
        }
Пример #4
0
        private GenericResponseVM CreateMatter(ClientContext clientContext, MatterMetdataVM matterMetadataVM)
        {
            var client = matterMetadataVM.Client;
            var matter = matterMetadataVM.Matter;
            GenericResponseVM genericResponseVM = null;
            try
            {
                var matterConfiguration = matterMetadataVM.MatterConfigurations;
                Uri centralListURL = new Uri(string.Concat(generalSettings.CentralRepositoryUrl, ServiceConstants.FORWARD_SLASH,
                    ServiceConstants.LISTS, ServiceConstants.FORWARD_SLASH, listNames.DMSMatterListName)); // Central Repository List URL  
                IList<string> documentLibraryFolders = new List<string>();
                Dictionary<string, bool> documentLibraryVersioning = new Dictionary<string, bool>();
                Uri clientUrl = new Uri(client.Url);
                string matterOneNoteTitle = TrimMatterNameForOneNoteTitle(matter.Name);
                ListInformation listInformation = new ListInformation();
                listInformation.name = matter.Name;
                listInformation.description = matter.Description;
                listInformation.folderNames = matter.FolderNames;
                listInformation.isContentTypeEnable = true;
                listInformation.versioning = new VersioningInfo();
                listInformation.versioning.EnableVersioning = matterSettings.IsMajorVersionEnable;
                listInformation.versioning.EnableMinorVersions = matterSettings.IsMinorVersionEnable;
                listInformation.versioning.ForceCheckout = matterSettings.IsForceCheckOut;
                listInformation.Path = matter.MatterGuid;

                matterRepositoy.CreateList(clientContext, listInformation);

                documentLibraryVersioning.Add("EnableVersioning", false);
                documentLibraryFolders.Add(matterOneNoteTitle);
                listInformation.name = matter.Name + matterSettings.OneNoteLibrarySuffix;
                listInformation.folderNames = documentLibraryFolders;
                listInformation.versioning.EnableVersioning = false;
                listInformation.versioning.EnableMinorVersions = false;
                listInformation.versioning.ForceCheckout = false;
                listInformation.Path = matter.MatterGuid + matterSettings.OneNoteLibrarySuffix;
                matterRepositoy.CreateList(clientContext, listInformation);

                bool isCopyRoleAssignment = CopyRoleAssignment(matter.Conflict.Identified, matter.Conflict.SecureMatter);
                //create calendar list if create calendar flag is enabled and break its permissions
                string calendarName = string.Concat(matter.Name, matterSettings.CalendarNameSuffix);
                string taskListName = string.Concat(matter.Name, matterSettings.TaskNameSuffix);

                if (matterSettings.IsCreateCalendarEnabled && matterConfiguration.IsCalendarSelected)
                {
                    ListInformation calendarInformation = new ListInformation();
                    calendarInformation.name = calendarName;
                    calendarInformation.isContentTypeEnable = false;
                    calendarInformation.templateType = ServiceConstants.CALENDAR_NAME;
                    calendarInformation.Path = matterSettings.TitleListsPath + matter.MatterGuid + matterSettings.CalendarNameSuffix;

                    if (matterRepositoy.CreateList(clientContext, calendarInformation))
                    {
                        matterRepositoy.BreakPermission(clientContext, calendarName, isCopyRoleAssignment);
                    }
                    else
                    {
                        return ServiceUtility.GenericResponse(errorSettings.ErrorCodeAddCalendarList, errorSettings.ErrorMessageAddCalendarList);
                    }
                }

                if (matterConfiguration.IsTaskSelected)
                {
                    ListInformation taskListInformation = new ListInformation();
                    taskListInformation.name = taskListName;
                    taskListInformation.isContentTypeEnable = false;
                    taskListInformation.templateType = ServiceConstants.TASK_LIST_TEMPLATE_TYPE;
                    taskListInformation.Path = matterSettings.TitleListsPath + matter.MatterGuid + matterSettings.TaskNameSuffix;
                    if (matterRepositoy.CreateList(clientContext, taskListInformation))
                    {
                        matterRepositoy.BreakPermission(clientContext, taskListName, isCopyRoleAssignment);
                    }
                    else
                    {
                        return ServiceUtility.GenericResponse(errorSettings.ErrorCodeAddTaskList, errorSettings.ErrorMessageAddTaskList);
                    }
                }

                string oneNoteUrl = string.Concat(clientUrl.AbsolutePath, ServiceConstants.FORWARD_SLASH,
                    matter.MatterGuid, matterSettings.OneNoteLibrarySuffix, ServiceConstants.FORWARD_SLASH, matterOneNoteTitle);
                matterRepositoy.AddOneNote(clientContext, client.Url, oneNoteUrl, matter.MatterGuid, matter.Name);
                if (null != matter.Conflict)
                {
                    //Break permission for Matter library
                    matterRepositoy.BreakPermission(clientContext, matter.Name, isCopyRoleAssignment);

                    //Break permission for OneNote document library
                    string oneNoteLibraryName = string.Concat(matter.Name, matterSettings.OneNoteLibrarySuffix);
                    matterRepositoy.BreakPermission(clientContext, oneNoteLibraryName, isCopyRoleAssignment);
                }

                genericResponseVM = validationFunctions.RoleCheck(matter);
                if (genericResponseVM == null)
                {
                    string centralList = Convert.ToString(centralListURL, CultureInfo.InvariantCulture);
                    string matterSiteURL = centralList.Substring(0, centralList.LastIndexOf(string.Concat(ServiceConstants.FORWARD_SLASH,
                        ServiceConstants.LISTS, ServiceConstants.FORWARD_SLASH), StringComparison.OrdinalIgnoreCase));
                    string matterListName = centralList.Substring(centralList.LastIndexOf(ServiceConstants.FORWARD_SLASH, StringComparison.OrdinalIgnoreCase) + 1);

                    if(generalSettings.IsBackwardCompatible==false)
                    {
                        bool isMatterSaved = matterRepositoy.SaveMatter(client, matter, matterListName, matterConfiguration, matterSiteURL);
                        if (isMatterSaved == false)
                        {
                            genericResponseVM = ServiceUtility.GenericResponse(errorSettings.ErrorCodeAddTaskList, "Matter Not Saved");
                            genericResponseVM.IsError = true;
                            return genericResponseVM;
                        }
                    }

                    
                }
                genericResponseVM = new GenericResponseVM()
                {
                    Code = HttpStatusCode.OK.ToString(),
                    Value = client.Url,
                    IsError = false
                };
                return genericResponseVM;
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Пример #5
0
 public GenericResponseVM CheckMatterExists(MatterMetdataVM matterMetadataVM)
 {
     var matter = matterMetadataVM.Matter;
     var client = matterMetadataVM.Client;
     GenericResponseVM genericResponse = null;
     using (ClientContext clientContext = spoAuthorization.GetClientContext(matterMetadataVM.Client.Url))
     {
         List<string> listExists = validationFunctions.CheckListExists(matterMetadataVM.Client, matterMetadataVM.Matter.Name, matterMetadataVM.MatterConfigurations);
         if (listExists.Count > 0)
         {
             string listName = !string.Equals(matter.Name, listExists[0]) ? listExists[0].Contains(ServiceConstants.UNDER_SCORE) ?
                 listExists[0].Split(ServiceConstants.UNDER_SCORE[0]).Last() : ServiceConstants.MATTER : ServiceConstants.MATTER;
             return ServiceUtility.GenericResponse(errorSettings.MatterLibraryExistsCode,
                 string.Format(CultureInfo.InvariantCulture, errorSettings.ErrorDuplicateMatter, listName) + ServiceConstants.DOLLAR +
                 ServiceConstants.PIPE + ServiceConstants.DOLLAR + MatterPrerequisiteCheck.LibraryExists);
         }
         else
         {
             Uri clientUri = new Uri(client.Url);
             string requestedUrl = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{4}{5}", clientUri.AbsolutePath, ServiceConstants.FORWARD_SLASH,
                 matterSettings.MatterLandingPageRepositoryName.Replace(ServiceConstants.SPACE, string.Empty),
                 ServiceConstants.FORWARD_SLASH, matter.Name, ServiceConstants.ASPX_EXTENSION);
             if (matterRepositoy.IsPageExists(clientContext, requestedUrl))
             {
                 return ServiceUtility.GenericResponse(errorSettings.MatterLibraryExistsCode,
                 errorSettings.ErrorDuplicateMatterLandingPage + ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR + MatterPrerequisiteCheck.MatterLandingPageExists);
             }
         }
     }
     return genericResponse;
 }
Пример #6
0
        public GenericResponseVM CreateMatter(MatterMetdataVM matterMetadataVM)
        {
            var client = matterMetadataVM.Client;
            var matter = matterMetadataVM.Matter;
            var matterConfiguration = matterMetadataVM.MatterConfigurations;
            GenericResponseVM genericResponseVM = null;
            try
            {
                using (ClientContext clientContext = spoAuthorization.GetClientContext(client.Url))
                {
                    if (!matterRepositoy.CheckPermissionOnList(clientContext, listNames.MatterConfigurationsList, PermissionKind.EditListItems))
                    {
                        return ServiceUtility.GenericResponse(errorSettings.UserNotSiteOwnerCode, errorSettings.UserNotSiteOwnerMessage);
                    }
                    var matterInformation = new MatterInformationVM()
                    {
                        Client = client,
                        Matter = matter
                    };

                    genericResponseVM = validationFunctions.IsMatterValid(matterInformation, int.Parse(ServiceConstants.PROVISION_MATTER_CREATEMATTER), matterConfiguration);

                    if (genericResponseVM != null)
                    {
                        return ServiceUtility.GenericResponse(genericResponseVM.Code, genericResponseVM.Value);
                    }

                    genericResponseVM = CheckMatterExists(matterMetadataVM);

                    if (genericResponseVM != null)
                    {
                        return ServiceUtility.GenericResponse(genericResponseVM.Code, genericResponseVM.Value);
                    }

                    if (null != matter.Conflict && !string.IsNullOrWhiteSpace(matter.Conflict.Identified))
                    {
                        if (Convert.ToBoolean(matter.Conflict.Identified, CultureInfo.InvariantCulture))
                        {
                            genericResponseVM = editFunctions.CheckSecurityGroupInTeamMembers(client, matter, matterMetadataVM.UserIds);
                            if (genericResponseVM != null)
                            {
                                return ServiceUtility.GenericResponse(errorSettings.IncorrectInputConflictIdentifiedCode, errorSettings.IncorrectInputConflictIdentifiedMessage);
                            }
                        }

                        genericResponseVM = CreateMatter(clientContext, matterMetadataVM);

                    }
                }
                return genericResponseVM;
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Пример #7
0
        public GenericResponseVM AssignUserPermissions(MatterMetdataVM matterMetadataVM)
        {
            var client = matterMetadataVM.Client;
            var matter = matterMetadataVM.Matter;
            var matterConfigurations = matterMetadataVM.MatterConfigurations;
            ClientContext clientContext = null;
            string calendarName = string.Concat(matter.Name, matterSettings.CalendarNameSuffix);
            string oneNoteLibraryName = string.Concat(matter.Name, matterSettings.OneNoteLibrarySuffix);
            string taskLibraryName = string.Concat(matter.Name, matterSettings.TaskNameSuffix);
            GenericResponseVM genericResponseVM = null;
            using (clientContext = spoAuthorization.GetClientContext(client.Url))
            {


                MatterInformationVM matterInfo = new MatterInformationVM()
                {
                    Client = matterMetadataVM.Client,
                    Matter = matterMetadataVM.Matter,
                    MatterDetails = matterMetadataVM.MatterDetails
                };
                genericResponseVM = validationFunctions.IsMatterValid(matterInfo,
                    int.Parse(ServiceConstants.PROVISION_MATTER_ASSIGN_USER_PERMISSIONS, CultureInfo.InvariantCulture), null);

                if (genericResponseVM != null)
                {
                    DeleteMatter(matterMetadataVM as MatterVM);
                    return genericResponseVM;
                }
                if (!string.IsNullOrWhiteSpace(matter.Name))
                {



                    //Assign permission for Matter library
                    matterRepositoy.SetPermission(clientContext, matter.AssignUserEmails, matter.Permissions, matter.Name);
                    //Assign permission for OneNote library 
                    matterRepositoy.SetPermission(clientContext, matter.AssignUserEmails, matter.Permissions, oneNoteLibraryName);
                    if (matterSettings.IsCreateCalendarEnabled && matterConfigurations.IsCalendarSelected)
                    {
                        bool returnValueCalendar = matterRepositoy.SetPermission(clientContext, matter.AssignUserEmails, matter.Permissions, calendarName);
                        if (!returnValueCalendar)
                        {
                            genericResponseVM =
                                new GenericResponseVM()
                                {
                                    Code = errorSettings.ErrorCodeCalendarCreation,
                                    Value = errorSettings.ErrorMessageCalendarCreation,
                                    IsError = true
                                };
                            return genericResponseVM;
                        }
                    }

                    // Assign permission to task list if it is selected
                    if (matterConfigurations.IsTaskSelected)
                    {
                        bool returnValueTask = matterRepositoy.SetPermission(clientContext, matter.AssignUserEmails, matter.Permissions, taskLibraryName);
                        if (!returnValueTask)
                        {

                            genericResponseVM =
                                new GenericResponseVM()
                                {
                                    Code = errorSettings.ErrorMessageTaskCreation,
                                    Value = errorSettings.ErrorCodeAddTaskList,
                                    IsError = true
                                };
                            return genericResponseVM;
                        }
                    }
                }
            }
            return genericResponseVM;
        }
Пример #8
0
        public GenericResponseVM UpdateMatterMetadata(MatterMetdataVM matterMetadata)
        {
            var matter = matterMetadata.Matter;
            var matterDetails = matterMetadata.MatterDetails;
            var client = matterMetadata.Client;
            ClientContext clientContext = null;
            GenericResponseVM genericResponse = null;
            try
            {
                MatterInformationVM matterInfo = new MatterInformationVM()
                {
                    Client = matterMetadata.Client,
                    Matter = matterMetadata.Matter,
                    MatterDetails = matterMetadata.MatterDetails
                };              
                clientContext = spoAuthorization.GetClientContext(matterMetadata.Client.Url);
                PropertyValues matterStampedProperties = matterRepositoy.GetStampedProperties(clientContext, matter.Name);
                Dictionary<string, string> propertyList = SetStampProperty(matterMetadata);
                matterRepositoy.SetPropertBagValuesForList(clientContext, matterStampedProperties, matter.Name, propertyList);
                //As part of final step in matter creation, check whether any assigned users are external to the 
                //organization and if yes, send notification to that user to accepct the invitation so that he can access matter center

                //Need to loop each matter information, update the table storage with that matter information, before sending
                //notification to external user
                if (matterInfo.Matter != null && matterInfo.Matter.Roles != null && matterInfo.Matter.Roles.Count > 0)
                {
                    ShareMatterToExtUser(matterInfo);
                }
                genericResponse = ServiceUtility.GenericResponse("", "Matter Update Success");                
            }
            catch (Exception ex)
            {
                DeleteMatter(matterMetadata as MatterVM);
                customLogger.LogError(ex, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable);
                throw;
            }
            return genericResponse;
        }
Пример #9
0
        /// <summary>
        /// Function to create dictionary object for stamp property 
        /// </summary>
        /// <param name="client">Client object containing Client data</param>
        /// <param name="matter">Matter object containing Matter data</param>
        /// <param name="matterDetails">Matter details object which has data of properties to be stamped</param>
        /// <returns>returns dictionary object</returns>
        internal Dictionary<string, string> SetStampProperty(MatterMetdataVM matterMetadata)
        {
            try
            {

                Client client = matterMetadata.Client;
                Matter matter = matterMetadata.Matter;
                MatterDetails matterDetails = matterMetadata.MatterDetails;
                var index = 0;
                List<string> arrRoles =new List<string>();
                List<string> arrPermissions = new List<string>();

                foreach (IList<string> userNames in matter.AssignUserNames)
                {
                    IList<string> userNamesListTemp = userNames.Where(user => !string.IsNullOrWhiteSpace(user)).ToList();
                    foreach (var userTem in userNamesListTemp)
                    {
                        arrRoles.Add(matter.Roles[index]);
                        arrPermissions.Add(matter.Permissions[index]);
                    }
                    index++;
                }
                matter.Roles = arrRoles;
                matter.Permissions = arrPermissions;
                string documentTemplateCount = string.Join(ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR, matter.DocumentTemplateCount);         
                string matterCenterPermission = string.Join(ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR, matter.Permissions);
                string matterCenterRoles = string.Join(ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR, matter.Roles);
                string[] members = matterDetails.TeamMembers.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                string finalTeamMembers = String.Join(";", members);
                string finalResponsibleAttorneysUsers = matterDetails.ResponsibleAttorney;
                string finalResponsibleAttorneysEmail = matterDetails.ResponsibleAttorneyEmail;
                string matterCenterUsers = string.Empty;
                string matterCenterUserEmails = string.Empty;
                string separator = string.Empty;
                foreach (IList<string> userNames in matter.AssignUserNames)
                {
                    IList<string> userNamesListTemp = userNames.Where(user => !string.IsNullOrWhiteSpace(user)).ToList();
                    foreach (var userTem in userNamesListTemp)
                    {
                        if (userDetails.CheckUserPresentInMatterCenter(client.Url, userTem) == true)
                        {
                            matterCenterUsers += separator + string.Join(ServiceConstants.SEMICOLON, userTem);
                            separator = ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR;
                        }
                    }
                }

                foreach (IList<string> userEmails in matter.AssignUserEmails)
                {
                    IList<string> userNamesListTemp = userEmails.Where(user => !string.IsNullOrWhiteSpace(user)).ToList();
                    foreach (var userEmailTem in userNamesListTemp)
                    {
                        if (userDetails.CheckUserPresentInMatterCenter(client.Url, userEmailTem) == true)
                        {
                            matterCenterUserEmails += string.Join(ServiceConstants.SEMICOLON, userEmailTem) + separator;
                        }
                    }
                }
                var finalMatterPermissionsList = matterCenterPermission.Replace("$|$", "$").Split('$').ToList();
                var finalMatterRolesList = matterCenterRoles.Replace("$|$", "$").Split('$').ToList();
                var finalTeamMembersList = matterDetails.TeamMembers.Split(';').Where(s => !string.IsNullOrWhiteSpace(s)).ToList();
                //matterDetails.TeamMembers.Replace(";;", "$").Split('$').ToList();
                var finalResponsibleAttorneysEmailList = matterDetails.ResponsibleAttorneyEmail.Split(';').ToList();
                var finalResponsibleAttorneysUsersList = matterDetails.ResponsibleAttorney.Split(';').ToList();
                var userEmailsList = matter.AssignUserEmails;
                var userNamesList = matter.AssignUserNames;

                List<int> itemsToRemove = new List<int>();
                List<int> itemsToRemoveAttorneys = new List<int>();
                int l = 0;
                foreach (string userName in finalResponsibleAttorneysUsersList)
                {
                    if (!string.IsNullOrWhiteSpace(userName) && userDetails.CheckUserPresentInMatterCenter(client.Url, userName) == false)
                    {
                        itemsToRemoveAttorneys.Add(l);
                    }
                    l = l + 1;
                }

                if (itemsToRemoveAttorneys.Count > 0)
                {
                    for (int k = 0; k < itemsToRemoveAttorneys.Count; k++)
                    {
                        if (finalResponsibleAttorneysEmailList.Count > itemsToRemoveAttorneys[k] && finalResponsibleAttorneysEmailList[itemsToRemoveAttorneys[k]] != null)
                        {
                            finalResponsibleAttorneysEmailList[itemsToRemoveAttorneys[k]] = string.Empty;
                            finalResponsibleAttorneysUsersList[itemsToRemoveAttorneys[k]] = string.Empty;
                        }
                    }
                    finalResponsibleAttorneysEmailList = finalResponsibleAttorneysEmailList.Where(s => !string.IsNullOrWhiteSpace(s)).ToList();
                    finalResponsibleAttorneysUsersList = finalResponsibleAttorneysUsersList.Where(s => !string.IsNullOrWhiteSpace(s)).ToList();
                }

                l = 0;

                //Check if any of the assigned team member is an external user?
                foreach (IList<string> userNames in matter.AssignUserNames)
                {
                    IList<string> userNamesListTemp = userNames.Where(user => !string.IsNullOrWhiteSpace(user)).ToList();
                    foreach (var userTem in userNamesListTemp)
                    {
                        if (userDetails.CheckUserPresentInMatterCenter(client.Url, userTem) == false)
                        {
                            itemsToRemove.Add(l);
                        }
                        l = l + 1;
                    }
                   
                }

                //If any of the team members are external users, do not add his role, his permission into matter proeprty bag
                //Once the user accepts the invitation, then  update the property bag with role and permissions
                if (itemsToRemove.Count > 0)
                {
                    for (int k = 0; k < itemsToRemove.Count; k++)
                    {
                        finalMatterPermissionsList[itemsToRemove[k]] = string.Empty;
                        finalMatterRolesList[itemsToRemove[k]] = string.Empty; ;
                        finalTeamMembersList[itemsToRemove[k]] = string.Empty; ;
                    }

                    finalMatterPermissionsList = finalMatterPermissionsList.Where(s => !string.IsNullOrWhiteSpace(s)).ToList();
                    finalMatterRolesList = finalMatterRolesList.Where(s => !string.IsNullOrWhiteSpace(s)).ToList();
                    finalTeamMembersList = finalTeamMembersList.Where(s => !string.IsNullOrWhiteSpace(s)).ToList();
                    var finalTeamMembersArray = finalTeamMembersList.ToArray();
                    var finalMatterPermissionsArray = finalMatterPermissionsList.ToArray();
                    var finalMatterRolesArray = finalMatterRolesList.ToArray();
                    var finalResponsibleAttorneysEmailsArray = finalResponsibleAttorneysEmailList.ToArray();
                    var finalResponsibleAttorneysUsersArray = finalResponsibleAttorneysUsersList.ToArray();

                    matterCenterUsers = "";
                    matterCenterUserEmails = "";
                    separator = "";
                    foreach (IList<string> userNames in userNamesList)
                    {
                        IList<string> userNamesListTemp = userNames.Where(user => !string.IsNullOrWhiteSpace(user)).ToList();
                        foreach (var userTem in userNamesListTemp)
                        {
                            if (userDetails.CheckUserPresentInMatterCenter(client.Url, userTem) == true)
                            {
                                matterCenterUsers += separator + string.Join(ServiceConstants.SEMICOLON, userTem);
                                separator = ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR;
                            }
                        }

                    }
                    separator = "";
                    foreach (IList<string> userEmails in userEmailsList)
                    {
                        IList<string> userNamesListTemp = userEmails.Where(user => !string.IsNullOrWhiteSpace(user)).ToList();
                        foreach (var userTem in userNamesListTemp)
                        {
                            if (userDetails.CheckUserPresentInMatterCenter(client.Url, userTem) == true)
                            {
                                matterCenterUserEmails += separator + string.Join(ServiceConstants.SEMICOLON, userTem);
                                separator = ServiceConstants.DOLLAR + ServiceConstants.PIPE + ServiceConstants.DOLLAR;
                            }
                        }
                    }

                    finalTeamMembers = string.Join(";", finalTeamMembersArray);                    
                    matterCenterPermission = string.Join("$|$", finalMatterPermissionsArray);
                    matterCenterRoles = string.Join("$|$", finalMatterRolesArray);
                    finalResponsibleAttorneysEmail = string.Join(";", finalResponsibleAttorneysEmailsArray);
                    finalResponsibleAttorneysUsers = string.Join(";", finalResponsibleAttorneysUsersArray);
                }
                List<string> keys = new List<string>();
                Dictionary<string, string> propertyList = new Dictionary<string, string>();
                //Get all the matter stamped properties from the appsettings.json file
                var matterStampedProperties = configuration.GetSection("Matter").GetChildren();
                keys.Add(matterSettings.StampedPropertyMatterName);
                keys.Add(matterSettings.StampedPropertyMatterID);
                keys.Add(matterSettings.StampedPropertyClientName);
                keys.Add(matterSettings.StampedPropertyClientID);
                keys.Add(matterSettings.StampedPropertyResponsibleAttorney);
                keys.Add(matterSettings.StampedPropertyResponsibleAttorneyEmail);
                keys.Add(matterSettings.StampedPropertyTeamMembers);
                keys.Add(matterSettings.StampedPropertyIsMatter);
                keys.Add(matterSettings.StampedPropertyOpenDate);
                keys.Add(matterSettings.StampedPropertySecureMatter);
                keys.Add(matterSettings.StampedPropertyBlockedUploadUsers);
                keys.Add(matterSettings.StampedPropertyMatterDescription);
                keys.Add(matterSettings.StampedPropertyConflictCheckDate);
                keys.Add(matterSettings.StampedPropertyConflictCheckBy);
                keys.Add(matterSettings.StampedPropertyMatterCenterRoles);
                keys.Add(matterSettings.StampedPropertyMatterCenterPermissions);
                keys.Add(matterSettings.StampedPropertyMatterCenterUsers);
                keys.Add(matterSettings.StampedPropertyMatterCenterUserEmails);
                keys.Add(matterSettings.StampedPropertyDefaultContentType);
                keys.Add(matterSettings.StampedPropertyIsConflictIdentified);
                keys.Add(matterSettings.StampedPropertyDocumentTemplateCount);
                keys.Add(matterSettings.StampedPropertyBlockedUsers);
                keys.Add(matterSettings.StampedPropertyMatterGUID);
                /*
                 * All the managed columns need to be read from the appsettings.json file. In old implementation
                 * all the managed columns are hardcoded and that hardcoding has been removed, by reading the
                 * column names from appsettings.json file
                 */
                //Get the number of levels from Taxonomy Settings
                int levels = int.Parse(configuration.GetSection("Taxonomy")["Levels"].ToString());
                for (int i = 1; i <= levels; i++)
                {
                    //Get all the managed columns from "ContentType" settings from appsettings.json file
                    string stampedColumnName = configuration.GetSection("ContentTypes").GetSection("ManagedStampedColumns")["ColumnName" + i];
                    string columnName = configuration.GetSection("ContentTypes").GetSection("ManagedColumns")["ColumnName" + i];
                    ManagedColumn managedColumn = matterDetails.ManagedColumnTerms[columnName];                    
                    //Add all the managed columns values to the property list of the matter document library             
                    propertyList.Add(stampedColumnName, WebUtility.HtmlEncode(managedColumn.TermName.Trim()));
                    //Add all the managed columns to the Indexed Property keys of the matter document library
                    keys.Add(stampedColumnName);
                }
                propertyList.Add(matterSettings.StampedPropertyMatterName, WebUtility.HtmlEncode(matter.Name));
                propertyList.Add(matterSettings.StampedPropertyMatterID, WebUtility.HtmlEncode(matter.Id));
                if(!propertyList.ContainsKey(matterSettings.StampedPropertyClientName))
                {
                    propertyList.Add(matterSettings.StampedPropertyClientName, WebUtility.HtmlEncode(client.Name));
                }                
                propertyList.Add(matterSettings.StampedPropertyClientID, WebUtility.HtmlEncode(client.Id));
                propertyList.Add(matterSettings.StampedPropertyResponsibleAttorney, WebUtility.HtmlEncode(finalResponsibleAttorneysUsers));
                propertyList.Add(matterSettings.StampedPropertyTeamMembers, WebUtility.HtmlEncode(finalTeamMembers.Replace(";", "; ")));
                propertyList.Add(matterSettings.StampedPropertyIsMatter, ServiceConstants.TRUE);
                propertyList.Add(matterSettings.StampedPropertyOpenDate, WebUtility.HtmlEncode(DateTime.Now.ToString(matterSettings.ValidDateFormat, CultureInfo.InvariantCulture)));
                propertyList.Add(matterSettings.PropertyNameVtiIndexedPropertyKeys, WebUtility.HtmlEncode(ServiceUtility.GetEncodedValueForSearchIndexProperty(keys)));
                propertyList.Add(matterSettings.StampedPropertySecureMatter, (matter.Conflict != null) ? (matter.Conflict.SecureMatter != null) ? WebUtility.HtmlEncode(matter.Conflict.SecureMatter) : "False" : "False");
                propertyList.Add(matterSettings.StampedPropertyBlockedUploadUsers, WebUtility.HtmlEncode(string.Join(";", matterDetails.UploadBlockedUsers)));
                propertyList.Add(matterSettings.StampedPropertyMatterDescription, WebUtility.HtmlEncode(matter.Description));
                propertyList.Add(matterSettings.StampedPropertyConflictCheckDate, (string.IsNullOrEmpty(matter.Conflict.CheckOn)) ?
                    "" : WebUtility.HtmlEncode(Convert.ToDateTime(matter.Conflict.CheckOn, CultureInfo.InvariantCulture).ToString(matterSettings.ValidDateFormat, CultureInfo.InvariantCulture)));
                propertyList.Add(matterSettings.StampedPropertyConflictCheckBy, WebUtility.HtmlEncode(matter.Conflict.CheckBy));
                propertyList.Add(matterSettings.StampedPropertyMatterCenterRoles, WebUtility.HtmlEncode(matterCenterRoles));
                propertyList.Add(matterSettings.StampedPropertyMatterCenterPermissions, WebUtility.HtmlEncode(matterCenterPermission));
                propertyList.Add(matterSettings.StampedPropertyMatterCenterUsers, WebUtility.HtmlEncode(matterCenterUsers));
                propertyList.Add(matterSettings.StampedPropertyDefaultContentType, WebUtility.HtmlEncode(matter.DefaultContentType));
                propertyList.Add(matterSettings.StampedPropertyIsConflictIdentified, WebUtility.HtmlEncode(matter.Conflict.Identified));
                propertyList.Add(matterSettings.StampedPropertyDocumentTemplateCount, WebUtility.HtmlEncode(documentTemplateCount));
                propertyList.Add(matterSettings.StampedPropertyBlockedUsers, WebUtility.HtmlEncode(string.Join(";", matter.BlockUserNames)));
                propertyList.Add(matterSettings.StampedPropertyMatterGUID, WebUtility.HtmlEncode(matter.MatterGuid));
                propertyList.Add(matterSettings.StampedPropertySuccess, ServiceConstants.TRUE);
                propertyList.Add(matterSettings.StampedPropertyMatterCenterUserEmails, WebUtility.HtmlEncode(matterCenterUserEmails));
                propertyList.Add(matterSettings.StampedPropertyResponsibleAttorneyEmail, WebUtility.HtmlEncode(finalResponsibleAttorneysEmail));

                if (matterMetadata.MatterProvisionFlags.SendEmailFlag)
                {
                    ShareMatter(matterMetadata, matterMetadata.MatterProvisionFlags.MatterLandingFlag);
                }

                l = 0;
                itemsToRemoveAttorneys.Clear();
                finalResponsibleAttorneysEmailList = matterDetails.ResponsibleAttorneyEmail.Split(';').ToList();
                finalResponsibleAttorneysUsersList = matterDetails.ResponsibleAttorney.Split(';').ToList();
                foreach (string userName in finalResponsibleAttorneysUsersList)
                {
                    if (!string.IsNullOrWhiteSpace(userName) && userDetails.CheckUserPresentInMatterCenter(client.Url, userName) == true)
                    {
                        itemsToRemoveAttorneys.Add(l);
                    }
                    l = l + 1;
                }
                if (itemsToRemoveAttorneys.Count > 0)
                {
                    for (int k = 0; k < itemsToRemoveAttorneys.Count; k++)
                    {
                        finalResponsibleAttorneysUsersList[itemsToRemoveAttorneys[k]] = string.Empty;
                        finalResponsibleAttorneysEmailList[itemsToRemoveAttorneys[k]] = string.Empty;
                    }
                    finalResponsibleAttorneysUsersList = finalResponsibleAttorneysUsersList.Where(s => !string.IsNullOrWhiteSpace(s)).ToList();
                    finalResponsibleAttorneysEmailList = finalResponsibleAttorneysEmailList.Where(s => !string.IsNullOrWhiteSpace(s)).ToList();
                }
                itemsToRemove.Clear();
                l = 0;
                //Check if any of the assigned team member is an external user?
                //   List<List<string>> userNamesListTempForExt = new List<List<string>>();
                //setting the internal users to null and adding the index to remove the roles and permissions in matter.Permissions and matter.roles
                for (int z=0;z< matter.AssignUserNames.Count; z++)
                {                  
                    for(int y=0;y< matter.AssignUserNames[z].Count; y++)
                    {
                        string userName = matter.AssignUserNames[z][y].ToString();
                        if (userName != "")
                        {
                            if (userDetails.CheckUserPresentInMatterCenter(client.Url, userName) == true)
                            {
                                itemsToRemove.Add(l);
                                matter.AssignUserNames[z][y] = null;
                                matter.AssignUserEmails[z][y] = null;
                            }                           
                            l = l + 1;
                        }
                    }
                }

               

                for (int x = 0; x < matter.AssignUserNames.Count; x++)
                {
                    var matterAssignedNames = matter.AssignUserNames[x].Where(user => !string.IsNullOrWhiteSpace(user));
                    var matterAssignedUserEmails = matter.AssignUserEmails[x].Where(user => !string.IsNullOrWhiteSpace(user));
                    if (matterAssignedNames.Count() > 0)
                    {
                        matter.AssignUserNames[x] = matterAssignedNames.ToList();
                        matter.AssignUserEmails[x] = matterAssignedUserEmails.ToList();
                    }
                    else
                    {
                        matter.AssignUserNames[x] = null;
                        matter.AssignUserEmails[x] = null;
                    }
                }
               

                //foreach (IList<string> userNames in matter.AssignUserNames)
                //{
                //    IList<string> userNamesListTemp = userNames.Where(user => !string.IsNullOrWhiteSpace(user)).ToList();
                //    List<string> userNameExtForTemp = new List<string>();
                //    foreach (var userTem in userNamesListTemp)
                //    {

                //        if (userDetails.CheckUserPresentInMatterCenter(client.Url, userTem) == true)
                //        {
                //            itemsToRemove.Add(l);

                //        }
                //        else
                //        {
                //            userNameExtForTemp.Add(userTem);
                //        }
                //        l = l + 1;
                //    }
                //    if (userNameExtForTemp.Count >= 1) {
                //        userNamesListTempForExt.Add(userNameExtForTemp);
                //    }
                //}

                finalTeamMembersList = matterDetails.TeamMembers.Split(';').Where(s => !string.IsNullOrWhiteSpace(s)).ToList();               
                if (itemsToRemove.Count > 0)
                {
                    for (int k = 0; k < itemsToRemove.Count; k++)
                    {
                        matter.Permissions[itemsToRemove[k]] = string.Empty;
                        matter.Roles[itemsToRemove[k]] = string.Empty;
                        //matter.AssignUserEmails[itemsToRemove[k]] = null;
                      //  matter.AssignUserNames[itemsToRemove[k]] = null;
                        finalTeamMembersList[itemsToRemove[k]] = string.Empty;
                    }
                }

                matter.Permissions = matter.Permissions.Where(s => !string.IsNullOrWhiteSpace(s)).ToList();
                matter.Roles = matter.Roles.Where(s => !string.IsNullOrWhiteSpace(s)).ToList();
                finalTeamMembersList = finalTeamMembersList.Where(s => !string.IsNullOrWhiteSpace(s)).ToList();
                matter.AssignUserEmails = matter.AssignUserEmails.Where(s => s != null).ToList();
                matter.AssignUserNames = matter.AssignUserNames.Where(s => s != null).ToList();


                matterDetails.ResponsibleAttorneyEmail = string.Empty;
                matterDetails.ResponsibleAttorney = string.Empty;
                matterDetails.TeamMembers = string.Join(";", finalTeamMembersList.ToArray());
                matterDetails.ResponsibleAttorneyEmail = string.Join(";", finalResponsibleAttorneysEmailList.ToArray());
                matterDetails.ResponsibleAttorney = string.Join(";", finalResponsibleAttorneysUsersList.ToArray());
                return propertyList;
            }
            catch(Exception ex)
            {
                throw;
            }
        }
Пример #10
0
 /// <summary>
 /// Creates an item in the specific list with the list of users to whom the matter will be shared.
 /// </summary>
 /// <param name="requestObject">Request Object containing SharePoint App Token</param>
 /// <param name="client">Client object containing Client data</param>
 /// <param name="matter">Matter object containing Matter data</param>
 /// <returns>true if success else false</returns>
 /// /// <summary>
 internal GenericResponseVM ShareMatter(MatterMetdataVM matterMetadata, string matterLandingFlag)
 {
     GenericResponseVM returnFlag = null;
     var matter = matterMetadata.Matter;
     var matterDetails = matterMetadata.MatterDetails;
     var client = matterMetadata.Client;
     var matterConfigurations = matterMetadata.MatterConfigurations;
     if (null != client && null != matter && null != matterDetails)
     {
         try
         {
             Uri mailListURL = new Uri(string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}{3}{4}", generalSettings.CentralRepositoryUrl,
                 ServiceConstants.FORWARD_SLASH, ServiceConstants.LISTS, ServiceConstants.FORWARD_SLASH, matterSettings.SendMailListName));
             string centralMailListURL = Convert.ToString(mailListURL, CultureInfo.InvariantCulture);
             string mailSiteURL = centralMailListURL.Substring(0, centralMailListURL.LastIndexOf(string.Concat(ServiceConstants.FORWARD_SLASH,
                 ServiceConstants.LISTS, ServiceConstants.FORWARD_SLASH), StringComparison.OrdinalIgnoreCase));
             ///// Retrieve the specific site where the Mail List is present along with the required List Name
             if (null != mailListURL && null != client.Url)
             {
                 if (!string.IsNullOrWhiteSpace(mailSiteURL))
                 {
                     returnFlag = ShareMatterUtility(client, matter, matterDetails,
                         mailSiteURL, centralMailListURL, matterLandingFlag, matterConfigurations);
                 }
             }
         }
         catch (Exception ex)
         {
             customLogger.LogError(ex, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable);
             throw;
         }
     }
     return returnFlag;
 }
Пример #11
0
 public GenericResponseVM UpdateMatterMetadata(MatterMetdataVM matterMetadata)
 {
     var matter = matterMetadata.Matter;
     var matterDetails = matterMetadata.MatterDetails;
     var client = matterMetadata.Client;
     ClientContext clientContext = null;
     GenericResponseVM returnFlag = null;
     try
     {
         clientContext = spoAuthorization.GetClientContext(matterMetadata.Client.Url);
         PropertyValues matterStampedProperties = matterRepositoy.GetStampedProperties(clientContext, matter.Name);
         Dictionary<string, string> propertyList = SetStampProperty(client, matter, matterDetails);
         matterRepositoy.SetPropertBagValuesForList(clientContext, matterStampedProperties, matter.Name, propertyList);
         if (matterMetadata.MatterProvisionFlags.SendEmailFlag)
         {
             returnFlag = ShareMatter(matterMetadata, matterMetadata.MatterProvisionFlags.MatterLandingFlag);
         }
         else
         {
             ServiceUtility.GenericResponse("", "Matter Update Success");
         }
     }
     catch(Exception ex)
     {
         DeleteMatter(client, matter);
         customLogger.LogError(ex, MethodBase.GetCurrentMethod().DeclaringType.Name, MethodBase.GetCurrentMethod().Name, logTables.SPOLogTable);
         throw;
     }
     return returnFlag;
 }