private void CheckDocumentAttachments(LogEntry Entry = null)
        {
            if (!CanRun)
            {
                return;
            }

            if (DocReceivedFields == null || DocReceivedFields.Count().Equals(0))
            {
                return;
            }

            if (Entry != null && (!Entry.EntryType.Equals(LogEntryType.TrackedDocument) || !DocReceivedFields.Any(x => x.Description.Equals((Entry as TrackedDocument).Title))))
            {
                return;
            }

            foreach (FieldDescriptor field in DocReceivedFields)
            {
                if (!string.IsNullOrEmpty(field.Description))
                {
                    AttachmentList attachments = GetAttachments(field);
                    if (attachments == null)
                    {
                        continue;
                    }

                    EncompassHelper.Set(field.FieldID, attachments.Count.ToString());
                }
            }
        }
Beispiel #2
0
        public override void DataExchangeReceived(object sender, DataExchangeEventArgs e)
        {
            bool isDoorbell = e.Data.ToString().Contains("Is Out Of") || e.Data.ToString().Contains("Trying to Access");

            if (!Hide && isDoorbell)
            {
                Hide = false;
                bool exit = e.Data.ToString().Contains("Exit");
                System.Media.SoundPlayer music = new System.Media.SoundPlayer(exit ? Resources.Exit : Resources.Out);
                music.Play();
                EncompassHelper.ShowOnTop("DoorBell Notification", e.Data.ToString());

                if (exit)
                {
                    DingBackID = e.Source.UserID;
                    if (EncompassApplication.CurrentLoan == null)
                    {
                        string loanNumber = e.Data.ToString().Split('#')[1].Split(',')[0];
                        DingBack(loanNumber);
                    }
                    else
                    {
                        SendOutOfFileMessage = true;
                        DingBackBorrower     = $"{EncompassApplication.CurrentLoan.Fields["4002"].FormattedValue}, {EncompassApplication.CurrentLoan.Fields["4000"].FormattedValue}";
                    }
                }
            }
        }
Beispiel #3
0
        public static bool CheckAccess(string pluginName, bool menu = false, bool loan = false)
        {
            if (EncompassHelper.IsTest() || CDOHelper.CDO.CommunitySettings.SuperAdminRun)
            {
                return(true);
            }


            if (Plugins != null)
            {
                return(CheckAccessInPlugins(pluginName, menu, loan));
            }


            PluginAccessRight right = Rights.Where(x => x.PluginName.Equals(pluginName)).FirstOrDefault();

            if (right == null)
            {
                return(false);
            }

            bool isAllowedToRun = loan ? false : right.AllAccess;

            if (!isAllowedToRun && right.Personas != null)
            {
                isAllowedToRun = EncompassHelper.ContainsPersona(right.Personas);
            }

            if (!isAllowedToRun && right.UserIDs != null)
            {
                isAllowedToRun = right.UserIDs.Contains(EncompassHelper.User.ID);
            }

            return(isAllowedToRun);
        }
        private void CheckDocumentRecentAttachment(LogEntry Entry = null)
        {
            if (!CanRun)
            {
                return;
            }

            if (DocAttachmentFields == null || DocAttachmentFields.Count().Equals(0))
            {
                return;
            }

            if (Entry != null && (!Entry.EntryType.Equals(LogEntryType.TrackedDocument) || !DocAttachmentFields.Any(x => x.Description.Equals((Entry as TrackedDocument).Title))))
            {
                return;
            }

            foreach (FieldDescriptor field in DocAttachmentFields)
            {
                if (!string.IsNullOrEmpty(field.Description))
                {
                    AttachmentList attachments = GetAttachments(field);
                    if (attachments == null || attachments.Count == 0)
                    {
                        continue;
                    }
                    DateTime newest = attachments.Cast <Attachment>().OrderByDescending(x => x.Date).FirstOrDefault().Date;
                    EncompassHelper.Set(field.FieldID, newest.ToString());
                }
            }
        }
