public IActionResult AdicionarDemanda(Demandas demanda)
        {
            demanda.DataAbertura = System.DateTime.Now;
            _painelControleServices.AdicionarDemanda(demanda);

            return(RedirectToAction("Retorno"));
        }
        protected void BtnEnviarDemadna_Click(object sender, EventArgs e)
        {
            Demandas d = new Demandas();

            d = d.PesquisaDemandaPorID(int.Parse(TxIdDemanda.Text));

            TxDataCadastro.Text = d.DataCadastro;
            TxDataCadastro.ReadOnly = true;

            if (d.DataInicio != null)
            {
                TxIniciada.Text = d.DataInicio;
                TxIniciada.ReadOnly = true;
            }
            else
            {
                TxIniciada.Text = "";
                TxIniciada.ReadOnly = false;
            }

            if (d.DataFinalizada != null)
            {
                TxFinalizada.Text = d.DataFinalizada;
                TxFinalizada.ReadOnly = true;
                LinkAtualizar.Enabled = false;
            }
            else
            {
                LinkAtualizar.Enabled = true;
                TxFinalizada.Text = "";
            }
        }
 protected void cbSetor_SelectedIndexChanged(object sender, EventArgs e)
 {
     Demandas d = new Demandas();
     cbDemanda.DataSource = d.RetornaDemandaPorSetor(int.Parse(cbSetor.SelectedValue));
     cbDemanda.DataTextField = "DESCRICAO";
     cbDemanda.DataValueField = "ID";
     cbDemanda.DataBind();
 }
        public Demandas AlterarDataTermino(int id, DateTime dtTermino)
        {
            Demandas demanda = _ProjectContext.TB_Demanda.AsEnumerable().Where(x => id == x.Id).FirstOrDefault();

            demanda.DataTermino = DateTime.Now;
            _ProjectContext.Update(demanda);
            _ProjectContext.SaveChanges();
            return(demanda);
        }
        protected void btnPesquisar_Click(object sender, EventArgs e)
        {
            Demandas d = new Demandas();

            int idDemanda = int.Parse(cbDemanda.SelectedValue);
            int idSetor = int.Parse(cbSetor.SelectedValue);

            dtgDadosDemandas.DataSource = d.RetornaDemandasPorSetorDemanda(idDemanda, idSetor);
            dtgDadosDemandas.DataBind();
        }
Example #6
0
 public int AtualizaUsuarioDemanda(Demandas x)
 {
     if (x.DataFinalizada == null)
     {
         return(dbUsuarioDemanda.AtualizaDemandaStatus(DateTime.Parse(x.DataInicio), null, x.StatusDemanda, x.idDemanda));
     }
     else
     {
         return(dbUsuarioDemanda.AtualizaDemandaStatus(DateTime.Parse(x.DataInicio), DateTime.Parse(x.DataFinalizada), x.StatusDemanda, x.idDemanda));
     }
 }
Example #7
0
        public bool IncluirDemanda(Demandas x)
        {
            try
            {
                dbDemandas.InserirDemanda(x.IdTipoDemanda, x.LogradouroDemanda, x.NumeroDemanda, x.ComplementoDemanda, x.BairroDemanda, x.DescricaoDemanda);
                return(true);
            }
            catch (Exception)
            {
                return(false);

                throw;
            }
            finally
            {
                dbDemandas.Connection.Close();
            }
        }
Example #8
0
        protected void BtnConfirmar_Click(object sender, EventArgs e)
        {
            int i = 0;

            Demandas d = new Demandas();

            if (TxBairroOcorrencia.Text.Equals(""))
            {
                TxBairroOcorrencia.BackColor = Color.Yellow;
                i++;
            }
            if (TxNumeroOcorrencia.Text.Equals(""))
            {
                TxNumeroOcorrencia.BackColor = Color.Yellow;
                i++;
            }
            if (TxDescricaoDetalhada.Text.Equals(""))
            {
                TxDescricaoDetalhada.BackColor = Color.Yellow;
                i++;
            }
            if (TxLogradouroOcorrencia.Text.Equals(""))
            {
                TxLogradouroOcorrencia.BackColor = Color.Yellow;
                i++;
            }

            if (i > 0)
            {
                Response.Write("<script LANGUAGE='JavaScript' >alert('Preencha os campos faltosos')</script>");
            }
            else
            {
                d.BairroDemanda      = TxBairroOcorrencia.Text.ToUpper();
                d.ComplementoDemanda = TxComplementoOcorrencia.Text.ToUpper();
                d.DescricaoDemanda   = TxDescricaoDetalhada.Text.ToUpper();
                d.IdTipoDemanda      = int.Parse(cbServicos.SelectedValue);
                d.LogradouroDemanda  = TxLogradouroOcorrencia.Text.ToUpper();
                d.NumeroDemanda      = int.Parse(TxNumeroOcorrencia.Text);
                d.InserirDemanda(d, LbCPFLogin.Text);
                Page_Load(sender, e);
            }
        }
        protected void LinkAtualizar_Click(object sender, EventArgs e)
        {
            Demandas d = new Demandas();

            d.idDemanda = int.Parse(TxIdDemanda.Text);

            if (!TxIniciada.Text.Equals(""))
            {
                d.DataInicio = TxIniciada.Text;
            }

            if (!TxFinalizada.Text.Equals(""))
            {
                d.DataFinalizada = TxFinalizada.Text;
                d.StatusDemanda = true;
            }

            if (TxIniciada.Text.Equals(""))
                Response.Write("<script LANGUAGE='JavaScript' >alert('Preencha os campos faltosos')</script>");
            else
                d.AtualizarUsuarioDemanda(d);

            ObjPesquisa_Load(sender, e);
        }
Example #10
0
        public Demandas PesquisaDemandaPorID(int iddemanda)
        {
            Demandas x = new Demandas();

            DataRow LinhaTabela = dbUsuarioDemanda.RetornaDemandaCadastradaPorID(iddemanda).Rows[0];

            x.DataCadastro = DateTime.Parse(LinhaTabela["DATACADASTRO"].ToString()).ToShortDateString();

            var aux = LinhaTabela["DATAINICIO"].ToString();

            if (!aux.Equals(""))
            {
                x.DataInicio = DateTime.Parse(LinhaTabela["DATAINICIO"].ToString()).ToShortDateString();
            }

            aux = LinhaTabela["DATAFIM"].ToString();

            if (!aux.Equals(""))
            {
                x.DataFinalizada = LinhaTabela["DATAFIM"].ToString();
            }

            return(x);
        }
 public void AdicionarDemanda(Demandas demandas)
 {
     _ProjectContext.Add(demandas);
     _ProjectContext.SaveChanges();
 }
        public Demandas FindById(int id)
        {
            Demandas retorno = _ProjectContext.TB_Demanda.Include(a => a.Cliente).Where(x => x.Id == id).FirstOrDefault();

            return(retorno);
        }