Esempio n. 1
0
 public void copy(ref T_Chamado cpy)
 {
     fk_loja         = cpy.fk_loja;
     tg_fechado      = cpy.tg_fechado;
     fk_operador     = cpy.fk_operador;
     nu_prioridade   = cpy.nu_prioridade;
     nu_categoria    = cpy.nu_categoria;
     dt_abertura     = cpy.dt_abertura;
     dt_fechamento   = cpy.dt_fechamento;
     st_motivo       = cpy.st_motivo;
     tg_tecnico      = cpy.tg_tecnico;
     fk_oper_criador = cpy.fk_oper_criador;
 }
Esempio n. 2
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute ins_chamado ");

            /// USER [ execute ]

            T_Chamado cham = new T_Chamado(this);

            cham.set_dt_abertura(GetDataBaseTime());
            cham.set_fk_loja(loj.get_identity());
            cham.set_fk_operador(user.get_identity());
            cham.set_fk_oper_criador(user.get_identity());
            cham.set_tg_fechado(Context.FALSE);
            cham.set_nu_prioridade(input_cont_dc.get_nu_prioridade());
            cham.set_nu_categoria(input_cont_dc.get_nu_categ());
            cham.set_st_motivo(input_cont_dc.get_st_motivo());
            cham.set_tg_tecnico(input_cont_dc.get_tg_tecnico());

            if (!cham.create_T_Chamado())
            {
                return(false);
            }

            LOG_Chamado l_c = new LOG_Chamado(this);

            l_c.set_fk_chamado(cham.get_identity());
            l_c.set_fk_operador(user.get_identity());
            l_c.set_dt_solucao(cham.get_dt_abertura());
            l_c.set_st_solucao("## Criação do chamado");

            if (!l_c.create_LOG_Chamado())
            {
                return(false);
            }

            PublishNote("Chamado criado com sucesso!");

            /// USER [ execute ] END

            Registry("execute done ins_chamado ");

            return(true);
        }
Esempio n. 3
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute exec_alteraChamado ");

            /// USER [ execute ]

            T_Chamado   cham      = new T_Chamado(this);
            T_Usuario   usrConvey = new T_Usuario(this);
            LOG_Chamado l_c       = new LOG_Chamado(this);

            if (input_tg_fechado == Context.TRUE)
            {
                cham.ExclusiveAccess();
            }

            if (!cham.selectIdentity(input_id_chamado))
            {
                return(false);
            }

            if (cham.get_tg_fechado() == Context.TRUE)
            {
                PublishError("Chamado fechado não pode ser alterado");
                return(false);
            }

            if (!usrConvey.select_rows_login(input_st_operador, "000000"))
            {
                PublishError("Usuário inexistente");
                return(false);
            }

            if (!usrConvey.fetch())
            {
                return(false);
            }

            l_c.set_fk_chamado(cham.get_identity());
            l_c.set_fk_operador(user.get_identity());
            l_c.set_st_solucao(input_st_new_desc);
            l_c.set_dt_solucao(GetDataBaseTime());

            if (!l_c.create_LOG_Chamado())
            {
                return(false);
            }

            cham.set_tg_fechado(input_tg_fechado);
            cham.set_fk_operador(usrConvey.get_identity());

            if (input_tg_fechado == Context.TRUE)
            {
                cham.set_dt_fechamento(GetDataBaseTime());
            }

            if (!cham.synchronize_T_Chamado())
            {
                return(false);
            }

            if (input_tg_fechado == Context.TRUE)
            {
                l_c.set_st_solucao("## Chamado fechado");

                if (!l_c.create_LOG_Chamado())
                {
                    return(false);
                }
            }

            PublishNote("Chamado alterado com sucesso");

            /// USER [ execute ] END

            Registry("execute done exec_alteraChamado ");

            return(true);
        }
