public static async Task WithdrawAsync(string tenant, string reason, long tranId, LoginView meta) { bool isRestrictedTransactionMode = await IsRestrictedTransactionModeAsync(tenant, meta.OfficeId).ConfigureAwait(false); if (isRestrictedTransactionMode) { throw new JournalWithdrawalException(I18N.CannotWithdrawTransactionDuringRestrictedTransactionMode); } var status = await Verifications.GetVerificationStatusAsync(tenant, tranId, meta.OfficeId).ConfigureAwait(false); if (status.UserId != meta.UserId) { throw new JournalWithdrawalException(I18N.AccessDeniedCannotWithdrawSomeoneElseTransaction); } if ( status.VerificationStatusId.Equals(0) //Awaiting verification || status.VerificationStatusId.Equals(1) //Automatically Approved by Workflow ) { await TransacitonPostings.WithdrawAsync(tenant, reason, meta.UserId, tranId, meta.OfficeId).ConfigureAwait(false); } throw new JournalWithdrawalException(I18N.AccessIsDenied); }
public void Test_StoreUserVerification_WithData_StoresCorrectValidation() { var repoMock = new Mock <IVerificationsRepository>(); var subject = Subject(repoMock, MockHttpClient()); var verification = new Verifications { Userid = 1, ForumId = 1, ForumName = "any", VerifiedBy = "any" }; subject.StoreUserVerification( verification.Userid, verification.ForumId ?? 1, verification.ForumName, verification.VerifiedBy ); repoMock.Verify(m => m.Create( It.Is <Verifications>(v => v.Userid == verification.Userid && v.ForumId == verification.ForumId && v.ForumName == verification.ForumName && v.VerifiedBy == verification.VerifiedBy) ), Times.Once); }
public void Save(CashBookTransaction cashbookTransaction) { using (var core = new StandardBusinessLayer(this)) { core.Connect(); bool newVerification = cashbookTransaction.No == 0; core.Save(cashbookTransaction); if (newVerification) { CashBookTransactions.Add(cashbookTransaction); } else { for (int i = 0; i < CashBookTransactions.Count(); i++) { if (CashBookTransactions[i].No == cashbookTransaction.No) { CashBookTransactions[i] = cashbookTransaction; break; } } } FillVerification(Verifications.First(v => v.No == cashbookTransaction.VerificationNo)); } }
public void Save(AccountTransaction accountTransaction) { using (var core = new StandardBusinessLayer(this)) { core.Connect(); bool newTransaction = accountTransaction.No == 0; core.Save(accountTransaction); if (newTransaction) { AccountTransactions.Add(accountTransaction); } else { for (int i = 0; i < AccountTransactions.Count(); i++) { if (AccountTransactions[i].No == accountTransaction.No) { AccountTransactions[i] = accountTransaction; break; } } } FillVerification(Verifications.First(v => v.No == accountTransaction.VerificationNo)); } }
public EventSubscriptionMock() { this.countCallers = new CountCallers(this); this.countCalls = new CountCalls(this); this.handlers = new Handlers(this); this.verifications = new Verifications(this); this.verifiers = new Verifiers(this); }
/// <summary> /// Разделяет имя файла на составные части: [Автор, Группа, Имя]. /// </summary> /// <param name="fileName">Имя файла</param> /// <returns>Массив составных частей из имени файла в виде [Author, Group, DocumentName]</returns> public static string[] SplitFileName(string fileName) { if (Verifications.IsFileNameValid(fileName)) { return(fileName.Split('_')); } throw new FileNameFormatException("Неправильный формат входного файла!"); }
public ContainerMock() { this.countCallers = new CountCallers(this); this.countCalls = new CountCalls(this); this.handlers = new Handlers(this); this.verifications = new Verifications(this); this.verifiers = new Verifiers(this); }
public StateManagerMock() { this.countCallers = new CountCallers(this); this.countCalls = new CountCalls(this); this.handlers = new Handlers(this); this.verifications = new Verifications(this); this.verifiers = new Verifiers(this); }
public NavigationServiceMock() { this.countCallers = new CountCallers(this); this.countCalls = new CountCalls(this); this.handlers = new Handlers(this); this.verifications = new Verifications(this); this.verifiers = new Verifiers(this); }
public EventAggregatorMock() { this.countCallers = new CountCallers(this); this.countCalls = new CountCalls(this); this.handlers = new Handlers(this); this.verifications = new Verifications(this); this.verifiers = new Verifiers(this); }
public ContactRepositoryMock() { this.countCallers = new CountCallers(this); this.countCalls = new CountCalls(this); this.handlers = new Handlers(this); this.verifications = new Verifications(this); this.verifiers = new Verifiers(this); }
public ViewModelMock() { this.countCallers = new CountCallers(this); this.countCalls = new CountCalls(this); this.handlers = new Handlers(this); this.verifications = new Verifications(this); this.verifiers = new Verifiers(this); }
public static void VerifyRegKeysIFUpdate() { if (isUpdate) { WorkFolder = Verifications.HKLM_GetString(@"SOFTWARE\NDDigital\eForms\Connector", "PathWorkFolder"); PathFolder = Verifications.HKLM_GetString(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\NDDigital eForms Connector", "InstallLocation"); RootFolder = Verifications.HKLM_GetString(@"SOFTWARE\NDDigital\eForms\Connector", "PathWorkFolder"); } }
public GenericResponse Post([FromBody] TestRequest request) { Verifications.ValidateAppRole(ConfigurationManager.AppSettings["AppRoleName"]); Verifications.EnsureCallerHasAppOnlyToken(); var response = new GenericResponse(); response.message = $"Hi {request.name}! You were able to access to the function. Ooohh weeee!!"; return(response); }
/// <summary> /// Activate this license manually. /// </summary> public void Activate() { if (IsActivated) { throw new Exception("This license is already activated."); } if (string.IsNullOrEmpty(Config.PublicKey)) { throw new Exception("You must provide a public key to use this function."); } if (!Verifications.IsCorrectAccessFormat(Config.AccessKey)) { throw new Exception("You must provide a correct access key to use this function."); } if (!Verifications.IsCorrectKey(Config.PublicKey)) { throw new Exception("You must provide a correct public key to use this function."); } if (!Verifications.IsCorrectLicenseFormat(License)) { throw new Exception("Please provide a correct license key."); } var client = new RestClient(Globals.EndPoint); var request = new RestRequest("validate", Method.POST); request.AddHeader("X-API-KEY", Config.PublicKey); request.AddHeader("X-PRODUCT-ID", Config.ProductID); request.AddHeader("X-ACCESS-KEY", Config.AccessKey); request.AddParameter("license", License, ParameterType.GetOrPost); var response = client.Execute(request); if (!response.IsSuccessful) { throw new WebException("Can't connect to the server at this moment."); } var parsedResponse = JsonConvert.DeserializeObject <License.RawInput>(response.Content); if (parsedResponse.Result) { return; } throw new Exception(parsedResponse.Message); }
public void GivenClassWithoutNavigationProperties_WhenGetAll_ReadsExceptedResults() { //Arrange SetupMockFile("baseDir\\Person.csv", MockCsvs.MockPeopleLines); //Act var ppl = _testRepo.Get <Person>().ToList(); //Assert Verifications.VerifyEquals(new object[] { 1, "David", 25, 60.43m, new DateTime(1994, 02, 14) }, ppl[0]); Verifications.VerifyEquals(new object[] { 2, "Sam", 40, 65.94m, new DateTime(1990, 11, 29) }, ppl[1]); Verifications.VerifyEquals(new object[] { 3, "Julia", 32, 64.02m, new DateTime(1983, 8, 05) }, ppl[2]); }
/// <summary> /// Get all licenses for a product with details. /// </summary> /// <returns></returns> public List <Licenses.Object> GetAllLicenses() { if (string.IsNullOrEmpty(Config.PrivateKey)) { throw new Exception("You must provide a private key to use this function."); } if (!Verifications.IsCorrectAccessFormat(Config.AccessKey)) { throw new Exception("You must provide a correct access key to use this function."); } if (!Verifications.IsCorrectKey(Config.PrivateKey)) { throw new Exception("You must provide a correct private key to use this function."); } var client = new RestClient(Globals.EndPoint); var request = new RestRequest("/", Method.GET); request.AddHeader("X-API-KEY", Config.PrivateKey); request.AddHeader("X-PRODUCT-ID", Config.ProductID); request.AddHeader("X-ACCESS-KEY", Config.AccessKey); var response = client.Execute(request); if (!response.IsSuccessful) { throw new WebException("Can't connect to the server at this moment."); } var parsedResponse = JsonConvert.DeserializeObject <Licenses.RawInput>(response.Content); if (!parsedResponse.Result) { throw new Exception(parsedResponse.Message); } var tempList = new List <Licenses.Object>(); foreach (var item in parsedResponse.Objects) { item.Config = Config; item.HardwareID = HardwareID; tempList.Add(item); } return(tempList); }
/// <summary> /// Modify a license time. It will calculate new license time based on an activated date. /// </summary> /// <param name="hours"></param> public void ModifyHours(int hours) { if (string.IsNullOrEmpty(Config.PrivateKey)) { throw new Exception("You must provide a private key to use this function."); } if (!Verifications.IsCorrectAccessFormat(Config.AccessKey)) { throw new Exception("You must provide a correct access key to use this function."); } if (!Verifications.IsCorrectKey(Config.PrivateKey)) { throw new Exception("You must provide a correct private key to use this function."); } if (hours <= 0) { throw new Exception("Please provide 1 hour or more for a parameter."); } var client = new RestClient(Globals.EndPoint); var request = new RestRequest("", Method.PATCH); request.AddHeader("X-API-KEY", Config.PrivateKey); request.AddHeader("X-PRODUCT-ID", Config.ProductID); request.AddHeader("X-ACCESS-KEY", Config.AccessKey); request.AlwaysMultipartFormData = true; request.AddParameter("license", License); request.AddParameter("expireHour", hours.ToString()); var response = client.Execute(request); if (!response.IsSuccessful) { throw new WebException("Can't connect to the server at this moment."); } var parsedResponse = JsonConvert.DeserializeObject <License.RawInput>(response.Content); if (parsedResponse.Result) { return; } throw new Exception(parsedResponse.Message); }
public String Transform(String filePath, String originalText) { var lines = originalText .Trim() .Replace("\r", "") .Split("\n"); var characters = new List <Character>(); var storyLines = new List <String> { "" }; foreach (var line in lines) { var character = Character.Get(line); if (character != null) { characters.Add(character); } else { storyLines.Add(line); } } storyLines.Add(""); var newText = String.Join("\n", storyLines); foreach (var replace in TextTransform) { newText = replace.Transform(newText); } foreach (var replace in characters) { newText = replace.Transform(newText); } newText = newText.Trim(); NotFound = Verifications.SelectMany( v => v.NotAllowedMatches(newText) ).Select(t => $"not found: {t}").ToList(); return(Start + newText + End); }
/// <summary> /// Return new object with refreshed data. /// </summary> /// <returns></returns> public Object RefreshData() { if (string.IsNullOrEmpty(Config.PrivateKey)) { throw new Exception("You must provide a private key to use this function."); } if (!Verifications.IsCorrectAccessFormat(Config.AccessKey)) { throw new Exception("You must provide a correct access key to use this function."); } if (!Verifications.IsCorrectKey(Config.PublicKey)) { throw new Exception("You must provide a correct public key to use this function."); } if (!Verifications.IsCorrectLicenseFormat(License)) { throw new Exception("Please provide a correct license key."); } var client = new RestClient(Globals.EndPoint); var request = new RestRequest("/" + License, Method.GET); request.AddHeader("X-API-KEY", Config.PrivateKey); request.AddHeader("X-PRODUCT-ID", Config.ProductID); request.AddHeader("X-ACCESS-KEY", Config.AccessKey); var response = client.Execute(request); if (!response.IsSuccessful) { throw new WebException("Can't connect to the server at this moment."); } var parsedResponse = JsonConvert.DeserializeObject <License.RawInput>(response.Content); if (!parsedResponse.Result) { throw new Exception(parsedResponse.Message); } var newObject = parsedResponse.Object; newObject.Config = Config; newObject.HardwareID = HardwareID; return(newObject); }
public void DeleteVerification(int no) { using (var core = new StandardBusinessLayer(this)) { core.Connect(); Verification verification = Verifications.FirstOrDefault(v => v.No == no); if (verification != null) { core.DeleteVerification(no); Verifications.Remove(verification); } } }
public static bool VerifyDBMGRResult() { bool result; string ok = Verifications.HKLM_GetString(@"SOFTWARE\NDDigital\eForms\Connector", "DBMGR_Status"); if (ok == "1") { result = true; } else { result = false; } return(result); }
public void Save(Verification verification) { using (var core = new StandardBusinessLayer(this)) { core.Connect(); bool newVerification = verification.No == 0; core.Save(verification); FillVerification(verification); if (newVerification) { Verifications.Add(verification); } else { for (int i = 0; i < Verifications.Count(); i++) { if (Verifications[i].No == verification.No) { Verifications[i] = verification; break; } } for (int i = 0; i < AccountTransactions.Count(); i++) { if (AccountTransactions[i].VerificationNo == verification.No) { AccountTransactions[i].SetTransactionTime(verification.Date); AccountTransactions[i].SetAccountingDate(verification.AccountingDate); break; } } for (int i = 0; i < CashBookTransactions.Count(); i++) { if (CashBookTransactions[i].VerificationNo == verification.No) { CashBookTransactions[i].SetTransactionTime(verification.Date); CashBookTransactions[i].SetAccountingDate(verification.AccountingDate); break; } } } } }
/// <summary> /// Очищает текст используя базу (словарь) стоп-слов /// </summary> /// <param name="text">Неочищенный текст, который нужно канонизировать</param> /// <returns>Коллекцию слов из текста, которые готовы к употреблению =)</returns> private static List <string> TextPurify(string text) { //разделяем ввесь текст на отдельные слова var rawTokens = text.Split(Separators).ToList(); //проходимся по этому списку слов в linq-выражении var canonedTokens = rawTokens.Select(word => word.ToCharArray().Where(n => !char.IsDigit(n)).ToArray()).Select(purified => new string(purified)).ToList(); //из этой коллекции удаляем все пустые элементы и стоп-слова используя linq canonedTokens.RemoveAll(item => StopWords.Contains(item.ToLower()) || string.IsNullOrWhiteSpace(item)); //также удаляются все стоп-символы из слов в коллекции var purifiedTokens = (from item in canonedTokens let regex = new Regex("[0-9/|_!@#$%^&*()_+=?:;.,{}№><«»'\"`~" + @"\\[\]– -]*") select regex.Replace(item, "")).ToList(); //устанавливаются все слова в Lower Case var purifiedLowerCaseTokens = purifiedTokens.Select(purifiedToken => purifiedToken.ToLower()).ToList(); var stemmedLowerCaseTokens = new List <string>(); var cyrillicStemmer = new RussianStemmer(); var latinStemmer = new EnglishStemmer(); foreach (var purifiedLowerCaseToken in purifiedLowerCaseTokens) { switch (Verifications.GetFontType(purifiedLowerCaseToken)) { case FontType.Cyrillic: stemmedLowerCaseTokens.Add(cyrillicStemmer.Stem(purifiedLowerCaseToken)); break; case FontType.Latin: stemmedLowerCaseTokens.Add(latinStemmer.Stem(purifiedLowerCaseToken)); break; case FontType.Other: case FontType.Numbers: break; default: throw new ArgumentOutOfRangeException(); } } return(stemmedLowerCaseTokens); }
public void DeleteCashBookTransaction(int no) { using (var core = new StandardBusinessLayer(this)) { core.Connect(); var transaction = CashBookTransactions.FirstOrDefault(t => t.No == no); if (transaction != null) { Verification verification = Verifications.FirstOrDefault(v => v.No == transaction.VerificationNo); core.DeleteCashBookTransaction(no); CashBookTransactions.Remove(transaction); FillVerification(verification); } } }
static void Main() { //autenticacaoUsuario = System.Security.Principal.WindowsIdentity.GetCurrent().IsAuthenticated; if (IsAdministrator()) { if (Verifications.ValidaWindows()) { if (!Verifications.VerificaIIS()) { if (eConnector.InstallConnectorVerify()) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new StartPage()); } else { Application.Exit(); } } else { MessageBox.Show("O Internet Information Service não está instalado e este é um pré-requisito para prosseguir com a instalação. Instale o Internet Information Service e execute o instalador do e-Connector novamente." , "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("O e-Forms não está homologado para o Sistema Operacional atual: " + Verifications.ProductName + ". Não é possível prosseguir.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("O usuário da sessão atual não possui direitos de administrador para realizar a instalação." + " Não é possível prosseguir.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
public void Test_IsForumProfileLinked_WithValidVerification_ReturnsTrue() { var repoMock = new Mock <IVerificationsRepository>(); var subject = Subject(repoMock, MockHttpClient()); var verification = new Verifications { Userid = 1, ForumId = 1, ForumName = "any", VerifiedBy = "any", VerifiedOn = DateTime.UtcNow, DeletedOn = null }; repoMock.Setup(m => m.FindByForumId(It.IsAny <int>())).Returns(verification); var result = subject.IsForumProfileLinked(verification.ForumId ?? 0); Assert.True(result); }
public static void AccountsMenu(string[,] clientsArray, decimal[,] accountsArray) { MenuLib.PrintSubmenu("ACESSO AO MENU DE CONTAS"); int clientPosition = Verifications.ReadCPF(clientsArray, "Digite o CPF do cliente:"); if (clientPosition != -1) { decimal.TryParse(clientsArray[clientPosition, 0], out decimal clientCPF); string[] accountsMenuOptions = new string[] { "Criar uma nova conta", "Remover uma conta", "Consultar contas do cliente", "Retornar ao menu principal" }; bool returnToMainMenu = false; do { MenuLib.PrintMenu(accountsMenuOptions, "MENU DE CONTAS"); MenuLib.PrintMessage("Acessando as contas de:\n"); ClientsLib.PrintClientNameAndCPF(clientsArray, clientPosition); Console.WriteLine(); string accountsMenuChoice = MenuLib.ReadOption(accountsMenuOptions); switch (accountsMenuChoice) { case "Criar uma nova conta": accountsArray = AccountsLib.AddNewAccount(accountsArray, clientCPF); break; case "Remover uma conta": accountsArray = AccountsLib.RemoveAccount(accountsArray, clientCPF); break; case "Consultar contas do cliente": AccountsLib.ConsultAccounts(accountsArray, clientCPF); break; case "Retornar ao menu principal": returnToMainMenu = true; break; } }while (!returnToMainMenu); MainMenu(clientsArray, accountsArray); } }
public void Test_GetUserForumProfileData_WithValidVerification_ReturnsCorrectForumIdAndForumName() { var repoMock = new Mock <IVerificationsRepository>(); var subject = Subject(repoMock, MockHttpClient("<title>SA-MP Forums - View Profile: any</title>")); var verification = new Verifications { Userid = 1, ForumId = 1, ForumName = "any", VerifiedBy = "any", VerifiedOn = DateTime.UtcNow, DeletedOn = null }; repoMock.Setup(m => m.FindByUserId(It.IsAny <ulong>())).Returns(verification); subject.GetUserForumProfileData(verification.Userid, out int forumId, out string forumName); Assert.Equal(verification.ForumId, forumId); Assert.Equal(verification.ForumName, forumName); }
/// <summary> /// Delete a provided license. /// </summary> /// <param name="license">License key</param> public void DeleteLicense(string license) { if (string.IsNullOrEmpty(Config.PrivateKey)) { throw new Exception("You must provide a private key to use this function."); } if (!Verifications.IsCorrectAccessFormat(Config.AccessKey)) { throw new Exception("You must provide a correct access key to use this function."); } if (!Verifications.IsCorrectKey(Config.PrivateKey)) { throw new Exception("You must provide a correct private key to use this function."); } var client = new RestClient(Globals.EndPoint); var request = new RestRequest("/" + license, Method.DELETE); request.AddHeader("X-API-KEY", Config.PrivateKey); request.AddHeader("X-PRODUCT-ID", Config.ProductID); request.AddHeader("X-ACCESS-KEY", Config.AccessKey); var response = client.Execute(request); if (!response.IsSuccessful) { throw new WebException("Can't connect to the server at this moment."); } var parsedResponse = JsonConvert.DeserializeObject <CommonResponse>(response.Content); if (parsedResponse.Result) { return; } throw new Exception(parsedResponse.Message); }
private void getFromLocalDB(UInt32 idDocumentCible) { Dictionary<string, object> arg = new Dictionary<string, object>(); arg.Add("@idDocument", (Int64)idDocumentCible); SqlDataReader Reader = ConnectorSqlServer.ExecCommandSql( @"SELECT typeDocument FROM Documents WHERE idDocument = @idDocument", arg); string nomTable = ""; while (Reader.Read()) { nomTable = GetDBString("typeDocument", Reader); } ConnectorSqlServer.Close(Reader); Reader = ConnectorSqlServer.ExecCommandSql( @"SELECT * FROM Documents JOIN " + nomTable + @" ON Documents.idDocument = " + nomTable + @".idDocument WHERE Documents.idDocument = @idDocument", arg); if (Reader == null) return; while (Reader.Read()) { //Récupération de tous les paramètre concernant le document this.idDocument = GetDBBigInt("idDocument", Reader); this.dateTimeEditionBDD = GetDBDateTime("dateTimeEditionBDD", Reader); this.versionDocumentBDD = GetDBInt("versionDocumentBDD", Reader); this.idUtilisateur = GetDBBigInt("idUtilisateur", Reader); this.systeme = GetDBString("systeme", Reader); this.section = GetDBString("section", Reader); this.subdivision = GetDBString("subdivision", Reader); this.typeDocument = GetDBString("typeDocument", Reader); this.typeContenu = GetDBString("typeContenu", Reader); //En fonction de ce qu'on lit dans le reader, on instancie la class correspondant au type de document if (this.typeDocument == "DocNormales") { DocNormales tmpDocument = new DocNormales(idDocument); tmpDocument.categorieDocument = GetDBString("categorieDocument", Reader); tmpDocument.titreDocument = GetDBString("titreDocument", Reader); tmpDocument.dateDocument = GetDBDateTime("dateDocument", Reader); tmpDocument.versionDocument = GetDBString("versionDocument", Reader); tmpDocument.auteurDocument = GetDBString("auteurDocument", Reader); this.document = tmpDocument; } if (this.typeDocument == "TachesJournalieres") { TachesJournalieres tmpDocument = new TachesJournalieres(idDocument); tmpDocument.titreAction = GetDBString("titreAction", Reader); tmpDocument.jourApplication = GetDBString("jourApplication", Reader); tmpDocument.detailAction = GetDBString("detailAction", Reader); tmpDocument.derniereAction = GetDBDateTime("derniereAction", Reader); tmpDocument.versionAction = GetDBString("versionAction", Reader); tmpDocument.dateVersion = GetDBDateTime("dateVersion", Reader); tmpDocument.heureApplication = GetDBTime("heureApplication", Reader); tmpDocument.duree = GetDBTime("duree", Reader); tmpDocument.dateExpiration = GetDBDateTime("dateExpiration", Reader); this.document = tmpDocument; } if (this.typeDocument == "Consignes") { Consignes tmpDocument = new Consignes(idDocument); tmpDocument.objetConsigne = GetDBString("objetConsigne", Reader); tmpDocument.typeConsigne = GetDBString("typeConsigne", Reader); tmpDocument.debut = GetDBDateTime("debut", Reader); tmpDocument.fin = GetDBDateTime("fin", Reader); tmpDocument.referenceConsigne = GetDBString("referenceConsigne", Reader); tmpDocument.annuleEtRemplace = GetDBString("annuleEtRemplace", Reader); tmpDocument.redigePar = GetDBString("redigePar", Reader); tmpDocument.validePar = GetDBString("validePar", Reader); tmpDocument.signePar = GetDBString("signePar", Reader); tmpDocument.intervenant = GetDBString("intervenant", Reader); tmpDocument.responsableOperation = GetDBString("responsableOperation", Reader); tmpDocument.miseEnService = GetDBBoolean("miseEnService", Reader); tmpDocument.refMISO = GetDBString("refMISO", Reader); tmpDocument.epis = GetDBBoolean("epis", Reader); tmpDocument.refEPIS = GetDBString("refEPIS", Reader); tmpDocument.consequenceOperationnelle = GetDBBoolean("consequenceOperationnelle", Reader); tmpDocument.consequenceDocumentation = GetDBBoolean("consequenceDocumentation", Reader); tmpDocument.dateArchivage = GetDBDateTime("dateArchivage", Reader); this.document = tmpDocument; } if (this.typeDocument == "Verifications") { Verifications tmpDocument = new Verifications(idDocument); tmpDocument.titreAction = GetDBString("titreAction", Reader); tmpDocument.vacationCible = GetDBString("vacationCible", Reader); tmpDocument.lieu = GetDBString("lieu", Reader); tmpDocument.detailAction = GetDBString("detailAction", Reader); tmpDocument.derniereVerification = GetDBDateTime("derniereVerification", Reader); this.document = tmpDocument; } } ConnectorSqlServer.Close(Reader); //Récupération de tous les informations concernant le contenu du document //Requete SQL pour sélectionner le contenu d'une documentation // Si y'a un contenu hein =) if (this.typeDocument != "WITHOUT_CONTENT") { Reader = ConnectorSqlServer.ExecCommandSql(@"SELECT * FROM Contenus WHERE idDocument = @idDocument", arg); if (Reader == null) return; while (Reader.Read()) { this.contenu = new Contenus(idDocument); this.contenu.pathToFolder = GetDBString("pathToFolder", Reader); this.contenu.fileName = GetDBString("fileName", Reader); this.contenu.parsingDocument = GetDBString("parsingDocument", Reader); } ConnectorSqlServer.Close(Reader); } }
private void getFromServeur(UInt32 idDocumentCible) { Dictionary<string, object> arg = new Dictionary<string, object>(); arg.Add("@idDocument", idDocumentCible); MySqlDataReader Reader = ConnectorMySql.ExecCommand(@"SET @tableToJoin = (SELECT typeDocument FROM Documents WHERE idDocument = @idDocument); SET @sql = CONCAT('SELECT * FROM Documents AS d JOIN ', @tableToJoin, ' AS t USING (idDocument) WHERE d.idDocument=', @idDocument); PREPARE stmt FROM @sql; EXECUTE stmt;", arg); while (Reader!= null && Reader.Read()) { //Récupération de tous les paramètre concernant le document this.idDocument = GetDBUInt32("idDocument", Reader); this.dateTimeEditionBDD = GetDBDateTime("dateTimeEditionBDD", Reader); this.versionDocumentBDD = GetDBUInt32("versionDocumentBDD", Reader); this.idUtilisateur = GetDBUInt32("idUtilisateur", Reader); this.systeme = GetDBString("systeme", Reader); this.section = GetDBString("section", Reader); this.subdivision = GetDBString("subdivision", Reader); this.typeDocument = GetDBString("typeDocument", Reader); this.typeContenu = GetDBString("typeContenu", Reader); //En fonction de ce qu'on lit dans le reader, on instancie la class correspondant au type de document if (this.typeDocument == "DocNormales") { DocNormales tmpDocument = new DocNormales(idDocument); tmpDocument.categorieDocument = GetDBString("categorieDocument", Reader); tmpDocument.titreDocument = GetDBString("titreDocument", Reader); tmpDocument.dateDocument = GetDBDateTime("dateDocument", Reader); tmpDocument.versionDocument = GetDBString("versionDocument", Reader); tmpDocument.auteurDocument = GetDBString("auteurDocument", Reader); this.document = tmpDocument; } if (this.typeDocument == "TachesJournalieres") { TachesJournalieres tmpDocument = new TachesJournalieres(idDocument); tmpDocument.titreAction = GetDBString("titreAction", Reader); tmpDocument.jourApplication = GetDBString("jourApplication", Reader); tmpDocument.detailAction = GetDBString("detailAction", Reader); tmpDocument.derniereAction = GetDBDateTime("derniereAction", Reader); tmpDocument.versionAction = GetDBString("versionAction", Reader); tmpDocument.dateVersion = GetDBDateTime("dateVersion", Reader); tmpDocument.heureApplication = GetDBTime("heureApplication", Reader); tmpDocument.duree = GetDBTime("duree", Reader); tmpDocument.dateExpiration = GetDBDateTime("dateExpiration", Reader); this.document = tmpDocument; } if (this.typeDocument == "Consignes") { Consignes tmpDocument = new Consignes(idDocument); tmpDocument.objetConsigne = GetDBString("objetConsigne", Reader); tmpDocument.typeConsigne = GetDBString("typeConsigne", Reader); tmpDocument.debut = GetDBDateTime("debut", Reader); tmpDocument.fin = GetDBDateTime("fin", Reader); tmpDocument.referenceConsigne = GetDBString("referenceConsigne", Reader); tmpDocument.annuleEtRemplace = GetDBString("annuleEtRemplace", Reader); tmpDocument.redigePar = GetDBString("redigePar", Reader); tmpDocument.validePar = GetDBString("validePar", Reader); tmpDocument.signePar = GetDBString("signePar", Reader); tmpDocument.intervenant = GetDBString("intervenant", Reader); tmpDocument.responsableOperation = GetDBString("responsableOperation", Reader); tmpDocument.miseEnService = GetDBBoolean("miseEnService", Reader); tmpDocument.refMISO = GetDBString("refMISO", Reader); tmpDocument.epis = GetDBBoolean("epis", Reader); tmpDocument.refEPIS = GetDBString("refEPIS", Reader); tmpDocument.consequenceOperationnelle = GetDBBoolean("consequenceOperationnelle", Reader); tmpDocument.consequenceDocumentation = GetDBBoolean("consequenceDocumentation", Reader); tmpDocument.dateArchivage = GetDBDateTime("dateArchivage", Reader); this.document = tmpDocument; } if (this.typeDocument == "Verifications") { Verifications tmpDocument = new Verifications(idDocument); tmpDocument.titreAction = GetDBString("titreAction", Reader); tmpDocument.vacationCible = GetDBString("vacationCible", Reader); tmpDocument.lieu = GetDBString("lieu", Reader); tmpDocument.detailAction = GetDBString("detailAction", Reader); tmpDocument.derniereVerification = GetDBDateTime("derniereVerification", Reader); this.document = tmpDocument; } } ConnectorMySql.Close(Reader); //Requete SQL pour sélectionner le contenu d'une documentation // Si y'a un contenu hein =) if (this.typeContenu != "WITHOUT_CONTENT") { //cmd.CommandText = @"SELECT * FROM Contenus WHERE idDocument = @idDocument"; Reader = ConnectorMySql.ExecCommand(@"SELECT * FROM Contenus WHERE idDocument = @idDocument", arg); //Reader = cmd.ExecuteReader(); //cmd.Dispose(); while (Reader.Read()) { this.contenu = new Contenus(idDocument); //On stocke l'adresse du fichier sans le prefixe serveur web (ou serveur de fichier) this.contenu.pathToFolder = Properties.Settings.Default.pathToDataLocal + GetDBString("pathToFolder", Reader); //.Replace(Properties.Settings.Default.pathToDataServeurFichier, Properties.Settings.Default.pathToDataLocal) this.contenu.fileName = GetDBString("fileName", Reader); this.contenu.parsingDocument = GetDBString("parsingDocument", Reader); } ConnectorMySql.Close(Reader); } }