Esempio n. 1
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);
    }
Esempio n. 2
0
    private void popularDDLProjeto()
    {
        bool flProjetosAtivos = true;

        if (Request.QueryString["flProjetosAtivos"] != null)
        {
            Boolean.TryParse(Request.QueryString["flProjetosAtivos"].ToString(), out flProjetosAtivos);
        }

        using (Katapoka.BLL.Projeto.ProjetoBLL projetoBLL = new Katapoka.BLL.Projeto.ProjetoBLL())
        {
            ddlProjeto.Items.Clear();
            ddlProjeto.DataSource = projetoBLL.GetAll(flProjetosAtivos);
            ddlProjeto.DataBind();
            ddlProjeto.Items.Insert(0, new ListItem("Todos", ""));

            //Seleciona o campo de projeto correto
            if (Request.QueryString["idProjeto"] != null)
            {
                if (ddlProjeto.Items.FindByValue(Request.QueryString["idProjeto"].ToString()) != null)
                {
                    ddlProjeto.Items.FindByValue(Request.QueryString["idProjeto"].ToString()).Selected = true;
                }
            }
        }
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int idProjeto = 0;

        if (Katapoka.BLL.Autenticacao.Usuario.UsuarioAtual == null)
        {
            Response.Redirect("~/Login.aspx");
        }
        else
        {
            if (Request.QueryString["pid"] != null)
            {
                Int32.TryParse(Request.QueryString["pid"].ToString(), out idProjeto);
                if (idProjeto > 0)
                {
                    if (new Katapoka.BLL.Atividade.AtividadeBLL().GetCountAtividades(null, idProjeto, null, null, null, null, null, Katapoka.BLL.Atividade.AtividadeBLL.OrdenacaoAtividade.IdC) == 0)
                    {
                        this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "IdProjeto", "var IdProjeto = " + idProjeto.ToString() + ";", true);
                        using (Katapoka.BLL.Atividade.TipoAtividadeBLL tipoAtividadeBLL = new Katapoka.BLL.Atividade.TipoAtividadeBLL())
                        {
                            using (Katapoka.BLL.Projeto.ProjetoBLL projetoBLL = tipoAtividadeBLL.CriarObjetoNoMesmoContexto <Katapoka.BLL.Projeto.ProjetoBLL>())
                            {
                                Katapoka.DAO.Projeto_Tb projetoTb = projetoBLL.GetById(idProjeto);
                                if (projetoTb != null)
                                {
                                    IList <Katapoka.DAO.Atividade.TipoAtividade> atividades =
                                        tipoAtividadeBLL.GetTipoAtividadePorTipoProjeto(projetoTb.IdTipoProjeto);

                                    for (int i = 1; i <= atividades.Count; i++)
                                    {
                                        this.relacoes[atividades[i - 1].IdTipoAtividade.Value] = i;
                                    }

                                    rptAtividades.DataSource = atividades;
                                    rptAtividades.DataBind();
                                }
                                else
                                {
                                    Response.Redirect("~/ListarProjetos.aspx");
                                }
                            }
                        }
                    }
                    else
                    {
                        Response.Redirect("~/ListarProjetos.aspx");
                    }
                }
                else
                {
                    Response.Redirect("~/ListarProjetos.aspx");
                }
            }
            else
            {
                Response.Redirect("~/ListarProjetos.aspx");
            }
        }
    }
Esempio n. 4
0
 private void populaDDLProjeto()
 {
     using (Katapoka.BLL.Projeto.ProjetoBLL projetoBLL = new Katapoka.BLL.Projeto.ProjetoBLL())
     {
         ddlProjeto.Items.Clear();
         ddlProjeto.DataSource     = projetoBLL.GetAll();
         ddlProjeto.DataValueField = "IdProjeto";
         ddlProjeto.DataTextField  = "DsNome";
         ddlProjeto.DataBind();
         ddlProjeto.Items.Insert(0, new ListItem("Selecione um projeto", ""));
     }
 }
