Exemplo n.º 1
0
        private void lstOcorrencia_SelectedIndex(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            try
            {
                string vl_select = lstOcorrencia.SelectedItems[0].Text;
                nr_OcorrenciaSelecionada = vl_select;
            }
            catch
            {
                nr_OcorrenciaSelecionada = "0";
            }
            lblProblema.Visible = true;
            clsOcorrencias objOcorrencia = new clsOcorrencias();

            objOcorrencia.Nr_ocorrencia = Convert.ToInt32(nr_OcorrenciaSelecionada);
            MySqlDataReader sql_dr = objOcorrencia.getOcorrenciasByID();

            if (sql_dr.Read())
            {
                objOcorrencia.Ds_Defeito      = sql_dr["ds_defeito"].ToString();
                objOcorrencia.Dt_entrada      = Convert.ToDateTime(sql_dr["dt_entrada"].ToString());
                objOcorrencia.Id_departamento = Convert.ToInt32(sql_dr["id_departamento"].ToString());
                objOcorrencia.Id_usuario      = Convert.ToInt32(sql_dr["id_usuario"].ToString());
                objOcorrencia.Nm_maquina      = sql_dr["nm_maquina"].ToString();
            }
            lblProblema.Text = objOcorrencia.Ds_Defeito;
        }
Exemplo n.º 2
0
        private void CarregarOS()
        {
            clsOcorrencias objOcorrencia = new clsOcorrencias();

            objOcorrencia.Nr_ocorrencia = nr_ocorrenciaLocal;
            MySqlDataReader sql_dr = objOcorrencia.getOcorrenciasByID();

            if (sql_dr.Read())
            {
                objOcorrencia.Ds_Defeito      = sql_dr["ds_defeito"].ToString();
                objOcorrencia.Dt_entrada      = Convert.ToDateTime(sql_dr["dt_entrada"].ToString());
                objOcorrencia.Id_departamento = Convert.ToInt32(sql_dr["id_departamento"].ToString());
                objOcorrencia.Id_usuario      = Convert.ToInt32(sql_dr["id_usuario"].ToString());
                objOcorrencia.Nm_maquina      = sql_dr["nm_maquina"].ToString();
                objOcorrencia.Patrimonio_os   = sql_dr["patrimonio_os"].ToString();
            }
            txtDefeito.Text    = objOcorrencia.Ds_Defeito;
            txtMaquina.Text    = objOcorrencia.Nm_maquina;
            txtPatrimonio.Text = objOcorrencia.Patrimonio_os;
            clsDepartamento objDept = new clsDepartamento();

            objDept.Id_departamento = objOcorrencia.Id_departamento;
            objDept.carregarDeptByID();
            cmbDepartamento.Text = objDept.Nm_departamento;
            carregarDepartamentos();
        }
Exemplo n.º 3
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            if (ocorrenciaLocal != 0)
            {
                clsOcorrencias objOcorrencia = new clsOcorrencias();
                objOcorrencia.Nr_ocorrencia = ocorrenciaLocal;
                MySqlDataReader sql_dr = objOcorrencia.getOcorrenciasByID();

                if (sql_dr.Read())
                {
                    objOcorrencia.Ds_Defeito      = sql_dr["ds_defeito"].ToString();
                    objOcorrencia.Dt_entrada      = Convert.ToDateTime(sql_dr["dt_entrada"].ToString());
                    objOcorrencia.Id_departamento = Convert.ToInt32(sql_dr["id_departamento"].ToString());
                    objOcorrencia.Id_usuario      = Convert.ToInt32(sql_dr["id_usuario"].ToString());
                    objOcorrencia.Nm_maquina      = sql_dr["nm_maquina"].ToString();

                    objOcorrencia.Nm_retirante = txtRetirante.Text;
                    objOcorrencia.Dt_saida     = Convert.ToDateTime(txtSaida.Text);
                    objOcorrencia.Ds_solucao   = txtSolucao.Text;
                    objOcorrencia.Ds_status    = cmbStatus.Text;
                    objOcorrencia.update();
                    MessageBox.Show(objOcorrencia.ds_msg);
                    this.Close();
                }
            }
        }
Exemplo n.º 4
0
        private void CarregarCampos(int nr_ocorrencia)
        {
            clsOcorrencias objOcorrencia = new clsOcorrencias();

            objOcorrencia.Nr_ocorrencia = nr_ocorrencia;
            MySqlDataReader sql_dr = objOcorrencia.getOcorrenciasByID();

            if (sql_dr.Read())
            {
                txtSolucao.Text = sql_dr["DS_SOLUCAO"].ToString();
            }
        }
