public ReportTemplate SaveTemplate(ReportTemplate template) { if (template == null) { throw new ArgumentNullException("template"); } if (template.CreateOn == default(DateTime)) { template.CreateOn = TenantUtil.DateTimeNow(); } if (string.IsNullOrEmpty(template.CreateBy)) { template.CreateBy = SecurityContext.CurrentAccount.ID.ToString(); } return(reportDao.SaveTemplate(template)); }
private string GetHTMLComment(string text, string commentID) { var comment = new Comment { Content = text, CreateOn = TenantUtil.DateTimeNow(), CreateBy = SecurityContext.CurrentAccount.ID }; if (!String.IsNullOrEmpty(commentID)) { comment = Global.EngineFactory.GetCommentEngine().GetByID(new Guid(commentID)); comment.Content = text; } return(GetHTMLComment(comment, true)); }
public Subtask ChangeStatus(Task task, Subtask subtask, TaskStatus newStatus) { if (subtask == null) { throw new Exception("subtask.Task"); } if (task == null) { throw new ArgumentNullException("task"); } if (task.Status == TaskStatus.Closed) { throw new Exception("task can't be closed"); } if (subtask.Status == newStatus) { return(subtask); } ProjectSecurity.DemandEdit(task, subtask); subtask.Status = newStatus; subtask.LastModifiedBy = SecurityContext.CurrentAccount.ID; subtask.LastModifiedOn = TenantUtil.DateTimeNow(); subtask.StatusChangedOn = TenantUtil.DateTimeNow(); if (subtask.Responsible.Equals(Guid.Empty)) { subtask.Responsible = SecurityContext.CurrentAccount.ID; } var senders = GetSubscribers(task); if (task.Status != TaskStatus.Closed && newStatus == TaskStatus.Closed && !DisableNotifications && senders.Count != 0) { NotifyClient.Instance.SendAboutSubTaskClosing(senders, task, subtask); } if (task.Status != TaskStatus.Closed && newStatus == TaskStatus.Open && !DisableNotifications && senders.Count != 0) { NotifyClient.Instance.SendAboutSubTaskResumed(senders, task, subtask); } return(DaoFactory.SubtaskDao.Save(subtask)); }
public Milestone ChangeStatus(Milestone milestone, MilestoneStatus newStatus) { ProjectSecurity.DemandEdit(milestone); if (milestone == null) { throw new ArgumentNullException("milestone"); } if (milestone.Project == null) { throw new Exception("Project can be null."); } if (milestone.Status == newStatus) { return(milestone); } if (milestone.Project.Status == ProjectStatus.Closed) { throw new Exception(EngineResource.ProjectClosedError); } if (milestone.ActiveTaskCount != 0 && newStatus == MilestoneStatus.Closed) { throw new Exception("Can not close a milestone with open tasks"); } milestone.Status = newStatus; milestone.LastModifiedBy = SecurityContext.CurrentAccount.ID; milestone.LastModifiedOn = TenantUtil.DateTimeNow(); milestone.StatusChangedOn = TenantUtil.DateTimeNow(); var senders = new HashSet <Guid> { milestone.Project.Responsible, milestone.CreateBy, milestone.Responsible }; if (newStatus == MilestoneStatus.Closed && !false && senders.Count != 0) { NotifyClient.Instance.SendAboutMilestoneClosing(senders, milestone); } if (newStatus == MilestoneStatus.Open && !false && senders.Count != 0) { NotifyClient.Instance.SendAboutMilestoneResumed(senders, milestone); } return(DaoFactory.MilestoneDao.Save(milestone)); }
public Project ChangeStatus(Project project, ProjectStatus status) { if (project == null) { throw new ArgumentNullException("project"); } ProjectSecurity.DemandEdit(project); project.LastModifiedBy = SecurityContext.CurrentAccount.ID; project.LastModifiedOn = TenantUtil.DateTimeNow(); project.StatusChangedOn = DateTime.Now; project.Status = status; DaoFactory.ProjectDao.Update(project); return(project); }
public List <Milestone> GetLateMilestones(int offset, int max) { var now = TenantUtil.DateTimeNow(); var yesterday = now.Date.AddDays(-1); var query = CreateQuery() .SetFirstResult(offset) .Where("p.status", ProjectStatus.Open) .Where(!Exp.Eq("t.status", MilestoneStatus.Closed)) .Where(Exp.Le("t.deadline", yesterday)) .SetMaxResults(max) .OrderBy("t.deadline", true); using (var db = new DbManager(DatabaseId)) { return(db.ExecuteList(query).ConvertAll(converter)); } }
private UserInfo CreateUserInfo(LDAPUser domainUser) { return(new UserInfo { ID = Guid.NewGuid(), UserName = domainUser.AccountName, Sid = domainUser.Sid.Value, ActivationStatus = (!string.IsNullOrEmpty(domainUser.Mail) ? EmployeeActivationStatus.Activated : EmployeeActivationStatus.NotActivated), Email = (!string.IsNullOrEmpty(domainUser.Mail) ? domainUser.Mail : domainUser.AccountName + "@" + ADDomain.Domain.Name + ".net"), FirstName = (!string.IsNullOrEmpty(domainUser.FirstName) ? domainUser.FirstName : domainUser.AccountName), LastName = (!string.IsNullOrEmpty(domainUser.SecondName) ? domainUser.SecondName : domainUser.AccountName), MobilePhone = (!string.IsNullOrEmpty(domainUser.Mobile) ? domainUser.Mobile : string.Empty), Title = (!string.IsNullOrEmpty(domainUser.Title) ? domainUser.Title : string.Empty), Location = (!string.IsNullOrEmpty(domainUser.Street) ? domainUser.Street : string.Empty), WorkFromDate = TenantUtil.DateTimeNow() }); }
public List <Milestone> GetUpcomingMilestones(int offset, int max, params int[] projects) { var query = CreateQuery() .SetFirstResult(offset) .Where("p.status", ProjectStatus.Open) .Where(Exp.Ge("t.deadline", TenantUtil.DateTimeNow().Date)) .Where("t.status", MilestoneStatus.Open) .SetMaxResults(max) .OrderBy("t.deadline", true); if (projects != null && 0 < projects.Length) { query.Where(Exp.In("p.id", projects.Take(0 < max ? max : projects.Length).ToArray())); } return(Db.ExecuteList(query).ConvertAll(converter)); }
protected void Page_Load(object sender, EventArgs e) { if (Report.ReportType == ReportType.UsersActivity || Report.ReportType == ReportType.TimeSpend) { DateTime fromDateTime; DateTime toDateTime; if (!TryParseFilter("ffrom", out fromDateTime) || !TryParseFilter("fto", out toDateTime)) { fromDateTime = TenantUtil.DateTimeNow(); toDateTime = fromDateTime.AddDays(7); } fromDate.Text = fromDateTime.ToString(DateTimeExtension.DateFormatPattern); toDate.Text = toDateTime.ToString(DateTimeExtension.DateFormatPattern); } }
public static bool TryCreateReportFromTemplate(ReportTemplate template, Action <ReportState, string> callback, object obj, out ReportState state, bool auto = false) { var report = CreateNewReport(template.ReportType, template.Filter); template.Name = report.FileName; var data = report.GetDocbuilderData(template.Id); var dataJson = JsonConvert.SerializeObject(data); var columnsJson = JsonConvert.SerializeObject(report.ExtendedReportType.ColumnsName); var filterJson = JsonConvert.SerializeObject(template.Filter); var userCulture = CoreContext.UserManager.GetUsers(template.CreateBy).GetCulture(); var reportInfoJson = JsonConvert.SerializeObject(new Dictionary <string, object> { { "Title", report.ReportInfo.Title }, { "CreatedText", ReportResource.ReportCreated }, { "CreatedAt", TenantUtil.DateTimeNow().ToString("M/d/yyyy", CultureInfo.InvariantCulture) }, { "CreatedBy", ProjectsFilterResource.By + " " + CoreContext.UserManager.GetUsers(template.CreateBy).DisplayUserName(false) }, { "DateFormat", userCulture.DateTimeFormat.ShortDatePattern } }); var tmpFileName = DocbuilderReportsUtility.TmpFileName; var script = GetDocbuilderMasterTemplate .Replace("${outputFilePath}", tmpFileName) .Replace("${reportData}", dataJson) .Replace("${reportColumn}", columnsJson) .Replace("${reportFilter}", filterJson) .Replace("${reportInfo}", reportInfoJson.Replace("\"", "\\\"")) .Replace("${templateBody}", GetDocbuilderTemplate(report.ReportType.ToString(), report.Filter.ViewType)); state = new ReportState(report.FileName, tmpFileName, script, (int)template.ReportType, auto ? ReportOrigin.ProjectsAuto : ReportOrigin.Projects, callback, obj); if (data.Count == 0) { state.Exception = ReportResource.ErrorEmptyData; state.Status = ReportStatus.Failed; return(false); } DocbuilderReportsUtility.Enqueue(state); return(true); }
private void SetFieldValueInDb(EntityType entityType, int entityID, int fieldID, string fieldValue) { if (!_supportedEntityType.Contains(entityType)) { throw new ArgumentException(); } fieldValue = fieldValue.Trim(); var dbEntity = Query(CrmDbContext.FieldValue) .FirstOrDefault(x => x.EntityId == entityID && x.EntityType == entityType && x.FieldId == fieldID); if (string.IsNullOrEmpty(fieldValue) && dbEntity != null) { _factoryIndexer.Delete(dbEntity); CrmDbContext.Remove(dbEntity); } else { if (dbEntity == null) { dbEntity = new DbFieldValue { EntityId = entityID, FieldId = fieldID, EntityType = entityType, TenantId = TenantID }; CrmDbContext.Add(dbEntity); } dbEntity.Value = fieldValue; dbEntity.LastModifedOn = _tenantUtil.DateTimeToUtc(_tenantUtil.DateTimeNow()); dbEntity.LastModifedBy = _securityContext.CurrentAccount.ID; CrmDbContext.SaveChanges(); _factoryIndexer.Index(dbEntity); } }
public void UpdateNewTags(IEnumerable<Tag> tags) { if (tags == null || !tags.Any()) return; lock (syncRoot) { using (var tx = FilesDbContext.Database.BeginTransaction()) { var createOn = TenantUtil.DateTimeToUtc(TenantUtil.DateTimeNow()); foreach (var tag in tags) { UpdateNewTagsInDb(tag, createOn); } tx.Commit(); } } }
public List <Milestone> GetLateMilestones(int offset, int max, params int[] projects) { var query = CreateQuery() .SetFirstResult(offset) .Where("p.status", ProjectStatus.Open) .Where(!Exp.Eq("t.status", MilestoneStatus.Closed)) .Where(Exp.Le("t.deadline", TenantUtil.DateTimeNow().Date.AddDays(-1))) .SetMaxResults(max) .OrderBy("t.deadline", true); if (projects != null && 0 < projects.Length) { query.Where(Exp.In("p.id", projects.Take(0 < max ? max : projects.Length).ToArray())); } return(DbManager .ExecuteList(query) .ConvertAll(r => ToMilestone(r))); }
private static void BeforeTransferRequest(NotifyEngine sender, NotifyRequest request) { var aid = Guid.Empty; var aname = string.Empty; if (SecurityContext.IsAuthenticated) { aid = SecurityContext.CurrentAccount.ID; if (CoreContext.UserManager.UserExists(aid)) { aname = CoreContext.UserManager.GetUsers(aid).DisplayUserName(false) .Replace(">", ">") .Replace("<", "<"); } } IProduct product; IModule module; CommonLinkUtility.GetLocationByRequest(out product, out module); if (product == null && CallContext.GetData("asc.web.product_id") != null) { product = WebItemManager.Instance[(Guid)CallContext.GetData("asc.web.product_id")] as IProduct; } request.Arguments.Add(new TagValue(CommonTags.AuthorID, aid)); request.Arguments.Add(new TagValue(CommonTags.AuthorName, aname)); request.Arguments.Add(new TagValue(CommonTags.AuthorUrl, CommonLinkUtility.GetFullAbsolutePath(CommonLinkUtility.GetUserProfile(aid)))); request.Arguments.Add(new TagValue(CommonTags.VirtualRootPath, CommonLinkUtility.GetFullAbsolutePath("~").TrimEnd('/'))); request.Arguments.Add(new TagValue(CommonTags.ProductID, product != null ? product.ID : Guid.Empty)); request.Arguments.Add(new TagValue(CommonTags.ModuleID, module != null ? module.ID : Guid.Empty)); request.Arguments.Add(new TagValue(CommonTags.ProductUrl, CommonLinkUtility.GetFullAbsolutePath(product != null ? product.StartURL : "~"))); request.Arguments.Add(new TagValue(CommonTags.DateTime, TenantUtil.DateTimeNow())); request.Arguments.Add(new TagValue(CommonTags.Helper, new PatternHelper())); request.Arguments.Add(new TagValue(CommonTags.RecipientID, Context.SYS_RECIPIENT_ID)); request.Arguments.Add(new TagValue(CommonTags.RecipientSubscriptionConfigURL, CommonLinkUtility.GetMyStaff())); request.Arguments.Add(new TagValue("Partner", GetPartnerInfo())); request.Arguments.Add(new TagValue(Constants.LetterLogo, CommonLinkUtility.GetFullAbsolutePath(TenantLogoManager.GetLogoLight(true)))); if (!request.Arguments.Any(x => CommonTags.SendFrom.Equals(x.Tag))) { request.Arguments.Add(new TagValue(CommonTags.SendFrom, CoreContext.TenantManager.GetCurrentTenant().Name)); } }
public Issue SaveIssue(Issue issue) { if (issue == null) { throw new ArgumentNullException("issue"); } issue.LastModifiedBy = SecurityContext.CurrentAccount.ID; issue.LastModifiedOn = TenantUtil.DateTimeNow(); if (issue.CreateBy == default(Guid)) { issue.CreateBy = SecurityContext.CurrentAccount.ID; } if (issue.CreateOn == default(DateTime)) { issue.CreateOn = TenantUtil.DateTimeNow(); } return(dao.SaveIssue(issue)); }
public virtual void UpdateCases(Cases cases) { CRMSecurity.DemandEdit(cases); // Delete relative keys _cache.Insert(_caseCacheKey, String.Empty); using (var db = GetDb()) { db.ExecuteNonQuery( Update("crm_case") .Set("title", cases.Title) .Set("is_closed", cases.IsClosed) .Set("last_modifed_on", TenantUtil.DateTimeToUtc(TenantUtil.DateTimeNow())) .Set("last_modifed_by", SecurityContext.CurrentAccount.ID) .Where("id", cases.ID) ); } }
private void AddToHistory(int contactID, String content, DaoFactory _daoFactory) { if (contactID == 0 || String.IsNullOrEmpty(content)) { return; } var historyEvent = new RelationshipEvent() { ContactID = contactID, Content = content, CreateBy = _currUser, CreateOn = _tenantUtil.DateTimeNow(), }; if (historyCategory == 0) { var listItemDao = _daoFactory.GetListItemDao(); // HACK var listItem = listItemDao.GetItems(ListType.HistoryCategory).Find(item => item.AdditionalParams == "event_category_email.png"); if (listItem == null) { listItemDao.CreateItem( ListType.HistoryCategory, new ListItem { AdditionalParams = "event_category_email.png", Title = CRMCommonResource.HistoryCategory_Note }); } historyCategory = listItem.ID; } historyEvent.CategoryID = historyCategory; var relationshipEventDao = _daoFactory.GetRelationshipEventDao(); historyEvent = relationshipEventDao.CreateItem(historyEvent); if (historyEvent.ID > 0 && _fileID != null && _fileID.Count > 0) { relationshipEventDao.AttachFiles(historyEvent.ID, _fileID.ToArray()); } }
public Template SaveOrUpdate(Template template) { if (template.Id == default(int)) { if (template.CreateBy == default(Guid)) { template.CreateBy = SecurityContext.CurrentAccount.ID; } if (template.CreateOn == default(DateTime)) { template.CreateOn = TenantUtil.DateTimeNow(); } } template.LastModifiedBy = SecurityContext.CurrentAccount.ID; template.LastModifiedOn = TenantUtil.DateTimeNow(); return(_dao.Save(template)); }
public virtual void UpdateCases(Cases cases) { CRMSecurity.DemandEdit(cases); // Delete relative keys _cache.Remove(new Regex(TenantID.ToString(CultureInfo.InvariantCulture) + "invoice.*")); using (var db = GetDb()) { db.ExecuteNonQuery( Update("crm_case") .Set("title", cases.Title) .Set("is_closed", cases.IsClosed) .Set("last_modifed_on", TenantUtil.DateTimeToUtc(TenantUtil.DateTimeNow())) .Set("last_modifed_by", SecurityContext.CurrentAccount.ID) .Where("id", cases.ID) ); } }
public int Compare(DateTime x, DateTime y) { var today = TenantUtil.DateTimeNow(); var leap = new DateTime(2000, today.Month, today.Day); var dx = new DateTime(2000, x.Month, x.Day).DayOfYear - leap.DayOfYear; var dy = new DateTime(2000, y.Month, y.Day).DayOfYear - leap.DayOfYear; if (dx < 0 && dy >= 0) { return(1); } if (dx >= 0 && dy < 0) { return(-1); } return(dx.CompareTo(dy)); }
public Subtask Copy(Subtask from, Task task, IEnumerable <Participant> team) { var subtask = new Subtask { ID = default(int), CreateBy = SecurityContext.CurrentAccount.ID, CreateOn = TenantUtil.DateTimeNow(), Task = task.ID, Title = from.Title, Status = from.Status }; if (team.Any(r => r.ID == from.Responsible)) { subtask.Responsible = from.Responsible; } return(SaveOrUpdate(subtask, task)); }
private DateTime GetDate(bool start) { var date = TenantUtil.DateTimeNow(); if (TimeInterval == ReportTimeInterval.Today) { return date; } if (TimeInterval == ReportTimeInterval.Yesterday) { return date.AddDays(-1); } if (TimeInterval == ReportTimeInterval.Tomorrow) { return date.AddDays(1); } if (TimeInterval == ReportTimeInterval.CurrWeek || TimeInterval == ReportTimeInterval.NextWeek || TimeInterval == ReportTimeInterval.PrevWeek) { var diff = CoreContext.TenantManager.GetCurrentTenant().GetCulture().DateTimeFormat.FirstDayOfWeek - date.DayOfWeek; if (0 < diff) diff -= 7; date = date.AddDays(diff); if (TimeInterval == ReportTimeInterval.NextWeek) date = date.AddDays(7); if (TimeInterval == ReportTimeInterval.PrevWeek) date = date.AddDays(-7); if (!start) date = date.AddDays(7).AddDays(-1); return date; } if (TimeInterval == ReportTimeInterval.CurrMonth || TimeInterval == ReportTimeInterval.NextMonth || TimeInterval == ReportTimeInterval.PrevMonth) { date = new DateTime(date.Year, date.Month, 1); if (TimeInterval == ReportTimeInterval.NextMonth) date = date.AddMonths(1); if (TimeInterval == ReportTimeInterval.PrevMonth) date = date.AddMonths(-1); if (!start) date = date.AddMonths(1).AddDays(-1); return date; } if (TimeInterval == ReportTimeInterval.CurrYear || TimeInterval == ReportTimeInterval.NextYear || TimeInterval == ReportTimeInterval.PrevYear) { date = new DateTime(date.Year, 1, 1); if (TimeInterval == ReportTimeInterval.NextYear) date = date.AddYears(1); if (TimeInterval == ReportTimeInterval.PrevYear) date = date.AddYears(-1); if (!start) date = date.AddYears(1).AddDays(-1); return date; } throw new ArgumentOutOfRangeException(string.Format("TimeInterval")); }
private int Update(ContactInfo contactInfo, DbManager db) { if (contactInfo == null || contactInfo.ID == 0 || contactInfo.ContactID == 0) { throw new ArgumentException(); } db.ExecuteNonQuery(Update("crm_contact_info") .Where("id", contactInfo.ID) .Set("data", contactInfo.Data) .Set("category", contactInfo.Category) .Set("is_primary", contactInfo.IsPrimary) .Set("contact_id", contactInfo.ContactID) .Set("type", (int)contactInfo.InfoType) .Set("last_modifed_on", TenantUtil.DateTimeToUtc(TenantUtil.DateTimeNow())) .Set("last_modifed_by", ASC.Core.SecurityContext.CurrentAccount.ID) ); return(contactInfo.ID); }
protected void cmdRevert_Click(object sender, EventArgs e) { int ver; if (int.TryParse((sender as LinkButton).CommandName, out ver)) { var page = Wiki.GetPage(PageNameUtil.Decode(WikiPage), ver); if (page != null) { page.Date = TenantUtil.DateTimeNow(); page.UserID = SecurityContext.CurrentAccount.ID; page.Version = Wiki.GetPageMaxVersion(page.PageName) + 1; Wiki.SavePage(page); Wiki.UpdateCategoriesByPageContent(page); BindHistoryList(); } } }
private int CreateNewDealInDb(Deal deal) { if (String.IsNullOrEmpty(deal.Title) || deal.ResponsibleID == Guid.Empty || deal.DealMilestoneID <= 0) { throw new ArgumentException(); } // Delete relative keys _cache.Remove(new Regex(TenantID.ToString(CultureInfo.InvariantCulture) + "deals.*")); var itemToInsert = new DbDeal { Title = deal.Title, Description = deal.Description, ResponsibleId = deal.ResponsibleID, ContactId = deal.ContactID, BidCurrency = deal.BidCurrency, BidValue = deal.BidValue, BidType = deal.BidType, DealMilestoneId = deal.DealMilestoneID, DealMilestoneProbability = deal.DealMilestoneProbability, ExpectedCloseDate = deal.ExpectedCloseDate, ActualCloseDate = deal.ActualCloseDate, PerPeriodValue = deal.PerPeriodValue, CreateOn = _tenantUtil.DateTimeToUtc(deal.CreateOn == DateTime.MinValue ? _tenantUtil.DateTimeNow() : deal.CreateOn), CreateBy = _securityContext.CurrentAccount.ID, LastModifedOn = _tenantUtil.DateTimeToUtc(deal.CreateOn == DateTime.MinValue ? _tenantUtil.DateTimeNow() : deal.CreateOn), LastModifedBy = _securityContext.CurrentAccount.ID, TenantId = TenantID }; CrmDbContext.Deals.Add(itemToInsert); CrmDbContext.SaveChanges(); var dealID = itemToInsert.Id; // if (deal.ContactID > 0) // AddMember(dealID, deal.ContactID); return(dealID); }
public static string ToVerbString(this DateTime dateTime) { try { TimeSpan diff = (TenantUtil.DateTimeNow().Date - dateTime.Date); if (diff.Days == 0) { return(dateTime.ToShortTimeString()); } if (TenantUtil.DateTimeNow().Year == dateTime.Date.Year) { return(String.Format("{0}", dateTime.ToString("MMMM dd"))); } return(String.Format("{0} {1} {2}", dateTime.ToString("dd"), dateTime.ToString("MMMM"), dateTime.ToString("yyyy"))); } catch (Exception) { return(String.Format("{0} {1}", dateTime.ToShortDateString(), dateTime.ToShortTimeString())); } }
public Comment UpdateComment(Comment comment) { var toUpdate = GetComment(comment.Id); if (toUpdate == null) { throw new ItemNotFoundException("comment not found"); } if (String.IsNullOrEmpty(comment.Body)) { throw new ArgumentException(@"comment content cannot be empty", "comment"); } CommunitySecurity.DemandPermissions(new WikiObjectsSecurityObject(toUpdate), ASC.Web.Community.Wiki.Common.Constants.Action_EditRemoveComment); toUpdate.Body = comment.Body; toUpdate.UserId = SecurityContext.CurrentAccount.ID; toUpdate.Date = TenantUtil.DateTimeNow(); return(SaveComment(toUpdate)); }
public Subtask Copy(Subtask from, Task task) { var team = factory.ProjectEngine.GetTeam(task.Project.ID); var subtask = new Subtask { ID = default(int), CreateBy = SecurityContext.CurrentAccount.ID, CreateOn = TenantUtil.DateTimeNow(), Task = task.ID, Title = from.Title, Status = from.Status }; if (team.Any(r => r.ID == from.Responsible)) { subtask.Responsible = from.Responsible; } return(SaveOrUpdate(subtask, task)); }
public void SaveOrUpdate(Comment comment) { if (comment == null) { throw new ArgumentNullException("comment"); } if (comment.CreateBy == default(Guid)) { comment.CreateBy = SecurityContext.CurrentAccount.ID; } var now = TenantUtil.DateTimeNow(); if (comment.CreateOn == default(DateTime)) { comment.CreateOn = now; } commentDao.Save(comment); }
private static UserInfo CreateNewUser(string firstName, string lastName, string email, string pwd, EmployeeType employeeType, bool fromInviteLink) { var isVisitor = employeeType == EmployeeType.Visitor; string secretEmailPattern = ConfigurationManager.AppSettings["web.autotest.secret-email"]; if (!string.IsNullOrEmpty(secretEmailPattern) && Regex.IsMatch(email, secretEmailPattern, RegexOptions.Compiled)) { fromInviteLink = false; } var newUser = UserManagerWrapper.AddUser(new UserInfo { FirstName = firstName, LastName = lastName, Email = email, WorkFromDate = TenantUtil.DateTimeNow() }, pwd, true, true, isVisitor, fromInviteLink); return(newUser); }