private void bwLoadCatalogues_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { try { // check the status of the async operation. if (e.Error != null) { string errorMessage = Messages.ErrLoadingCatalogues + Environment.NewLine + e.Error.Message; MessageBox.Show(Utils.FormContainer, errorMessage, Messages.Error, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } // status OK if (!e.Cancelled && e.Error == null) { if (e.Result != null) { Catalogues cataloguesPerUser = e.Result as Catalogues; globalCataloguesCollection.Add(cataloguesPerUser); } } } catch (Exception ex) { MyLogger.Write(ex, "bwLoadCatalogues_RunWorkerCompleted", LoggingCategory.Exception); throw new Exception(Messages.ErrLoadingCatalogues, ex); } finally { Interlocked.Decrement(ref activeThreads); } }
protected virtual void SaveCataloguesAcl(Catalogues catalogues, CataloguesModel model) { var existingAclRecords = _aclService.GetAclRecords(catalogues); var allCustomerRoles = _customerService.GetAllCustomerRoles(true); foreach (var customerRole in allCustomerRoles) { if (model.SelectedCustomerRoleIds != null && model.SelectedCustomerRoleIds.Contains(customerRole.Id)) { //new role if (existingAclRecords.Count(acl => acl.CustomerRoleId == customerRole.Id) == 0) { _aclService.InsertAclRecord(catalogues, customerRole.Id); } } else { //remove role var aclRecordToDelete = existingAclRecords.FirstOrDefault(acl => acl.CustomerRoleId == customerRole.Id); if (aclRecordToDelete != null) { _aclService.DeleteAclRecord(aclRecordToDelete); } } } }
/// <summary> /// Updates the catalogues /// </summary> /// <param name="catalogues">Catalogues</param> public virtual void UpdateCatalogues(Catalogues catalogues) { if (catalogues == null) { throw new ArgumentNullException("catalogues"); } //validate catalogues hierarchy var parentCatalogues = GetCatalogueById(catalogues.ParentCatalogueId); while (parentCatalogues != null) { if (catalogues.Id == parentCatalogues.Id) { catalogues.ParentCatalogueId = 0; break; } parentCatalogues = GetCatalogueById(parentCatalogues.ParentCatalogueId); } _cataloguesRepository.Update(catalogues); //cache _cacheManager.RemoveByPattern(CATALOGUES_PATTERN_KEY); _cacheManager.RemoveByPattern(NEWSCATALOGUES_PATTERN_KEY); //event notification _eventPublisher.EntityUpdated(catalogues); }
protected virtual void UpdateLocales(Catalogues catalogues, CataloguesModel model) { foreach (var localized in model.Locales) { _localizedEntityService.SaveLocalizedValue(catalogues, x => x.Name, localized.Name, localized.LanguageId); _localizedEntityService.SaveLocalizedValue(catalogues, x => x.Description, localized.Description, localized.LanguageId); _localizedEntityService.SaveLocalizedValue(catalogues, x => x.MetaKeywords, localized.MetaKeywords, localized.LanguageId); _localizedEntityService.SaveLocalizedValue(catalogues, x => x.MetaDescription, localized.MetaDescription, localized.LanguageId); _localizedEntityService.SaveLocalizedValue(catalogues, x => x.MetaTitle, localized.MetaTitle, localized.LanguageId); //search engine name var seName = catalogues.ValidateSeName(localized.SeName, localized.Name, false); _urlRecordService.SaveSlug(catalogues, seName, localized.LanguageId); } }
private void cmbConnections_SelectedValueChanged(object sender, EventArgs e) { try { if (cmbConnections.SelectedValue != null) { int selUser = int.Parse(cmbConnections.SelectedValue.ToString()); if (selUser != this.connectionId) { this.connectionId = selUser; this.Enabled = false; cataloguesPerUser = _catalogues.GetCataloguesForConnection(this.connectionId); // load the catalogues from the new selected user // and populate the controls accordingly PopulateControls(); this.Enabled = true; } } } catch (Exception ex) { MyLogger.Write(ex, "cmbConnections_SelectedValueChanged", LoggingCategory.Exception); MessageBox.Show(this, ex.Message, Messages.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Get catalogues breadcrumb /// </summary> /// <param name="catalogues">Catalogues</param> /// <param name="cataloguesService">Catalogues service</param> /// <param name="aclService">ACL service</param> /// <param name="storeMappingService">Store mapping service</param> /// <param name="showHidden">A value indicating whether to load hidden records</param> /// <returns>Catalogues breadcrumb </returns> public static IList <Catalogues> GetCataloguesBreadCrumb(this Catalogues catalogues, ICataloguesService cataloguesService, IAclService aclService, IStoreMappingService storeMappingService, bool showHidden = false) { if (catalogues == null) { throw new ArgumentNullException("catalogues"); } var result = new List <Catalogues>(); //used to prevent circular references var alreadyProcessedCatalogueIds = new List <int>(); while (catalogues != null && //not null !catalogues.Deleted && //not deleted (showHidden || catalogues.Published) && //published (showHidden || aclService.Authorize(catalogues)) && //ACL !alreadyProcessedCatalogueIds.Contains(catalogues.Id)) //prevent circular references { result.Add(catalogues); alreadyProcessedCatalogueIds.Add(catalogues.Id); catalogues = cataloguesService.GetCatalogueById(catalogues.ParentCatalogueId); } result.Reverse(); return(result); }
/// <summary> /// Get formatted catalogues breadcrumb /// Note: ACL and store mapping is ignored /// </summary> /// <param name="catalogues">Catalogues</param> /// <param name="cataloguesService">Catalogues service</param> /// <param name="separator">Separator</param> /// <param name="languageId">Language identifier for localization</param> /// <returns>Formatted breadcrumb</returns> public static string GetFormattedBreadCrumb(this Catalogues catalogues, ICataloguesService cataloguesService, string separator = ">>", int languageId = 0) { if (catalogues == null) { throw new ArgumentNullException("catalogues"); } string result = string.Empty; //used to prevent circular references var alreadyProcessedCatalogueIds = new List <int>(); while (catalogues != null && //not null !catalogues.Deleted && //not deleted !alreadyProcessedCatalogueIds.Contains(catalogues.Id)) //prevent circular references { var cataloguesName = catalogues.GetLocalized(x => x.Name, languageId); if (String.IsNullOrEmpty(result)) { result = cataloguesName; } else { result = string.Format("{0} {1} {2}", cataloguesName, separator, result); } alreadyProcessedCatalogueIds.Add(catalogues.Id); catalogues = cataloguesService.GetCatalogueById(catalogues.ParentCatalogueId); } return(result); }
void refreshCatalogues_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker bkgWork = sender as BackgroundWorker; try { bkgWork.ReportProgress(0); List <Catalogues> activeConnections = new List <Catalogues>(); for (int i = 0; i < globalCataloguesCollection.Count; i++) { activeConnections.Add(globalCataloguesCollection[i]); } globalCataloguesCollection.Clear(); for (int i = 0; i < activeConnections.Count; i++) { TDSettings.ConnectionRow connRow = _appSettings.GetConnectionById(activeConnections [i].ConnectionId); Catalogues newCatalogue = null; try { newCatalogue = CatalogueManager.GetCataloguesForUser(connRow, bkgWork); } catch (Exception) { // login failed or another exception // old collection are kept. } // add catalogues per user if (newCatalogue != null) { globalCataloguesCollection.Add(newCatalogue); } else { // keep the old collections globalCataloguesCollection.Add(activeConnections[i]); } string connectionInfo = _appSettings.GetConnectionInfo(connRow.ConnectionId); bkgWork.ReportProgress(1 + i * 90 / activeConnections.Count, connectionInfo); } bkgWork.ReportProgress(100); } catch (Exception ex) { MyLogger.Write(ex, "refreshCatalogues_DoWork", LoggingCategory.Exception); bkgWork.ReportProgress(100); throw; } }
private void EditBug_Load(object sender, EventArgs e) { try { if (!this.DesignMode) { _appSettings = MyZillaSettingsDataSet.GetInstance(); _asyncOpManager = AsyncOperationManagerList.GetInstance(); // disable the control until de bug details are loaded and // all the controls are populated accordingly. ShowConnectionInfo(); this.Enabled = false; _catalogues = CatalogueManager.Instance(); //if (_catalogues.DependentCataloguesLoadedCompleted!=null) _catalogues.DependentCataloguesLoadedCompleted += new EventHandler(this._catalogues_DependentCataloguesLoadedCompleted); cataloguesPerUser = _catalogues.GetCataloguesForConnection(this.connectionId); if (cataloguesPerUser.catalogueComponent == null || cataloguesPerUser.catalogueVersion == null || cataloguesPerUser.catalogueTargetMilestone == null) { cmbComponent.Enabled = false; cmbVersion.Enabled = false; cmbMilestone.Enabled = false; _catalogues.CompAndVersionCataloguesLoadedCompleted += new EventHandler(_catalogues_CompAndVersionCataloguesLoadedCompleted); _catalogues.LoadCompAndVersionCatalogues(cataloguesPerUser); } else { PopulateControls(); // asyn op GetBugDetailsAndSetControls(this.bugId, true); } if (_appSettings.GetConnectionById(connectionId).Version.StartsWith("2.18")) { GetLastUpdated(); } } } catch (Exception ex) { MyLogger.Write(ex, "EditBug_Load", LoggingCategory.Exception); MessageBox.Show(this, ex.Message, Messages.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected virtual void UpdatePictureSeoNames(Catalogues catalogues) { var picture = _pictureService.GetPictureById(catalogues.PictureId); if (picture != null) { _pictureService.SetSeoFilename(picture.Id, _pictureService.GetPictureSeName(catalogues.Name)); } }
private void InsertBug_Load(object sender, EventArgs e) { try { if (!this.DesignMode) { MyZillaSettingsDataSet _appSettings = MyZillaSettingsDataSet.GetInstance(); _catalogues = CatalogueManager.Instance(); this.txtReporter.Text = _appSettings.GetConnectionById(this.connectionId).UserName; asyncOpManager = AsyncOperationManagerList.GetInstance(); cmbConnections.SelectedValueChanged -= new EventHandler(cmbConnections_SelectedValueChanged); LoadConnectionInfo(); cmbConnections.Text = _appSettings.GetConnectionInfo(this.connectionId); cmbConnections.SelectedValueChanged += new EventHandler(cmbConnections_SelectedValueChanged); // verify if all catalogues have been added and populate the controls properly cataloguesPerUser = _catalogues.GetCataloguesForConnection(this.connectionId); if (cataloguesPerUser.catalogueComponent == null || cataloguesPerUser.catalogueVersion == null || cataloguesPerUser.catalogueTargetMilestone == null) { cmbComponent.Enabled = false; cmbVersion.Enabled = false; cmbMilestone.Enabled = false; btnInsertBug.Enabled = false; _catalogues.CompAndVersionCataloguesLoadedCompleted += new EventHandler(_catalogues_CompAndVersionCataloguesLoadedCompleted); _catalogues.LoadCompAndVersionCatalogues(cataloguesPerUser); } else { _catalogues.DependentCataloguesLoadedCompleted += new EventHandler(this._catalogues_DependentCataloguesLoadedCompletedInsertBug); PopulateControls(); } } } catch (Exception ex) { MyLogger.Write(ex, "InsertBug_Load", LoggingCategory.Exception); MessageBox.Show(this, ex.Message, Messages.Error, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void bkgDepCatalogues1_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker bkgWork = sender as BackgroundWorker; try { #if DEBUG System.Diagnostics.Stopwatch watch = System.Diagnostics.Stopwatch.StartNew(); #endif Interlocked.Increment(ref activeThreads); bkgWork.ReportProgress(0); bkgWork.ReportProgress(10); // component and version catalogues Catalogues cataloguesPerUser = e.Argument as Catalogues; IUtilities catalogue = (IUtilities)BLControllerFactory.GetRegisteredConcreteFactory(cataloguesPerUser.ConnectionId); bkgWork.ReportProgress(60); // request ArrayList al = catalogue.GetValuesForDependentCatalogues(0, cataloguesPerUser.catalogueProduct); cataloguesPerUser.catalogueComponent = al[0] as NameValueCollection; cataloguesPerUser.catalogueVersion = al[1] as NameValueCollection; cataloguesPerUser.catalogueTargetMilestone = al[2] as NameValueCollection; bkgWork.ReportProgress(100); e.Result = cataloguesPerUser; #if DEBUG watch.Stop(); MyLogger.Write(watch.ElapsedMilliseconds.ToString(), "bkgDepCatalogues1_DoWork", LoggingCategory.Debug); #endif } catch (Exception ex) { MyLogger.Write(ex, "bkgDepCatalogues1_DoWork", LoggingCategory.Exception); bkgWork.ReportProgress(100); throw; } }
void bkgDepCatalogues2_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker bkgWork = sender as BackgroundWorker; try { bkgWork.ReportProgress(0); bkgWork.ReportProgress(10); Interlocked.Increment(ref activeThreads); ArrayList argument = e.Argument as ArrayList; //get connection id from the event arguments int connectionID = int.Parse(argument[0].ToString()); //get product name from the event arguments string product = argument[1].ToString(); Catalogues cataloguesPerUser = this.GetCataloguesForConnection(connectionID); IUtilities catalogue = (IUtilities)BLControllerFactory.GetRegisteredConcreteFactory(connectionID); bkgWork.ReportProgress(60); // al[0] = AssignTo; al[1] = CC // request ArrayList alSpecificCatalogues = catalogue.GetSpecificCataloguesWhenManageBug(product, cataloguesPerUser.catalogueComponent); NameValueCollection assignToColl = alSpecificCatalogues[0] as NameValueCollection; cataloguesPerUser.catalogueAssignedTo = assignToColl; NameValueCollection ccColl = alSpecificCatalogues[1] as NameValueCollection; cataloguesPerUser.catalogueCC = ccColl; NameValueCollection ccPriority = alSpecificCatalogues[2] as NameValueCollection; cataloguesPerUser.catalogueDefaultPriority = ccPriority; bkgWork.ReportProgress(100); } catch (Exception ex) { MyLogger.Write(ex, "bkgDepCatalogues2_DoWork", LoggingCategory.Exception); bkgWork.ReportProgress(100); throw; } }
public void LoadCompAndVersionCatalogues(Catalogues cataloguesPerUser) { // start a new thread for Component and Version catalogues BackgroundWorker bkgDepCatalogues1 = new BackgroundWorker(); bkgDepCatalogues1.DoWork += new DoWorkEventHandler(bkgDepCatalogues1_DoWork); bkgDepCatalogues1.ProgressChanged += new ProgressChangedEventHandler(bkgDepCatalogues1_ProgressChanged); bkgDepCatalogues1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bkgDepCatalogues1_RunWorkerCompleted); bkgDepCatalogues1.WorkerReportsProgress = true; bkgDepCatalogues1.WorkerSupportsCancellation = true; bkgDepCatalogues1.RunWorkerAsync(cataloguesPerUser); }
private bool CheckConditionsForLoading() { bool isValid = true; CatalogueManager _catalogues = CatalogueManager.Instance(); Catalogues cataloguesPerUser = _catalogues.GetCataloguesForConnection(_connectionId); if (cataloguesPerUser == null) { return(false); } return(isValid); }
public SourceGlobalNamespaceSymbol( ImmutableArray <SourceNode> rootDataNodes, WhamCompilation declaringCompilation) { DeclaringCompilation = declaringCompilation; DeclarationDiagnostics = DiagnosticBag.GetInstance(); AllRootSymbols = rootDataNodes.Select(CreateSymbol).Where(x => x is not null).ToImmutableArray() !; Rosters = AllRootSymbols.OfType <RosterSymbol>().ToImmutableArray(); Catalogues = AllRootSymbols.OfType <CatalogueBaseSymbol>().ToImmutableArray(); RootCatalogue = GetOrCreateGamesystemSymbol(); // TODO more diagnostics, e.g. all catalogues are from the same game system? ICatalogueSymbol GetOrCreateGamesystemSymbol() { var rootCandidates = Catalogues.Where(x => x.IsGamesystem).ToImmutableArray(); if (rootCandidates.Length > 1) { foreach (var candidate in rootCandidates) { DeclarationDiagnostics.Add(ErrorCode.ERR_MultipleGamesystems, candidate.Declaration); } } return(rootCandidates.FirstOrDefault() ?? DeclaringCompilation.CreateMissingGamesystemSymbol(DeclarationDiagnostics)); } Symbol?CreateSymbol(SourceNode node) { if (node is CatalogueNode catalogueNode) { return(new CatalogueSymbol(this, catalogueNode, DeclarationDiagnostics)); } else if (node is GamesystemNode gamesystemNode) { return(new GamesystemSymbol(this, gamesystemNode, DeclarationDiagnostics)); } else if (node is RosterNode rosterNode) { return(new RosterSymbol(this, rosterNode, DeclarationDiagnostics)); } else { DeclarationDiagnostics.Add(ErrorCode.ERR_UnknownCatalogueType, node); return(null); } } }
/// <summary> /// Inserts catalogues /// </summary> /// <param name="catalogues">Catalogues</param> public virtual void InsertCatalogues(Catalogues catalogues) { if (catalogues == null) { throw new ArgumentNullException("catalogues"); } _cataloguesRepository.Insert(catalogues); //cache _cacheManager.RemoveByPattern(CATALOGUES_PATTERN_KEY); _cacheManager.RemoveByPattern(NEWSCATALOGUES_PATTERN_KEY); //event notification _eventPublisher.EntityInserted(catalogues); }
/// <summary> /// Delete catalogues /// </summary> /// <param name="catalogues">Catalogues</param> public virtual void DeleteCatalogues(Catalogues catalogues) { if (catalogues == null) { throw new ArgumentNullException("catalogues"); } catalogues.Deleted = true; UpdateCatalogues(catalogues); //reset a "Parent catalogues" property of all child subcategories var subcategories = GetAllCataloguesByParentCatalogueId(catalogues.Id, true); foreach (var subcatalogues in subcategories) { subcatalogues.ParentCatalogueId = 0; UpdateCatalogues(subcatalogues); } }
protected virtual void PrepareAclModel(CataloguesModel model, Catalogues catalogues, bool excludeProperties) { if (model == null) { throw new ArgumentNullException("model"); } model.AvailableCustomerRoles = _customerService .GetAllCustomerRoles(true) .Select(cr => cr.ToModel()) .ToList(); if (!excludeProperties) { if (catalogues != null) { model.SelectedCustomerRoleIds = _aclService.GetCustomerRoleIdsWithAccess(catalogues); } } }
public bool Delete(string pName, bool pAutoSave = true) { int index = GetIndexByName(pName); if (index < 0) { return(false); } Catalogues.RemoveAt(index); string errorText; if (pAutoSave) { Save(CataloguesIndexFilePath, out errorText); } return(true); }
private void bwLoadCatalogues_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; try { TDSettings.ConnectionRow currentConnection = e.Argument as TDSettings.ConnectionRow; Catalogues cataloguesPerUser = CatalogueManager.LoadMainCatalogues(currentConnection, worker); e.Result = cataloguesPerUser; } catch (Exception ex) { SplashManager.Close(); // just in case MyLogger.Write(ex, "bwLoadCatalogues_DoWork", LoggingCategory.Exception); worker.ReportProgress(100); throw; } }
void bkgCatalogues_DoWork(object sender, DoWorkEventArgs e) { SavingData sp = null; BackgroundWorker backgroundWorker = sender as BackgroundWorker; ArrayList result = new ArrayList(); try { ArrayList al = e.Argument as ArrayList; TDSettings.ConnectionRow currentConnection = al[0] as TDSettings.ConnectionRow; sp = al[1] as SavingData; Catalogues cataloguesPerUser = CatalogueManager.GetCataloguesForUser(currentConnection, backgroundWorker); result.Add(cataloguesPerUser); result.Add(sp); e.Result = result; } catch (Exception ex) { sp.ErrorMessage = ex.Message; sp.Operation = OperationType.LogOnFailed; MyLogger.Write(ex, "bkgCatalogues_DoWork", LoggingCategory.Exception); SplashManager.Close(); // just in case backgroundWorker.ReportProgress(100); throw new CustomException(sp, String.Empty, ex); } }
public int Rename(string pOldName, string pNewName, bool pAutoSave = true) { if (string.IsNullOrEmpty(pOldName = pOldName?.Trim()) || string.IsNullOrEmpty(pNewName = pNewName?.Trim())) { return(-1); } int oldIndex = GetIndexByName(pOldName); if (oldIndex < 0) { return(-1); } int newIndex = GetIndexByName(pNewName); if (newIndex >= 0) { return(-1); } Catalogues[oldIndex].Name = pNewName; List <CatalogueInfo> catalogues = Catalogues.OrderBy(o => o.FilePath).ToList(); Catalogues = catalogues; string errorText; if (pAutoSave) { Save(CataloguesIndexFilePath, out errorText); } return(GetIndexByName(pNewName)); }
public int Update(string pName, string pDescription = null, int?pAddonCount = null, DateTime?pLastUpdate = null, string pVersion = null, bool pAutoSave = true) { if (string.IsNullOrEmpty(pName = pName?.Trim())) { return(-1); } int index = GetIndexByName(pName); bool newCatalogue = (index < 0); CatalogueInfo updatedCatalogueInfo = newCatalogue ? new CatalogueInfo() { Name = pName } : (CatalogueInfo)Catalogues[index].Clone(); bool needsToSave = false; if (!string.IsNullOrEmpty(pDescription = pDescription?.Trim())) { if (newCatalogue || (pDescription != updatedCatalogueInfo.Description)) { updatedCatalogueInfo.Description = pDescription; needsToSave = true; } } if (pAddonCount.HasValue && (newCatalogue || pAddonCount.Value != updatedCatalogueInfo.AddonCount)) { updatedCatalogueInfo.AddonCount = pAddonCount.Value; needsToSave = true; } if (pLastUpdate.HasValue && (newCatalogue || pLastUpdate.Value != updatedCatalogueInfo.LastUpdateDateTime)) { updatedCatalogueInfo.LastUpdateDateTime = pLastUpdate.Value; needsToSave = true; } if (!string.IsNullOrEmpty(pVersion = pVersion?.Trim()) && (newCatalogue || (pVersion != updatedCatalogueInfo.Version))) { updatedCatalogueInfo.Version = pVersion; needsToSave = true; } if (!needsToSave) { return(index); } if (newCatalogue) { Catalogues.Add(updatedCatalogueInfo); } else { Catalogues[index] = updatedCatalogueInfo; } List <CatalogueInfo> catalogues = Catalogues.OrderBy(o => o.Name).ToList(); Catalogues = catalogues; string errorText; if (pAutoSave) { Save(CataloguesIndexFilePath, out errorText); } return(GetIndexByName(pName)); }
void bkgCatalogues_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Error != null) { CustomException ex = (CustomException)e.Error; string errorMessage; if (ex != null) { if (this.CatalogueEvent != null) { SavingData sp = ex.CustomData; if (sp.Operation == OperationType.LogOnFailed) { // no code here. } else { sp.Operation = OperationType.AddConnectionThrowsError; } if (this.CatalogueEvent != null) { this.CatalogueEvent(this, new MyZillaSettingsEventArgs(sp)); } } errorMessage = Messages.ErrLoadingCatalogues + Environment.NewLine + ex.InnerException.Message; } else { errorMessage = Messages.ErrLoadingCatalogues + Environment.NewLine + e.Error.Message; } if (!string.IsNullOrEmpty(errorMessage)) { MyLogger.Write(errorMessage, "bkgCatalogues_RunWorkerCompleted", LoggingCategory.Exception); } } // status OK if (!e.Cancelled && e.Error == null) { ArrayList result = e.Result as ArrayList; Catalogues cataloguesPerUser = result[0] as Catalogues; SavingData sp = result[1] as SavingData; if (result[0] != null) { // check if catalogues exist bool areLoaded = this.AreCataloguesLoaded(cataloguesPerUser.ConnectionId); if (areLoaded) { // remove if exist this.RemoveCataloguesForConnection(cataloguesPerUser.ConnectionId); } // add catalogues per user globalCataloguesCollection.Add(cataloguesPerUser); if (this.CatalogueEvent != null) { this.CatalogueEvent(this, new MyZillaSettingsEventArgs(sp)); } } else { if (this.CatalogueEvent != null) { TDSettings.ConnectionRow connectionRow = sp.ConnectionRow; SavingData spWhenNullCatalogues = new SavingData(OperationType.AddConnectionThrowsError, connectionRow); this.CatalogueEvent(this, new MyZillaSettingsEventArgs(spWhenNullCatalogues)); } } } }
public static Catalogues ToEntity(this CataloguesModel model, Catalogues destination) { return(model.MapTo(destination)); }
public static CataloguesModel ToModel(this Catalogues entity) { return(entity.MapTo <Catalogues, CataloguesModel>()); }
void _appSettings_SaveSettings(object sender, MyZillaSettingsEventArgs e) { switch (e.SaveParameter.Operation) { case OperationType.AddConnection: if (e.SaveParameter.ConnectionRow.ActiveUser == true) { // check if catalogues for user are already cached Catalogues cataloguesPerUser = this.GetCataloguesForConnection(e.SaveParameter.ConnectionRow.ConnectionId); if (cataloguesPerUser != null) { // catalogues are already cached. // no action here. } else { if (this.CatalogueEvent != null) { this.CatalogueEvent(this, new MyZillaSettingsEventArgs(e.SaveParameter)); } this.LoadCataloguesForUser(e.SaveParameter); } } else { if (this.CatalogueEvent != null) { this.CatalogueEvent(this, new MyZillaSettingsEventArgs(e.SaveParameter)); } } break; case OperationType.EditConnection: if (e.SaveParameter.ConnectionRow.ActiveUser == true) { // check if catalogues for user are already cached Catalogues cataloguesPerUser = this.GetCataloguesForConnection(e.SaveParameter.ConnectionRow.ConnectionId); if (cataloguesPerUser != null) { // catalogues are already cached. // fire the event to be processed by the subscribers if any if (this.CatalogueEvent != null) { this.CatalogueEvent(this, new MyZillaSettingsEventArgs(e.SaveParameter)); } } else { if (this.CatalogueEvent != null) { this.CatalogueEvent(this, new MyZillaSettingsEventArgs(e.SaveParameter)); } this.LoadCataloguesForUser(e.SaveParameter); } } else { //this.RemoveCataloguesForConnection (e.SaveParameter.ConnectionRow.ConnectionId ); if (this.CatalogueEvent != null) { this.CatalogueEvent(this, new MyZillaSettingsEventArgs(e.SaveParameter)); } } break; case OperationType.DeleteConnection: this.RemoveUsersForConnection(e.SaveParameter.ConnectionRow.ConnectionId); if (this.CatalogueEvent != null) { this.CatalogueEvent(this, new MyZillaSettingsEventArgs(e.SaveParameter)); } break; } }