Beispiel #5
0
        private static bool CheckAccessInPlugins(string pluginName, bool menu, bool loan)
        {
            if (Plugins.TryGetValue(pluginName, out var pluginSettings) == false)
            {
                return(false);
            }

            if (pluginSettings.Permissions == null)
            {
                return(false);
            }

            if (pluginSettings.Permissions.Everyone)
            {
                return(true);
            }


            var isAllowedToRun = !loan && pluginSettings.Permissions.Everyone;

            if (!isAllowedToRun && pluginSettings.Permissions.Personas != null)
            {
                isAllowedToRun = EncompassHelper.ContainsPersona(pluginSettings.Permissions.Personas);
            }

            if (!isAllowedToRun && pluginSettings.Permissions.UserIDs != null)
            {
                isAllowedToRun = pluginSettings.Permissions.UserIDs.Contains(EncompassHelper.User.ID);
            }

            return(isAllowedToRun);
        }
        private static void SendEmails(MailTrigger Trigger, List <string> guids)
        {
            foreach (string guid in guids)
            {
                MailMessage mail = new MailMessage();
                mail.From       = new MailAddress(EncompassApplication.CurrentUser.Email, EncompassApplication.CurrentUser.FullName);
                mail.IsBodyHtml = true;
                mail.Subject    = InsertEncompassValue(Trigger.Subject, guid);
                mail.Body       = InsertEncompassValue(Trigger.Body, guid);
                foreach (string email in Trigger.To.Split(','))
                {
                    mail.To.Add(new MailAddress(InsertEncompassValue(email, guid)));
                }
                EncompassHelper.SendEmail(mail);
            }

            //Email Owner of Report
            MailMessage mailMessage = new MailMessage();

            mailMessage.From    = new MailAddress(EncompassApplication.CurrentUser.Email, EncompassApplication.CurrentUser.FullName);
            mailMessage.Subject = $"Report for {Trigger.Name}";
            mailMessage.Body    = $"Loans that were included in the emailed report {string.Join(Environment.NewLine, guids)}";
            mailMessage.To.Add(new MailAddress(EncompassApplication.CurrentUser.Email));
            EncompassHelper.SendEmail(mailMessage);
        }
        private async Task <DbResponse <EncompassDocumentEntity>[]> AddNewDocument(HashSet <Guid> addingDocumentGuids, Dictionary <Guid, Attachment> apiDocuments, Guid loanGuid)
        {
            var addingDbDocs = addingDocumentGuids.Select(x =>
            {
                var document = apiDocuments[x];
                return(new EncompassDocumentEntity
                {
                    LoanGuid = loanGuid,
                    DocumentTitle = document.Document.EntityName,
                    DocumentTypeName = EncompassHelper.GetAlphaNumeric(document.Document.EntityName),
                    DocumentDtTm = document.DateCreated,
                    DocumentGuid = x,
                    DocumentId = document.AttachmentId,
                    AddedById = document.CreatedBy,
                    AddedByName = document.CreatedByName,
                    FileName = document.Title,
                    FileSizeBytes = document.FileSize,
                    DownloadSucceededBit = false,
                    DownloadFileFullPath = string.Empty,
                    StartDownloadDtTm = DateTimeOffset.Now,
                    EndDownloadDtTm = null,
                    IsActiveBit = document.IsActive,
                    DownloadStatusTypeId = DocumentStatusEnum.Downloading,
                    ErrorMsgTxt = null
                });
            });

            var addingDbTasks   = addingDbDocs.Select(x => _documentRepository.AddDocumentAsync(x));
            var addingDbResults = await Task.WhenAll(addingDbTasks.ToArray()).ConfigureAwait(false);

            return(addingDbResults);
        }
Beispiel #8
0
 public override AnalysisResult SearchResults(string Search)
 {
     return(new AnalysisResult(nameof(SearchLog))
     {
         Result = EncompassHelper.ReadLog(Search)
     });
 }
Beispiel #9
0
        private GeoCoordinate Coordinates()
        {
            string city    = EncompassHelper.Val("FR0106");
            string state   = EncompassHelper.Val("FR0107");
            string zipcode = EncompassHelper.Val("FR0108");

            return(ZipCodeUtils.GetZipGeoCoordinate(zipcode, state, city, string.Empty));
        }
 public override void FieldChanged(object sender, FieldChangeEventArgs e)
 {
     if (e.FieldID.Equals("CX.CUSTOM.ACTION") && !string.IsNullOrEmpty(e.NewValue))
     {
         actionName = e.NewValue;
         RunAction(actionName);
         EncompassHelper.Set("CX.CUSTOM.ACTION", "");
     }
 }