Exemplo n.º 5
0
        private void CarregarOS()
        {
            clsOcorrencias objOcorrencia = new clsOcorrencias();

            objOcorrencia.Nr_ocorrencia = nr_ocorrenciaLocal;
            MySqlDataReader sql_dr = objOcorrencia.getOcorrenciasByID();

            if (sql_dr.Read())
            {
                objOcorrencia.Ds_Defeito      = sql_dr["ds_defeito"].ToString();
                objOcorrencia.Dt_entrada      = Convert.ToDateTime(sql_dr["dt_entrada"].ToString());
                objOcorrencia.Id_departamento = Convert.ToInt32(sql_dr["id_departamento"].ToString());
                objOcorrencia.Id_usuario      = Convert.ToInt32(sql_dr["id_usuario"].ToString());
                objOcorrencia.Nm_maquina      = sql_dr["nm_maquina"].ToString();
            }
            txtMaquina.Text = objOcorrencia.Nm_maquina;
        }
Exemplo n.º 6
0
 public FRM_EmitirQRCode(int nrOcorrencia)
 {
     InitializeComponent();
     Zen.Barcode.CodeQrBarcodeDraw qrcode = Zen.Barcode.BarcodeDrawFactory.CodeQr;
     if (nrOcorrencia == 0)
     {
         //pegar a ultima ocorrencia cadastrada
         clsOcorrencias objOcorrencia = new clsOcorrencias();
         objOcorrencia.getLastOcorrencia();
         if (!Equals(objOcorrencia.ds_msg, ""))
         {
             MessageBox.Show(objOcorrencia.ds_msg);
         }
         else
         {
             nr_os = objOcorrencia.Nr_ocorrencia;
         }
         clsDepartamento objDept = new clsDepartamento();
         objDept.Id_departamento = objOcorrencia.Id_departamento;
         objDept.carregarDeptByID();
         //conseguir colocar mais info junto com o link
         pictureBox1.Image = qrcode.Draw("LINK DO SITE" + objOcorrencia.Nr_ocorrencia, 50);
     }
     else
     {
         //pegar a ocorencia pelo id(nrOcorrencia)
         clsOcorrencias objOcorrencia = new clsOcorrencias();
         objOcorrencia.Nr_ocorrencia = nrOcorrencia;
         objOcorrencia.getOcorrenciasByID();
         if (!Equals(objOcorrencia.ds_msg, ""))
         {
             MessageBox.Show(objOcorrencia.ds_msg);
         }
         else
         {
             nr_os = nrOcorrencia;
         }
         clsDepartamento objDept = new clsDepartamento();
         objDept.Id_departamento = objOcorrencia.Id_departamento;
         objDept.carregarDeptByID();
         pictureBox1.Image = qrcode.Draw("LINK DO SITE" + objOcorrencia.Nr_ocorrencia, 50);
     }
     CarregarImpressoras();
 }
Exemplo n.º 7
0
 private void btnGravar_Click(object sender, EventArgs e)
 {
     if (!Equals(txtMaquina, ""))
     {
         clsOcorrencias objOcorrencia = new clsOcorrencias();
         objOcorrencia.Nr_ocorrencia = nr_ocorrenciaLocal;
         MySqlDataReader sql_dr = objOcorrencia.getOcorrenciasByID();
         if (sql_dr.Read())
         {
             objOcorrencia.Ds_Defeito      = sql_dr["ds_defeito"].ToString();
             objOcorrencia.Dt_entrada      = Convert.ToDateTime(sql_dr["dt_entrada"].ToString());
             objOcorrencia.Id_departamento = Convert.ToInt32(sql_dr["id_departamento"].ToString());
             objOcorrencia.Id_usuario      = Convert.ToInt32(sql_dr["id_usuario"].ToString());
             objOcorrencia.Nm_maquina      = sql_dr["nm_maquina"].ToString();
             objOcorrencia.Ds_solucao      = sql_dr["ds_solucao"].ToString();
             objOcorrencia.Ds_status       = "ENTREGUE";
             objOcorrencia.Nm_retirante    = txtRetirante.Text;
             objOcorrencia.Dt_saida        = DateTime.Today;
             objOcorrencia.remove();
             MessageBox.Show(objOcorrencia.ds_msg);
             this.Close();
         }
     }
 }
