コード例 #1
0
        public CustomActionResult <MessageItem> deleteagenda_servico(AgendaServico agendaservico)
        {
            MessageItem      m             = new MessageItem();
            AgendaServicoDAO agendaservDAO = new AgendaServicoDAO();

            if (!agendaservDAO.Delete(agendaservico))
            {
                m.Code = "500";
                return(GetResultBadRequest(m));
            }
            else
            {
                m.Code = "200";
                return(GetResultOK(m));
            }
        }
コード例 #2
0
        private async void btn_Agendar_Servico_Click(object sender, RoutedEventArgs e)
        {
            NumeroOrcamento = txt_NumeroOrcamento.Text;
            string MyConString = "SERVER=localhost;DATABASE=Gessoft;UID=root;PASSWORD=vegas;";

            try
            {
                MySqlConnection connection = new MySqlConnection(MyConString);
                MySqlCommand    command    = connection.CreateCommand();
                MySqlDataReader Reader;
                command.CommandText = "select * from agendaServico where cdOrcamento = '" + NumeroOrcamento + "';";
                connection.Open();
                Reader = command.ExecuteReader();

                while (Reader.Read())
                {
                    cdNumS2      = (Reader.GetInt16("numS"));
                    ClienteID    = (Reader.GetString("cdCliente"));
                    Descricao    = (Reader.GetString("Descricao"));
                    PegueiStatus = (Reader.GetString("cdStatus"));


                    //Data = (Reader.GetString("CPF"));
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Erro de comandos:" + ex.Message);
            }
            if (cdNumS2 == 0)
            {
                MessageDialog MessageDialog = new MessageDialog("Numero de orçamento invalido.", "Gessoft");
                await MessageDialog.ShowAsync();

                txt_NumeroOrcamento.Text = "";
            }



//=================================================================================================================================
//==================================================================================== Doidera minha acima cuidado ======================
            Model.AgendaServico NovoServico = new Model.AgendaServico();

            // Falta cadastrar a data de agendamento...

            AgendaServicoDAO DA = new AgendaServicoDAO();

            NovoServico.CdServico     = txt_NumeroServico.Text;
            NovoServico.Descricao     = txt_Descricao_Servico.Text;
            NovoServico.CodigoCliente = Convert.ToInt16(Gambis.BadCodigo);
            // Um endereço por cliente.
            NovoServico.CodigoEndereco = 1;
            //NovoServico.CodigoUsuario = null;

            TextBlock BlocoMes;

            BlocoMes = (TextBlock)cmbMes.SelectedItem;
            String SelecMes = BlocoMes.Text;

            if (SelecMes == "Janeiro")
            {
                ContMes = 1;
            }
            else if (SelecMes == "Fevereiro")
            {
                ContMes = 2;
            }
            else if (SelecMes == "Março")
            {
                ContMes = 3;
            }
            else if (SelecMes == "Abril")
            {
                ContMes = 4;
            }
            else if (SelecMes == "Maio")
            {
                ContMes = 5;
            }
            else if (SelecMes == "Junho")
            {
                ContMes = 6;
            }
            else if (SelecMes == "Julho")
            {
                ContMes = 7;
            }
            else if (SelecMes == "Agosto")
            {
                ContMes = 8;
            }
            else if (SelecMes == "Setembro")
            {
                ContMes = 9;
            }
            else if (SelecMes == "Outubro")
            {
                ContMes = 10;
            }
            else if (SelecMes == "Novembro")
            {
                ContMes = 11;
            }
            else if (SelecMes == "Dezembro")
            {
                ContMes = 12;
            }

            NovoServico.Mes = ContMes.ToString();

            TextBlock BlocoAno;

            BlocoAno = (TextBlock)cmbAno.SelectedItem;
            String SelecAno = BlocoAno.Text;

            NovoServico.Ano = SelecAno;

            TextBlock BlocoDia;

            BlocoDia = (TextBlock)cmbDia.SelectedItem;
            String SelecDia = BlocoDia.Text;

            if (SelecAno == "" || ContMes == 0 || SelecDia == "")
            {
                MessageDialog MessageDialog1 = new MessageDialog("Selecione alguma data para agendamento.", "Gessoft");
                await MessageDialog1.ShowAsync();
            }
            else
            {
                NovoServico.Dia = SelecDia;

                int barao = Convert.ToInt16(PegueiStatus);
                barao++;
                NovoServico.CdStatus    = barao.ToString();
                NovoServico.CdOrcamento = NumeroOrcamento;

                DA.UpDateOrcamento(NovoServico);
                DA.NovoCadastroServico(NovoServico);

                MessageDialog MessageDialog = new MessageDialog("Serviço Agendado com sucesso.", "Gessoft");
                await MessageDialog.ShowAsync();
            }
        }
コード例 #3
0
        private async void btn_Agendar_Orcamento_Click(object sender, RoutedEventArgs e)
        {
            if ((cmbDia.SelectedIndex == -1) || (cmbMes.SelectedIndex == -1) || (cmbAno.SelectedIndex == -2))
            {
                MessageDialog MessageDialog1 = new MessageDialog("Selecione alguma data para agendamento.", "Gessoft");
                await MessageDialog1.ShowAsync();
            }
            else if ((txt_Cliente_ID.Text == "") || (txt_Descricao_Servico.Text == "") || (txt_Medida.Text == "") || (cmb_Ambiente.SelectedIndex == -1) || (cmb_Material.SelectedIndex == -1))
            {
                MessageDialog MessageDialog3 = new MessageDialog("Preencha todos os campos.", "Gessoft");
                await MessageDialog3.ShowAsync();
            }
            else
            {
                Model.AgendaServico NovoOrcamento = new Model.AgendaServico();

                // Falta cadastrar a data de agendamento...

                AgendaServicoDAO DA = new AgendaServicoDAO();

                NovoOrcamento.CdOrcamento   = txt_NumeroOrcamento.Text;
                NovoOrcamento.Descricao     = txt_Descricao_Servico.Text;
                NovoOrcamento.CodigoCliente = Convert.ToInt16(Gambis.BadCodigo);
                // Um endereço por cliente.
                NovoOrcamento.CodigoEndereco = 1;
                //NovoServico.CodigoUsuario = null;

                TextBlock BlocoMes;
                BlocoMes = (TextBlock)cmbMes.SelectedItem;
                String SelecMes = BlocoMes.Text;

                if (SelecMes == "Janeiro")
                {
                    ContMes = 1;
                }
                else if (SelecMes == "Fevereiro")
                {
                    ContMes = 2;
                }
                else if (SelecMes == "Março")
                {
                    ContMes = 3;
                }
                else if (SelecMes == "Abril")
                {
                    ContMes = 4;
                }
                else if (SelecMes == "Maio")
                {
                    ContMes = 5;
                }
                else if (SelecMes == "Junho")
                {
                    ContMes = 6;
                }
                else if (SelecMes == "Julho")
                {
                    ContMes = 7;
                }
                else if (SelecMes == "Agosto")
                {
                    ContMes = 8;
                }
                else if (SelecMes == "Setembro")
                {
                    ContMes = 9;
                }
                else if (SelecMes == "Outubro")
                {
                    ContMes = 10;
                }
                else if (SelecMes == "Novembro")
                {
                    ContMes = 11;
                }
                else if (SelecMes == "Dezembro")
                {
                    ContMes = 12;
                }

                NovoOrcamento.Mes = ContMes.ToString();

                TextBlock BlocoAno;
                BlocoAno = (TextBlock)cmbAno.SelectedItem;
                String SelecAno = BlocoAno.Text;

                NovoOrcamento.Ano = SelecAno;

                TextBlock BlocoDia;
                BlocoDia = (TextBlock)cmbDia.SelectedItem;
                String SelecDia = BlocoDia.Text;

                NovoOrcamento.Dia = SelecDia;

                DA.NovoCadastroOrcamento(NovoOrcamento);

                MessageDialog MessageDialog2 = new MessageDialog("Orçamento agendado com sucesso.", "Gessoft");
                await MessageDialog2.ShowAsync();
            }
        }