public ActionResult ListarAgenda(string start, string end, int?id_marca, int?id_colecao, int?id_cliente, int?id_cidade, int?id_grupo, string tp_status)
        {
            //código para trazer os eventos do mês
            DateTime dataInicial = Convert.ToDateTime(start);
            DateTime dataFinal   = Convert.ToDateTime(end);

            if ((dataInicial - dataFinal).TotalDays > -2)
            {
                dataFinal = dataInicial;
            }

            List <Agendamento> eventosDb = AgendamentoDAL.GetAgendaEventos(Convert.ToInt64(UsuarioLogado.IdConta), dataInicial.Ticks, dataFinal.Ticks, id_marca, id_colecao, id_cliente, id_cidade, id_grupo).ToList();

            var obj = new List <int>();

            obj.Add(eventosDb.Count());

            /* obj.Add(eventosDb.Count(item => (item.tp_status == 1)));
             * obj.Add(eventosDb.Count(item => (item.tp_status == 2)));
             * obj.Add(eventosDb.Count(item => (item.tp_status == 3)));
             * obj.Add(eventosDb.Count(item => (item.tp_status == 4)));*/

            var eventos = from e in eventosDb ?? new List <Agendamento>()
                          select new
            {
                e.id,
                dt_agenda = e.dt_agenda.ToString().Substring(0, 10).Trim(),
                hr_agenda = e.hr_agenda.Substring(0, 5).Trim(),
                // e.vl_servico,
                e.nm_cliente,
                e.nm_colecao,
                e.nm_marca,
                e.cliente,
                e.colecao,
                e.marca,
                e.tp_status,
                e.status_cliente,
                e.realizado,
                e.metacolecaoatual,
                atendeshowroom = e.atendeshowroom ? "SIM" : "NÃO",
                reservasuite   = e.reservasuite? "SIM" : "NÃO",
                clientenovo    = e.clientenovo ? "SIM" : "NÃO",
                //  e.sessao_atual,
                title  = e.nm_cliente,              //e.hr_agenda.Substring(0, 5).Trim() + " " +
                start  = new DateTime((e.dt_agenda ?? DateTime.MinValue).Year, (e.dt_agenda ?? DateTime.MinValue).Month, (e.dt_agenda ?? DateTime.MinValue).Day, TimeSpan.Parse(e.hr_agenda).Hours, TimeSpan.Parse(e.hr_agenda).Minutes, TimeSpan.Parse(e.hr_agenda).Seconds).ToString("s"),
                end    = new DateTime((e.dt_agenda ?? DateTime.MinValue).Year, (e.dt_agenda ?? DateTime.MinValue).Month, (e.dt_agenda ?? DateTime.MinValue).Day, TimeSpan.Parse(e.hr_agenda).Hours, TimeSpan.Parse(e.hr_agenda).Minutes, TimeSpan.Parse(e.hr_agenda).Seconds).AddHours(0.5).ToString("s"),
                color  = e.cor_marca,
                Totais = obj
            };

            return(Json(eventos.ToList(), JsonRequestBehavior.AllowGet));
        }
        public ActionResult ListarAgendaGeral()
        {
            ListaAgendaViewModel model = new ListaAgendaViewModel();

            //código para trazer os eventos do mês
            DateTime dataInicial = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            DateTime dataFinal   = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month));

            model.DataInicio = dataInicial.ToString("dd/MM/yyyy");
            model.DataFinal  = dataFinal.ToString("dd/MM/yyyy");

            List <Agendamento> eventosDb = AgendamentoDAL.GetAgendaEventos(Convert.ToInt64(UsuarioLogado.IdConta), dataInicial.Ticks, dataFinal.Ticks, 0, 0, 0, 0, 0).Where(item => !(item.tp_status == 999)).ToList();

            model.ListarAgenda = eventosDb;

            return(View(model));
        }
        public ActionResult ListarAgendaGeral(ListaAgendaViewModel obj)
        {
            string   dtInicio = obj.DataInicio;
            string   dtFinal  = obj.DataFinal;
            DateTime dataInicial;
            DateTime dataFinal;

            if (string.IsNullOrEmpty(dtInicio))
            {
                dataInicial = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            }
            else
            {
                dataInicial = Convert.ToDateTime(dtInicio);
            }

            if (string.IsNullOrEmpty(dtFinal))
            {
                dataFinal = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month));
            }
            else
            {
                dataFinal = Convert.ToDateTime(dtFinal);
            }

            ListaAgendaViewModel model = new ListaAgendaViewModel();

            model.filtro_colecao    = obj.filtro_colecao;
            model.filtro_nm_colecao = obj.filtro_nm_colecao;
            model.filtro_marca      = obj.filtro_marca;
            model.filtro_nm_marca   = obj.filtro_nm_marca;
            model.filtro_cliente    = obj.filtro_cliente;
            model.filtro_nm_cliente = obj.filtro_nm_cliente;

            model.DataInicio = obj.DataInicio;
            model.DataFinal  = obj.DataFinal;

            List <Agendamento> eventosDb = AgendamentoDAL.GetAgendaEventos(Convert.ToInt64(UsuarioLogado.IdConta), dataInicial.Ticks, dataFinal.Ticks, model.filtro_marca, model.filtro_colecao, model.filtro_cliente, 0, 0).
                                           Where(item => !(item.tp_status == 999)).ToList();

            model.ListarAgenda = eventosDb;

            return(View("ListarAgendaGeral", model));
        }