Beispiel #11
0
 public override void FieldChanged(object sender, FieldChangeEventArgs e)
 {
     if (e.FieldID.Equals("CX.OPENDOCUMENT") && !string.IsNullOrEmpty(e.NewValue))
     {
         DocumentName = e.NewValue;
         OpenEfolderDocument();
         EncompassHelper.Set("CX.OPENDOCUMENT", "");
     }
 }
        private Dictionary <Guid, Attachment> ParseDoucmentApiResponse(GetAttachmentResponse response)
        {
            var documentIds = new Dictionary <Guid, Attachment>();

            foreach (var attachment in response.SuccessResponse)
            {
                documentIds.Add(EncompassHelper.GetGuid(attachment.AttachmentId), attachment);
            }
            return(documentIds);
        }
        private void CustomLinkLabel_Click(object sender, EventArgs e)
        {
            try
            {
                switch (this.Type)
                {
                case LinkType.Internet:
                    Process.Start(this.InternetLink);
                    break;

                case LinkType.Email:
                    //Email.Send(this.MailTo, this.EmailSubject, this.EmailBody, true, false);
                    break;

                case LinkType.Print:
                    Macro.SetFieldNoRules(this.FormName, "X");
                    Macro.SendKeys("%lp{ENTER}");
                    break;

                case LinkType.Popup:
                    try
                    {
                        Macro.Popup(this.FormName, this.FormName, this.PopupWidth, this.PopupHeight);
                        break;
                    }
                    catch (Exception ex)
                    {
                        Logger.HandleError(ex, nameof(CustomLinkLabel));
                        Macro.GoToForm(this.FormName);
                        Macro.Popup(this.FormName, this.FormName, this.PopupWidth, this.PopupHeight);
                        break;
                    }

                case LinkType.Form:
                    Macro.GoToForm(this.FormName);
                    break;

                case LinkType.EFolder:
                    EncompassHelper.Set("CX.OPENDOCUMENT", this.FormName);
                    break;

                case LinkType.Service:
                    Macro.DisplayServices(this.FormName);
                    break;

                case LinkType.Pricing:
                    Process.Start(this.InternetLink);
                    break;
                }
            }
            catch (Exception ex)
            {
                Logger.HandleError(ex, nameof(CustomLinkLabel));
            }
        }
        private void InitControls()
        {
            CDO = CustomDataObject.Get <LoanFolderRules>(LoanFolderRules.Key);
            dgvFolders.Columns.Add("Loan Folder", "Loan Folder");
            foreach (string folder in EncompassHelper.GetFolders())
            {
                dgvFolders.Rows.Add(folder);
            }

            cmbMilestone.Items.AddRange(EncompassHelper.GetAllMilestones());
        }
        private void GenerateWcmDisclosurePackage(WCMDisclosurePackage package)
        {
            string eFolderThatContainsPackage = package.EfolderNameThatContainsDisclosures;

            EncompassHelper.RemoveCurrentAttachmentsInEfolderPlaceholder(this.Loan, eFolderThatContainsPackage);
            Loan.Fields["CX.KM.PRINTSCENARIO"].Value = eFolderThatContainsPackage;

            if (package.PackageType == WCMPackageTypeEnum.PriorityPurchase)
            {
                _cdoDisclosuresUtility.GeneratePpBorrowersAuthorization();
            }
        }
Beispiel #16
0
        public override void FieldChanged(object sender, FieldChangeEventArgs e)
        {
            bool flag  = string.IsNullOrEmpty(EncompassHelper.Val("3152"));
            bool flag2 = e.FieldID.Equals("FR0108");
            bool flag3 = !string.IsNullOrEmpty(e.NewValue);
            bool flag4 = e.FieldID.Equals("3142");

            if (flag && flag3 && (flag2 || flag4))
            {
                ClearAndUpdateData();
            }
        }