Exemplo n.º 8
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            if (ocorrenciaLocal != 0)
            {
                clsOcorrencias objOcorrencia = new clsOcorrencias();
                objOcorrencia.Nr_ocorrencia = ocorrenciaLocal;
                MySqlDataReader sql_dr = objOcorrencia.getOcorrenciasByID();

                if (sql_dr.Read())
                {
                    objOcorrencia.Ds_Defeito      = sql_dr["ds_defeito"].ToString();
                    objOcorrencia.Dt_entrada      = Convert.ToDateTime(sql_dr["dt_entrada"].ToString());
                    objOcorrencia.Id_departamento = Convert.ToInt32(sql_dr["id_departamento"].ToString());
                    objOcorrencia.Id_usuario      = Convert.ToInt32(sql_dr["id_usuario"].ToString());
                    objOcorrencia.Nm_maquina      = sql_dr["nm_maquina"].ToString();
                    objOcorrencia.Ds_solucao      = txtSolucao.Text;
                    objOcorrencia.Ds_status       = cmbStatus.Text;
                    objOcorrencia.update();
                    MessageBox.Show(objOcorrencia.ds_msg);
                    if (ckbEmail.Checked)
                    {
                        clsResponsaveis objResp    = new clsResponsaveis();
                        MySqlDataReader sql_dtr    = objResp.getRespByIdDept(objOcorrencia.Id_departamento);
                        clsUsuario      objUsuario = new clsUsuario();
                        sql_dtr.Read();
                        try
                        {
                            objUsuario.Id_usuario = Convert.ToInt32(sql_dtr["id_usuario"].ToString());
                            objUsuario.getUserById();
                            System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
                            client.Host      = "SMTP";
                            client.Port      = 587;
                            client.EnableSsl = false;
                            //credenciais de login
                            client.Credentials = new System.Net.NetworkCredential("SEU EMAIL", "SUA SENHA");
                            MailMessage mail = new MailMessage();
                            //mail.Sender = new System.Net.Mail.MailAddress("*****@*****.**", "Departamento de TI");
                            //de quem
                            mail.From = new MailAddress("SEU EMAIL");
                            //para quem
                            mail.To.Add(new MailAddress(objUsuario.email));
                            mail.To.Add(new MailAddress("EMAIL A RECEBER 2"));
                            //assunto
                            mail.Subject = "Status da máquina " + objOcorrencia.Nm_maquina + " atualizado.";
                            //corpo do email
                            string status = cmbStatus.Text.ToLower();
                            status = char.ToUpper(status[0]) + status.Substring(1);
                            string solucao = txtSolucao.Text.ToLower();
                            solucao   = char.ToUpper(solucao[0]) + solucao.Substring(1);
                            mail.Body = "Olá " + objUsuario.Nm_Usuario + " aqui é do Departamento de TI! Vimos informar que o status da ocorrência " + objOcorrencia.Nr_ocorrencia + " refente a máquina " + objOcorrencia.Nm_maquina + " é: " + status + ".\nAssentamento: " + solucao + "\n";
                            if (Equals(cmbStatus.Text, "AGUARDANDO RETIRADA"))
                            {
                                mail.Body += "\nEstamos aguardando no departamento de TI para a reirada da mesma.";
                            }
                            mail.IsBodyHtml = false;
                            mail.Priority   = MailPriority.High;
                            try
                            {
                                client.Send(mail);
                            }
                            catch (System.Exception erro)
                            {
                                MessageBox.Show(erro.ToString());
                            }
                            finally
                            {
                                mail = null;
                            }
                        }
                        catch
                        {
                            MessageBox.Show("Não existe responsável pelo departamento e questão!");
                        }
                    }
                    this.Close();
                }
            }
        }
