Exemple #1
0
    public static Katapoka.DAO.JsonResponse Salvar(int?idUsuario, string nome, string email, string senha, int idNivel, int idCargo)
    {
        Katapoka.DAO.JsonResponse response = new Katapoka.DAO.JsonResponse();

        if (Katapoka.BLL.Autenticacao.Usuario.UsuarioAtual == null)
        {
            response.Status = 300;
            response.Data   = "Por favor, faça login!";
        }
        else
        {
            using (Katapoka.BLL.Usuario.UsuarioBLL usuarioBLL = new Katapoka.BLL.Usuario.UsuarioBLL())
            {
                try
                {
                    usuarioBLL.Save(idUsuario, nome, email, senha, idNivel, idCargo);
                    response.Status = 200;
                    response.Data   = "OK";
                }
                catch (Exception ex)
                {
                    response.Status = 600;
                    response.Data   = ex.Message;
                }
            }
        }

        return(response);
    }
Exemple #2
0
    public static Katapoka.DAO.JsonResponse Salvar(int idProjeto, List <Katapoka.DAO.Atividade.AtividadeAjaxPost> atividades)
    {
        Katapoka.DAO.JsonResponse response = new Katapoka.DAO.JsonResponse();
        try
        {
            Katapoka.BLL.Projeto.ProjetoBLL projetoBLL           = new Katapoka.BLL.Projeto.ProjetoBLL();
            IList <Katapoka.DAO.Atividade.AtividadeAjaxPost> ret = projetoBLL.SalvarAtividades(idProjeto, atividades, Katapoka.BLL.Autenticacao.Usuario.UsuarioAtual.IdUsuario);
            response.Status = 200;
            response.Data   = ret;

            //Tenta mandar um push para todos que estão na página
            try
            {
                lock (usuariosOnline)
                {
                    foreach (string hashLogin in usuariosOnline
                             .Where(p => p != Katapoka.BLL.Autenticacao.Usuario.UsuarioAtual.DsHashLogin).ToList())
                    {
                        Katapoka.AjaxReverso.Message message = new Katapoka.AjaxReverso.Message();
                        message.RecipientName  = hashLogin;
                        message.MessageContent = JsonConvert.SerializeObject(ret);
                        Katapoka.AjaxReverso.ClientAdapter.Instance.SendMessage(message);
                    }
                }
            }
            catch { }
        }
        catch (Exception ex)
        {
            response.Status = 500;
            response.Data   = ex.Message + (ex.InnerException != null ? "\n" + ex.InnerException.Message : "");
        }
        return(response);
    }
Exemple #3
0
    public static Katapoka.DAO.JsonResponse IncluirAtividades(int idProjeto, Katapoka.DAO.Atividade.AtividadeCompleta[] atividades)
    {
        Katapoka.DAO.JsonResponse response = new Katapoka.DAO.JsonResponse();
        if (Katapoka.BLL.Autenticacao.Usuario.UsuarioAtual == null)
        {
            response.Status = 100;
            response.Data   = "Realize o login para continuar.";
            return(response);
        }
        try
        {
            using (Katapoka.BLL.Atividade.AtividadeBLL atividadeBLL = new Katapoka.BLL.Atividade.AtividadeBLL())
            {
                atividadeBLL.Salvar(idProjeto, atividades, Katapoka.BLL.Autenticacao.Usuario.UsuarioAtual.IdUsuario);
                response.Status = 200;
                response.Data   = "OK";
            }
        }
        catch (Exception ex)
        {
            response.Status = 500;
            response.Data   = ex.Message;
        }

        return(response);
    }
Exemple #4
0
    public static Katapoka.DAO.JsonResponse Salvar(int?idAtividade, int idProjeto, int?idAtividadePredecessora, string tituloAtividade, string tempoEstimado, int porcentagemCompleta, string strDtInicio, string strDtTermino, string descricao, Katapoka.DAO.Tag.TagCompleta[] tags)
    {
        Katapoka.DAO.JsonResponse response = new Katapoka.DAO.JsonResponse();
        if (Katapoka.BLL.Autenticacao.Usuario.UsuarioAtual == null)
        {
            response.Status = 300;
            response.Data   = "Por favor, faça o login.";
        }
        else
        {
            DateTime dtInicio  = DateTime.Now;
            DateTime dtTermino = DateTime.Now;
            #region CONVERT DTTIME
            try
            {
                dtInicio = Convert.ToDateTime(strDtInicio);
            }
            catch
            {
                response.Status = 500;
                response.Data   = "Data Início inválida.";
                return(response);
            }

            try
            {
                dtTermino = Convert.ToDateTime(strDtTermino);
            }
            catch
            {
                response.Status = 500;
                response.Data   = "Data Término inválida.";
                return(response);
            }
            #endregion
            using (Katapoka.BLL.Atividade.AtividadeBLL atividadeBLL = new Katapoka.BLL.Atividade.AtividadeBLL())
            {
                int idUsuario = Katapoka.BLL.Autenticacao.Usuario.UsuarioAtual.IdUsuario;
                try
                {
                    Decimal tmpEstimado = Katapoka.BLL.Utilitarios.Utilitario.ConvertTimeStringToDecimal(tempoEstimado);
                    atividadeBLL.Save(idAtividade, idProjeto, idAtividadePredecessora, tituloAtividade, tmpEstimado, porcentagemCompleta, dtInicio, dtTermino, descricao, idUsuario, tags);
                    response.Status = 200;
                    response.Data   = "OK";
                }
                catch (Exception ex)
                {
                    response.Status = 600;
                    response.Data   = ex.Message;
                }
            }
        }
        return(response);
    }
