public string OpenUserConnect(string sUserName, string sPassword) { //Controllo se non è stato aperto già un File di Log //sConn è la stringa di connessione da restituire //string sConn = null; SVAOLLib.Session oSession; oSession = new SVAOLLib.Session(); //setto i server appropriati oSession.Server = serverArchiflow; oSession.Database = databaseArchiflow; //Effettuo il login try { sConnection = oSession.Login(sUserName, sPassword, ""); } catch (Exception e) { // Logger.WriteOnLog(LogId, "PROBLEMA DI CONNESSIONE", 1); // Logger.WriteOnLog(LogId, e.Source + " " + e.Message, 1); lErr = -1; throw new ArgumentException("LOGIN NON ESEGUITO.", e); //throw new Exception(String.Format("{0} >> {1}: {2}", "PROBLEMA DI CONNESSIONE", e.Source, e.Message), e); } if (sConnection != null) { // Logger.WriteOnLog(LogId, "connessione riuscita! per l'utente " + sUserName, 3); } // else Logger.WriteOnLog(LogId, "ERRORE: connessione non riuscita!", 3); return(sConnection); }
public SVAOLLib.Offices GetOffices(string GuidConnect, string CardId, string sOffices) { SVAOLLib.Offices oOfficesNotice = new SVAOLLib.Offices(); var oSession = new SVAOLLib.Session(); //setto i server appropriati oSession.Server = serverArchiflow; oSession.Database = databaseArchiflow; oSession.GUIDconnect = GuidConnect; try { CardVisibilityManager oCardVisibilityManager = new CardVisibilityManager(CardId, GuidConnect); logger.Debug("Card: " + CardId); logger.Debug("Uffici estratti: " + oCardVisibilityManager.getXMLVisibility()); foreach (string sOffice in sOffices.Split('|')) { if (!string.IsNullOrEmpty(sOffice)) { logger.Debug("Elaboro l'ufficio: " + sOffice); var oOffices = oCardVisibilityManager.getOfficesFromVisibility(sOffice); foreach (var oOff in oOffices) { oOfficesNotice.Add(oOff); } } } return(oOfficesNotice); } catch (Exception e) { lErr = -1; logger.Error("ERRORE: " + e.Source + " - " + e.StackTrace + " - " + e.Message); throw new Exception(String.Format("{0}>>{1}>>{2}", "ERRORE : GetOffices", e.Source, e.Message), e); } }
public Boolean SendNotify(string GuidConnect, string CardId, string sOffices, string sGroups, string sUsers, string sMessages) { SVAOLLib.Offices oOfficesNotice = new SVAOLLib.Offices(); SVAOLLib.Users oUsersNotice = new SVAOLLib.Users(); SVAOLLib.Groups oGroupsNotice = new SVAOLLib.Groups(); var oSession = new SVAOLLib.Session(); //setto i server appropriati oSession.Server = serverArchiflow; oSession.Database = databaseArchiflow; oSession.GUIDconnect = GuidConnect; logger.Debug("Entro in connection->SendNotify"); oOfficesNotice = this.GetOffices(GuidConnect, CardId, sOffices); oGroupsNotice = this.GetGroups(GuidConnect, sGroups); oUsersNotice = this.GetUsers(GuidConnect, sUsers); try { logger.Debug("Invio il messaggio: " + sMessages); oSession.SendMailMessage(oOfficesNotice, oGroupsNotice, oUsersNotice, sMessages); return(true); } catch (Exception e) { lErr = -1; logger.Error("ERRORE: " + e.Source + " - " + e.StackTrace + " - " + e.Message); throw new Exception(String.Format("{0}>>{1}>>{2}", "ERRORE : SendNotify", e.Source, e.Message), e); } }
public List <dynamic> GetIndiciScheda(string stGuidConnect, string sGuidCard) { List <dynamic> oModelCard = new List <dynamic>(); dynamic index = ""; index = new DynamicDictionary(); SVAOLLib.Card oCard; oCard = new SVAOLLib.Card(); SVAOLLib.Session oSession = new SVAOLLib.Session(); oSession.GUIDconnect = stGuidConnect; oCard.GUIDconnect = stGuidConnect; oCard.GuidCard = _Logger.FormatID(sGuidCard); oCard.LoadFromGuid(); List <string> IndiciScheda = new List <string>(); string[] buffer = new string[21]; IndiciScheda = buffer.ToList(); foreach (SVAOLLib.Field oField in (SVAOLLib.Fields)oCard.Fields) { index.id = oField.Id; index.description = oField.Description; if (oField.Value != null) { index.value = oField.Value.ToString(); } else { index.value = ""; } oModelCard.Add(index); } return(oModelCard); }
public Boolean RemoveVisibility(string GuidConnect, string sGuidCard, string sUsers, string sOffices, string sGroups) { bool bResult = false; SVAOLLib.Offices oOfficesNotice = new SVAOLLib.Offices(); SVAOLLib.Users oUsersNotice = new SVAOLLib.Users(); SVAOLLib.Groups oGroupsNotice = new SVAOLLib.Groups(); var oSession = new SVAOLLib.Session(); ConnectionManager oConnectionManager = new ConnectionManager(logger); logger.Debug("Entro in connection->RemoveVisibility"); oOfficesNotice = oConnectionManager.GetOffices(GuidConnect, sGuidCard, sOffices); oGroupsNotice = oConnectionManager.GetGroups(GuidConnect, sGroups); oUsersNotice = oConnectionManager.GetUsers(GuidConnect, sUsers); try { SVAOLLib.Card card = GetCardFromId(GuidConnect, sGuidCard); card.RemoveVisibility(oOfficesNotice, oGroupsNotice, oUsersNotice); bResult = true; } catch (Exception e) { lErr = -1; logger.Error("ERRORE: " + e.Source + " - " + e.StackTrace + " - " + e.Message); throw new Exception(String.Format("{0}>>{1}>>{2}", "ERRORE : RemoveVisibility", e.Source, e.Message), e); } return(bResult); }
public string GetTypeDocumentNameByCode(string stGuidConnect, short Code) { string sNameDocumentType = ""; //istanzio l'oggetto SvAol.Session SVAOLLib.Session oSession = new SVAOLLib.Session(); try { oSession.GUIDconnect = stGuidConnect; //Inizializzo gli oggetti SvAol. SVAOLLib.DocumentTypes oArchiveDocumentTypes = new SVAOLLib.DocumentTypes(); //Recupero tutti gli Archivi. oArchiveDocumentTypes = (SVAOLLib.DocumentTypes)oSession.GetDocTypes(0, 0); //il secondo argomento è false //Cerco l'archivio con nome #stName#. foreach (SVAOLLib.DocumentType oDocumentType in oArchiveDocumentTypes) { if (oDocumentType.Id == Code) { sNameDocumentType = oDocumentType.Description; break; } } } catch (Exception e) { _Logger.WriteOnLog(_sLogId, "ERRORE NELL'ESECUZIONE DI : GetTypeDocumentNameByCode", 1); _Logger.WriteOnLog(_sLogId, e.Source + " " + e.Message, 1); throw new Exception(String.Format("{0}>>{1}>>{2}", "ERRORE : GetTypeDocumentNameByCode", e.Source, e.Message), e); } finally { } return(sNameDocumentType); }
public Boolean AddVisibility(string GuidConnect, string sGuidCard, string sUsers, string sOffices, string sGroups, SVAOLLib.Offices oMailOffices = null, SVAOLLib.Groups oMailGroups = null, SVAOLLib.Users oMailUsers = null) { int iStateWf = 0; bool bResult = false; bool bWorkflowActice = false; SVAOLLib.Offices oOfficesNotice = new SVAOLLib.Offices(); SVAOLLib.Users oUsersNotice = new SVAOLLib.Users(); SVAOLLib.Groups oGroupsNotice = new SVAOLLib.Groups(); if (oMailOffices == null) { oMailOffices = new SVAOLLib.Offices(); } if (oMailGroups == null) { oMailGroups = new SVAOLLib.Groups(); } if (oMailUsers == null) { oMailUsers = new SVAOLLib.Users(); } var oSession = new SVAOLLib.Session(); ConnectionManager oConnectionManager = new ConnectionManager(logger); logger.Debug("Entro in connection->AddVisibility"); oOfficesNotice = oConnectionManager.GetOffices(GuidConnect, sGuidCard, sOffices); oGroupsNotice = oConnectionManager.GetGroups(GuidConnect, sGroups); oUsersNotice = oConnectionManager.GetUsers(GuidConnect, sUsers); try { SVAOLLib.Card card = GetCardFromId(GuidConnect, sGuidCard); if (card.ProcWF != 0) { iStateWf = (int)card.ProcWF; card.ModifyProcWf(SVAOLLib.svProcWF.svPWFNothing); bWorkflowActice = true; } card.Offices = oOfficesNotice; card.Users = oUsersNotice; card.Groups = oGroupsNotice; card.Send(oMailOffices, oMailGroups, oMailUsers, "", ""); if (bWorkflowActice) { card.ModifyProcWf((SVAOLLib.svProcWF)iStateWf); } bResult = true; } catch (Exception e) { lErr = -1; logger.Error("ERRORE: " + e.Source + " - " + e.StackTrace + " - " + e.Message); throw new Exception(String.Format("{0}>>{1}>>{2}", "ERRORE : RemoveVisibility", e.Source, e.Message), e); } return(bResult); }
public bool CheckConnection() { SVAOLLib.Session oSession; oSession = new SVAOLLib.Session(); //setto i server appropriati oSession.Server = serverArchiflow; oSession.Database = databaseArchiflow; oSession.GUIDconnect = sConnection; bool bIsValid = false; bIsValid = oSession.IsValidSession(); return(bIsValid); }
public List <dynamic> GetAttachmentExt(string stGuidConnect, SVAOLLib.Card gCard, List <string> idAttachments, Boolean addBinary = true) { //Controllo se non è stato aperto già un File di Log bool newcon = false; //controllo se sono già connesso, in caso contrario mi connetto e ritorno la stringa di connessione SVAOLLib.Session oSession = new SVAOLLib.Session(); oSession.GUIDconnect = stGuidConnect; SVAOLLib.Attachment oAttachmentFrom = new SVAOLLib.Attachment(); oAttachmentFrom.GUIDconnect = stGuidConnect; oAttachmentFrom.GuidCard = gCard.GuidCard; dynamic objAttachment; Object aBinaryData = new Object(); List <dynamic> objAttachments = new List <dynamic>(); try { int iCount; object[,] attachments = (object[, ])gCard.AttachmentsAsArray; for (iCount = 1; iCount < attachments.GetLength(0); iCount++) { if (Convert.ToInt32(attachments[iCount, 3]) == 0) { objAttachment = new DynamicDictionary(); objAttachment.id = attachments[iCount, 1].ToString(); objAttachment.nomefile = attachments[iCount, 4].ToString(); objAttachment.note = attachments[iCount, 2].ToString(); objAttachment.binarycontent = Convert.ToBase64String((byte[])(aBinaryData)); objAttachments.Add(objAttachment); } } return(objAttachments); } catch (Exception e) { _Logger.WriteOnLog(_sLogId, "ERRORE NELL'ESECUZIONE DI : GetAttachmentExt", 1); _Logger.WriteOnLog(_sLogId, e.Source + " " + e.Message, 1); return(null); throw new Exception(String.Format("{0}>>{1}>>{2}", "GetAttachmentExt", e.Source, e.Message), e); } finally { if (newcon) { oSession.Logout(); } } }
public static Boolean SetExternalAttach(string stGuidConnect, string stguidCardTo, string stAttachName, object aBinaryData, string note, string LogId) { //Controllo se non è stato aperto già un File di Log bool newcon = false; //è la variabile da ritornare Boolean SetCirAtt = false; //inizializzo l'oggetto session SVAOLLib.Session oSession = new SVAOLLib.Session(); try { //controllo se sono già connesso, in cvaso contrario mi connetto e ritorno la stringa di connessione if (stGuidConnect.Length != 0) { SVAOLLib.Attachment oAttachmentTo; // Se la GUIDCard non è formattata lo faccio ora stguidCardTo = CardManager.FormatID(stguidCardTo, LogId); // Imposto l'allegato della scheda oAttachmentTo = new SVAOLLib.Attachment(); oAttachmentTo.GuidCard = stguidCardTo; oAttachmentTo.GUIDconnect = stGuidConnect; oAttachmentTo.Note = note; oAttachmentTo.IsInternal = 0; oAttachmentTo.Name = stAttachName; // Inserisco l'allegato esterno della Card FROM nella Card TO. int q = ((byte[])aBinaryData).GetUpperBound(0) + 1; oAttachmentTo.InsertExternal(aBinaryData, q, 0, q, 0, 0); SetCirAtt = true; } } catch (Exception e) { throw new Exception(String.Format("{0}>>{1}>>{2}", "ERRORE : SetCircleAttach", e.Source, e.Message), e); } finally { if (newcon) { oSession.Logout(); } } return(SetCirAtt); }
public SVAOLLib.Groups GetGroups(string GuidConnect, string sGroups) { SVAOLLib.Groups oGroupsNotice = new SVAOLLib.Groups(); var oSession = new SVAOLLib.Session(); //setto i server appropriati oSession.Server = serverArchiflow; oSession.Database = databaseArchiflow; oSession.GUIDconnect = GuidConnect; try { foreach (string sGroup in sGroups.Split('|')) { if (!string.IsNullOrEmpty(sGroup)) { var oGroupsFound = oSession.GetAllGroups(1); SVAOLLib.Group ogroup = new SVAOLLib.Group(); foreach (var oGrp in oGroupsFound) { if (oGrp.Name == sGroup) { logger.Debug("Gruppo Trovato"); oGroupsNotice.Add(oGrp); break; } logger.Debug("userid: " + oGrp.Name); } ; } } return(oGroupsNotice); } catch (Exception e) { lErr = -1; logger.Error("ERRORE: " + e.Source + " - " + e.StackTrace + " - " + e.Message); throw new Exception(String.Format("{0}>>{1}>>{2}", "ERRORE : GetGroups", e.Source, e.Message), e); } }
public SVAOLLib.Users GetUsers(string GuidConnect, string sUsers) { SVAOLLib.Users oUsersNotice = new SVAOLLib.Users(); var oSession = new SVAOLLib.Session(); //setto i server appropriati oSession.Server = serverArchiflow; oSession.Database = databaseArchiflow; oSession.GUIDconnect = GuidConnect; try { foreach (string sUser in sUsers.Split('|')) { if (!string.IsNullOrEmpty(sUser)) { logger.Debug("Elaboro il l'utente: " + sUser); var oUsersFound = oSession.GetAllUsers(0); foreach (var oUsr in oUsersFound) { if (oUsr.UserID == sUser) { logger.Debug("Utente Trovato"); oUsersNotice.Add(oUsr); break; } logger.Debug("userid: " + oUsr.UserID); } ; } } return(oUsersNotice); } catch (Exception e) { lErr = -1; logger.Error("ERRORE: " + e.Source + " - " + e.StackTrace + " - " + e.Message); throw new Exception(String.Format("{0}>>{1}>>{2}", "ERRORE : SendNotify", e.Source, e.Message), e); } }
public string GetArchiveNameByCode(string stGuidConnect, short Code) { //Controllo se non è stato aperto già un File di Log string sArchiveName = ""; //istanzio l'oggetto SvAol.Session SVAOLLib.Session oSession = new SVAOLLib.Session(); try { oSession.GUIDconnect = stGuidConnect; //Inizializzo gli oggetti SvAol. SVAOLLib.Archives oArchives = new SVAOLLib.Archives(); //Recupero tutti gli Archivi. oArchives = (SVAOLLib.Archives)oSession.GetArchives(0, 0); //il secondo argomento è false //Cerco l'archivio con nome #stName#. foreach (SVAOLLib.Archive oArchive in oArchives) { if (oArchive.Id == Code) { _Logger.WriteOnLog(_sLogId, "NomeArchivio: " + _Logger.ToJson(oArchive.Description), 3); sArchiveName = oArchive.Description; break; } } } catch (Exception e) { _Logger.WriteOnLog(_sLogId, e.StackTrace, 1); _Logger.WriteOnLog(_sLogId, "ERRORE NELL'ESECUZIONE DI : GetArchiveByName", 1); _Logger.WriteOnLog(_sLogId, e.Source + " " + e.Message, 1); throw new Exception(String.Format("{0}>>{1}>>{2}", "ERRORE : GetArchiveByName", e.Source, e.Message), e); } finally { } return(sArchiveName); }
/*------------------------------------------------------------------------------------------------------------ * ' FUNZIONE: CLOSECONNECT * ' DESCRIZIONE:Chiude una connessione verso SvAol. * ' * ' * ' * ' INPUT * ' stGuidConnect: guid di connessione a svaol | Type: STRING * ' OUTPUT * ' */ public void CloseConnect() { //Controllo se non è stato aperto già un File di Log // if (LogId == null || LogId == "") LogId = LOL.LOLIB.CodeGen(null); /// LOL.LOLIB Logger = new LOL.LOLIB(); if (sConnection == null) { // Logger.WriteOnLog(LogId, "ATTENZIONE:non è presente alcuna stringa di connessione!", 2); } else { //istanzio la connessione da chiudere e le passo la stringa di connessione SVAOLLib.Session oSession = new SVAOLLib.Session(); oSession.GUIDconnect = sConnection; //chiudo la connessione oSession.Logout(); // Logger.WriteOnLog(LogId, "Connessione chiusa", 3); Dispose(); } }
public Boolean RemoveAllVisibility(string GuidConnect, string sGuidCard) { bool bResult = false; var oSession = new SVAOLLib.Session(); ConnectionManager oConnectionManager = new ConnectionManager(logger); logger.Debug("Entro in connection->RemoveAllVisibility"); try { CardVisibilityManager visibilityFromCard = new CardVisibilityManager(sGuidCard, GuidConnect); //logger.Debug("Leggo la visibilità della scheda: " + CardId); //WcfGdpd.WsCard.Group dValue1 = (WcfGdpd.WsCard.Group)Convert.ChangeType(visibilityFromCard.getGroupFromVisibility(resourceFileManager.getConfigData("GroupVisibilityRiservato")), typeof(WcfGdpd.WsCard.Group)); //var elio= Convert.ChangeType(visibilityFromCard.getGroupFromVisibility(resourceFileManager.getConfigData("GroupVisibilityRiservato")), typeof(WcfGdpd.WsCard.Group)); var groupsWCF = visibilityFromCard.getGroupsFromSharePredefinite(); //logger.Debug("Ricavo la visibilità predefinita dai gruppi: " + sGuidCard); var officesWCF = visibilityFromCard.getOfficesFromSharePredefinite(); //logger.Debug("Ricavo la visibilità predefinita dagli uffici: " + sGuidCard); var usersWCF = visibilityFromCard.getUsersFromSharePredefinite(); //logger.Debug("Ricavo la visibilità predefinita dagli utenti: " + sGuidCard); var groupsMailWCF = visibilityFromCard.getGroupsMailFromSharePredefinite(); //logger.Debug("Ricavo la visibilità predefinita dai gruppi con notifica: " + sGuidCard); var officesMailWCF = visibilityFromCard.getOfficesMailFromSharePredefinite(); //logger.Debug("Ricavo la visibilità predefinita dagli uffici con notifica: " + sGuidCard); var usersMailWCF = visibilityFromCard.getUsersMailFromSharePredefinite(); SVAOLLib.Card card = GetCardFromId(GuidConnect, sGuidCard); card.RemoveVisibility(officesWCF, groupsWCF, usersWCF); bResult = true; } catch (Exception e) { lErr = -1; logger.Error("ERRORE: " + e.Source + " - " + e.StackTrace + " - " + e.Message); throw new Exception(String.Format("{0}>>{1}>>{2}", "ERRORE : RemoveVisibility", e.Source, e.Message), e); } return(bResult); }
public List <string> SearchCardsByField(string stGuidConnect, string stArchive, string stDocType, long lFieldID, string stFieldValueFrom, string stFieldValueTo, string userId) { //Controllo se non è stato aperto già un File di Log List <string> lResult = new List <string>(); //istanzio i Manager che mi servono //Inizializzo l'oggetto SvAol.Session SVAOLLib.Session oSession = new SVAOLLib.Session(); SVAOLLib.User oUser = new SVAOLLib.User(); try { if (stGuidConnect != null) { oUser.GUIDconnect = stGuidConnect; oUser.UserID = userId.ToUpper(); oUser.LoadFromUserID(userId.ToUpper()); //istanzio gli oggetti svaol SVAOLLib.Archive oArchive = new SVAOLLib.Archive(); SVAOLLib.DocumentType oDocType = new SVAOLLib.DocumentType(); SVAOLLib.SearchCriteria oSearchCriteria = new SVAOLLib.SearchCriteria(); SVAOLLib.Archives oArchives = new SVAOLLib.Archives(); SVAOLLib.Fields oFields = new SVAOLLib.Fields(); object[] aCardsAsArray; long lCardsCount, lSearchRes; //recupero l'archivioo e il tipo documento Int16 idTipoDocumento = 0; Int16 idTipoArchivio = 0; using (var oDocManager = new DocManager(_Logger, _sLogId)) { idTipoDocumento = oDocManager.GetIdDocTypeByName(stGuidConnect, stDocType); } oDocType.Id = idTipoDocumento; oDocType.GUIDconnect = stGuidConnect; oDocType.LoadDocumentTypeFromId(); using (var oDocManager = new DocManager(_Logger, _sLogId)) { idTipoArchivio = oDocManager.GetIdArchiveByName(stGuidConnect, stArchive); } oArchive.GUIDconnect = stGuidConnect; oArchive.Id = idTipoArchivio; oArchive.LoadFromId(); //Inizializzo l'oggetto Session oSession.GUIDconnect = stGuidConnect; //Aggiungo l'archivio all'oggetto relativo ai criteri di ricerca oArchives.Add(oArchive, null); oSearchCriteria.Archives = oArchives; //Aggiungo il tipo documento all'oggetto relativo ai criteri di ricerca oSearchCriteria.DocType = oDocType; //Inserisco l'ambito della ricerca oSearchCriteria.Context = SVAOLLib.svContextSearch.svCsBoth; //Inserisco il tipo di ricerca oSearchCriteria.SearchType = SVAOLLib.svSearchType.svStIndexes; //Inserisco l'informazione sull'utente collegato oSearchCriteria.CntUser = oUser.Code; //Chiave di ricerca foreach (SVAOLLib.Field oField in (SVAOLLib.Fields)oDocType.Fields) { if ((long)oField.Id == lFieldID) { oField.Value = stFieldValueFrom; oField.ValueTo = stFieldValueTo; oFields.Add(oField, null); break; } } //Eseguo la ricerca oSearchCriteria.Fields = oFields; aCardsAsArray = (object[])oSession.SearchAsArray(oSearchCriteria, 0); lSearchRes = (long)oSearchCriteria.SearchResult; lCardsCount = aCardsAsArray.GetUpperBound(0); // Controllo che mi sia tornata una Card valida if (lCardsCount > 0) { //assegno la GuidCard della scheda trovata for (int i = 1; i < lCardsCount + 1; i++) { lResult.Add(aCardsAsArray[i].ToString().Substring(24)); } } } } catch (Exception e) { throw new Exception(String.Format("{0} >> {1}: {2}", "ERRORE: SearchCardByField", e.Source, e.Message), e); } finally { } return(lResult); }