Exemplo n.º 1
0
        /// <summary>
        /// Verify if O.S informations in List<>WaitList are done already
        /// </summary>
        public static void CheckList()
        {
            LogWriteLine("-------------------Executing unfinished O.S vector-------------------");
            Conection.DeskOpen();
            MySqlCommand sqlcommand = new MySqlCommand("", Conection.DeskConection);

            //This method is basically the same thing than the SatisfactionSenderSeeker(). the only difference is that this method already have the os number.
            for (int i = 0; i < WaitList.Count; i++)
            {
                sqlcommand.CommandText = "SELECT stc_os1 FROM v11_mafra.OpOrdensServicoCabecalhos where cod_os1 = " + WaitList[i].Cod;
                try
                {
                    int getstate = Convert.ToInt32(sqlcommand.ExecuteScalar());
                    if (getstate == 83)
                    {
                        InformationOS aux = WaitList[i];
                        WaitList.Remove(WaitList[i]);
                        GreenSignal(aux, i);
                        System.Threading.Thread.Sleep(1000);
                    }
                }
                catch (Exception e)
                {
                    LogWriteLine("CODE 168 FAIL TO GET THE STATE OF O.S " + WaitList[i].Cod + " ERROR: " + e.Message);
                }
            }
            sqlcommand.Cancel();
            Conection.DeskConection.Close();
        }
 public override int GetId()
 {
     Conection.DeskOpen();
     command.CommandText = "SELECT cod_fu1 from cadastrosfuncionarios where nom_fu1 = '" + name + "'";
     command.Connection  = Conection.DeskConection;
     id_vip = Convert.ToInt32(command.ExecuteScalar());
     Conection.DeskConection.Close();
     return(id_vip);
 }
 public override string GetName()
 {
     Conection.DeskOpen();
     command.CommandText = "SELECT nom_fu1 from cadastrosfuncionarios where cod_fu1 = " + id_vip;
     command.Connection  = Conection.DeskConection;
     name = command.ExecuteScalar().ToString();
     Conection.DeskConection.Close();
     return(name);
 }
 public override int GetId()
 {
     Conection.DeskOpen();
     command.CommandText = "SELECT id__cl1 from cadastrosclientesfornecedoresrepresentadastransportadoras where nom_cl1 = '" + name + "'";
     command.Connection  = Conection.DeskConection;
     id_vip = Convert.ToInt32(command.ExecuteScalar());
     Conection.DeskConection.Close();
     return(id_vip);
 }
Exemplo n.º 5
0
        /// <summary>
        /// Check if employee belong to tecnical group (code 4)
        /// </summary>
        /// <returns></returns>
        private static int GetGroupCode()
        {
            Conection.DeskOpen();
            MySqlCommand sqlcommand = sqlcommand = new MySqlCommand("", Conection.DeskConection);

            sqlcommand.CommandText = "select gru_se1 from cadastrossenhasusuariosv11 where cod_se1 like '%" + nomfun + "%'";
            int getstate = Convert.ToInt32(sqlcommand.ExecuteScalar());

            sqlcommand.Cancel();
            Conection.DeskConection.Close();
            return(getstate);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Get employee code
        /// </summary>
        private static void GetFunCode()
        {
            Conection.DeskOpen();
            MySqlCommand sqlcommand = new MySqlCommand("", Conection.DeskConection);

            sqlcommand.CommandText = "select cod_fu1 from cadastrosfuncionarios where nom_fu1 like '%" + nomfun + "%'";
            try
            {
                cod_fun = Convert.ToInt32(sqlcommand.ExecuteScalar());
                lastOS  = codOS;
            }
            catch (Exception e)
            {
                LogWriteLine("CODE 123 EXECUTESCALAR ERROR. MSG->" + e.Message);
            }
        }
 public override string GetName()
 {
     Conection.DeskOpen();
     command.CommandText = "SELECT nom_cl1 from cadastrosclientesfornecedoresrepresentadastransportadoras where id__cl1 = " + id_vip;
     command.Connection  = Conection.DeskConection;
     try
     {
         name = command.ExecuteScalar().ToString();
         return(name);
     }
     catch (Exception e)
     {
         Service1.LogWriteLine("ERROR GETNAME() FROM CUSTOMER CLASS AT LINE 78 ERROR->" + e.Message);
         return("");
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// Check if O.S is already finished. (Code 81 = unfinished; 83 = finished)
 /// </summary>
 /// <returns></returns>
 private static int StateOS()
 {
     try
     {
         Conection.DeskOpen();
         MySqlCommand sqlcommand = new MySqlCommand("", Conection.DeskConection);
         sqlcommand.CommandText = "SELECT stc_os1 FROM v11_mafra.OpOrdensServicoCabecalhos where cod_os1 = " + codOS;
         int getstate = Convert.ToInt32(sqlcommand.ExecuteScalar());
         sqlcommand.Cancel();
         Conection.DeskConection.Close();
         return(getstate);
     }
     catch (Exception e)
     {
         LogWriteLine("CODE 168 FAIL TO GET THE STATE OF O.S " + codOS + " ERROR: " + e.Message);
         return(0);
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// Gets the last O.S and client code. Employee name and O.S state.
        /// </summary>
        private static void GetAllInfos()
        {
            Conection.DeskOpen();
            MySqlCommand sqlcommand = sqlcommand = new MySqlCommand("", Conection.DeskConection);

            sqlcommand.CommandText = "SELECT cod_os1, usu_os1, cl1_os1, stc_os1 FROM v11_mafra.OpOrdensServicoCabecalhos order by cod_os1 desc limit 1";
            using (MySqlDataReader datget = sqlcommand.ExecuteReader())
            {
                datget.Read();
                codOS   = Convert.ToInt32(datget["cod_os1"]); //O.S code
                nomfun  = datget["usu_os1"].ToString();       // employee name
                codcli  = Convert.ToInt32(datget["cl1_os1"]); // cliente code
                osstate = Convert.ToInt32(datget["stc_os1"]); // O.S code state
                datget.Close();
            }
            sqlcommand.Cancel();
            Conection.DeskConection.Close();
        }
Exemplo n.º 10
0
        /// <summary>
        /// Retorna a lista de emails disponíveis de um determinado cliente
        /// </summary>
        /// <returns></returns>
        public List <string> GetEmails()
        {
            Conection.DeskOpen();
            List <string> listemails = new List <string>();

            command = new MySqlCommand("SELECT ema_cl1, www_cl1 from v11_mafra.cadastrosclientesfornecedoresrepresentadastransportadoras WHERE id__cl1 = " + id_vip, Conection.DeskConection);
            string add1, add2, aux2;

            string[] aux;

            using (MySqlDataReader read = command.ExecuteReader())
            {
                while (read.Read())
                {
                    if (!String.IsNullOrEmpty(read["ema_cl1"].ToString()) || !String.IsNullOrEmpty(read["www_cl1"].ToString()))
                    {
                        add1 = read["ema_cl1"].ToString();
                        add2 = read["www_cl1"].ToString();

                        aux = add1.Split(';');
                        foreach (string str in aux)
                        {
                            aux2 = str.Replace(" ", string.Empty);
                            listemails.Add(aux2);
                        }

                        aux = add2.Split(';');
                        foreach (string str in aux)
                        {
                            aux2 = str.Replace(" ", string.Empty);
                            listemails.Add(str);
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }
            Conection.DeskConection.Close();
            return(listemails);
        }