Exemple #5
0
 public static Katapoka.DAO.JsonResponse Logar(string email, string senha)
 {
     Katapoka.DAO.JsonResponse response = new Katapoka.DAO.JsonResponse();
     try
     {
         Katapoka.BLL.Autenticacao.Usuario.Login(email, senha);
         response.Status = 200;
         response.Data   = "";
     }
     catch (Exception ex)
     {
         response.Status = 400;
         response.Data   = ex.Message;
     }
     return(response);
 }
Exemple #6
0
    public static Katapoka.DAO.JsonResponse Salvar(int?idTipoProjeto, string dsTipoProjeto)
    {
        Katapoka.DAO.JsonResponse response = new Katapoka.DAO.JsonResponse();

        try
        {
            Katapoka.BLL.Projeto.TipoProjetoBLL tipoProjetoBLL = new Katapoka.BLL.Projeto.TipoProjetoBLL();
            tipoProjetoBLL.Save(idTipoProjeto, dsTipoProjeto);
            response.Status = 200;
            response.Data   = "OK";
        }
        catch (Exception ex)
        {
            response.Status = 500;
            response.Data   = ex.Message;
        }

        return(response);
    }
Exemple #7
0
 public Katapoka.DAO.JsonResponse  GetUsuarioAutocomplete(string nome)
 {
     Katapoka.DAO.JsonResponse response = new Katapoka.DAO.JsonResponse();
     try
     {
         using (Katapoka.BLL.Usuario.UsuarioBLL usuarioBLL = new Katapoka.BLL.Usuario.UsuarioBLL())
         {
             response.Status = 200;
             response.Data   = usuarioBLL.GetByNome(nome, Katapoka.BLL.Usuario.EsquemaBuscaNome.ComecandoCom)
                               .Select(p => new Katapoka.DAO.UsuarioCompleto()
             {
                 DsNome    = p.DsNome,
                 IdUsuario = p.IdUsuario
             }).ToList();
         }
     }
     catch (Exception ex)
     {
         response.Status = 500;
         response.Data   = ex.Message;
     }
     return(response);
 }
Exemple #8
0
    public static Katapoka.DAO.JsonResponse Salvar(int?idProjeto, string nome, int idEmpresa, string dtInicioStr, string dtTerminoStr, string codReferencia, string status, int idTipoProjeto)
    {
        Katapoka.DAO.JsonResponse response = new Katapoka.DAO.JsonResponse(999, null);
        if (Katapoka.BLL.Autenticacao.Usuario.UsuarioAtual == null)
        {
            response.Status = 100;
            response.Data   = "Você precisa estar conectado para executar esta ação.";
        }
        using (Katapoka.BLL.Projeto.ProjetoBLL projetoBLL = new Katapoka.BLL.Projeto.ProjetoBLL())
        {
            DateTime?dtInicio = null;
            try
            { dtInicio = (DateTime)DateTime.Parse(dtInicioStr); }
            catch
            { dtInicio = null; }

            DateTime?dtTermino = null;
            try
            { dtTermino = (DateTime)DateTime.Parse(dtTerminoStr); }
            catch
            { dtTermino = null; }

            try
            {
                string retorno = projetoBLL.Salvar(idProjeto, nome, idEmpresa, Katapoka.BLL.Autenticacao.Usuario.UsuarioAtual.IdUsuario, dtInicio, dtTermino, codReferencia, status, idTipoProjeto);
                response.Status = 200;
                response.Data   = retorno;
            }
            catch (Exception ex)
            {
                response.Status = 500;
                response.Data   = ex.Message;
            }
        }
        return(response);
    }
Exemple #9
0
 public static Katapoka.DAO.JsonResponse Salvar(int?idEmpresa,
                                                string nomeFantasia, string razaoSocial, string cnpj,
                                                int idAreaAtuacao, string email, string url, string sumario,
                                                string cep, string endereco, string numero, string complemento,
                                                int?idCidade, int?idBairro, string bairroNome, bool flAceite, bool flAprovada,
                                                string telefoneComercial, string telefoneResidencial, string telefoneCelular, string telefoneFax, string observacaoContato)
 {
     Katapoka.DAO.JsonResponse response = new Katapoka.DAO.JsonResponse(999, null);
     using (Katapoka.BLL.Empresa.EmpresaBLL empresaBLL = new Katapoka.BLL.Empresa.EmpresaBLL())
     {
         try
         {
             int retorno = empresaBLL.Salvar(idEmpresa, nomeFantasia, razaoSocial, cnpj, idAreaAtuacao, email, url, sumario, cep, endereco, numero, complemento, idCidade, idBairro, bairroNome, flAceite, flAprovada, telefoneComercial, telefoneResidencial, telefoneCelular, telefoneFax, observacaoContato);
             response.Status = 200;
             response.Data   = retorno;
         }
         catch (Exception ex)
         {
             response.Status = 400;
             response.Data   = ex.Message;
         }
     }
     return(response);
 }