Пример #1
0
            public static string DeletDocument(string IDCATEGORY, string IdDocumento)
            {
                try
                {
                    string   Justificativa = "Exclusão Documento";
                    SEClient DeletDoc      = Conection.GetConnection();
                    string   RetornoDelet  = DeletDoc.deleteDocument(IDCATEGORY, IdDocumento, "", Justificativa);

                    File.AppendAllText(logExcluirDocumentos + @"\" + "log_ExcluirDocumentos.txt", "\r\n" + DateTime.Now + @" | Deletado Documento " + IdDocumento + @" " + RetornoDelet.Substring(3).ToString() + @";");

                    IDDelDoc = 1;

                    if (RetornoDelet.Contains("1:"))
                    {
                        return("Sucesso");
                    }
                    else
                    {
                        return("false");
                    }
                }
                catch (Exception ex)
                {
                    while (IDDelDoc <= 2)
                    {
                        IDDelDoc++;
                        Thread.Sleep(Convert.ToInt32(5000));
                        File.AppendAllText(logExcluirDocumentos + @"\" + "log_erro_Excluir_Documentos.txt", "\r\n" + DateTime.Now + @" | " + ex.Message.ToString() + @";");
                        return(DeletDocument(IDCATEGORY, IdDocumento));
                    }
                    return("false");
                }
            }
Пример #2
0
        public static string CriaDocContainerAssocia(string IDCATEGORY, string Retornocriar, string RetornCreateFolder)
        {
            try
            {
                string IDPASTA             = "";
                string StructID            = "";
                var    digitosparaStructID = "";

                #region DadosXML

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

                foreach (var p in prods)
                {
                    IDPASTA             = p.IDCategoriaPasta;
                    StructID            = p.StructPendenteID;
                    digitosparaStructID = p.DigitosStructID;
                }
                #endregion

                if (StructID == "")
                {
                    string strID = IDCATEGORY.Substring(0, Convert.ToInt32(digitosparaStructID));
                    StructID = strID;
                }


                SEClient newDocContainerAss = Conection.GetConnection();
                string   resultContainerAss = newDocContainerAss.newDocumentContainerAssociation(IDPASTA, RetornCreateFolder, "", StructID, IDCATEGORY, Retornocriar, out long codeAssociation, out string detailAssociation);
                if (resultContainerAss.ToString().Substring(0, 2).Contains("0:"))
                {
                    File.AppendAllText(logCriarPastaFuncionario + @"\" + "log_erro_CriarPastaFuncionario.txt", "\r\n" + DateTime.Now + @" | VINCULADO DOCUMENTO: " + Retornocriar + @" A PASTA " + RetornCreateFolder + @" COM " + resultContainerAss + @";");
                }
                else
                {
                    File.AppendAllText(logCriarPastaFuncionario + @"\" + "log_CriarPastaFuncionario.txt", "\r\n" + DateTime.Now + @" | VINCULADO DOCUMENTO: " + Retornocriar + @" A PASTA " + RetornCreateFolder + @" COM " + resultContainerAss + @";");
                }
                IDAssoc = 1;
                return(resultContainerAss);
            }
            catch (Exception ex)
            {
                while (IDAssoc <= 2)
                {
                    IDAssoc++;
                    File.AppendAllText(logCriarPastaFuncionario + @"\" + "log_erro_CriarPastaFuncionario.txt", "\r\n" + DateTime.Now + @" | CriarPastaDoc | " + ex.Message.ToString() + @";");
                    Thread.Sleep(Convert.ToInt32(5000));
                    return(CriaDocContainerAssocia(IDCATEGORY, Retornocriar, RetornCreateFolder));
                }
                return("false");
            }
        }
Пример #3
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            try
            {
                int cont = 0;

                var categ = textBox1categ.Text.Replace(" ", "");

                if (categ != "" && categ != null)
                {
                    listBox1PSTsemDOC.Items.Clear();
                    sendText("");

                    searchDocumentReturn searchDocumentReturn = new searchDocumentReturn();
                    searchDocumentFilter searchDocumentFilter = new searchDocumentFilter {
                        IDCATEGORY = categ
                    };
                    SEClient SeachDoc = Conection.GetConnection();
                    searchDocumentReturn = SeachDoc.searchDocument(searchDocumentFilter, null, null);

                    if (searchDocumentReturn.RESULTS.Count() > 0)
                    {
                        foreach (var item in (searchDocumentReturn.RESULTS))
                        {
                            documentDataReturn searchDocumentReturn2 = new documentDataReturn();
                            SEClient           SeachDoc2             = Conection.GetConnection();
                            searchDocumentReturn2 = SeachDoc2.viewDocumentData(item.IDDOCUMENT, "", "", "");

                            sendText("Pesquisando... " + item.IDDOCUMENT);

                            if (searchDocumentReturn2.ELECTRONICFILE.Count() == 0)
                            {
                                listBox1PSTsemDOC.Items.Add(item.IDDOCUMENT + " - " + item.NMTITLE);
                                cont++;
                            }
                        }
                        sendText("Total de Documentos: " + cont);
                    }
                }
                else
                {
                    MessageBox.Show("Digite a categoria !", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro: " + ex.Message, ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #4
0
 public static string DeletDocument(string IDCATEGORY, string IdDocumento)
 {
     try
     {
         //string caminho = "C:\Tecfy2SE-RH";
         SEClient SeachDoc = Conection.GetConnection();
         var      strijjj  = SeachDoc.downloadEletronicFile(IdDocumento, "", "", "", "", "", "", "");
         return("false");
     }
     catch (Exception ex)
     {
         var logpath = ConfigurationManager.AppSettings["PastaDestinoLog"].ToString();
         File.AppendAllText(logpath + @"\" + "log_Excluir_Documentos.txt", "\r\n" + DateTime.Now + @" | DeletDoc " + ex.Message.ToString() + @";");
         return("");
     }
 }
Пример #5
0
        public static string ValidMatricExistt(string IdentificadorDOC)
        {
            Boolean PesqPastaAluno = Convert.ToBoolean(ConfigurationManager.AppSettings["PesqPastaAluno"]);

            if (PesqPastaAluno == true)
            {
                try
                {
                    SEClient SeachDoc1 = Conection.GetConnection();

                    searchDocumentReturn searchDocumentReturnT1 = new searchDocumentReturn();
                    searchDocumentFilter searchDocumentFilterT1 = new searchDocumentFilter {
                        IDDOCUMENT = IdentificadorDOC
                    };
                    searchDocumentReturnT1 = SeachDoc1.searchDocument(searchDocumentFilterT1, "", null);
                    Pesq2 = 1;

                    if (searchDocumentReturnT1.RESULTS.Count() > 0)
                    {
                        return("yes");
                    }
                    else
                    {
                        return("NoExist");
                    }
                }
                catch (Exception ex)
                {
                    while (Pesq2 <= 2)
                    {
                        Pesq2++;
                        File.AppendAllText(logpath + @"\" + "log_erro.txt", "\r\n" + DateTime.Now + @" | ValidMatricExistt | " + @" Valida Matricula: " + IdentificadorDOC + @" - " + ex.Message.ToString() + @";");
                        Thread.Sleep(Convert.ToInt32(IntervalReturn));
                        return(ValidMatricExistt(IdentificadorDOC));
                    }
                    //File.AppendAllText(logpath + @"\" + "log_erro.txt", "\r\n" + DateTime.Now + @" | SeachDoc " + ex.Message.ToString() + @";");
                    return("NoConect");
                }
            }
            else
            {
                return("yes");
            }
        }
Пример #6
0
        public static void UpdateAtributos(string IDDoc, string idattribute, string vlattribute)
        {
            try
            {
                SEClient UpdateAtrib    = Conection.GetConnection();
                string   resUpdateAtrib = UpdateAtrib.setAttributeValue(IDDoc, "", idattribute, vlattribute);

                UpdateAtr = 1;
            }
            catch (Exception ex)
            {
                while (UpdateAtr <= 2)
                {
                    UpdateAtr++;
                    File.AppendAllText(logCriarPastaFuncionario + @"\" + "log_erro_CriarPastaFuncionario.txt", "\r\n" + DateTime.Now + @" |  UpdateAtributos " + ex.Message);
                    MessageBox.Show("UpdateAtributos" + ex.Message, ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Пример #7
0
        public static void UpdateTitulo(string IDCATEGORY, string IdDocumento, string titulo)
        {
            try
            {
                SEClient EditDoc    = Conection.GetConnection();
                string   resEditDoc = EditDoc.editDocument(IDCATEGORY, IdDocumento, "", "", titulo, "");
                UpdateTit = 1;
            }
            catch (Exception ex)
            {
                while (UpdateTit <= 2)
                {
                    UpdateTit++;

                    File.AppendAllText(logCriarPastaFuncionario + @"\" + "log_erro_CriarPastaFuncionario.txt", "\r\n" + DateTime.Now + @" | " + ex.Message);
                }
                MessageBox.Show(ex.Message, ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #8
0
        //#region BuscaMatricula
        //public static string ValidMatricExistt(string CategDoc, string VlAtribut, string CategPast)
        //{

        //    try
        //    {
        //        SEClient SeachDoc1 = Conection.GetConnection();

        //        searchDocumentReturn searchDocumentReturnT1 = new searchDocumentReturn();
        //        searchDocumentFilter searchDocumentFilterT1 = new searchDocumentFilter { IDCATEGORY = CategDoc };
        //        searchDocumentReturnT1 = SeachDoc1.searchDocument(searchDocumentFilterT1, "", null);

        //        if (searchDocumentReturnT1.RESULTS.Count() > 0)
        //        {
        //            foreach (var item in (searchDocumentReturnT1.RESULTS))
        //            {

        //                documentDataReturn documentDataReturn = new documentDataReturn();
        //                SEClient SeachDoc = Conection.GetConnection();
        //                documentDataReturn = SeachDoc.viewDocumentData(item.IDDOCUMENT, "", "", "");

        //                foreach (var item1 in (documentDataReturn.ATTRIBUTTES.Where(p => p.ATTRIBUTTENAME == VlAtribut)))
        //                {

        //                    var AtribuValue = item1.ATTRIBUTTEVALUE[0];

        //                    if (AtribuValue != null && AtribuValue != "")
        //                    {
        //                        var IDPasta = CategPast + "-" + AtribuValue;
        //                        AssociarDOCxPASTA(CategPast, IDPasta, CategDoc, item.IDDOCUMENT);
        //                    }
        //                    else
        //                    {
        //                        File.AppendAllText(logpath + @"\" + "log_Associação_erro.txt", "\r\n" + DateTime.Now + @" | ASSOCIAR DOCUMENTO: " + item.IDDOCUMENT + @" DOCUMENTO SEM VALOR NO ATRIBUTO: " + VlAtribut);
        //                    }

        //                }

        //            }
        //        }

        //        //Pesq2 = 1;

        //        //if (searchDocumentReturnT1.RESULTS.Count() > 0)
        //        //{
        //        //    return ("yes");
        //        //}
        //        //else
        //        //{
        //        return ("NoExist");
        //        //}

        //    }
        //    catch (Exception ex)
        //    {
        //        //while (Pesq2 <= 2)
        //        //{
        //        //    Pesq2++;
        //        //    File.AppendAllText(logpath + @"\" + "log_erro.txt", "\r\n" + DateTime.Now + @" | ValidMatricExistt | " + @" Valida Matricula: " + IdentificadorDOC + @" - " + ex.Message.ToString() + @";");
        //        //    Thread.Sleep(Convert.ToInt32());
        //        //    return ValidMatricExistt(IdentificadorDOC);
        //        //}
        //        ////File.AppendAllText(logpath + @"\" + "log_erro.txt", "\r\n" + DateTime.Now + @" | SeachDoc " + ex.Message.ToString() + @";");
        //        return ("NoConect");
        //    }

        //}
        //#endregion


        #region CREATEDOCCONTAINER
        public static string AssociarDOCxPASTA(string CategPast, string IDPasta, string CategDoc, string IDDocument)
        {
            try
            {
                var fileNameArray = Path.GetFileName(CategDoc).ToString().Split(new char[] { Convert.ToChar("-") });

                string StructID = fileNameArray[0];

                SEClient newDocContainerAss = Conection.GetConnection();
                string   resultadoAssocDoc  = newDocContainerAss.newDocumentContainerAssociation(CategPast, IDPasta, "", StructID, CategDoc, IDDocument, out long codeAssociation, out string detailAssociation);

                string RespAssoc = resultadoAssocDoc + "-" + detailAssociation;

                if (resultadoAssocDoc == "SUCCESS")
                {
                    File.AppendAllText(logAssociaçaoDocumento + @"\" + "log_Associação.txt", "\r\n" + DateTime.Now + @" | ASSOCIAR DOCUMENTO: " + IDDocument + @" A PASTA " + IDPasta + @" - " + RespAssoc + @";");
                }
                else if (RespAssoc.Contains("Documento já associado"))
                {
                    File.AppendAllText(logAssociaçaoDocumento + @"\" + "log_Documento já associado.txt", "\r\n" + DateTime.Now + @" | ASSOCIAR DOCUMENTO: " + IDDocument + @" A PASTA " + IDPasta + @" - " + detailAssociation + @";");
                }
                else if (RespAssoc.Contains("FAILURE"))
                {
                    File.AppendAllText(logAssociaçaoDocumento + @"\" + "log_Associação_erro.txt", "\r\n" + DateTime.Now + @" | ASSOCIAR DOCUMENTO: " + IDDocument + @" A PASTA " + IDPasta + @" - " + RespAssoc + @";");
                }
                IDAssoc = 1;

                return("");
            }
            catch (Exception ex)
            {
                while (IDAssoc <= 2)
                {
                    IDAssoc++;
                    File.AppendAllText(logAssociaçaoDocumento + @"\" + "log_Associação_erro.txt", "\r\n" + DateTime.Now + @" | AssociaDOC | " + ex.Message.ToString() + @";");
                    Thread.Sleep(5000);
                    return(AssociarDOCxPASTA(CategPast, IDPasta, CategDoc, IDDocument));
                }
                return("");
            }
        }
Пример #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                searchDocumentReturn searchDocumentReturn = new searchDocumentReturn();
                SEClient             SeachDoc             = Conection.GetConnection();

                searchDocumentFilter searchDocumentFilter = new searchDocumentFilter {
                    IDCATEGORY = "123"
                };
                searchDocumentReturn = SeachDoc.searchDocument(searchDocumentFilter, null, null);

                if (searchDocumentReturn.RESULTS.Count() >= 0)
                {
                    MessageBox.Show("Conexão testada com Sucesso!", ".:: Sucesso ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro " + ex.Message, "..:: Erro ::..", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #10
0
            public static string BuscarDoc(string Identificador)
            {
                if (Identificador == "")
                {
                    return("false");
                }

                documentDataReturn documentDataReturn = new documentDataReturn();

                SEClient SeachDoc = Conection.GetConnection();

                documentDataReturn = SeachDoc.viewDocumentData(Identificador, "", "", "");

                if (documentDataReturn.ERROR == null)
                {
                    return("verdadeiro");
                }
                else
                {
                    return("false");
                }
            }
Пример #11
0
        private void button4_Click(object sender, EventArgs e)
        {
            dateTimePicker1Inicio.Text = Convert.ToString(System.DateTime.Now.ToString("yyyy-MM-dd"));
            var inicio = "2020-06-19";


            var fim = dateTimePicker2Fim.Text;

            searchDocumentReturn searchDocumentReturn = new searchDocumentReturn();
            searchDocumentFilter searchDocumentFilter = new searchDocumentFilter {
                IDCATEGORY = textBox1CategDate.Text
            };
            SEClient SeachDoc = Conection.GetConnection();

            searchDocumentReturn = SeachDoc.searchDocument(searchDocumentFilter, null, null);

            foreach (var item in (searchDocumentReturn.RESULTS.Where(p => p.DTDOCUMENT == inicio && p.DTDOCUMENT == fim)))
            {
                var data = item.DTDOCUMENT;
                var id   = item.IDDOCUMENT;
                var nome = item.NMTITLE;
            }
        }
Пример #12
0
            public static string CriaDocContainerAssocia(string IDCATEGORY, string Retornocriar, string MatriculaPasta)
            {
                try
                {
                    string UpperLevelCategoryID = ConfigurationManager.AppSettings["CATEGORIADEASSOCIACAO"];
                    string StructID             = ConfigurationManager.AppSettings["CONTAINER"];

                    SEClient newDocContainerAss = Conection.GetConnection();
                    string   resultadoNewDoc    = newDocContainerAss.newDocumentContainerAssociation(UpperLevelCategoryID, MatriculaPasta, "", StructID, IDCATEGORY, Retornocriar, out long codeAssociation, out string detailAssociation);

                    if (resultadoNewDoc.Contains("SUCCESS"))
                    {
                        File.AppendAllText(logpath + @"\" + "log.txt", "\r\n" + DateTime.Now + @" | Vinculado: " + Retornocriar + @" ao " + MatriculaPasta + @" " + resultadoNewDoc.ToString() + @";");
                    }
                    else
                    {
                        File.AppendAllText(logpath + @"\" + "log_erro.txt", "\r\n" + DateTime.Now + @" | Vinculado: " + Retornocriar + @" ao " + MatriculaPasta + @" " + resultadoNewDoc.ToString() + @";");
                    }
                    iAssoc = 1;
                    return("");
                }
                catch (Exception ex)
                {
                    while (iAssoc <= 2)
                    {
                        iAssoc++;
                        File.AppendAllText(logpath + @"\" + "log_erro.txt", "\r\n" + DateTime.Now + @" | AssociacaoDoc " + @" | " + Retornocriar + @" ao " + MatriculaPasta + @" " + ex.Message.ToString() + @";");
                        Thread.Sleep(Convert.ToInt32(IntervalReturn));
                        return(CriaDocContainerAssocia(IDCATEGORY, Retornocriar, MatriculaPasta));
                    }
                    EnviaEmail(ex.Message.ToString(), "Erro na Associação");
                    //File.AppendAllText(logpath + @"\" + "log_erro.txt", "\r\n" + DateTime.Now + @" | AssociacaoDoc " + ex.Message.ToString() + @";");
                    iAssoc = 1;
                    return("");
                }
            }
Пример #13
0
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                int cont = 0;

                var categ = textBox1categ.Text.Replace(" ", "");

                if (categ != "" && categ != null)
                {
                    listBox1PSTsemDOC.Items.Clear();
                    sendText2("");

                    searchDocumentReturn searchDocumentReturn = new searchDocumentReturn();
                    searchDocumentFilter searchDocumentFilter = new searchDocumentFilter {
                        IDCATEGORY = categ
                    };
                    SEClient SeachDoc = Conection.GetConnection();
                    searchDocumentReturn = SeachDoc.searchDocument(searchDocumentFilter, null, null);

                    if (searchDocumentReturn.RESULTS.Count() > 0)
                    {
                        foreach (var item in (searchDocumentReturn.RESULTS))
                        {
                            //documentDataReturn searchDocumentReturn2 = new documentDataReturn();
                            //SEClient SeachDoc2 = Conection.GetConnection();
                            searchDocumentReturn2 = SeachDoc2.viewDocumentData(item.IDDOCUMENT, "", "", "");

                            sendText2("Pesquisando... " + item.IDDOCUMENT);

                            if (searchDocumentReturn2.ELECTRONICFILE.Count() == 0)
                            {
                                listBox1PSTsemDOC.Items.Add(item.IDDOCUMENT + " - " + item.NMTITLE);
                                cont++;
                            }
                        }
                        sendText2("Total de Documentos: " + cont);

                        if (cont > 0)
                        {
                            DialogResult dr = MessageBox.Show("Deseja realmente excluir? ", "..:: Atenção ::..", MessageBoxButtons.YesNo);

                            switch (dr)
                            {
                            case DialogResult.No:
                                break;

                            case DialogResult.Yes:

                                foreach (var item in (searchDocumentReturn.RESULTS))
                                {
                                    searchDocumentReturn2 = SeachDoc2.viewDocumentData(item.IDDOCUMENT, "", "", "");

                                    if (searchDocumentReturn2.ELECTRONICFILE.Count() == 0)
                                    {
                                        sendText3("Excluindo... " + searchDocumentReturn2.IDDOCUMENT + " - " + searchDocumentReturn2.NMTITLE);
                                        var RetornDelete = DeleteDocument.DeletDocument(searchDocumentReturn2.IDCATEGORY, searchDocumentReturn2.IDDOCUMENT);
                                    }
                                }
                                break;
                            }
                            MessageBox.Show("Finalizado Exclusão!", ".:: Alerta ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            sendText3("");
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Digite a categoria !", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro: " + ex.Message, ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #14
0
            public static string ImportarDoc(string Identificador, string item)
            {
                string nome = Path.GetFileName(item);

                try
                {
                    byte[]          fileBinary = File.ReadAllBytes(item);
                    eletronicFile[] Arquivo    = new eletronicFile[1];
                    Arquivo[0] = new eletronicFile
                    {
                        BINFILE   = fileBinary,
                        ERROR     = "",
                        CONTAINER = "",
                        NMFILE    = nome
                    };
                    #region TST
                    SEClient seClient = Conection.GetConnection();

                    if (fileBinary.Length > 20000000)
                    {
                        string IntervalTimeout = ConfigurationManager.AppSettings["IntervalTimeout"];

                        seClient.Timeout = (Convert.ToInt32(IntervalTimeout));
                    }
                    #endregion
                    string resultado = seClient.uploadEletronicFile(Identificador, "", "", Arquivo);
                    Thread.Sleep(1000);

                    if (resultado[0].ToString().Contains("0"))
                    {
                        File.AppendAllText(logpath + @"\" + "log_erro.txt", "\r\n" + DateTime.Now + @" | " + nome + @" | " + resultado.Substring(3).ToString() + @";");

                        if (File.Exists(PastaArquivos + "\\" + Path.GetFileName(item)))
                        {
                            File.Delete(PastaArquivos + "\\" + Path.GetFileName(item));
                        }
                        File.Move(item, string.Concat(PastaArquivos, "\\", Path.GetFileName(item)));

                        EnviaEmail(resultado.Substring(3).ToString(), nome);
                        return("false");
                    }
                    else
                    {
                        File.AppendAllText(logpath + @"\" + "log.txt", "\r\n" + DateTime.Now + @" | " + nome + @" | Importação: " + Identificador + @" - " + resultado.Substring(3).ToString() + @";");
                    }
                    iImport = 1;
                    return(Identificador);
                }
                catch (Exception ex)
                {
                    while (iImport <= 2)
                    {
                        iImport++;
                        File.AppendAllText(logpath + @"\" + "log_erro.txt", "\r\n" + DateTime.Now + @" | ImportarDoc " + @" | " + nome + @" | " + ex.Message.ToString() + @";");
                        Thread.Sleep(Convert.ToInt32(IntervalReturn));
                        return(ImportarDoc(Identificador, item));
                    }

                    //File.AppendAllText(logpath + @"\" + "log_erro.txt", "\r\n" + DateTime.Now + @" | ImportarDoc " + ex.Message.ToString() + @";");

                    if (File.Exists(PastaArquivos + "\\" + Path.GetFileName(item)))
                    {
                        File.Delete(PastaArquivos + "\\" + Path.GetFileName(item));
                    }
                    File.Move(item, string.Concat(PastaArquivos, "\\", Path.GetFileName(item)));
                    EnviaEmail(ex.Message.ToString(), nome);
                    iImport = 1;
                    return("false");
                }
            }
Пример #15
0
            public static string CriarDoc(string Identificador, string IDCATEGORY, string Titulo, string IDUSER, string PosAtr1, string PosAtr2, string PosAtr3, string PosAtr4, string PosAtr5, string PosAtr6, string PosAtr7, string PosAtr8, string PosAtr9, string PosAtr10, string item)
            {
                string nome = Path.GetFileName(item);

                try
                {
                    //NAME_ATRIBUTE
                    //var AtributoCPF = ConfigurationManager.AppSettings["AtributoCPF"];
                    var Atributo1  = ConfigurationManager.AppSettings["Atributo1"];
                    var Atributo2  = ConfigurationManager.AppSettings["Atributo2"];
                    var Atributo3  = ConfigurationManager.AppSettings["Atributo3"];
                    var Atributo4  = ConfigurationManager.AppSettings["Atributo4"];
                    var Atributo5  = ConfigurationManager.AppSettings["Atributo5"];
                    var Atributo6  = ConfigurationManager.AppSettings["Atributo6"];
                    var Atributo7  = ConfigurationManager.AppSettings["Atributo7"];
                    var Atributo8  = ConfigurationManager.AppSettings["Atributo8"];
                    var Atributo9  = ConfigurationManager.AppSettings["Atributo9"];
                    var Atributo10 = ConfigurationManager.AppSettings["Atributo10"];
                    var DSRESUME   = ConfigurationManager.AppSettings["DSRESUME"];


                    //ATRIBUTE_VALORES_FIXO
                    var V_Atributo1  = ConfigurationManager.AppSettings["V_Atributo1"];
                    var V_Atributo2  = ConfigurationManager.AppSettings["V_Atributo2"];
                    var V_Atributo3  = ConfigurationManager.AppSettings["V_Atributo3"];
                    var V_Atributo4  = ConfigurationManager.AppSettings["V_Atributo4"];
                    var V_Atributo5  = ConfigurationManager.AppSettings["V_Atributo5"];
                    var V_Atributo6  = ConfigurationManager.AppSettings["V_Atributo6"];
                    var V_Atributo7  = ConfigurationManager.AppSettings["V_Atributo7"];
                    var V_Atributo8  = ConfigurationManager.AppSettings["V_Atributo8"];
                    var V_Atributo9  = ConfigurationManager.AppSettings["V_Atributo9"];
                    var V_Atributo10 = ConfigurationManager.AppSettings["V_Atributo10"];
                    var IDUSERFIXED  = ConfigurationManager.AppSettings["IDUSERFIXED"];

                    if (IDUSER == "")
                    {
                        IDUSER = IDUSERFIXED;
                    }

                    string FormatoData = ConfigurationManager.AppSettings["FormatoData"];
                    string DTDOCUMENT  = Convert.ToString(System.DateTime.Now.ToString(FormatoData));

                    //string STEP = ConfigurationManager.AppSettings["STEP"];


                    int FGMODEL = 1;


                    //if (Atributo1 != "")
                    //{
                    //    PosAtr1 = Convert.ToUInt64(PosAtr1).ToString(@"000\.000\.000\-00");
                    //}
                    //Atributo6 = "";

                    //string PosAtrAJust = PosAtr1;
                    //Atributo6 = "";
                    //PosAtr6 = "";

                    //participantsData[] participantsData = new participantsData[1];
                    //participantsData[0] = new participantsData
                    //{
                    //    STEP = STEP,

                    //};



                    string StrAtribut = (Atributo1 + "=" + PosAtr1 + "" + V_Atributo1 + ";"
                                         + Atributo2 + "=" + PosAtr2 + "" + V_Atributo2 + ";"
                                         + Atributo3 + "=" + PosAtr3 + "" + V_Atributo3 + ";"
                                         + Atributo4 + "=" + PosAtr4 + "" + V_Atributo4 + ";"
                                         + Atributo5 + "=" + PosAtr5 + "" + V_Atributo5 + ";"
                                         + Atributo6 + "=" + PosAtr6 + "" + V_Atributo6 + ";"
                                         + Atributo7 + "=" + PosAtr7 + "" + V_Atributo7 + ";"
                                         + Atributo8 + "=" + PosAtr8 + "" + V_Atributo8 + ";"
                                         + Atributo9 + "=" + PosAtr9 + "" + V_Atributo9 + ";"
                                         + Atributo10 + "=" + PosAtr10 + "" + V_Atributo10 + ";"
                                         );

                    //string Titulo1 = Titulo + " - " + PosAtr2 + "-" + PosAtr3;

                    string ATTRIBUTTES = StrAtribut.Replace("=;=;=;=;=", "").Replace("=;", "").Replace("=;=", "").Replace("=;=;=", "").Replace("=;=;=;=", "");

                    SEClient newDoc          = Conection.GetConnection();
                    var      resultadoNewDoc = newDoc.newDocument(IDCATEGORY, Identificador, Titulo, DSRESUME, DTDOCUMENT, ATTRIBUTTES, IDUSER, null, FGMODEL, null);

                    Thread.Sleep(1000);

                    if (Identificador == "")
                    {
                        Identificador = resultadoNewDoc.Substring(3).Replace(": Documento criado com sucesso", "");
                    }

                    if (resultadoNewDoc[0].ToString().Contains("0"))
                    {
                        File.AppendAllText(logpath + @"\" + "log_erro.txt", "\r\n" + DateTime.Now + @" | " + nome + @" | " + resultadoNewDoc.Substring(3).ToString() + @";");

                        if (File.Exists(PastaArquivos + "\\" + Path.GetFileName(item)))
                        {
                            File.Delete(PastaArquivos + "\\" + Path.GetFileName(item));
                        }
                        File.Move(item, string.Concat(PastaArquivos, "\\", Path.GetFileName(item)));

                        EnviaEmail(resultadoNewDoc.Substring(3), nome);

                        return("false");
                    }
                    else
                    {
                        File.AppendAllText(logpath + @"\" + "log.txt", "\r\n" + DateTime.Now + @" | " + nome + @" | " + resultadoNewDoc.Substring(3).ToString() + @";");
                    }
                    iCriar = 1;
                    return(Identificador);
                }
                catch (Exception ex)
                {
                    while (iCriar <= 2)
                    {
                        iCriar++;
                        File.AppendAllText(logpath + @"\" + "log_erro.txt", "\r\n" + DateTime.Now + @" | CriarDoc " + @" | " + nome + @" | " + ex.Message.ToString() + @";");
                        Thread.Sleep(Convert.ToInt32(IntervalReturn));
                        return(CriarDoc(Identificador, IDCATEGORY, Titulo, IDUSER, PosAtr1, PosAtr2, PosAtr3, PosAtr4, PosAtr5, PosAtr6, PosAtr7, PosAtr8, PosAtr9, PosAtr10, item));
                    }
                    //File.AppendAllText(logpath + @"\" + "log_erro.txt", "\r\n" + DateTime.Now + @" | CriarDoc " + ex.Message.ToString() + @";");

                    if (File.Exists(PastaArquivos + "\\" + Path.GetFileName(item)))
                    {
                        File.Delete(PastaArquivos + "\\" + Path.GetFileName(item));
                        EnviaEmail(ex.Message.ToString(), nome);
                    }
                    File.Move(item, string.Concat(PastaArquivos, "\\", Path.GetFileName(item)));
                    EnviaEmail(ex.Message.ToString(), nome);
                    iCriar = 1;
                    return("false");
                }
            }
Пример #16
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists(logAssociaçaoDocumento))
            {
                Directory.CreateDirectory(logAssociaçaoDocumento);
            }

            //string AssociaçaoDocumento = "";
            //string CategPast = textBox1CategPast.Text;
            //string CategDoc = textBox3CategDoc.Text;
            //string AtribDoc = textBox2AtribDoc.Text;

            //string ReturnBusc = ValidMatricExistt(CategDoc, AtribDoc, CategPast);
            try
            {
                string CategPast = textBox1CategPast.Text;
                string CategDoc  = textBox3CategDoc.Text;
                string AtribDoc  = textBox2AtribDoc.Text;

                SEClient SeachDoc1 = Conection.GetConnection();

                searchDocumentReturn searchDocumentReturnT1 = new searchDocumentReturn();
                searchDocumentFilter searchDocumentFilterT1 = new searchDocumentFilter {
                    IDCATEGORY = CategDoc
                };
                searchDocumentReturnT1 = SeachDoc1.searchDocument(searchDocumentFilterT1, "", null);

                if (searchDocumentReturnT1.RESULTS.Count() > 0)
                {
                    foreach (var item in (searchDocumentReturnT1.RESULTS))
                    {
                        documentDataReturn documentDataReturn = new documentDataReturn();
                        SEClient           SeachDoc           = Conection.GetConnection();
                        documentDataReturn = SeachDoc.viewDocumentData(item.IDDOCUMENT, "", "", "");

                        foreach (var item1 in (documentDataReturn.ATTRIBUTTES.Where(p => p.ATTRIBUTTENAME == AtribDoc)))
                        {
                            var AtribuValue = item1.ATTRIBUTTEVALUE[0];

                            if (AtribuValue != null && AtribuValue != "")
                            {
                                string IDPasta = "";

                                if (travaAssocCategMatric == "yes")
                                {
                                    IDPasta = AtribuValue;
                                }
                                else
                                {
                                    IDPasta = CategPast + "-" + AtribuValue;
                                }

                                texto = @"Verificando associação... Documento: " + item.IDDOCUMENT + @"  Pasta: " + IDPasta;
                                sendText(texto);

                                AssociarDOCxPASTA(CategPast, IDPasta, CategDoc, item.IDDOCUMENT);
                            }
                            else
                            {
                                File.AppendAllText(logAssociaçaoDocumento + @"\" + "log_Associação_erro.txt", "\r\n" + DateTime.Now + @" | ASSOCIAR DOCUMENTO: " + item.IDDOCUMENT + @" DOCUMENTO SEM VALOR NO ATRIBUTO: " + AtribDoc);
                            }
                        }
                        //MessageBox.Show("Atributo Documento: " + AtribDoc + " não confere", ".:: Alerta ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        //break;
                    }
                }
                MessageBox.Show("Verificação concluida!", ".:: Alerta ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                sendText("");
            }
            catch (Exception ex)
            {
                File.AppendAllText(logAssociaçaoDocumento + @"\" + "log_Associação_erro.txt", "\r\n" + DateTime.Now + @" | AssociaçãoDoc " + ex.Message.ToString() + @";");
                MessageBox.Show("Erro " + ex.Message.ToString(), ".:: Alerta ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Пример #17
0
        public static string CreateFolder(string matricula, string nome, string ColunaC_Empresa, 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, string Indice)
        {
            try
            {
                #region DadosXML
                var ColunaA_MatriculaPasta = "";
                var AttributeNome          = "";
                var AttributeEmpresa       = "";
                var vColunaD = "";
                var AttributeDtdesligamento = "";
                var vColunaF = "";
                var vColunaG = "";
                var vColunaH = "";
                var vColunaI = "";
                var vColunaJ = "";

                var vColunaK = "";
                var vColunaL = "";
                var vColunaM = "";
                var vColunaN = "";
                var vColunaO = "";
                var vColunaP = "";

                string IDCATEGORY  = "";
                string IDUSER      = "";
                string FormatoData = "";
                string EditAtrib   = "";


                XDocument doc   = XDocument.Load((CaminhoDadosXML(caminho) + @"System.net.cnfg.xml"));
                var       prods = from p in doc.Descendants("Config")
                                  select new
                {
                    ColunaA_MatriculaPasta = p.Element("ColunaA_MatriculaPasta").Value,
                    ColunaB_Nome           = p.Element("ColunaB_Nome").Value,
                    ColunaC_Empresa        = p.Element("ColunaC_Empresa").Value,
                    ColunaD_Dtadmissao     = p.Element("ColunaD_Dtadmissao").Value,
                    ColunaE_Dtdesligamento = p.Element("ColunaE_Dtdesligamento").Value,
                    ColunaF = p.Element("ColunaF").Value,
                    ColunaG = p.Element("ColunaG").Value,
                    ColunaH = p.Element("ColunaH").Value,
                    ColunaI = p.Element("ColunaI").Value,
                    ColunaJ = p.Element("ColunaJ").Value,
                    ColunaK = p.Element("ColunaK").Value,
                    ColunaL = p.Element("ColunaL").Value,
                    ColunaM = p.Element("ColunaM").Value,
                    ColunaN = p.Element("ColunaN").Value,
                    ColunaO = p.Element("ColunaO").Value,
                    ColunaP = p.Element("ColunaP").Value,

                    IDCategoriaPasta  = p.Element("IDCategoriaPasta").Value,
                    Categorychecklist = p.Element("Categorychecklist").Value,

                    StructPendenteID = p.Element("StructPendenteID").Value,
                    DigitosStructID  = p.Element("DigitosStructID").Value,

                    IdUsuario      = p.Element("IdUsuario").Value,
                    EditarCadastro = p.Element("EditarCadastro").Value,
                    FormatoData    = p.Element("FormatoData").Value,
                };

                foreach (var p in prods)
                {
                    ColunaA_MatriculaPasta = p.ColunaA_MatriculaPasta;
                    AttributeNome          = p.ColunaB_Nome;
                    AttributeEmpresa       = p.ColunaC_Empresa;
                    vColunaD = p.ColunaD_Dtadmissao;
                    AttributeDtdesligamento = p.ColunaE_Dtdesligamento;
                    vColunaF    = p.ColunaF;
                    vColunaG    = p.ColunaG;
                    vColunaH    = p.ColunaH;
                    vColunaI    = p.ColunaI;
                    vColunaJ    = p.ColunaJ;
                    vColunaK    = p.ColunaK;
                    vColunaL    = p.ColunaL;
                    vColunaM    = p.ColunaM;
                    vColunaN    = p.ColunaN;
                    vColunaO    = p.ColunaO;
                    vColunaP    = p.ColunaP;
                    IDCATEGORY  = p.IDCategoriaPasta;
                    IDUSER      = p.IdUsuario;
                    FormatoData = p.FormatoData;
                    EditAtrib   = p.EditarCadastro;
                }
                #endregion

                string DTDOCUMENT = Convert.ToString(System.DateTime.Now.ToString(FormatoData));

                string StrAtribut = (ColunaA_MatriculaPasta + "=" + matricula + ";"
                                     + AttributeNome + "=" + nome + ";"
                                     + AttributeEmpresa + "=" + ColunaC_Empresa + ";"
                                     + vColunaD + "=" + ColunaD + ";"
                                     + AttributeDtdesligamento + "=" + ColunaE_Dtdesligamento + ";"
                                     + vColunaF + "=" + ColunaF + ";"
                                     + vColunaG + "=" + ColunaG + ";"
                                     + vColunaH + "=" + ColunaH + ";"
                                     + vColunaI + "=" + ColunaI + ";"
                                     + vColunaJ + "=" + ColunaJ + ";"
                                     + vColunaK + "=" + ColunaK + ";"
                                     + vColunaL + "=" + ColunaL + ";"
                                     + vColunaM + "=" + ColunaM + ";"
                                     + vColunaN + "=" + ColunaN + ";"
                                     + vColunaO + "=" + ColunaO + ";"
                                     + vColunaP + "=" + ColunaP);

                string ATTRIBUTTES = StrAtribut.Replace("=;=;=;=;=", "").Replace(";=", "").Replace("=;=", "").Replace("=;=;=", "").Replace("=;=;=;=", "");


                int FGMODEL = 1;

                string Cat_Indice = IDCATEGORY + "-" + Indice;

                SEClient newFolder       = Conection.GetConnection();
                string   resultadoNewDoc = newFolder.newDocument(IDCATEGORY, Cat_Indice, "", "", DTDOCUMENT, ATTRIBUTTES, IDUSER, null, FGMODEL, null);

                IDCriate = 1;
                string strID = "";

                if (resultadoNewDoc.ToString().Substring(0, 2).Contains("0:"))
                {
                    //File.AppendAllText(logCriarPastaFuncionario + @"\" + "log_CriarPastaFuncionario.txt", "\r\n" + DateTime.Now + @" | " + matricula + @" | " + nome + @" | " + resultadoNewDoc.Substring(3).ToString() + @";");
                    File.AppendAllText(logCriarPastaFuncionario + @"\" + "log_erro_CriarPastaFuncionario.txt", "\r\n" + DateTime.Now + @" | " + matricula + @" | " + nome + @" | " + resultadoNewDoc.Substring(3).ToString() + @";");
                    //
                    if (EditAtrib == "Sim")
                    {
                        if (resultadoNewDoc.ToString().Contains("0: Identificador já existente.."))
                        {
                            string[] edd         = resultadoNewDoc.ToString().Split(new char[] { Convert.ToChar("[") });
                            string   idmatricula = edd[1].Replace("]", "");

                            foreach (var item in (ATTRIBUTTES.ToString().Split(new char[] { Convert.ToChar(";") })))
                            {
                                if (item == "")
                                {
                                    break;
                                }

                                string[] strNome = item.ToString().Split(new char[] { Convert.ToChar("=") });

                                string idattribute = strNome[0];
                                string vlattribute = strNome[1];
                                UpdateAtributos(idmatricula, idattribute, vlattribute);
                            }
                            UpdateTitulo(IDCATEGORY, idmatricula, nome);
                            File.AppendAllText(logCriarPastaFuncionario + @"\" + "log_CriarPastaFuncionario.txt", "\r\n" + DateTime.Now + @" | Atualizado dados no cadastro da Matricula " + idmatricula + @";");

                            return("false");
                        }
                    }

                    //File.AppendAllText(logpath + @"\" + "log.txt", "\r\n" + DateTime.Now + @" | " + matricula + @" | " + nome + @" | " + resultadoNewDoc.Substring(3).ToString() + @";");
                    MessageBox.Show(matricula + @" | " + nome + @" | " + resultadoNewDoc.Substring(3).ToString(), ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return("false");
                }
                else
                {
                    strID = resultadoNewDoc.Substring(3).Replace(": Documento criado com sucesso", "");
                    File.AppendAllText(logCriarPastaFuncionario + @"\" + "log_CriarPastaFuncionario.txt", "\r\n" + DateTime.Now + @" | " + matricula + @" | " + nome + @" | " + resultadoNewDoc.Substring(3).ToString().Replace("Documento", "Pasta") + @";");
                }


                return(strID);
            }
            catch (Exception ex)
            {
                while (IDCriate <= 2)
                {
                    IDCriate++;
                    File.AppendAllText(logCriarPastaFuncionario + @"\" + "log_erro_CriarPastaFuncionario.txt", "\r\n" + DateTime.Now + @" | CriarPastaDoc | " + ex.Message.ToString() + @";");
                    Thread.Sleep(Convert.ToInt32(7000));
                    return(CreateFolder(matricula, nome, ColunaC_Empresa, ColunaD, ColunaE_Dtdesligamento, ColunaF, ColunaG, ColunaH, ColunaI, ColunaJ, ColunaK, ColunaL, ColunaM, ColunaN, ColunaO, ColunaP, Indice));
                }
                return("false");
            }
            #endregion
        }
Пример #18
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!Directory.Exists(logExcluirDocumentos))
            {
                Directory.CreateDirectory(logExcluirDocumentos);
            }


            //Variaveis
            searchDocumentReturn searchDocumentReturn = new searchDocumentReturn();
            SEClient             SeachDoc             = Conection.GetConnection();
            var texto     = "";
            var CampoText = textBoxCateg.Text.Replace(" ", "");

            if (Categoria.Checked)
            {
                try
                {
                    listBox1DelDoc.Visible = true;
                    listBox1DelDoc.Items.Clear();

                    if (CampoText != "" && CampoText != null)
                    {
                        searchDocumentFilter searchDocumentFilter = new searchDocumentFilter {
                            IDCATEGORY = CampoText
                        };
                        searchDocumentReturn = SeachDoc.searchDocument(searchDocumentFilter, null, null);

                        foreach (var item in (searchDocumentReturn.RESULTS))
                        {
                            listBox1DelDoc.Items.Add(item.IDDOCUMENT + " - " + item.NMTITLE);
                        }
                        int total = searchDocumentReturn.RESULTS.Count();

                        DialogResult dr = MessageBox.Show("Total de arquivos " + total + ", Deseja realmente excluir? ", "..:: Atenção ::..", MessageBoxButtons.YesNo);
                        switch (dr)
                        {
                        case DialogResult.No:
                            break;


                        case DialogResult.Yes:
                            if (searchDocumentReturn.RESULTS.Count() > 0)
                            {
                                foreach (var item in (searchDocumentReturn.RESULTS))
                                {
                                    texto = @"Total de Registros: " + total + " Excluindo ... " + item.IDDOCUMENT;
                                    sendText(texto);

                                    string RetornDelete = DeleteDocument.DeletDocument(CampoText, item.IDDOCUMENT);
                                    total = total - 1;
                                }

                                MessageBox.Show("Concluido!", ".:: Alerta ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                textBoxCateg.Text = "";
                                sendText("");
                            }
                            else
                            {
                                MessageBox.Show("Sem registro para excluir! \n ou \n Categoria Digitado errado", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                return;
                            }
                            break;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Categoria não digitada!", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
                catch (Exception ex)
                {
                    File.AppendAllText(logExcluirDocumentos + @"\" + "log_erro_ExcluirDocumentos.txt", "\r\n" + DateTime.Now + @" |" + ex.Message.ToString() + @";");
                    MessageBox.Show(ex.Message, ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else if (Matricula.Checked)
            {
                if (CampoText != "" && CampoText != null)
                {
                    try
                    {
                        listBox1DelDoc.Visible = true;
                        listBox1DelDoc.Items.Clear();

                        var fileNameArray = Path.GetFileName(CampoText).ToString().Split(new char[] { Convert.ToChar(",") });

                        documentDataReturn documentDataReturn = new documentDataReturn();

                        foreach (var item in (fileNameArray))
                        {
                            documentDataReturn = SeachDoc.viewDocumentData(item, "", "", "");
                            listBox1DelDoc.Items.Add(documentDataReturn.IDDOCUMENT + " - " + documentDataReturn.NMTITLE);
                        }

                        if (documentDataReturn.IDDOCUMENT != "" && documentDataReturn.IDDOCUMENT != null)
                        {
                            DialogResult dr = MessageBox.Show("Deseja realmente excluir? ", "..:: Atenção ::..", MessageBoxButtons.YesNo);

                            switch (dr)
                            {
                            case DialogResult.No:
                                break;

                            case DialogResult.Yes:


                                foreach (var item in (fileNameArray))
                                {
                                    var IdDoc = documentDataReturn.IDDOCUMENT;
                                    var IdCat = documentDataReturn.IDCATEGORY;

                                    texto = @" Excluindo ... " + IdDoc + @" - " + documentDataReturn.NMTITLE;
                                    sendText(texto);

                                    string RetornDelete = DeleteDocument.DeletDocument(IdCat, item);
                                    sendText("");
                                }
                                MessageBox.Show("Concluido!", ".:: Alerta ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);

                                break;
                            }

                            listBox1DelDoc.Items.Clear();
                            ////if (RetornDelete == true) {
                            //    MessageBox.Show("Concluido!", ".:: Alerta ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            ////}
                        }
                        else
                        {
                            listBox1DelDoc.Visible = false;
                            MessageBox.Show("\n Sem registro para Excluir! \n ou \n Registro Digitado errado!", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        File.AppendAllText(logExcluirDocumentos + @"\" + "log_erro_ExcluirDocumentos.txt", "\r\n" + DateTime.Now + @" |" + ex.Message.ToString() + @";");
                        MessageBox.Show(ex.Message, ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("Registro não digitado!", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
            }
        }
Пример #19
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");
            }
        }
Пример #20
0
        private void button1_Click(object sender, EventArgs e)
        {
            var matrORcat = RecMatricula.Text.Replace(" ", "");

            if (CheckMatricula.Checked)
            {
                try
                {
                    //DeletDocument(Matricula);

                    if (matrORcat != "" && matrORcat != null)
                    {
                        //listBoxLista.Visible = true;
                        listBoxLista.Items.Clear();
                        labelList.Text = "";

                        documentDataReturn searchDocumentReturn2 = new documentDataReturn();
                        SEClient           SeachDoc2             = Conection.GetConnection();
                        searchDocumentReturn2 = SeachDoc2.viewDocumentData(matrORcat, "", "", "");


                        if (searchDocumentReturn2.IDDOCUMENT != null && searchDocumentReturn2.IDDOCUMENT != "")
                        {
                            listBoxLista.Visible = true;
                            labelList.Text       = ("MATRICULA:  " + searchDocumentReturn2.IDDOCUMENT + "\r" +
                                                    "NOME:  " + searchDocumentReturn2.NMTITLE + "\r" +
                                                    "CATEGORIA:  " + searchDocumentReturn2.IDCATEGORY + " - " + searchDocumentReturn2.NMCATEGORY + "\r" +
                                                    "DATA DE CRIAÇÃO:  " + searchDocumentReturn2.DTDOCUMENT + "\r" +
                                                    ".. :: Atributos::.. ");

                            foreach (var item in (searchDocumentReturn2.ATTRIBUTTES))
                            {
                                if (item.ATTRIBUTTEVALUE.Count() <= 0)
                                {
                                    item.ATTRIBUTTEVALUE = null;
                                    listBoxLista.Items.Add(item.ATTRIBUTTENAME + " = " + "");
                                }
                                else
                                {
                                    listBoxLista.Items.Add(item.ATTRIBUTTENAME + " = " + item.ATTRIBUTTEVALUE[0]);
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("Documento não localizado !", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Digite a matricula !", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Erro :" + ex.Message, ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else if (Categoria.Checked)
            {
                try
                {
                    if (matrORcat != "" && matrORcat != null)
                    {
                        listBoxLista.Visible = true;
                        listBoxLista.Items.Clear();

                        searchDocumentReturn searchDocumentReturn = new searchDocumentReturn();
                        searchDocumentFilter searchDocumentFilter = new searchDocumentFilter {
                            IDCATEGORY = matrORcat
                        };
                        SEClient SeachDoc = Conection.GetConnection();
                        searchDocumentReturn = SeachDoc.searchDocument(searchDocumentFilter, null, null);

                        labelList.Text = "Total de Documentos: " + Convert.ToString(searchDocumentReturn.RESULTS.Count());

                        if (searchDocumentReturn.RESULTS.Count() > 0)
                        {
                            foreach (var item in (searchDocumentReturn.RESULTS))
                            {
                                listBoxLista.Items.Add(item.IDDOCUMENT + " - " + item.NMTITLE);
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Digite a categoria !", ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Erro: " + ex.Message, ".:: Atenção ::.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Пример #21
0
        public static string CriarDoc(string CategoryID, string matricula, string Indice, string ColunaA, string ColunaB, string ColunaC_Empresa, 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
            {
                var AttributeSituacaodoc       = "";
                var Valor_AttributeSituacaodoc = "";

                var AttributeMatriculaDoc = "";
                var V_Atributo2           = matricula;

                var    user        = "";
                string FormatoData = "";

                #region DadosXML

                string AtribDocColunaA = "";
                string AtribDocColunaB = "";
                string AtribDocColunaC = "";
                string AtribDocColunaD = "";
                string AtribDocColunaE = "";
                string AtribDocColunaF = "";
                string AtribDocColunaG = "";
                string AtribDocColunaH = "";
                string AtribDocColunaI = "";
                string AtribDocColunaJ = "";
                string AtribDocColunaK = "";
                string AtribDocColunaL = "";
                string AtribDocColunaM = "";
                string AtribDocColunaN = "";
                string AtribDocColunaO = "";
                string AtribDocColunaP = "";

                XDocument doc   = XDocument.Load((CaminhoDadosXML(caminho) + @"System.net.cnfg.xml"));
                var       prods = from p in doc.Descendants("Config")
                                  select new
                {
                    AttributeMatriculaDoc      = p.Element("AttributeMatriculaDoc").Value,
                    AttributeSituacaodoc       = p.Element("AttributeSituacaodoc").Value,
                    Valor_AttributeSituacaodoc = p.Element("Valor_AttributeSituacaodoc").Value,
                    IdUsuario       = p.Element("IdUsuario").Value,
                    FormatoData     = p.Element("FormatoData").Value,
                    AtribDocColunaA = p.Element("AtribDocColunaA").Value,
                    AtribDocColunaB = p.Element("AtribDocColunaB").Value,
                    AtribDocColunaC = p.Element("AtribDocColunaC").Value,
                    AtribDocColunaD = p.Element("AtribDocColunaD").Value,
                    AtribDocColunaE = p.Element("AtribDocColunaE").Value,
                    AtribDocColunaF = p.Element("AtribDocColunaF").Value,
                    AtribDocColunaG = p.Element("AtribDocColunaG").Value,
                    AtribDocColunaH = p.Element("AtribDocColunaH").Value,
                    AtribDocColunaI = p.Element("AtribDocColunaI").Value,
                    AtribDocColunaJ = p.Element("AtribDocColunaJ").Value,
                    AtribDocColunaK = p.Element("AtribDocColunaK").Value,
                    AtribDocColunaL = p.Element("AtribDocColunaL").Value,
                    AtribDocColunaM = p.Element("AtribDocColunaM").Value,
                    AtribDocColunaN = p.Element("AtribDocColunaN").Value,
                    AtribDocColunaO = p.Element("AtribDocColunaO").Value,
                    AtribDocColunaP = p.Element("AtribDocColunaP").Value,
                };

                foreach (var p in prods)
                {
                    AttributeSituacaodoc       = p.AttributeSituacaodoc;
                    Valor_AttributeSituacaodoc = p.Valor_AttributeSituacaodoc;
                    AttributeMatriculaDoc      = p.AttributeMatriculaDoc;
                    user            = p.IdUsuario;
                    FormatoData     = p.FormatoData;
                    AtribDocColunaA = p.AtribDocColunaA;
                    AtribDocColunaB = p.AtribDocColunaB;
                    AtribDocColunaC = p.AtribDocColunaC;
                    AtribDocColunaD = p.AtribDocColunaD;
                    AtribDocColunaE = p.AtribDocColunaE;
                    AtribDocColunaF = p.AtribDocColunaF;
                    AtribDocColunaG = p.AtribDocColunaG;
                    AtribDocColunaH = p.AtribDocColunaH;
                    AtribDocColunaI = p.AtribDocColunaI;
                    AtribDocColunaJ = p.AtribDocColunaJ;
                    AtribDocColunaK = p.AtribDocColunaK;
                    AtribDocColunaL = p.AtribDocColunaL;
                    AtribDocColunaM = p.AtribDocColunaM;
                    AtribDocColunaN = p.AtribDocColunaN;
                    AtribDocColunaO = p.AtribDocColunaO;
                    AtribDocColunaP = p.AtribDocColunaP;

                    if (AtribDocColunaA == "")
                    {
                        ColunaA = "";
                    }
                    if (AtribDocColunaB == "")
                    {
                        ColunaB = "";
                    }
                    if (AtribDocColunaC == "")
                    {
                        ColunaC_Empresa = "";
                    }
                    if (AtribDocColunaD == "")
                    {
                        ColunaD = "";
                    }
                    if (AtribDocColunaE == "")
                    {
                        ColunaE_Dtdesligamento = "";
                    }
                    if (AtribDocColunaF == "")
                    {
                        ColunaF = "";
                    }
                    if (AtribDocColunaG == "")
                    {
                        ColunaG = "";
                    }
                    if (AtribDocColunaH == "")
                    {
                        ColunaH = "";
                    }
                    if (AtribDocColunaI == "")
                    {
                        ColunaI = "";
                    }
                    if (AtribDocColunaJ == "")
                    {
                        ColunaJ = "";
                    }
                    if (AtribDocColunaK == "")
                    {
                        ColunaK = "";
                    }
                    if (AtribDocColunaL == "")
                    {
                        ColunaL = "";
                    }
                    if (AtribDocColunaM == "")
                    {
                        ColunaM = "";
                    }
                    if (AtribDocColunaN == "")
                    {
                        ColunaN = "";
                    }
                    if (AtribDocColunaO == "")
                    {
                        ColunaO = "";
                    }
                    if (AtribDocColunaP == "")
                    {
                        ColunaP = "";
                    }
                }

                #endregion

                string StrAtribut = (AttributeSituacaodoc + "=" + Valor_AttributeSituacaodoc + ";"
                                     + AttributeMatriculaDoc + "=" + V_Atributo2 + ";"
                                     + AtribDocColunaA + "=" + ColunaA + ";"
                                     + AtribDocColunaB + "=" + ColunaB + ";"
                                     + AtribDocColunaC + "=" + ColunaC_Empresa + ";"
                                     + AtribDocColunaD + "=" + ColunaD + ";"
                                     + AtribDocColunaE + "=" + ColunaE_Dtdesligamento + ";"
                                     + AtribDocColunaF + "=" + ColunaF + ";"
                                     + AtribDocColunaG + "=" + ColunaG + ";"
                                     + AtribDocColunaH + "=" + ColunaH + ";"
                                     + AtribDocColunaI + "=" + ColunaI + ";"
                                     + AtribDocColunaJ + "=" + ColunaJ + ";"
                                     + AtribDocColunaK + "=" + ColunaK + ";"
                                     + AtribDocColunaL + "=" + ColunaL + ";"
                                     + AtribDocColunaM + "=" + ColunaM + ";"
                                     + AtribDocColunaM + "=" + ColunaN + ";"
                                     + AtribDocColunaN + "=" + ColunaO + ";"
                                     + AtribDocColunaP + "=" + ColunaP);

                string ATTRIBUTTES = StrAtribut.Replace("=;=;=;=;=", "").Replace("=;", "").Replace("=;=", "").Replace("=;=;=", "").Replace("=;=;=;=", "").Replace(";=", "");

                string DTDOCUMENT = Convert.ToString(System.DateTime.Now.ToString(FormatoData));

                //string StrAtribut = (AttributeSituacaodoc + "=" + Valor_AttributeSituacaodoc + ";" + AttributeMatriculaDoc + "=" + V_Atributo2);

                int FGMODEL = 1;

                string CategIndice = CategoryID + @"-" + Indice;

                SEClient newDoc          = Conection.GetConnection();
                var      resultadoNewDoc = newDoc.newDocument(CategoryID, CategIndice, "", "", DTDOCUMENT, ATTRIBUTTES, user, null, FGMODEL, null);

                string Identific = "";

                if (resultadoNewDoc.ToString().Substring(0, 2).Contains("0:"))
                {
                    File.AppendAllText(logCriarPastaFuncionario + @"\" + "log_erro_CriarPastaFuncionario.txt", "\r\n" + DateTime.Now + @" | " + matricula + @" | " + resultadoNewDoc.Substring(3).ToString() + @";");
                    return("false");
                }
                else
                {
                    File.AppendAllText(logCriarPastaFuncionario + @"\" + "log_CriarPastaFuncionario.txt", "\r\n" + DateTime.Now + @" | " + matricula + @" | " + resultadoNewDoc.Substring(3).ToString() + @";");
                    Identific = resultadoNewDoc.Substring(3).Replace(": Documento criado com sucesso", "");
                }
                IDCriaDoc = 1;
                return(Identific);
            }
            catch (Exception ex)
            {
                while (IDCriaDoc <= 2)
                {
                    IDCriaDoc++;
                    File.AppendAllText(logCriarPastaFuncionario + @"\" + "log_erro_CriarPastaFuncionario.txt", "\r\n" + DateTime.Now + @" | CriarPastaDoc | " + ex.Message.ToString() + @";");
                    Thread.Sleep(Convert.ToInt32(5000));
                    return(CriarDoc(CategoryID, matricula, Indice, ColunaA, ColunaB, ColunaC_Empresa, ColunaD, ColunaE_Dtdesligamento, ColunaF, ColunaG, ColunaH, ColunaI, ColunaJ, ColunaK, ColunaL, ColunaM, ColunaN, ColunaO, ColunaP));
                }
                return("false");
            }
        }