Beispiel #17
0
        private void ClearAndUpdateData()
        {
            GeoCoordinate coordinates = Coordinates();


            List <HomeCounselor> List = GetAgencies(coordinates);

            if (List != null)
            {
                int index = 1;
                foreach (HomeCounselor c in List)
                {
                    EncompassHelper.SetBlank("HC01", index.ToString());
                    EncompassHelper.SetBlank("HC02", index.ToString());
                    EncompassHelper.SetBlank("HC03", index.ToString());
                    EncompassHelper.SetBlank("HC04", index.ToString());
                    EncompassHelper.SetBlank("HC05", index.ToString());
                    EncompassHelper.SetBlank("HC06", index.ToString());
                    EncompassHelper.SetBlank("HC07", index.ToString());
                    EncompassHelper.SetBlank("HC09", index.ToString());
                    EncompassHelper.SetBlank("HC10", index.ToString());
                    EncompassHelper.SetBlank("HC11", index.ToString());
                    EncompassHelper.SetBlank("HC12", index.ToString());
                    EncompassHelper.SetBlank("HC13", index.ToString());
                    EncompassHelper.SetBlank("HC17", index.ToString());

                    index++;
                }

                index = 1;
                foreach (HomeCounselor c in List)
                {
                    string i = index.ToString();
                    EncompassHelper.Set("HC01", !string.IsNullOrEmpty(c.Name) ? "Y" : string.Empty, i);
                    EncompassHelper.Set("HC02", c.Name, i);
                    EncompassHelper.Set("HC03", c.Address1, i);
                    EncompassHelper.Set("HC04", c.City, i);
                    EncompassHelper.Set("HC05", c.State, i);
                    EncompassHelper.Set("HC06", c.ZipCode, i);
                    EncompassHelper.Set("HC07", c.Phone1, i);
                    EncompassHelper.Set("HC09", c.Fax, i);
                    EncompassHelper.Set("HC10", c.Email, i);
                    EncompassHelper.Set("HC11", c.WebURL, i);
                    EncompassHelper.Set("HC12", Translate(c.Languages), i);
                    EncompassHelper.Set("HC13", Translate(c.Services, true), i);
                    EncompassHelper.Set("HC17", GetDistance(coordinates.Latitude, coordinates.Longitude, c.Latitude, c.Longitude), i);

                    index++;
                }
            }
        }
        public override void LoanOpened(object sender, EventArgs e)
        {
            if (EncompassApplication.Session.Loans.FieldDescriptors.CustomFields.Contains("CX.LOANOPEN"))
            {
                EncompassHelper.Set("CX.LOANOPEN", string.Empty);
                EncompassHelper.Set("CX.LOANOPEN", "X");
            }

            DocReceivedFields   = EncompassHelper.GetPrefixedFields("CX.DOCRECEIVED.");
            DocAttachmentFields = EncompassHelper.GetPrefixedFields("CX.DOCATTACH.");
            CanRun = DocReceivedFields.Count > 0 || DocAttachmentFields.Count > 0;

            RunChecks();
        }
        private async Task <ApiResponse <DownloadAttachmentResponse>[]> PerformDownloadDocument(DbResponse <EncompassDocumentEntity>[] addedDocuments, Guid loanGuid, string accessToken)
        {
            var urlRequests = addedDocuments.Select(x => new DownloadAttachmentRequest
            {
                LoanId            = EncompassHelper.GetLoanId(loanGuid),
                AccessToken       = accessToken,
                EncompassDocument = x.Body,
                DownloadFullPath  = BuildDownloadFilePath(_documentWorkerConfiguration.GetDownloadPath(),
                                                          x.Body.LoanGuid, x.Body.DocumentTypeName, x.Body.DocumentId)
            });

            var downloadTasks     = urlRequests.Select(x => _encompassClient.DownloadAttachmentAsync(x));
            var downloadResponses = await Task.WhenAll(downloadTasks.ToArray()).ConfigureAwait(false);

            return(downloadResponses);
        }
        public override void FieldChanged(object sender, FieldChangeEventArgs e)
        {
            if (!HasFields)
            {
                return;
            }

            if (e.FieldID.Equals("CX.OPENFORM") && !string.IsNullOrEmpty(e.NewValue))
            {
                InputFormInfo form = Session.FormManager.GetFormInfoByName(e.NewValue);
                if (form == null)
                {
                    return;
                }

                string   size        = EncompassHelper.Val("CX.OPENFORM.SIZE").ToString();
                string[] setSize     = size.Contains(',') ? size.Split(',') : new string[0];
                Size     controlSize = setSize.Count() > 0 ? new System.Drawing.Size(Convert.ToInt32(setSize[0]), Convert.ToInt32(setSize[1])) : new System.Drawing.Size(600, 600);
                q = new QuickEntryPopupDialog2(Session.LoanData, $"pop{form.Name}", form, controlSize.Width, controlSize.Height, EllieMae.Encompass.Forms.FieldSource.CurrentLoan, "", Session.DefaultInstance);
                q.Show();
                q.TopMost = true;
                Open      = true;

                EncompassHelper.SetBlank("CX.OPENFORM");
            }
            else if (Open)
            {
                foreach (Form f in FormWrapper.OpenForms.Where(x => x.Name.StartsWith("pop")).Select(x => x))
                {
                    LoanScreen screen = f?.Controls[0] as LoanScreen;
                    if (screen == null)
                    {
                        return;
                    }

                    if (screen != null && !screen.ContainsFocus)
                    {
                        screen.RefreshLoanContents();
                    }
                    else
                    {
                        Session.Application.GetService <ILoanEditor>()?.RefreshContents();
                    }
                }
            }
        }
