/// <summary> /// Создать сайт проверки контрагента. /// </summary> /// <param name="entityId">GUID сайта.</param> /// <param name="name">Имя сайта.</param> /// <param name="homeUrl">Домашняя страница сайта.</param> /// <param name="url">Шаблон адреса сайта.</param> /// <param name="isDefault">Признак, что сайт используется при открытии сайта из карточки КА.</param> /// <param name="note">Примечание.</param> /// <param name="selfEmployedUrl">Шаблон адреса сайта (ИП) (по умолчанию - null).</param> public static void CreateDueDiligenceWebsite(Guid entityId, string name, string homeUrl, string url, bool isDefault, string note, string selfEmployedUrl = null) { var externalLink = Docflow.PublicFunctions.Module.GetExternalLink(DueDiligenceWebsite.ClassTypeGuid, entityId); var dueDiligenceWebsite = DueDiligenceWebsites.Null; if (externalLink != null) { InitializationLogger.DebugFormat("Init: Refresh Due Diligence Website {0}", name); dueDiligenceWebsite = DueDiligenceWebsites.Get(externalLink.EntityId.Value); } else { InitializationLogger.DebugFormat("Init: Create Due Diligence Website {0}", name); dueDiligenceWebsite = DueDiligenceWebsites.Create(); dueDiligenceWebsite.IsDefault = isDefault; } dueDiligenceWebsite.IsSystem = true; dueDiligenceWebsite.Name = name; dueDiligenceWebsite.HomeUrl = homeUrl; dueDiligenceWebsite.Url = url; if (selfEmployedUrl != null) { dueDiligenceWebsite.UrlForSelfEmployed = selfEmployedUrl; } dueDiligenceWebsite.Note = note; dueDiligenceWebsite.Save(); if (externalLink == null) { Docflow.PublicFunctions.Module.CreateExternalLink(dueDiligenceWebsite, entityId); } }
public static IRole CreateRole(string roleName, string roleDescription, Guid roleGuid) { InitializationLogger.DebugFormat("Init: Create Role {0}", roleName); var role = Roles.GetAll(r => r.Sid == roleGuid).FirstOrDefault(); if (role == null) { role = Roles.Create(); role.Name = roleName; role.Description = roleDescription; role.Sid = roleGuid; role.IsSystem = true; role.Save(); } else { if (role.Name != roleName) { InitializationLogger.DebugFormat("Role '{0}'(Sid = {1}) renamed as '{2}'", role.Name, role.Sid, roleName); role.Name = roleName; role.Save(); } if (role.Description != roleDescription) { InitializationLogger.DebugFormat("Role '{0}'(Sid = {1}) update Description '{2}'", role.Name, role.Sid, roleDescription); role.Description = roleDescription; role.Save(); } } return(role); }
/// <summary> /// Создать страну, регионы и города согласно ФИАС. /// </summary> public static void CreateCountryRegionsCitiesFromFIAS() { if (Functions.Module.IsServerCultureRussian() && !Countries.GetAll().Any()) { InitializationLogger.DebugFormat("Init: Create country, regions and cities."); Docflow.PublicFunctions.Module.ExecuteSQLCommand(Queries.Module.CreateCountryRegionsCitiesFromFIAS); } }
public static void CreateApprovalRole(Enumeration roleType, string description) { InitializationLogger.DebugFormat("Init: Create approval rule {0}", ApprovalRoleBases.Info.Properties.Type.GetLocalizedValue(roleType)); var role = ProjectApprovalRoles.GetAll().Where(r => Equals(r.Type, roleType)).FirstOrDefault(); if (role == null) { role = ProjectApprovalRoles.Create(); role.Type = roleType; } role.Description = description; role.Save(); }
public static void CreateProjectKind(string name, Guid entityId) { var externalLink = Docflow.PublicFunctions.Module.GetExternalLink(ProjectKind.ClassTypeGuid, entityId); if (externalLink != null) { return; } InitializationLogger.DebugFormat("Init: Create project kind '{0}'.", name); var projectKind = ProjectKinds.Create(); projectKind.Name = name; projectKind.Save(); Docflow.PublicFunctions.Module.CreateExternalLink(projectKind, entityId); }
/// <summary> /// Обновить банки. /// </summary> public static void UpdateBanksFromCBR() { if (Commons.PublicFunctions.Module.IsServerCultureRussian()) { InitializationLogger.DebugFormat("Init: Update banks from CBR."); Docflow.PublicFunctions.Module.ExecuteSQLCommand(Queries.Module.PrepareBanksUpdate); Docflow.PublicFunctions.Module.ExecuteSQLCommand(Queries.Module.UpdateBanksFromCBR); var count = int.Parse(Docflow.PublicFunctions.Module.ExecuteScalarSQLCommand(Queries.Module.GetNewCountBanks).ToString()); if (count > 0) { // BUG 75302, Zamerov: генерируем ID для новых банков кодом, иначе создание контрагентов через Create будет ставить дедлок. var tableName = Banks.Info.DBTableName; var ids = Domain.IdentifierGenerator.GenerateIdentifiers(tableName, count).ToList(); using (var command = SQL.GetCurrentConnection().CreateCommand()) { command.CommandText = Queries.Module.CreateBanksFromCBR; Docflow.PublicFunctions.Module.AddIntegerParameterToCommand(command, "@newId", ids.First()); command.ExecuteNonQuery(); } } Docflow.PublicFunctions.Module.ExecuteSQLCommand(Queries.Module.CleanTempTablesAfterUpdateBanks); } }