Esempio n. 4
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_chamados ");

            /// USER [ execute ]

            T_Usuario usrConvey        = new T_Usuario(this);
            T_Usuario usrConveyCriador = new T_Usuario(this);

            if (input_st_operador.Length > 0)
            {
                if (!usrConvey.select_rows_login(input_st_operador, "000000"))
                {
                    PublishError("Usuário inexistente");
                    return(false);
                }

                if (!usrConvey.fetch())
                {
                    return(false);
                }
            }

            if (input_st_resp.Length > 0)
            {
                if (!usrConveyCriador.select_rows_login(input_st_resp, "000000"))
                {
                    PublishError("Usuário inexistente");
                    return(false);
                }

                if (!usrConveyCriador.fetch())
                {
                    return(false);
                }
            }

            T_Loja loj = new T_Loja(this);

            if (input_st_loja.Length > 0)
            {
                if (!loj.select_rows_loja(input_st_loja))
                {
                    PublishError("Código de loja inválido");
                    return(false);
                }

                if (!loj.fetch())
                {
                    return(false);
                }
            }

            T_Chamado cham = new T_Chamado(this);

            #region - busca pela data -

            if (input_dt_ini_ab.Length > 0 &&
                input_dt_fim_ab.Length > 0 &&
                input_dt_ini_fech.Length > 0 &&
                input_dt_fim_fech.Length > 0)
            {
                if (!cham.select_rows_abert_fech(input_dt_ini_ab,
                                                 input_dt_fim_ab,
                                                 input_dt_ini_fech,
                                                 input_dt_fim_fech))
                {
                    PublishError("Nenhum registro encontrado");
                    return(false);
                }
            }
            else if (input_dt_ini_ab.Length > 0 &&
                     input_dt_fim_ab.Length > 0 &&
                     input_dt_ini_fech.Length > 0 &&
                     input_dt_fim_fech.Length == 0)
            {
                if (!cham.select_rows_abert_fech(input_dt_ini_ab,
                                                 input_dt_fim_ab,
                                                 input_dt_ini_fech))
                {
                    PublishError("Nenhum registro encontrado");
                    return(false);
                }
            }
            else if (input_dt_ini_ab.Length > 0 &&
                     input_dt_fim_ab.Length > 0 &&
                     input_dt_ini_fech.Length == 0 &&
                     input_dt_fim_fech.Length == 0)
            {
                if (!cham.select_rows_abert_fech(input_dt_ini_ab,
                                                 input_dt_fim_ab))
                {
                    PublishError("Nenhum registro encontrado");
                    return(false);
                }
            }
            else if (input_dt_ini_ab.Length > 0 &&
                     input_dt_fim_ab.Length == 0 &&
                     input_dt_ini_fech.Length == 0 &&
                     input_dt_fim_fech.Length == 0)
            {
                if (!cham.select_rows_abert_fech(input_dt_ini_ab))
                {
                    PublishError("Nenhum registro encontrado");
                    return(false);
                }
            }
            else if (input_dt_ini_ab.Length > 0 &&
                     input_dt_fim_ab.Length == 0 &&
                     input_dt_ini_fech.Length > 0 &&
                     input_dt_fim_fech.Length == 0)
            {
                if (!cham.select_rows_abert_fech_ini(input_dt_ini_ab,
                                                     input_dt_ini_fech))
                {
                    PublishError("Nenhum registro encontrado");
                    return(false);
                }
            }
            else if (input_dt_ini_ab.Length == 0 &&
                     input_dt_fim_ab.Length == 0 &&
                     input_dt_ini_fech.Length > 0 &&
                     input_dt_fim_fech.Length == 0)
            {
                if (!cham.select_rows_fech(input_dt_ini_fech))
                {
                    PublishError("Nenhum registro encontrado");
                    return(false);
                }
            }

            #endregion

            StringBuilder sb = new StringBuilder();

            while (cham.fetch())
            {
                if (input_st_loja.Length > 0)
                {
                    if (cham.get_fk_loja() != loj.get_identity())
                    {
                        continue;
                    }
                }

                if (input_st_operador.Length > 0)
                {
                    if (cham.get_fk_operador() != usrConvey.get_identity())
                    {
                        continue;
                    }
                }
                else if (!usrConvey.selectIdentity(cham.get_fk_operador()))
                {
                    continue;
                }

                if (input_st_resp.Length > 0)
                {
                    if (cham.get_fk_oper_criador() != usrConveyCriador.get_identity())
                    {
                        continue;
                    }
                }
                else if (!usrConveyCriador.selectIdentity(cham.get_fk_oper_criador()))
                {
                    continue;
                }

                if (input_nu_prioridade != "-1")
                {
                    if (cham.get_nu_prioridade() != input_nu_prioridade)
                    {
                        continue;
                    }
                }

                if (input_nu_categ != "-1")
                {
                    if (cham.get_nu_categoria() != input_nu_categ)
                    {
                        continue;
                    }
                }

                if (cham.get_tg_fechado() != input_tg_closed)
                {
                    continue;
                }

                if (cham.get_tg_tecnico() != input_tg_tecnico)
                {
                    continue;
                }

                DadosChamado dc = new DadosChamado();

                dc.set_id_chamado(cham.get_identity());
                dc.set_st_oper(usrConvey.get_st_nome());
                dc.set_st_resp(usrConveyCriador.get_st_nome());
                dc.set_dt_ab(cham.get_dt_abertura());
                dc.set_st_motivo(cham.get_st_motivo());

                if (cham.get_tg_fechado() == Context.TRUE)
                {
                    dc.set_dt_fech(cham.get_dt_fechamento());
                }

                DataPortable tmp = dc as DataPortable;

                // ## indexa em memória

                sb.Append(MemorySave(ref tmp));
                sb.Append(",");
            }

            string list_ids = sb.ToString().TrimEnd(',');

            if (list_ids == "")
            {
                PublishNote("Nenhum resultado foi encontrado");
                return(true);
            }

            DataPortable dp = new DataPortable();

            dp.setValue("ids", list_ids);

            // ## cria indexador de bloco

            output_st_block = MemorySave(ref dp);

            /// USER [ execute ] END

            Registry("execute done fetch_chamados ");

            return(true);
        }