Пример #4
0
        private void copnsultadadosAgendados()
        {
            try
            {
                var DadosBanco = new AgendamentoDAL().ListaAgendamento();
                DGVDADOS.DataSource = null;
                //ECLUIR COLUNAS EXISTENTES
                DGVDADOS.Columns.Clear();
                //adiconar colunas

                DGVDADOS.DataSource = DadosBanco;
                Add_ColunaMenuTarefasAgendados();
                MontarGridAgendamento();
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show("Erro: " + ex.Message + ex.StackTrace);
            }
        }
Пример #5
0
        private void BtnPesquisarData_Click(object sender, EventArgs e)
        {
            try
            {
                var DadosBanco = new AgendamentoDAL().ListaAgendamento(dataPesquisar.Value);
                DGVDADOS.DataSource = null;
                //ECLUIR COLUNAS EXISTENTES
                DGVDADOS.Columns.Clear();
                //adiconar colunas

                DGVDADOS.DataSource = DadosBanco;
                Add_ColunaMenuTarefasAgendados();
                MontarGridAgendamento();
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show("Erro: " + ex.Message + ex.StackTrace);
            }
        }
Пример #6
0
        public bool UpdateFina(Agendamento_Estetica P)
        {
            bool           atualizou = false;
            AgendamentoDAL pDAL      = new AgendamentoDAL();

            //if (P.Id == 0)
            //{
            //    throw new Exception("Selecione uma pessoa para atualizar.");
            //}

            if (pDAL.UpdateFinalizado(P) > 0)
            {
                //Este IF verificará se o retorno do método será maior que 0,
                //ou seja, se a atualização foi feita pela classe que acessa o Banco
                //se sim vai mudar para TRUE a variável e retornar para quem chamou este método.
                atualizou = true;
            }
            return(atualizou);
        }
Пример #7
0
        private void editarAgendamentoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                FrmNovoAgendamento frm = new FrmNovoAgendamento();
                if (DGVDADOS.SelectedRows.Count > 0)
                {
                    var DadosAgendados = new AgendamentoDAL().Agendamento(Convert.ToInt32(DGVDADOS.SelectedRows[0].Cells["ID"].Value));
                    if (DadosAgendados.ID > 0)
                    {
                        frm.iDTextBox.Text   = DadosAgendados.ID.ToString();
                        frm.nOMETextBox.Text = DadosAgendados.NOME.ToString();
                        if (DadosAgendados.EMAIL != null)
                        {
                            frm.EMAILtextBox.Text = DadosAgendados.EMAIL.ToString();
                        }
                        if (DadosAgendados.TELEFONE != null)
                        {
                            frm.TELEFONEtextBox.Text = DadosAgendados.TELEFONE.ToString();
                        }

                        frm.BtnSalvaradm_modulo.Text = "ALTERAR";
                        frm.ShowDialog();

                        //atualiza a grid
                        //Dados da tabela de agendamento
                        copnsultadadosAgendados();
                        radioINSTALCAO.Checked = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBoxEx.Show("Erro: " + ex.Message + ex.StackTrace);
            }
        }
Пример #8
0
        public Agendamento_Estetica FindByIdAgendamento(int id)
        {
            AgendamentoDAL pDAL = new AgendamentoDAL();

            return(pDAL.FindByIdAgendamento(id));
        }
Пример #9
0
        public List <Agendamento_Estetica> FindAll()
        {
            AgendamentoDAL aDAL = new AgendamentoDAL();

            return(aDAL.FindAll());
        }
Пример #10
0
        public List <Agendamento_Estetica> FindClienteAgen()
        {
            AgendamentoDAL dal = new AgendamentoDAL();

            return(dal.FindClienteAgen());
        }