Ejemplo n.º 1
0
        public ProcessTest()
        {
            Conexao = new ConexaoNpgSql();


            try
            {
                Conexao.AbrirConexao();
                TemConexao = Conexao.ConexaoAberta();
                Conexao.FecharConexao();
            }
            catch
            {
                TemConexao = false;
            }
            ListTurnos = new Dictionary <string, Dictionary <string, int> >();
        }
        public ProcessTest()
        {
            var os = Environment.OSVersion;

            Conexao    = new ConexaoNpgSql(os.Platform == PlatformID.Unix);
            mostrarLog = true;


            try
            {
                Conexao.AbrirConexao();
                TemConexao = Conexao.ConexaoAberta();
                Conexao.FecharConexao();
            }
            catch
            {
                TemConexao = false;
            }
            ListTurnos = new Dictionary <string, Dictionary <string, int> >();
        }
        //Descontinuado
        //public Image ByteToImage(int CstId, int RptId, int lgsID, string file_full_path)
        //{
        //    try
        //    {

        //        NpgsqlDataReader dr = Call("auto.get_image", "cst_id:" + CstId.ToString(), "rpt_id:" + RptId.ToString(), "lgs_id:" + lgsID.ToString());
        //        if (dr.HasRows && dr.Read())
        //        {
        //            MemoryStream ms = new MemoryStream((byte[])dr["image_data"]);
        //            Image img = Image.FromStream(ms, true);
        //            dr.Close();
        //            return img;
        //        }
        //        else
        //        {
        //            dr.Close();
        //            return null;
        //        }

        //    }
        //    catch (Exception ex)
        //    {
        //        Print("ByteToImage", ex);
        //        return null;
        //    }
        //}

        public void EndTest(int ReportID = 0, string status = "pronto", bool deleteReport = false)
        {
            try
            {
                if (this.SitID == 0)
                {
                    throw new Exception(Print("EndTest(SitID=0)", null));
                }
                if (this.ScnID == 0)
                {
                    throw new Exception(Print("EndTest(ScnID=0)", null));
                }
                if (this.TstID == 0)
                {
                    throw new Exception(Print("EndTest(TstID=0)", null));
                }
                if (this.RptID == 0)
                {
                    throw new Exception(Print("EndTest(RptID=0)", null));
                }

                if (deleteReport == true || ReportID == 0)
                {
                    Call("auto.delete_rpt", "cst_id:" + CstID.ToString(), "rpt_id:" + RptID.ToString());
                }

                if (Conexao.ConexaoAberta())
                {
                    Conexao.FecharConexao();
                    Print("End Test", null);
                }
            }
            catch (Exception ex)
            {
                Print("EndTest", ex);
            }
        }