Exemplo n.º 9
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (Equals(txtSolucao.Text, "") || Equals(txtMaquina.Text, "") || Equals(txtDefeito.Text, "") || Equals(txtPatrimonio, "") || Equals(cmbDepartamento.Text, ""))
     {
         if (Equals(txtMaquina.Text, ""))
         {
             lblOMaquina.Visible = true;
         }
         else
         {
             lblOMaquina.Visible = false;
         }
         if (Equals(cmbDepartamento.Text, ""))
         {
             lblODept.Visible = true;
         }
         else
         {
             lblODept.Visible = false;
         }
         if (Equals(txtPatrimonio, ""))
         {
             lblOPatr.Visible = true;
         }
         else
         {
             lblOPatr.Visible = false;
         }
         if (Equals(txtSolucao.Text, ""))
         {
             txtMsg.Visible = true;
         }
         else
         {
             txtMsg.Visible = false;
         }
     }
     else if (!Equals(txtSolucao.Text, ""))
     {
         clsProcedimento objProcedimento = new clsProcedimento();
         objProcedimento.Nr_ocorrencia   = nr_ocorrenciaLocal;
         objProcedimento.Ds_Procedimento = txtSolucao.Text;
         objProcedimento.Status_atual    = cmbStatus.Text;
         objProcedimento.insert();
         MessageBox.Show(objProcedimento.ds_msg);
         clsOcorrencias objOcorrencia = new clsOcorrencias();
         objOcorrencia.Nr_ocorrencia = nr_ocorrenciaLocal;
         MySqlDataReader sql_dr = objOcorrencia.getOcorrenciasByID();
         if (sql_dr.Read())
         {
             objOcorrencia.Dt_entrada = Convert.ToDateTime(sql_dr["dt_entrada"].ToString());
             objOcorrencia.Id_usuario = Convert.ToInt32(sql_dr["id_usuario"].ToString());
             objOcorrencia.Nm_maquina = txtMaquina.Text;
             objOcorrencia.Ds_Defeito = txtDefeito.Text;
             if (!Equals(txtPatrimonio.Text, ""))
             {
                 objOcorrencia.Patrimonio_os = txtPatrimonio.Text;
             }
             else
             {
                 objOcorrencia.Patrimonio_os = null;
             }
             objOcorrencia.Ds_solucao = sql_dr["Ds_solucao"].ToString();
             try
             {
                 objOcorrencia.Dt_saida = Convert.ToDateTime(sql_dr["dt_saida"].ToString());
             }
             catch
             {
             }
             //objOcorrencia.Id_departamento = Convert.ToInt32(sql_dr["id_departamento"].ToString());
             clsDepartamento objDept = new clsDepartamento();
             sql_dr = objDept.carregarDeptByName(cmbDepartamento.Text);
             if (sql_dr.Read())
             {
                 objOcorrencia.Id_departamento = Convert.ToInt32(sql_dr["id_departamento"].ToString());
             }
             objOcorrencia.Ds_status = cmbStatus.Text;
             objOcorrencia.update();
             objOcorrencia.MandarHistorico();
             if (ckbEmail.Checked)
             {
                 clsResponsaveis objResp    = new clsResponsaveis();
                 MySqlDataReader sql_dtr    = objResp.getRespByIdDept(objOcorrencia.Id_departamento);
                 clsUsuario      objUsuario = new clsUsuario();
                 sql_dtr.Read();
                 try
                 {
                     objUsuario.Id_usuario = Convert.ToInt32(sql_dtr["id_usuario"].ToString());
                     objUsuario.getUserById();
                     System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
                     client.Host      = "SMTP";
                     client.Port      = 587;
                     client.EnableSsl = false;
                     //credenciais de login
                     client.Credentials = new System.Net.NetworkCredential("SEU EMAIL", "SUA SENHA");
                     MailMessage mail = new MailMessage();
                     //mail.Sender = new System.Net.Mail.MailAddress("*****@*****.**", "Departamento de TI");
                     //de quem
                     mail.From = new MailAddress("SEU EMAIL");
                     //para quem
                     mail.To.Add(new MailAddress(objUsuario.email));
                     mail.To.Add(new MailAddress("EMAIL A RECEBER 2"));
                     //assunto
                     mail.Subject = "Status da máquina " + objOcorrencia.Nm_maquina + " atualizado.";
                     //corpo do email
                     string status = cmbStatus.Text.ToLower();
                     status = char.ToUpper(status[0]) + status.Substring(1);
                     string solucao = txtSolucao.Text.ToLower();
                     solucao   = char.ToUpper(solucao[0]) + solucao.Substring(1);
                     mail.Body = "Olá " + objUsuario.Nm_Usuario + " aqui é do Departamento de TI! Vimos informar que o status da ocorrência " + objOcorrencia.Nr_ocorrencia + " refente a máquina " + objOcorrencia.Nm_maquina + " é: " + status + ".\nAssentamento: " + solucao + "\n";
                     if (Equals(cmbStatus.Text, "AGUARDANDO PEÇA"))
                     {
                         mail.Body += "\nEntre em contato com nossa equipe para mais informações sobre novas peças.";
                     }
                     mail.IsBodyHtml = false;
                     mail.Priority   = MailPriority.High;
                     try
                     {
                         client.Send(mail);
                     }
                     catch (System.Exception erro)
                     {
                         MessageBox.Show(erro.ToString());
                     }
                     finally
                     {
                         mail = null;
                     }
                 }
                 catch
                 {
                     MessageBox.Show("Não existe responsável pelo departamento e questão!");
                 }
             }
         }
         if (Equals(cmbStatus.Text, "AGUARDANDO PEÇA"))
         {
             FRM_EmitirOficio frm_oficio = new FRM_EmitirOficio(txtMaquina.Text, cmbDepartamento.Text);
             frm_oficio.ShowDialog();
         }
         this.Close();
     }
     else
     {
         txtMsg.Visible = true;
     }
 }