Exemplo n.º 1
0
        private void SalvaResultado(MOHuman mo)
        {
            try
            {
                //Pass the filepath and filename to the StreamWriter Constructor
                StreamWriter sw = new StreamWriter("C:\\inetpub\\wwwroot\\swaptools\\MOHuman.txt", true);

                //Write a line of text
                sw.WriteLine(string.Format("{0};{1};{2};{3};{4};{5}", mo.Id, mo.From, mo.To, mo.Msg, mo.Account, mo.Date_));

                //Write a second line of text
                //sw.WriteLine("From the StreamWriter class");

                //Close the file
                sw.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
            finally
            {
                Console.WriteLine("Executing finally block.");
            }
        }
Exemplo n.º 2
0
        private void SalvaResultado(MOHuman mo)
        {
            try
            {
                //Pass the filepath and filename to the StreamWriter Constructor
                StreamWriter sw = new StreamWriter("C:\\inetpub\\wwwroot\\swaptools\\MOHuman.txt", true);

                //Write a line of text
                sw.WriteLine(string.Format("{0};{1};{2};{3};{4};{5}", mo.Id, mo.From, mo.To, mo.Msg, mo.Account, mo.Date_));

                //Write a second line of text
                //sw.WriteLine("From the StreamWriter class");

                //Close the file
                sw.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
            finally
            {
                Console.WriteLine("Executing finally block.");
            }
        }
Exemplo n.º 3
0
        public static bool SalvarMO(MOHuman mo)
        {
            bool retorno = false;

            SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["DbConnection"].ToString());
            SqlCommand    cmd = new SqlCommand("udp_RetornoZenvia_ups", con);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            SqlParameter idRetorno           = new SqlParameter("@idRetorno", System.Data.SqlDbType.Int);
            SqlParameter ZenviaId            = new SqlParameter("@ZenviaId", System.Data.SqlDbType.VarChar);
            SqlParameter ZenviaFrom          = new SqlParameter("@ZenviaFrom", System.Data.SqlDbType.VarChar);
            SqlParameter ZenviaTo            = new SqlParameter("@ZenviaTo", System.Data.SqlDbType.VarChar);
            SqlParameter ZenviaMsg           = new SqlParameter("@ZenviaMsg", System.Data.SqlDbType.VarChar);
            SqlParameter ZenviaDate          = new SqlParameter("@ZenviaDate", System.Data.SqlDbType.VarChar);
            SqlParameter ZenviaAccount       = new SqlParameter("@ZenviaAccount", System.Data.SqlDbType.VarChar);
            SqlParameter dataHoraRecebimento = new SqlParameter("@dataHoraRecebimento", System.Data.SqlDbType.DateTime);

            idRetorno.Value           = 0;
            ZenviaId.Value            = mo.Id;
            ZenviaFrom.Value          = mo.From;
            ZenviaTo.Value            = mo.To;
            ZenviaMsg.Value           = mo.Msg;
            ZenviaDate.Value          = mo.Date_;
            ZenviaAccount.Value       = mo.Account;
            dataHoraRecebimento.Value = DateTime.Now;
            cmd.Parameters.Add(idRetorno);
            cmd.Parameters.Add(ZenviaId);
            cmd.Parameters.Add(ZenviaFrom);
            cmd.Parameters.Add(ZenviaTo);
            cmd.Parameters.Add(ZenviaMsg);
            cmd.Parameters.Add(ZenviaDate);
            cmd.Parameters.Add(ZenviaAccount);
            cmd.Parameters.Add(dataHoraRecebimento);


            try
            {
                con.Open();
                int numLinhas = cmd.ExecuteNonQuery();
                retorno = true;
            }
            catch (Exception exx)
            {
                retorno = false;
            }
            finally
            {
                con.Close();
            }
            return(retorno);
        }
Exemplo n.º 4
0
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         MOHuman mo = new MOHuman();
         mo.Id      = context.Request.QueryString["id"];
         mo.From    = context.Request.QueryString["from"];
         mo.To      = context.Request.QueryString["to"];
         mo.Msg     = context.Request.QueryString["msg"];
         mo.Account = context.Request.QueryString["account"];
         mo.Date_   = context.Request.QueryString["date"];
         SalvaResultado(mo);
         context.Response.Write("Ok");
     }
     catch (Exception exx)
     {
         context.Response.Write("Erro - " + exx.Message);
     }
 }
Exemplo n.º 5
0
 public void ProcessRequest(HttpContext context)
 {
     try
     {
         MOHuman mo = new MOHuman();
         mo.Id = context.Request.QueryString["id"];
         mo.From = context.Request.QueryString["from"];
         mo.To = context.Request.QueryString["to"];
         mo.Msg = context.Request.QueryString["msg"];
         mo.Account = context.Request.QueryString["account"];
         mo.Date_ = context.Request.QueryString["date"];
         SalvaResultado(mo);
         context.Response.Write("Ok");
     }
     catch (Exception exx)
     {
         context.Response.Write("Erro - " + exx.Message);
     }
 }
Exemplo n.º 6
0
        public static bool SalvarMO(MOHuman mo)
        {
            bool retorno = false;

            SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["DbConnection"].ToString());
            SqlCommand cmd = new SqlCommand("udp_RetornoZenvia_ups", con);
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            SqlParameter idRetorno = new SqlParameter("@idRetorno", System.Data.SqlDbType.Int);
            SqlParameter ZenviaId = new SqlParameter("@ZenviaId", System.Data.SqlDbType.VarChar);
            SqlParameter ZenviaFrom = new SqlParameter("@ZenviaFrom", System.Data.SqlDbType.VarChar);
            SqlParameter ZenviaTo = new SqlParameter("@ZenviaTo", System.Data.SqlDbType.VarChar);
            SqlParameter ZenviaMsg = new SqlParameter("@ZenviaMsg", System.Data.SqlDbType.VarChar);
            SqlParameter ZenviaDate = new SqlParameter("@ZenviaDate", System.Data.SqlDbType.VarChar);
            SqlParameter ZenviaAccount = new SqlParameter("@ZenviaAccount", System.Data.SqlDbType.VarChar);
            SqlParameter dataHoraRecebimento = new SqlParameter("@dataHoraRecebimento", System.Data.SqlDbType.DateTime);
            idRetorno.Value = 0;
            ZenviaId.Value = mo.Id;
            ZenviaFrom.Value = mo.From;
            ZenviaTo.Value = mo.To;
            ZenviaMsg.Value = mo.Msg;
            ZenviaDate.Value = mo.Date_;
            ZenviaAccount.Value = mo.Account;
            dataHoraRecebimento.Value = DateTime.Now;
            cmd.Parameters.Add(idRetorno);
            cmd.Parameters.Add(ZenviaId);
            cmd.Parameters.Add(ZenviaFrom);
            cmd.Parameters.Add(ZenviaTo);
            cmd.Parameters.Add(ZenviaMsg);
            cmd.Parameters.Add(ZenviaDate);
            cmd.Parameters.Add(ZenviaAccount);
            cmd.Parameters.Add(dataHoraRecebimento);

            try
            {
                con.Open();
                int numLinhas = cmd.ExecuteNonQuery();
                retorno = true;
            }
            catch (Exception exx)
            {
                retorno = false;
            }
            finally
            {
                con.Close();
            }
            return retorno;
        }