Beispiel #21
0
        private void TxtHtml_TextChanged(object sender, EventArgs e)
        {
            string[]      split       = txtHtml.Text.Split('[', ']');
            string        finalHtml   = String.Join(" ", split);
            List <string> mergeFields = txtHtml.Text.Split().Where(x => x.StartsWith("[") && x.EndsWith("]")).Select(x => x.Replace("[", "").Replace("]", "")).ToList();

            foreach (string field in mergeFields)
            {
                string value = EncompassHelper.Val(field);
                finalHtml = finalHtml.Replace($"{field}", value);
            }

            browser.DocumentText = "0";
            browser.Document.OpenNew(true);
            browser.Document.Write(finalHtml);
            browser.Refresh();
        }
Beispiel #22
0
        private void btnRun_Click(object sender, EventArgs e)
        {
            Task.Run(() =>
            {
                bool guidReport = dgvData.Columns[0].HeaderText.Equals("guid", StringComparison.OrdinalIgnoreCase);
                foreach (DataGridViewRow r in dgvData.Rows)
                {
                    Color c = r.DefaultCellStyle.BackColor;
                    if (chkOnlyChanged.Checked && c != Color.Yellow)
                    {
                        continue;
                    }

                    if (c == Color.Red || c == Color.Green)
                    {
                        continue;
                    }

                    string guid = r.Cells[0].Value.ToString();
                    if (!guidReport)
                    {
                        guid = EncompassHelper.LoanNumberToGuid(guid);
                    }

                    if (string.IsNullOrEmpty(guid))
                    {
                        r.DefaultCellStyle.BackColor = Color.Red;
                        continue;
                    }
                    BatchUpdate b = new BatchUpdate(guid);
                    for (int i = 1; i < dgvData.Columns.Count; i++)
                    {
                        string value  = r.Cells[i].Value.ToString();
                        string header = dgvData.Columns[i].HeaderText;
                        b.Fields.Add(header, value);
                    }

                    EncompassHelper.SubmitBatch(b);
                    r.DefaultCellStyle.BackColor = Color.Green;
                }
            });
        }
        public bool Calculate()
        {
            bool ExpressionTrue = false;

            if (!string.IsNullOrEmpty(Expression))
            {
                try
                {
                    ExpressionTrue = (bool)EncompassHelper.ParseExpression(Expression, true);
                }
                catch (Exception ex)
                {
                    Logger.HandleError(ex, nameof(LoanFolderRule));
                }
            }

            bool milestonComplete = string.IsNullOrEmpty(Milestone) ? false : EncompassHelper.CheckMSComplete(Milestone);

            return(milestonComplete || ExpressionTrue);
        }
