private HxXWDatabaseRecord(Session session, String ID, String connection, Boolean clone) { this.session = session; this.objDatabase = null; this.isClone = clone; this.connection = connection; //take connection string host:port:db string[] v = connection.Split(new Char[] { ':' }); if (v.Length != 3) throw new Exception("Incorrect DB connection string! [" + connection + "]"); ConfigData cfg = ConfigData.Open(); this.ID = ID; this.label = ID; this.db_host = v[0]; this.db_port = v[1]; this.db_usr = cfg.application["xDocUser"] ?? "lettore"; this.db_pwd = cfg.application["xDocPass"] ?? "reader"; this.db_name = v[2]; this.db_encoding = cfg.application["xDocEncoding"] ?? "utf-8"; this.titlePageSize = cfg.application["xDocIndexPageSize"].AsInt32; this.indexPageSize = cfg.application["xDocTitlesPageSize"].AsInt32; this.bDefault = ID == "MAIN" ? true : false; }
public HxXWDatabase(Session session, String _ID, String _dbHost, String _dbPort, String _dbUsr, String _dbPwd, String _dbName, String _dbEncoding, int _titlesPageSize, int _indexPageSize) { this.session = session; initConfig(); this.ID = _ID; this.host = _dbHost; this.port = _dbPort; this.user = _dbUsr; this.password = _dbPwd; this.db = _dbName; this.encoding = _dbEncoding; this.titlesPageSize = _titlesPageSize; this.indexPageSize = _indexPageSize; this.xDocUnSucessfullTryesCount = Convert.ToInt32(config.app["xDocUnSucessfullTryesCount"] ?? "3"); open(); }
public HxXWDatabaseRecord(Session session, KeyValuePair aParams, Boolean clone) : this(session, aParams.Key, aParams.AsString, clone) { }
public HxXWDatabaseRecord(Session session, KeyValuePair aParams) : this(session, aParams, false) { }
public HxXWPerson(Session session, HxXWDatabase acl, bool forceLoad) { String locuser = ""; String matricola = ""; String possibleDocwayIIdUnit = ""; XmlNode node = null; _session = session; if(_session != null){ Object tmp = null; if(!forceLoad) tmp = _session["ACL_USER"]; if(tmp == null){ acl.open(); //try check user by iIdUnit first possibleDocwayIIdUnit = _session.AsString("DOCWAY_USER_IIDUNIT"); if (possibleDocwayIIdUnit == "") { //first try to take session user locuser = _session.AsString("DOCWAY_USER_NAME"); if (locuser == "") { //try current auth user locuser = Environment.UserName; int idx = locuser.LastIndexOf('\\'); if (idx > -1) locuser = locuser.Substring(idx + 1); } /* * try to check up user for matricola containig it can be user$matricola */ string[] v = locuser.Split(new Char[] { '$' }); string mq = ""; if(v.Length == 2){ locuser = v[0]; matricola = v[1]; //[/persona_interna/@matricola/] mq = "and [/persona_interna/@matricola/]=\""+v[1]+"\""; }else{ locuser = v[0]; matricola = ""; } _presp = acl.loadFirst("[persint_loginname]=\"" + locuser + "\"" + mq, false); //verify last result size if (acl.lastResultSize > 1) { _isUnique = false; return; //escape function } //take iIdUnit node = _presp.xQuery("//Document"); if (node != null) { possibleDocwayIIdUnit = node.Attributes["idIUnit"].Value; } //take persona interna node = _presp.xQuery("//persona_interna"); if (node == null) { //we didnt find user in ACL so lets try default one locuser = ConfigData.Open().application.AsString("xDocDefaultDocwayUser") ?? ""; if (locuser == "") throw new Exception("Missing user to log on!"); _presp = acl.loadFirst("[persint_loginname]=\"" + locuser + "\"", false); //take iIdUnit node = _presp.xQuery("//Document"); if (node != null) { possibleDocwayIIdUnit = node.Attributes["idIUnit"].Value; } //take persona interna node = _presp.xQuery("//persona_interna"); } } else { //we have iIdUnit in session ///first try to take session user locuser = _session.AsString("DOCWAY_USER_NAME"); if (locuser == "") { //try current auth user locuser = Environment.UserName; int idx = locuser.LastIndexOf('\\'); if (idx > -1) locuser = locuser.Substring(idx + 1); } //in case of matricola presence string[] v = locuser.Split(new Char[] { '$' }); string mq = ""; if(v.Length == 2){ locuser = v[0]; matricola = v[1]; //[/persona_interna/@matricola/] mq = "and [/persona_interna/@matricola/]=\""+v[1]+"\""; }else{ locuser = v[0]; matricola = ""; } //load record by iIdUnit _presp = acl.loadDocument(Convert.ToInt32(possibleDocwayIIdUnit), false, true, false); node = _presp.xQuery("//persona_interna"); } //if we find user work on it if (node != null) { _params = new XDocBase.Web.CONTAINER.Map(); _params["nome"] = node.Attributes["nome"].Value; _params["cognome"] = node.Attributes["cognome"].Value; _params["cod_uff"] = node.Attributes["cod_uff"].Value; _params["AmmAoo"] = (String)node.Attributes["cod_amm"].Value + (String)node.Attributes["cod_aoo"].Value; _params["matricola"] = node.Attributes["matricola"].Value; matricola = node.Attributes["matricola"].Value; _params["cgnno"] = _params["cognome"] + " " + _params["nome"]; _params["nocgn"] = _params["nome"] + " " + _params["cognome"]; //make list of inserable repertories /* xpath for to take some repertory right * //right[starts-with(@cod,'DW-DOCINTRANET') and ends-with(@cod,'-V-InsRep')] */ //take all rights TRUE and put them in ',' separated string //right[text()='TRUE' or text()='true'] XmlNodeList entries = _presp.xQueryExt("//right[text()='TRUE' or text()='true']"); String rights = ""; foreach (XmlNode n in entries) { rights += n.Attributes["cod"].Value + ","; } _params["rights"] = rights; if (_params["cod_uff"].ToString().Length > 0) { _uresp = acl.loadFirst("[struint_coduff]=\"" + _params["cod_uff"] + "\"", false); node = _uresp.xQuery("//struttura_interna/nome"); if (node != null) { if (node.LastChild != null) _params["uff_name"] = node.LastChild.Value; else _params["uff_name"] = node.Value; } } _session["ACL_USER"] = _params; _session["DOCWAY_USER_NAME"] = locuser+"$"+matricola; _session["DOCWAY_USER_IIDUNIT"] = possibleDocwayIIdUnit; } else { throw new Exception("Persona [" + locuser + "] non trovata in ACL!"); } }else{ _params = (XDocBase.Web.CONTAINER.Map)tmp; } } }
public HxXWPerson(Session session, HxXWDatabase acl) : this(session, acl, false) { }