示例#1
0
        public Unity GetUnity(string user)
        {
            Unity unity = new Unity();

            attributeData[] attributeDatas = new attributeData[1];
            attributeDatas[0] = new attributeData
            {
                //search enrollment
                IDATTRIBUTE = EAttribute.tfyacess_userid.ToString(),
                VLATTRIBUTE = user
            };

            searchDocumentFilter searchDocumentFilter = new searchDocumentFilter
            {
                IDCATEGORY = searchAttributePermissionCategory
            };

            searchDocumentReturn searchDocumentReturn = seClient.searchDocument(searchDocumentFilter, "", attributeDatas);
            documentReturn       retorno = new documentReturn();

            if (searchDocumentReturn.RESULTS.Count() > 0)
            {
                string             idDocument         = searchDocumentReturn.RESULTS.FirstOrDefault().IDDOCUMENT;
                documentDataReturn documentDataReturn = seClient.viewDocumentData(idDocument, "", "", "");

                string attributeCode = EAttribute.SER_cad_cod_unidade.ToString();
                string attributeName = EAttribute.SER_cad_Unidade.ToString();

                unity.Code = documentDataReturn.ATTRIBUTTES.Any(x => x.ATTRIBUTTENAME == attributeCode) ? documentDataReturn.ATTRIBUTTES.Where(x => x.ATTRIBUTTENAME == attributeCode).FirstOrDefault().ATTRIBUTTEVALUE.FirstOrDefault() : null;
                unity.Name = documentDataReturn.ATTRIBUTTES.Any(x => x.ATTRIBUTTENAME == attributeName) ? documentDataReturn.ATTRIBUTTES.Where(x => x.ATTRIBUTTENAME == attributeName).FirstOrDefault().ATTRIBUTTEVALUE.FirstOrDefault() : null;
            }

            return(unity);
        }
示例#2
0
        public static string searchDoc(string Identificador, string empresa, string RetornCreateFolder, string Indice, string nome, string ColunaD, string ColunaE_Dtdesligamento, string ColunaF, string ColunaG, string ColunaH, string ColunaI, string ColunaJ, string ColunaK, string ColunaL, string ColunaM, string ColunaN, string ColunaO, string ColunaP)
        {
            try
            {
                #region DadosXML
                string Categorychecklist = "";
                string Chklist_empresa   = "";
                string Chklist_evento    = "";

                var separator = ConfigurationManager.AppSettings["separator"];

                XDocument doc   = XDocument.Load((CaminhoDadosXML(caminho) + @"System.net.cnfg.xml"));
                var       prods = from p in doc.Descendants("Config")
                                  select new
                {
                    Categorychecklist = p.Element("Categorychecklist").Value,
                    Chklist_empresa   = p.Element("Chklist_empresa").Value,
                    Chklist_evento    = p.Element("Chklist_evento").Value,
                };

                foreach (var p in prods)
                {
                    Categorychecklist = p.Categorychecklist;
                    Chklist_empresa   = p.Chklist_empresa;
                    Chklist_evento    = p.Chklist_evento;
                }
                #endregion
                //
                attributeData[] attributeDatas = new attributeData[2];
                attributeDatas[0] = new attributeData
                {
                    IDATTRIBUTE = Chklist_empresa,
                    VLATTRIBUTE = empresa
                };

                attributeDatas[1] = new attributeData
                {
                    IDATTRIBUTE = Chklist_evento,
                    VLATTRIBUTE = "admissão"
                };

                searchDocumentFilter searchDocumentFilter = new searchDocumentFilter {
                    IDCATEGORY = Categorychecklist
                };
                SEClient             seClient             = Conection.GetConnection();
                searchDocumentReturn searchDocumentReturn = seClient.searchDocument(searchDocumentFilter, "", attributeDatas);


                if (searchDocumentReturn.RESULTS.Count() > 0)
                {
                    foreach (var item in (searchDocumentReturn.RESULTS))
                    {
                        string[] strNome = Path.GetFileName(item.IDDOCUMENT).ToString().Split(new char[] { Convert.ToChar(separator) });

                        string IdCat = strNome[3];
                        //Identificador
                        var RetCriarDoc = CriarDoc(IdCat, RetornCreateFolder, Indice, Identificador, nome, empresa, ColunaD, ColunaE_Dtdesligamento, ColunaF, ColunaG, ColunaH, ColunaI, ColunaJ, ColunaK, ColunaL, ColunaM, ColunaN, ColunaO, ColunaP);
                        if (RetCriarDoc != "false")
                        {
                            var RetDocAssocia = CriaDocContainerAssocia(IdCat, RetCriarDoc, RetornCreateFolder);
                        }
                    }
                }
                IDSeachDoc = 1;
                return(Identificador);
            }
            catch (Exception ex)
            {///here
                while (IDSeachDoc <= 2)
                {
                    IDSeachDoc++;
                    File.AppendAllText(logCriarPastaFuncionario + @"\" + "log_erro_CriarPastaFuncionario.txt", "\r\n" + DateTime.Now + @" | CriarPastaDoc | " + ex.Message.ToString() + @";");
                    Thread.Sleep(Convert.ToInt32(5000));
                    return(searchDoc(Identificador, empresa, RetornCreateFolder, Indice, nome, ColunaD, ColunaE_Dtdesligamento, ColunaF, ColunaG, ColunaH, ColunaI, ColunaJ, ColunaK, ColunaL, ColunaM, ColunaN, ColunaO, ColunaP));
                }
                return("false");
            }
        }