Esempio n. 5
0
 public List <Katapoka.DAO.Projeto.ProjetoCompleto> GetProjetosFiltroAtivo(bool flProjetoAtivo)
 {
     using (Katapoka.BLL.Projeto.ProjetoBLL projetoBLL = new Katapoka.BLL.Projeto.ProjetoBLL())
     {
         return(projetoBLL.GetAll(flProjetoAtivo)
                .Select(p => new Katapoka.DAO.Projeto.ProjetoCompleto()
         {
             DsCodigoReferencia = p.DsCodigoReferencia,
             DsNome = p.DsNome,
             DtCriacao = p.DtCriacao,
             DtInicioEstimado = p.DtInicioEstimado,
             DtTerminoEstimado = p.DtTerminoEstimado,
             FlStatus = p.FlStatus,
             IdEmpresa = p.IdEmpresa,
             IdProjeto = p.IdProjeto,
             IdTipoProjeto = p.IdTipoProjeto,
             IdUsuarioCriacao = p.IdUsuarioCriacao
         }).ToList());
     }
 }
Esempio n. 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Katapoka.BLL.Autenticacao.Usuario.UsuarioAtual == null)
        {
            Response.Redirect("~/Login.aspx");
        }

        int idProjeto = 0;
        int idEmpresa = 0;

        populaDDLEmpresa();

        if (Request.QueryString["eid"] != null && Int32.TryParse(Request.QueryString["eid"].ToString(), out idEmpresa))
        {
            ListItem eli = ddlEmpresa.Items.FindByValue(idEmpresa.ToString());
            if (eli != null)
            {
                eli.Selected = true;
            }
        }

        populaDDLTipoProjeto();

        if (Request.QueryString["id"] != null && Int32.TryParse(Request.QueryString["id"].ToString(), out idProjeto))
        {
            //Edição
            using (Katapoka.BLL.Projeto.ProjetoBLL projetoBLL = new Katapoka.BLL.Projeto.ProjetoBLL())
            {
                Katapoka.DAO.Projeto_Tb projetoTb = projetoBLL.GetById(idProjeto);
                preencheDados(projetoTb);
            }
        }
        else
        {
            //Criação
        }
        this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "IdProjeto", "var IdProjeto = " + (idProjeto > 0 ? idProjeto.ToString() : "null") + ";", true);
    }
Esempio n. 7
0
    public Repeater PopularGrid()
    {
        //Recupera os parametros
        int?idEmpresa = (Request.QueryString["idEmpresa"] != null && Request.QueryString["idEmpresa"].ToString() != "" ? (int?)Convert.ToInt32(Request.QueryString["idEmpresa"].ToString()) : null);

        Katapoka.BLL.Projeto.ProjetoBLL.OrdenacaoProjeto order = (Request.QueryString["order"] != null ? (Katapoka.BLL.Projeto.ProjetoBLL.OrdenacaoProjeto)Enum.Parse(typeof(Katapoka.BLL.Projeto.ProjetoBLL.OrdenacaoProjeto), Request.QueryString["order"].ToString()) : Katapoka.BLL.Projeto.ProjetoBLL.OrdenacaoProjeto.IdC);

        using (Katapoka.BLL.Projeto.ProjetoBLL projetoBLL = new Katapoka.BLL.Projeto.ProjetoBLL())
        {
            Katapoka.Core.WebControlBind.TotalRegistros = projetoBLL.GetCountProjetos(null, idEmpresa, null, null, null, order);
            Katapoka.Core.WebControlBind.RepeaterBind <Katapoka.DAO.Projeto_Tb>(rptGrid,
                                                                                projetoBLL.GetProjetosFiltro(null, idEmpresa, null, null, null, order,
                                                                                                             Katapoka.Core.WebControlBind.PaginaAtual * Katapoka.Core.WebControlBind.QtdRegistrosPagina,
                                                                                                             Katapoka.Core.WebControlBind.QtdRegistrosPagina),
                                                                                Katapoka.Core.WebControlBind.PaginaAtual,
                                                                                Katapoka.Core.WebControlBind.QtdRegistrosPagina,
                                                                                Katapoka.Core.WebControlBind.TotalRegistros,
                                                                                null,
                                                                                PopularDropDownListOrdernacao,
                                                                                null);
            return(rptGrid);
        }
    }
