public DeclarationsController(DeclarationService service) { if (service == null) { throw new ArgumentNullException("service"); } _service = service; }
public PaymentViewModel(PageService pageservice, Validator validator, DeclarationService declarationService) : base(pageservice) { this.validator = validator; this.declarationService = declarationService; Cost = declarationService.GetCost(); Init(); }
public ImportController(DeclarationService service, ILigneImportRepository serviceImport) { if (service == null) { throw new ArgumentNullException("service"); } _service = service; _serviceImport = serviceImport; }
public LigneImportSqlController(DeclarationService service, DeclarationView entete) { if (service == null) { throw new ArgumentNullException("service"); } _service = service; _entete = entete; }
public void ShouldDeclareQueueWithDeadLetterRoutingKeyAndExchange() { // GIVEN var queueName = "queueName"; var durable = false; var exclusive = false; var autoDelete = false; var deadLetterRoutingKey = "dlqQueueName"; var deadLetterExchange = "dlqExchange"; var expectedArguments = new Dictionary <string, object>(); expectedArguments.Add(DeclarationService.QUEUE_DEAD_LETTER_ROUTING_KEY_ARGUMENT, deadLetterRoutingKey); expectedArguments.Add(DeclarationService.QUEUE_DEAD_LETTER_EXCHANGE_ARGUMENT, deadLetterExchange); var settings = new OwlerySettings { Queues = new Dictionary <string, QueueSettings>() { { "Queue", new QueueSettings() { QueueName = queueName, Durable = durable, Exclusive = exclusive, AutoDelete = autoDelete, DeadLetterRoutingKey = deadLetterRoutingKey, DeadLetterExchange = deadLetterExchange, } } } }; var service = new DeclarationService( Options.Create <OwlerySettings>(settings), this.logger); // WHEN service.DeclareAll(this.model.Object); // THEN this.model.Verify( m => m.QueueDeclare( It.Is <string>(s => s == queueName), It.Is <bool>(b => b == durable), It.Is <bool>(b => b == exclusive), It.Is <bool>(b => b == autoDelete), It.Is <IDictionary <string, object> >(d => deadLetterExchange == (string)d[DeclarationService.QUEUE_DEAD_LETTER_EXCHANGE_ARGUMENT] && deadLetterRoutingKey == (string)d[DeclarationService.QUEUE_DEAD_LETTER_ROUTING_KEY_ARGUMENT] ) ) ); this.model.VerifyNoOtherCalls(); }
public DetailInfoViewModel(PageService pageservice, BL.IAutoListService listService, UserService userService, DeclarationService declarationService) : base(pageservice) { this.listService = listService; this.userService = userService; this.declarationService = declarationService; Evac = listService.SelectedEvac; init(); }
public ProfileViewModel(PageService pageservice, Validator validator, UserService userService, UserRegisterService registerService, DeclarationService declarationService) : base(pageservice) { this.validator = validator; this.userService = userService; this.registerService = registerService; this.declarationService = declarationService; Init(); }
public DeclarationViewModel(PageService pageservice, UserService userService, EventBus eventBus, BL.DeclarationService declarationService) : base(pageservice) { this.userService = userService; this.eventBus = eventBus; this.declarationService = declarationService; Declaration = declarationService.GetDeclaration(); IsPaid = Declaration.DecStatus == DecStatus.ActivePaid && declarationService.IsEdit; init(); }
public static void CreateLignes(IEnumerable <LigneImportView> lignesImport, DeclarationService service, DeclarationCnss declaration) { List <CategorieCnss> categories = service.CnssService.GetAllCategories().ToList(); var _employee = new List <Employee>(); foreach (LigneImportView ligne in lignesImport) { if (_employee.Any(x => x.Cin == ligne.Cin)) { throw new ApplicationException(string.Format("Employee {0} est déclaré deux ou plusieurs fois!")); } var categorie = categories.Single(x => x.No == ligne.TypeCnss); var emp = new Employee { AutresNom = ligne.AutresNom, CleCnss = ligne.CleCnss, SituationFamille = (SituationFamille)ligne.SituationFamilleNo, Prenom = ligne.Prenom, Cin = ligne.Cin, Nom = ligne.Nom, Civilite = (Civilite)ligne.CiviliteNo, NumeroInterne = ligne.Matricule, NumeroCnss = ligne.NumeroCnss, NomJeuneFille = ligne.NomJeuneFille, CategorieNo = categorie.No, }; _employee.Add(emp); } foreach (var employee in _employee) { service.CnssService.EmployeeCreateOrUpdate(employee.Cin, employee.Nom, employee.Prenom, employee.Civilite, employee.SituationFamille, employee.NumeroCnss, employee.CleCnss, employee.NomJeuneFille, employee.AutresNom, employee.NumeroInterne, categories.Single(x => x.No == employee.CategorieNo)); } foreach (var l in lignesImport) { service.CnssService.LigneDeclarationCreate(declaration.Id, l.Cin, l.BrutA, l.BrutB, l.BrutC); } }
public FrmMain(AppConfiguration appConfig) : this() { if (appConfig == null) { throw new ArgumentNullException("appConfig"); } Program.RebindGroupConnection(appConfig.Get()); _service = Program.GetService(); //Update dataBase Program.MigrateDataBase(); _service.InitService(); }
public FrmOuverture( DeclarationService service) : this() { _service = service; // initialiser DXErrorProvider _dxErrorProvider = new DXErrorProvider { ContainerControl = lcMain }; // initialiser AuthenView _currentView = new AuthentView(); BindingSource(); }
public void ShouldDeclareExchangesWithAttributes() { // GIVEN var exchangeName = "exchangeName"; var type = "exchangeType"; var durable = false; var autoDelete = false; var arguments = new Dictionary <string, object>(); var settings = new OwlerySettings { Exchanges = new Dictionary <string, ExchangeSettings>() { { "Exchange", new ExchangeSettings() { ExchangeName = exchangeName, Type = type, Durable = durable, AutoDelete = autoDelete, Arguments = arguments, } } } }; var service = new DeclarationService( Options.Create <OwlerySettings>(settings), this.logger); // WHEN service.DeclareAll(this.model.Object); // THEN this.model.Verify( m => m.ExchangeDeclare( It.Is <string>(s => s == exchangeName), It.Is <string>(s => s == type), It.Is <bool>(b => b == durable), It.Is <bool>(b => b == autoDelete), It.Is <IDictionary <string, object> >(d => d == arguments) ) ); this.model.VerifyNoOtherCalls(); }
public void ShouldBindQueueToExchangeWithAttributes() { // GIVEN var queueName = "exchangeName"; var exchangeName = "exchangeName"; var routingKey = "routingKey"; var arguments = new Dictionary <string, object>(); var settings = new OwlerySettings { Bindings = new Dictionary <string, BindingSettings>() { { "Binding", new BindingSettings() { QueueName = queueName, ExchangeName = exchangeName, RoutingKey = routingKey, Arguments = arguments, } } } }; var service = new DeclarationService( Options.Create <OwlerySettings>(settings), this.logger); // WHEN service.DeclareAll(this.model.Object); // THEN this.model.Verify( m => m.QueueBind( It.Is <string>(s => s == queueName), It.Is <string>(s => s == exchangeName), It.Is <string>(s => s == routingKey), It.Is <IDictionary <string, object> >(d => d == arguments) ) ); this.model.VerifyNoOtherCalls(); }
public SocieteController(DeclarationService service) { _service = service; }
public DeclarationDs(DeclarationService service, DeclarationCnss declaration) : this() { if (service == null) { throw new ArgumentNullException("service"); } if (declaration == null) { throw new InvalidOperationException("declaration"); } Societe societe = service.Societe; if (societe == null) { throw new InvalidOperationException("Erreur chargement societe"); } List <CategorieCnss> categories = service.CnssService.GetAllCategories().ToList(); foreach (CategorieCnss categorieCnss in categories) { tableTCategorie.AddTCategorieRow(categorieCnss.Id, categorieCnss.Intitule, categorieCnss.CodeExploitation, categorieCnss.TauxPatronal, categorieCnss.TauxSalarial, categorieCnss.AccidentTravail); } var exercice = service.ExerciceGetAll().FirstOrDefault(x => x.Id == declaration.ExerciceId); if (exercice == null) { throw new ArgumentNullException("exercice"); } var lignes = service.CnssService.GetLigneDeclarationCnss(declaration.Id); tableTSociete.AddTSocieteRow(societe.RaisonSocial, societe.Activite, societe.Adresse, societe.CodePostal, societe.Ville, societe.Pays, societe.NumeroEmployeur.PadLeft(8, '0'), $"{societe.MatriculFiscal} {societe.MatriculCle}/{societe.MatriculCodeTva}/{societe.MatriculCategorie}/{societe.MatriculEtablissement}", societe.CodeBureau, exercice.Annee, declaration.Trimestre, societe.CleEmployeur.PadLeft(2, '0'), societe.MatriculCle, societe.MatriculCategorie, societe.MatriculEtablissement, societe.MatriculCodeTva); foreach (LigneCnss ligne in lignes) { CategorieCnss cat = categories.Single(x => x.Id == ligne.CategorieNo); if (cat == null) { throw new InvalidOperationException("Catégorie"); } tableTDeclaration.AddTDeclarationRow(ligne.Id, ligne.Page.Value, ligne.Ligne.Value, ligne.Brut1, ligne.Brut2, ligne.Brut3, cat.Intitule, ligne.CodeExploitation, ligne.NumeroCnss, ligne.CleCnss, ligne.Cin, ligne.Nom, ligne.Prenom, ligne.Civilite.ToString(), ligne.AutresNom, ligne.NomJeuneFille, ligne.NumeroInterne, cat.Id); } }
public ResultViewModel(PageService pageservice, DeclarationService declarationService) : base(pageservice) { this.declarationService = declarationService; init(); }
public static bool Verify(IEnumerable <LigneImportView> lignesImport, DeclarationService service, int trimestre) { Exercice currentExercice = service.Exercice; if (currentExercice == null) { throw new ApplicationException("Exercice invalide!"); } List <CategorieCnss> categories = service.CnssService.GetAllCategories().ToList(); int no = 1; foreach (LigneImportView ligne in lignesImport) { if (ligne.Annee == 0) { throw new ApplicationException(string.Format( "L'année est obligatoire! Enregistrement N[{0}]", no)); } if (!ligne.Annee.ToString().Equals(currentExercice.Annee)) { throw new ApplicationException(string.Format( "L'année invalide! Enregistrement N[{0}]", no)); } //******* Verify CIN *********** if (ligne.Cin.Length > 8) { throw new ApplicationException(string.Format( "CIN invalide! Enregistrement N[{0}]", no)); } if (ligne.Cin.Length < 8) { ligne.Cin = ligne.Cin.Trim().PadLeft(8, '0'); } var rgxCin = new Regex(@"[0-9]{8}"); if (!rgxCin.IsMatch(ligne.Cin)) { throw new ApplicationException(string.Format( "CIN invalide! Enregistrement N[{0}]", no)); } //******** Verify Civilite ********** if (ligne.CiviliteNo < 0 || ligne.CiviliteNo > 2) { throw new ApplicationException(string.Format( "Civilité invalide! Enregistrement N[{0}]", no)); } //******* Verify Nom ********* var regName = new Regex(@"^[a-zA-Z]"); if (string.IsNullOrEmpty(ligne.Nom) || !regName.IsMatch(ligne.Nom)) { throw new ApplicationException(string.Format( "Nom invalide! Enregistrement N[{0}]", no)); } //******* Verify Prenom ******** if (string.IsNullOrEmpty(ligne.Prenom) || !regName.IsMatch(ligne.Prenom)) { throw new ApplicationException(string.Format( "Prénom invalide! Enregistrement N[{0}]", no)); } //******* Verify Autre nom ******** if (ligne.AutresNom.Trim() != string.Empty && !regName.IsMatch(ligne.AutresNom)) { throw new ApplicationException(string.Format( "Autre nom invalide! Enregistrement N[{0}]", no)); } //******* Verify NomJeuneFille ******** if (!string.IsNullOrEmpty(ligne.NomJeuneFille)) { if (!regName.IsMatch(ligne.NomJeuneFille)) { throw new ApplicationException(string.Format( "Nom de jeune fille invalide! Enregistrement N[{0}]", no)); } } //******* Verify BrutA ******** CultureInfo culture = Thread.CurrentThread.CurrentCulture; string decimalSeparator = culture.NumberFormat.NumberDecimalSeparator; string brutAtStr = ligne.BrutAStr .Replace(",", decimalSeparator) .Replace(".", decimalSeparator); decimal brutA; if (!decimal.TryParse(brutAtStr, out brutA)) { throw new ApplicationException(string.Format( "Format montant invalide [BrutA]! Enregistrement N[{0}]", no)); } if (brutA < 0) { throw new ApplicationException(string.Format( "BrutA invalide! Enregistrement N[{0}]", no)); } //ligne.BrutA = brutA; //******* Verify BrutB ******** string brutBtStr = ligne.BrutBStr .Replace(",", decimalSeparator) .Replace(".", decimalSeparator); decimal brutB; if (!decimal.TryParse(brutBtStr, out brutB)) { throw new ApplicationException(string.Format( "Format montant invalide [BrutB]! Enregistrement N[{0}]", no)); } if (brutB < 0) { throw new ApplicationException(string.Format( "BrutB invalide! Enregistrement N[{0}]", no)); } // ligne.BrutB = brutB; //******* Verify BrutC ******** string brutCtStr = ligne.BrutCStr .Replace(",", decimalSeparator) .Replace(".", decimalSeparator); decimal brutC; if (!decimal.TryParse(brutCtStr, out brutC)) { throw new ApplicationException(string.Format( "Format montant invalide [BrutC]! Enregistrement N[{0}]", no)); } if (brutC < 0) { throw new ApplicationException(string.Format( "BrutC invalide! Enregistrement N[{0}]", no)); } //ligne.BrutC = brutC; //******* Verify Matricule cnss ******** var regNumero = new Regex(@"^[0-9]"); if (string.IsNullOrEmpty(ligne.NumeroCnss) || ligne.NumeroCnss.Length > 8 || !regNumero.IsMatch(ligne.NumeroCnss)) { throw new ApplicationException(string.Format( "Numéro Cnss invalide! Enregistrement N[{0}]", no)); } //******* Verify Cle ******** if (string.IsNullOrEmpty(ligne.CleCnss) || ligne.CleCnss.Length > 2 || !regNumero.IsMatch(ligne.CleCnss)) { throw new ApplicationException(string.Format( "Clé invalide! Enregistrement N[{0}]", no)); } //******* Verify matricule interne ******** if (string.IsNullOrEmpty(ligne.Matricule) || ligne.Matricule.Length > 10 //|| !regNumero.IsMatch(ligne.Matricule) ) { throw new ApplicationException(string.Format( "Matricule interne invalide! Enregistrement N[{0}]", no)); } //******* Verify Trimestre ******** if (ligne.Trimestre != trimestre) { throw new ApplicationException(string.Format( "Trimestre invalid! Enregistrement N[{0}]", no)); } //******* Verify Type cnss ******** if (ligne.TypeCnss > 19 || ligne.TypeCnss < 0 || categories.All(x => x.No != ligne.TypeCnss)) { throw new ApplicationException(string.Format( "Type cnss invalid! Enregistrement N[{0}]", no)); } //******* Situation familiale ******** if (ligne.SituationFamilleNo > 8 || ligne.SituationFamilleNo < 0) { throw new ApplicationException(string.Format( "Situation familiale invalide! Enregistrement N[{0}]", no)); } } return(true); }
public LiasseController(DeclarationService service) { _service = service; }
public UserController(DeclarationService service) { _service = service; }