Exemplo n.º 1
0
        public static bool cadPartComplende(CL_Partcomplende objPartComplende, string con)
        {
            DB_Funcoes.DesmontaConexao(con);
            CONEXAO = montaDAO(CONEXAO);
            Conn    = new NpgsqlConnection(CONEXAO);

            try
            {
                string sql = "INSERT INTO part_compl (pc_codigo, pc_codpart, pc_nome, pc_cnpj, pc_ende, pc_nr, pc_compl, pc_bairro, pc_ibge, " +
                             "pc_cida, pc_uf, pc_respons, pc_matric, pc_email, pc_fone, pc_cep, pc_iest, pc_ativo, pc_situac) VALUES (" +
                             "@pc_codigo, @pc_codpart, @pc_nome, @pc_cnpj, @pc_ende, @pc_nr, @pc_compl, @pc_bairro, @pc_ibge, " +
                             "@pc_cida, @pc_uf, @pc_respons, @pc_matric, @pc_email, @pc_fone, @pc_cep, @pc_iest, @pc_ativo, @pc_situac)";

                NpgsqlCommand comand = new NpgsqlCommand(sql, Conn);
                comand.Parameters.AddWithValue("pc_codigo", objPartComplende.pc_codigo);
                comand.Parameters.AddWithValue("pc_codpart", objPartComplende.pc_codpart);
                comand.Parameters.AddWithValue("pc_nome", objPartComplende.pc_nome);
                comand.Parameters.AddWithValue("pc_cnpj", objPartComplende.pc_cnpj);
                comand.Parameters.AddWithValue("pc_ende", objPartComplende.pc_ende);
                comand.Parameters.AddWithValue("pc_nr", objPartComplende.pc_nr);
                comand.Parameters.AddWithValue("pc_compl", objPartComplende.pc_compl);
                comand.Parameters.AddWithValue("pc_ibge", objPartComplende.pc_ibge);
                comand.Parameters.AddWithValue("pc_cida", objPartComplende.pc_cida);
                comand.Parameters.AddWithValue("pc_uf", objPartComplende.pc_uf);
                comand.Parameters.AddWithValue("pc_matric", objPartComplende.pc_matric);
                comand.Parameters.AddWithValue("pc_bairro", objPartComplende.pc_bairro);
                comand.Parameters.AddWithValue("pc_email", objPartComplende.pc_email);
                comand.Parameters.AddWithValue("pc_fone", objPartComplende.pc_fone);
                comand.Parameters.AddWithValue("pc_cep", objPartComplende.pc_cep);
                comand.Parameters.AddWithValue("pc_iest", objPartComplende.pc_iest);
                comand.Parameters.AddWithValue("pc_ativo", objPartComplende.pc_ativo);
                comand.Parameters.AddWithValue("pc_respons", objPartComplende.pc_respons);
                comand.Parameters.AddWithValue("pc_situac", objPartComplende.pc_situac);

                Conn.Open();
                comand.ExecuteScalar();
                return(true);
            }
            catch (Exception ex)
            {
                ex.ToString();
                return(false);
            }
            finally
            {
                if (Conn.State == ConnectionState.Open)
                {
                    Conn.Close();
                }
            }
        }