Esempio n. 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);
    }
Esempio n. 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Katapoka.BLL.Autenticacao.Usuario.UsuarioAtual == null)
        {
            Response.Redirect("~/Default.aspx");
        }

        string hashLogin = Katapoka.BLL.Autenticacao.Usuario.UsuarioAtual.DsHashLogin;

        this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "HashLogin", string.Format("var hashLogin = '******';", hashLogin), true);
        lock (usuariosOnline)
        {
            if (usuariosOnline.Where(p => p == hashLogin).Count() == 0)
            {
                usuariosOnline.Add(hashLogin);
            }
        }
        //Join ajax reverso
        Katapoka.AjaxReverso.ClientAdapter.Instance.Join(hashLogin);

        if (Request.QueryString["pid"] == null)
        {
            Response.Redirect("~/Default.aspx");
        }

        int idProjeto = 0;

        if (!Int32.TryParse(Request.QueryString["pid"].ToString(), out idProjeto))
        {
            Response.Redirect("~/Default.aspx");
        }
        Katapoka.DAO.Projeto_Tb projetoTb = new Katapoka.BLL.Projeto.ProjetoBLL().GetById(idProjeto);

        Katapoka.BLL.Atividade.AtividadeBLL.StatusAtividade?statusAtividade = null;
        if (Request.QueryString["status"] != null)
        {
            statusAtividade = (Katapoka.BLL.Atividade.AtividadeBLL.StatusAtividade?)Enum.Parse(typeof(Katapoka.BLL.Atividade.AtividadeBLL.StatusAtividade), Request.QueryString["status"]);
        }
        else
        {
            statusAtividade = Katapoka.BLL.Atividade.AtividadeBLL.StatusAtividade.Ativa;
        }

        using (Katapoka.BLL.Atividade.AtividadeBLL atividadeBLL = new Katapoka.BLL.Atividade.AtividadeBLL())
        {
            atividades = atividadeBLL.GetFiltroQueryAtividades(null, idProjeto, null, null, null, null, null, Katapoka.BLL.Atividade.AtividadeBLL.OrdenacaoAtividade.IdC, statusAtividade);
            rptAtividades.DataSource = atividades
                                       .Where(p => p.IdAtividadePredecessora == null).ToList();
            rptAtividades.DataBind();
        }

        bool ExibirSugeridas = atividades.Count == 0 && Request.QueryString["sugeridas"] != null && Convert.ToBoolean(Request.QueryString["sugeridas"].ToString());

        if (ExibirSugeridas)
        {
            using (Katapoka.BLL.Atividade.TipoAtividadeBLL tipoAtividadeBLL = new Katapoka.BLL.Atividade.TipoAtividadeBLL())
            {
                atividadesSugeridas = tipoAtividadeBLL.GetTipoAtividadePorTipoProjeto(projetoTb.IdTipoProjeto);
                rptAtividadesSugeridas.DataSource = atividadesSugeridas.Where(p => p.IdTipoAtividadePredecessora == null).ToList();
                rptAtividadesSugeridas.DataBind();
                rptAtividades.Visible = rptAtividades.Items.Count > 0;
            }
        }

        ltrNomeProjeto.Text = string.Format("Projeto: {0} - Código: #{1}", projetoTb.DsNome, projetoTb.DsCodigoReferencia);

        this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Tags", string.Format("var tags = {0};", JsonConvert.SerializeObject(tags)), true);
        this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Usuarios", string.Format("var usuarios = {0};", JsonConvert.SerializeObject(usuarios)), true);
        this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "UsuariosSugeridos", string.Format("var usuariosSugeridos = {0};", JsonConvert.SerializeObject(usuariosSugeridos)), true);
        this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "IdProjeto", "var IdProjeto = " + idProjeto.ToString() + ";", true);
        this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Lid", "var LocalIdCounter = " + IdIncremento.ToString() + ";", true);
    }