protected void Page_Load(object sender, EventArgs e)
        {
            StreamDAO     Stream   = new StreamDAO();
            LineNotify    lineNoti = new LineNotify();
            StringBuilder str_     = new StringBuilder();
            StringBuilder str_sent = new StringBuilder();


            str_ = Stream.getStreamLineNotify();
            //  str_ = str_ == "" ? "ไม่พบข้อมูล" : str_;

            Console.Out.WriteLine("start sent line notify");
            str_sent = str_.Replace("\\n", "\n");

            string test = str_sent.ToString();

            Console.Out.WriteLine("size == " + test.Length);
            string str_token = "Bearer MY0LqXiDDGUhdveI7WvFsIEXSAQNUXfucVX3VMuXGGq ----";

            str_token = "Bearer mKbIfvmrq75c8Ljz3Ipuhn96LUfgdvP8wy0JmqkibXR";

            str_sent.Append("test");

            Console.Out.WriteLine(test.Length);
            //   if (lineNoti.SendMessage("Bearer MYM1A0qV571lAYW5ea41SbtUpodZNCyny4ayV9aiqET", "\n" + msg))
            if (lineNoti.SendMessage(str_token, "\n" + str_sent.ToString()))
            {
                Console.Out.WriteLine("sent line notify success..." + lineNoti.LineError);
            }
            else
            {
                Console.Out.WriteLine("sent line notify failed..." + lineNoti.LineError);
            }
        }
        public void reSendLine(string token, string msg)
        {
            LineNotify lineNoti = new LineNotify();
            string     str_send = msg.Replace("\\n", "\n");

            writeLog(" \r\n --------- re send line ------------- \r\n");
            writeLog("msg ==" + str_send);

            if (lineNoti.SendMessage(token, "\n" + str_send))
            {
                writeLog("-- re sent line notify success...\r\n");
                Console.Out.WriteLine("sent line notify success..." + lineNoti.LineError);
            }
            else
            {
                writeLog("-- re sent line notify failed...");
                Console.Out.WriteLine("sent line notify failed...\r\n" + lineNoti.LineError);
            }
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            OraManager oraManager = new OraManager();
            DataTable  dt         = new DataTable();
            string     str_data   = "";
            string     str_sent   = "";

            try
            {
                string strQuery = string.Empty;
                strQuery = " select text_ from line_notify_edw ";

                dt = oraManager.GetDataEDW(strQuery);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    str_data += dt.Rows[i]["text_"].ToString();
                }

                str_sent = str_data.Replace("\\n", "\n");


                /* -------- sent line notiry ------------ */
                LineNotify lineNoti = new LineNotify();   //Bearer mKbIfvmrq75c8Ljz3Ipuhn96LUfgdvP8wy0JmqkibXR  -- key test

                // if (lineNoti.SendMessage("Bearer MYM1A0qV571lAYW5ea41SbtUpodZNCyny4ayV9aiqET", "\n" + str_sent)) --key edw
                if (lineNoti.SendMessage("Bearer mKbIfvmrq75c8Ljz3Ipuhn96LUfgdvP8wy0JmqkibXR", "\n" + str_sent))
                {
                    Console.Out.WriteLine("sent line notify success..." + lineNoti.LineError);
                }
                else
                {
                    Console.Out.WriteLine("sent line notify failed..." + lineNoti.LineError);
                }
            }
            catch (Exception ex) {
                Console.Out.WriteLine(ex.Message.ToString());
            }
        }
        public void sendLineMore1000Text(string token, List <string> msg)
        {
            LineNotify lineNoti = new LineNotify();

            for (int i = 0; i < msg.Count; i++)
            {
                string str_send = msg[i].Replace("\\n", "\n");
                writeLog("msg ==" + str_send);

                if (lineNoti.SendMessage(token, "\n" + str_send))
                {
                    writeLog("sent line notify success...\r\n");
                    Console.Out.WriteLine("sent line notify success..." + lineNoti.LineError);
                }
                else
                {
                    writeLog("sent line notify failed...");
                    Console.Out.WriteLine("sent line notify failed...\r\n" + lineNoti.LineError);

                    reSendLine(token, msg[i]);
                }
            }
        }