Exemplo n.º 2
0
 public static bool confereParticip(int clicod, int codend, string token, string con)
 {
     try
     {
         string cgc = "", sql = "";
         if (codend != 0)
         {
             CL_Partcomplende objPartComplend = new CL_Partcomplende();
             objPartComplend = NG_Partcomplende.buscaPartComplende(codend.ToString(), con);
             if (objPartComplend != null)
             {
                 cgc = cgc = objPartComplend.pc_cnpj.Replace(".", "").Replace("/", "").Replace("-", "");
                 cgc = cgc + "-" + objPartComplend.pc_codigo;
                 sql = "UPDATE part_compl SET pc_situac='S' WHERE pc_codigo=" + objPartComplend.pc_codigo;
                 if (objPartComplend.pc_situac == "S")
                 {
                     return(true);
                 }
                 else if (objPartComplend.pc_situac == "A")
                 {
                     string post = acertaXmlAlterar(objPartComplend.pc_nome, objPartComplend.pc_nome, objPartComplend.pc_uf, "BRASIL", objPartComplend.pc_cida, objPartComplend.pc_bairro, objPartComplend.pc_ende, objPartComplend.pc_nr, objPartComplend.pc_compl, objPartComplend.pc_cep, objPartComplend.pc_fone.Trim(), objPartComplend.pc_fone.Trim(), objPartComplend.pc_email);
                     if (attDadosApp(token, "serviceLocal", post, cgc))
                     {
                         if (attSituac(sql, con))
                         {
                             return(true);
                         }
                         else
                         {
                             return(false);
                         }
                     }
                     else
                     {
                         return(false);
                     }
                 }
                 else if (objPartComplend.pc_situac == "I" || objPartComplend.pc_situac == "")
                 {
                     string post = acertaXmlNovo(cgc, objPartComplend.pc_nome, objPartComplend.pc_nome, objPartComplend.pc_uf, "BRASIL", objPartComplend.pc_cida, objPartComplend.pc_bairro, objPartComplend.pc_ende, objPartComplend.pc_nr, objPartComplend.pc_compl, objPartComplend.pc_cep, objPartComplend.pc_fone.Trim(), objPartComplend.pc_fone.Trim(), objPartComplend.pc_email);
                     if (sincronizaApp(token, "serviceLocal", post))
                     {
                         if (attSituac(sql, con))
                         {
                             return(true);
                         }
                         else
                         {
                             return(false);
                         }
                     }
                     else
                     {
                         return(false);
                     }
                 }
                 else
                 {
                     return(false);
                 }
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             //PARTICIP
             CL_Particip objParticip = new CL_Particip();
             objParticip = NG_Particip.buscaParticip(clicod.ToString(), con);
             if (objParticip != null)
             {
                 cgc = cgc = objParticip.p_cgc.Replace(".", "").Replace("/", "").Replace("-", "");
                 sql = "UPDATE particip SET p_situac='S' WHERE p_cod=" + objParticip.p_clicod;
                 if (objParticip.p_situac == "S")
                 {
                     return(true);
                 }
                 else if (objParticip.p_situac == "A")
                 {
                     string post = acertaXmlAlterar(objParticip.p_nome, objParticip.p_fantas, objParticip.p_est, objParticip.p_pais, objParticip.p_cida, objParticip.p_bairro, objParticip.p_ende, objParticip.p_nr, objParticip.p_comend, objParticip.p_cep, objParticip.p_celul, objParticip.p_fone, objParticip.p_email);
                     if (attDadosApp(token, "serviceLocal", post, cgc))
                     {
                         if (attSituac(sql, con))
                         {
                             return(true);
                         }
                         else
                         {
                             return(false);
                         }
                     }
                     else
                     {
                         return(false);
                     }
                 }
                 else if (objParticip.p_situac == "I" || objParticip.p_situac == "")
                 {
                     string post = acertaXmlNovo(cgc, objParticip.p_nome, objParticip.p_fantas, objParticip.p_est, objParticip.p_pais, objParticip.p_cida, objParticip.p_bairro, objParticip.p_ende, objParticip.p_nr, objParticip.p_comend, objParticip.p_cep, objParticip.p_celul, objParticip.p_fone, objParticip.p_email);
                     if (sincronizaApp(token, "serviceLocal", post))
                     {
                         if (attSituac(sql, con))
                         {
                             return(true);
                         }
                         else
                         {
                             return(false);
                         }
                     }
                     else
                     {
                         return(false);
                     }
                 }
                 else
                 {
                     return(false);
                 }
             }
             else
             {
                 return(false);
             }
         }
     }
     catch (Exception ex)
     {
         ex.ToString();
         return(false);
     }
 }
Exemplo n.º 3
0
        public static CL_Partcomplende buscaPartComplende(string codigo, string con)
        {
            DB_Funcoes.DesmontaConexao(con);
            CONEXAO = montaDAO(CONEXAO);
            Conn    = new NpgsqlConnection(CONEXAO);

            string           sql    = "SELECT * FROM part_compl WHERE pc_codigo=@codigo";
            NpgsqlCommand    comand = new NpgsqlCommand(sql, Conn);
            NpgsqlDataReader dr;

            comand.Parameters.AddWithValue("codigo", codigo);
            CL_Partcomplende objPartComplende = new CL_Partcomplende();

            try
            {
                Conn.Open();
                dr = comand.ExecuteReader();
                if (dr.HasRows)
                {
                    if (dr.Read())
                    {
                        objPartComplende.pc_codigo  = Convert.ToInt32(codigo);
                        objPartComplende.pc_codpart = Convert.ToInt32(dr["pc_codpart"]);
                        objPartComplende.pc_nome    = dr["pc_nome"].ToString().Trim();
                        objPartComplende.pc_cnpj    = dr["pc_cnpj"].ToString().Trim();
                        objPartComplende.pc_ende    = dr["pc_ende"].ToString().Trim();
                        objPartComplende.pc_nr      = dr["pc_nr"].ToString().Trim();
                        objPartComplende.pc_compl   = dr["pc_compl"].ToString().Trim();
                        objPartComplende.pc_bairro  = dr["pc_bairro"].ToString().Trim();
                        objPartComplende.pc_ibge    = dr["pc_ibge"].ToString().Trim();
                        objPartComplende.pc_cida    = dr["pc_cida"].ToString().Trim();
                        objPartComplende.pc_uf      = dr["pc_uf"].ToString().Trim();
                        objPartComplende.pc_respons = dr["pc_respons"].ToString().Trim();
                        objPartComplende.pc_matric  = dr["pc_matric"].ToString().Trim();
                        objPartComplende.pc_email   = dr["pc_email"].ToString().Trim();
                        objPartComplende.pc_fone    = dr["pc_fone"].ToString().Trim();
                        objPartComplende.pc_cep     = dr["pc_cep"].ToString().Trim();
                        objPartComplende.pc_iest    = dr["pc_iest"].ToString().Trim();
                        objPartComplende.pc_ativo   = dr["pc_ativo"].ToString().Trim();
                        objPartComplende.pc_situac  = dr["pc_situac"].ToString().Trim();
                        return(objPartComplende);
                    }
                    else
                    {
                        objPartComplende = null;
                        return(objPartComplende);
                    }
                }
                else
                {
                    objPartComplende = null;
                    return(objPartComplende);
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
                objPartComplende = null;
                return(objPartComplende);
            }
            finally
            {
                if (Conn.State == ConnectionState.Open)
                {
                    Conn.Close();
                }
            }
        }
Exemplo n.º 4
0
 public static bool excluiPartComplende(CL_Partcomplende objPartComplende, string con)
 {
     return(DB_Partcomplende.excluiPartComplende(objPartComplende, con));
 }
Exemplo n.º 5
0
 public static bool alteraPartComplende(CL_Partcomplende objPartComplende, string con)
 {
     return(DB_Partcomplende.alteraPartComplende(objPartComplende, con));
 }