Esempio n. 5
0
        public override bool execute( )
        {
            if (base.execute() == false)
            {
                return(false);
            }

            Registry("execute fetch_chamadoHist ");

            /// USER [ execute ]

            T_Chamado   cham      = new T_Chamado(this);
            T_Loja      loj       = new T_Loja(this);
            T_Usuario   usrConvey = new T_Usuario(this);
            LOG_Chamado l_c       = new LOG_Chamado(this);

            if (!cham.selectIdentity(input_id_chamado))
            {
                return(false);
            }

            if (!loj.selectIdentity(cham.get_fk_loja()))
            {
                return(false);
            }

            if (!usrConvey.selectIdentity(cham.get_fk_operador()))
            {
                return(false);
            }

            output_cont_dc.set_st_cod_loja(loj.get_st_loja());
            output_cont_dc.set_st_nome_loja(loj.get_st_nome());
            output_cont_dc.set_st_motivo(cham.get_st_motivo());
            output_cont_dc.set_st_oper(usrConvey.get_st_nome());
            output_cont_dc.set_nu_categ(cham.get_nu_categoria());
            output_cont_dc.set_tg_fechado(cham.get_tg_fechado());
            output_cont_dc.set_dt_ab(cham.get_dt_abertura());
            output_cont_dc.set_dt_fech(cham.get_dt_fechamento());

            if (l_c.select_fk_chamado(cham.get_identity()))
            {
                l_c.SetReversedFetch();

                while (l_c.fetch())
                {
                    if (!usrConvey.selectIdentity(l_c.get_fk_operador()))
                    {
                        return(false);
                    }

                    DadosAlteracaoChamado dac = new DadosAlteracaoChamado();

                    dac.set_dt_alt(l_c.get_dt_solucao());
                    dac.set_st_oper_alt(usrConvey.get_st_nome());
                    dac.set_st_desc_alt(l_c.get_st_solucao());

                    output_array_generic_lst.Add(dac);
                }
            }

            /// USER [ execute ] END

            Registry("execute done fetch_chamadoHist ");

            return(true);
        }