Beispiel #24
0
        private void GridView_ItemDoubleClick(object source, GVItemEventArgs e)
        {
            VIPRoot cdo = VIPCDO.CDO;

            if (cdo.Loans.Contains(EncompassApplication.CurrentLoan.Guid))
            {
                UserGroup group = EncompassApplication.Session.Users.Groups.GetGroupByName("VIP");
                if (group == null)
                {
                    return;
                }

                UserList users = group.GetUsers();
                if (!users.Contains(EncompassApplication.CurrentUser))
                {
                    Session.Application.GetService <ILoanConsole>().CloseLoanWithoutPrompts(false);
                    EncompassHelper.ShowOnTop("VIP", "You do not have access to this loan.");
                }
            }
        }
        // we want to disable name, email fields when a portal has already been created so a user doesn't change them
        private void DisableThirdPartyFieldsForPortalsAlreadyCreated()
        {
            // get a count of the title only portal ids created
            var topIds = BlendUtility.GetTitleOnlyBlendPartyPortalIds(this.Loan);

            //get a list of all controls that contain title only fields
            var controls = this.Form.GetAllFieldControls();
            var titleOnlyPersonControls = controls.Where(x => x.Field.FieldID.ToUpper().Contains("CX.BLEND.TPO")).ToList();

            for (int i = 1; i <= topIds.Count; i++)
            {
                // title only fields have a number at the end (i.e. cx.blend.tpo.firstname1)
                // go through and disable controls where field ID contains tpo naming convention AND the number
                var controlsThatAreForThisTitleOnlyParty = titleOnlyPersonControls.Where(x => x.Field.FieldID.Contains(i.ToString()));
                foreach (var controlToDisable in controlsThatAreForThisTitleOnlyParty)
                {
                    EncompassHelper.EnableDisableControl(controlToDisable.ControlID, this.Form, false);
                }
            }
        }
Beispiel #26
0
        private List <SearchResultField> SearchFields(string Search)
        {
            List <FieldDescriptor> results = new List <FieldDescriptor>();

            results = StandardFields.Cast <FieldDescriptor>().Where(x => x.FieldID.Equals(Search, StringComparison.OrdinalIgnoreCase)).ToList();
            if (results.Count < 1)
            {
                results = VirtualFields.Cast <FieldDescriptor>().Where(x => x.FieldID.Equals(Search, StringComparison.OrdinalIgnoreCase)).ToList();
                if (results.Count < 1)
                {
                    results = CustomFields.Cast <FieldDescriptor>().Where(x => x.FieldID.Equals(Search, StringComparison.OrdinalIgnoreCase)).ToList();
                }
            }

            if (results.Count < 1)
            {
                results.AddRange(StandardFields.Cast <FieldDescriptor>().Where(x => x.FieldID.Contains(Search.ToUpper())).ToList());
                results.AddRange(VirtualFields.Cast <FieldDescriptor>().Where(x => x.FieldID.Contains(Search.ToUpper())).ToList());
                results.AddRange(CustomFields.Cast <FieldDescriptor>().Where(x => x.FieldID.Contains(Search.ToUpper())).ToList());
            }
            if (results.Count < 1)
            {
                results.AddRange(StandardFields.Cast <FieldDescriptor>().Where(x => x.FieldID.Equals(Search, StringComparison.OrdinalIgnoreCase)).ToList());
                results.AddRange(VirtualFields.Cast <FieldDescriptor>().Where(x => x.FieldID.Equals(Search, StringComparison.OrdinalIgnoreCase)).ToList());
                results.AddRange(CustomFields.Cast <FieldDescriptor>().Where(x => x.FieldID.Equals(Search, StringComparison.OrdinalIgnoreCase)).ToList());
            }

            if (results.Count < 1)
            {
                results.AddRange(StandardFields.Cast <FieldDescriptor>().Where(x => x.FieldID.Equals(Search, StringComparison.OrdinalIgnoreCase) || x.Description.ToUpper().Contains(Search.ToUpper()) || EncompassHelper.Val(x.FieldID).ToUpper().Contains(Search.ToUpper())).ToList());
                results.AddRange(VirtualFields.Cast <FieldDescriptor>().Where(x => x.FieldID.Equals(Search, StringComparison.OrdinalIgnoreCase) || x.Description.ToUpper().Contains(Search.ToUpper()) || EncompassHelper.Val(x.FieldID).ToUpper().Contains(Search.ToUpper())).ToList());
                results.AddRange(CustomFields.Cast <FieldDescriptor>().Where(x => x.FieldID.Equals(Search, StringComparison.OrdinalIgnoreCase) || x.Description.ToUpper().Contains(Search.ToUpper()) || EncompassHelper.Val(x.FieldID).ToUpper().Contains(Search.ToUpper())).ToList());
            }

            return(results.Select(x => new SearchResultField()
            {
                FieldID = x.FieldID, Description = x.Description, FormattedValue = EncompassHelper.Val(x.FieldID)
            }).ToList());
        }
Beispiel #27
0
        public static bool CheckAccess(string pluginName)
        {
            CommunitySettings        cdo    = CustomDataObject.Get <CommunitySettings>(CommunitySettings.Key);
            List <PluginAccessRight> rights = cdo.Rights;

            if (rights.Count.Equals(0))
            {
                rights.Add(new PluginAccessRight()
                {
                    PluginName = nameof(TopMenuBase), AllAccess = true
                });
                rights.Add(new PluginAccessRight()
                {
                    PluginName = nameof(PluginManagement), AllAccess = true
                });
                CustomDataObject.Save <CommunitySettings>(CommunitySettings.Key, cdo);
            }

            PluginAccessRight right = rights.Where(x => x.PluginName.Equals(pluginName)).FirstOrDefault();

            if (right == null)
            {
                return(false);
            }

            bool isAllowedToRun = right.AllAccess;

            if (!isAllowedToRun && right.Personas != null)
            {
                isAllowedToRun = EncompassHelper.ContainsPersona(right.Personas);
            }

            if (!isAllowedToRun && right.UserIDs != null)
            {
                isAllowedToRun = right.UserIDs.Contains(EncompassHelper.User.ID);
            }

            return(isAllowedToRun);
        }
        private static string InsertEncompassValue(string Convert, string guid)
        {
            if (!Convert.Contains("["))
            {
                return(Convert);
            }

            string result = Convert;

            result = result.Replace("[", " [").Replace("]", "] ");
            string[] split     = result.Split('[', ']');
            string   finalHtml = String.Join(" ", split);

            string[] mergeFields = result.Split().Where(x => x.StartsWith("[") && x.EndsWith("]")).Select(x => x.Replace("[", "").Replace("]", "")).ToArray();
            string[] values      = EncompassHelper.GetReportValues(mergeFields, guid);

            for (int i = 0; i < mergeFields.Length; i++)
            {
                result = result.Replace($"[{mergeFields[i]}]", values[i]);
            }

            return(result);
        }
 private static void Fatal(string Text, object data = null)
 {
     ApplicationLog.WriteError(EncompassHelper.LoanNumber(), "Fatal");
 }
Beispiel #30
0
        public static List <MenuPanelSection> GetMenu()
        {
            List <MenuPanelSection> source = new List <MenuPanelSection>();

            foreach (System.Type type in ((IEnumerable <System.Type>) typeof(SideMenuUI).Assembly.GetTypes()).Where <System.Type>((Func <System.Type, bool>)(type => type.IsSubclassOf(typeof(LoanMenuControl)))).ToList <System.Type>())
            {
                LoanMenuControl loanMenuControl = Activator.CreateInstance(type) as LoanMenuControl;
                if (loanMenuControl != null && (loanMenuControl.CanRun() || EncompassHelper.IsSuper && EncompassHelper.IsTest()) && source.FirstOrDefault <MenuPanelSection>((Func <MenuPanelSection, bool>)(x => x.GetType() == loanMenuControl.GetType())) == null)
                {
                    source.Add(new MenuPanelSection(SideMenuUI.GetHeading(loanMenuControl.Name), true, (loanMenuControl.CanShow() ? 1 : 0) != 0, new Control[1]
                    {
                        (Control)loanMenuControl
                    }));
                    loanMenuControl.RunBase();
                }
            }
            return(source);
        }