Esempio n. 1
1
    private  string getMachineCode()
    {
        //      * Copyright (C) 2012 Artem Los, All rights reserved.
        //      * 
        //      * This code will generate a 5 digits long key, finger print, of the system
        //      * where this method is being executed. However, that might be changed in the
        //      * hash function "GetStableHash", by changing the amount of zeroes in
        //      * MUST_BE_LESS_OR_EQUAL_TO to the one you want to have. Ex 1000 will return 
        //      * 3 digits long hash.
        //      * 
        //      * Please note, that you might also adjust the order of these, but remember to
        //      * keep them there because as it is stated at 
        //      * (http://www.codeproject.com/Articles/17973/How-To-Get-Hardware-Information-CPU-ID-MainBoard-I)
        //      * the processorID might be the same at some machines, which will generate same
        //      * hashes for several machines.
        //      * 
        //      * The function will probably be implemented into SKGL Project at http://skgl.codeplex.com/
        //      * and Software Protector at http://softwareprotector.codeplex.com/, so I 
        //      * release this code under the same terms and conditions as stated here:
        //      * http://skgl.codeplex.com/license
        //      * 
        //      * Any questions, please contact me at
        //      *  * [email protected]
        //      
        methods m = new methods();

        ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from Win32_Processor");
        string collectedInfo = "";
        // here we will put the informa
        foreach (ManagementObject share in searcher.Get())
        {
            // first of all, the processorid
            collectedInfo += share["ProcessorId"];
        }

        searcher.Query = new ObjectQuery("select * from Win32_BIOS");
        foreach (ManagementObject share in searcher.Get())
        {
            //then, the serial number of BIOS
            collectedInfo += share["SerialNumber"];
        }

        searcher.Query = new ObjectQuery("select * from Win32_BaseBoard");
        foreach (ManagementObject share in searcher.Get())
        {
            //finally, the serial number of motherboard
            collectedInfo += share["SerialNumber"];
        }

        // patch luca bernardini
        if (string.IsNullOrEmpty(collectedInfo) | collectedInfo == "00" | collectedInfo.Length <= 3)
        {
            collectedInfo += getHddSerialNumber();
        }

        return m.getEightByteHash(collectedInfo, 100000).ToString();
    }
Esempio n. 2
0
        static public void StartReplication(char subject)
        {
            var watch = System.Diagnostics.Stopwatch.StartNew();

            Logger.Info("Start replication DBF-files to SQL Server.");
            parameters param = new parameters(subject);
            methods    meth  = new methods(ref param);

            try
            {
                if (File.Exists(param.destination))
                {
                    meth.Extract();
                    meth.RenameDir();
                    meth.PewPewDBFs();
                }
            }

            catch (Exception e)
            {
                //param.log.Add(e.ToString());
                Logger.Error(e);
            }
            watch.Stop();
            var ellapsed = watch.Elapsed;

            Console.WriteLine("Replication ended. Ellapsed = " + ellapsed.TotalMinutes + " min.");
            Logger.Info("Replication ended. Ellapsed = " + ellapsed.TotalMinutes + " min.");
        }
Esempio n. 3
0
 public static void ThreadStart(methods m)
 {
     System.Threading.ThreadStart threadMethod;
     threadMethod = new System.Threading.ThreadStart(m);
     System.Threading.Thread thread = new System.Threading.Thread(threadMethod);
     thread.Start();
 }
Esempio n. 4
0
        private void btn_show_garage_Click(object sender, EventArgs e)
        {
            string  search_query = "Select * from ";
            string  TableName    = "Garage ;";
            methods m            = new methods();

            m.show_table_element(TableName, search_query, dataGrid_Garage);
        }
Esempio n. 5
0
 public TmpFunction(float _time, float _arriveTime, methods _function, byte _num)
 {
     taskIndex  = _num;
     needTime   = _time;
     arriveTime = _arriveTime;
     doFunction = _function;
     needToShow = false;
 }
Esempio n. 6
0
 public TmpFunction(float _time, float _arriveTime, methods _function, Text _text, Image _img, byte _num)
 {
     taskIndex  = _num;
     needTime   = _time;
     arriveTime = _arriveTime;
     doFunction = _function;
     showText   = _text;
     showBar    = _img;
     needToShow = true;
 }
Esempio n. 7
0
        private void btn_src_driver_Click(object sender, EventArgs e)
        {
            //string search_query = "Select Employee.[First Name] from";
            //string TableName = "Employee,Bus_Driver where Employee.E_id= Bus_Driver.E_id and Bus_Driver.Salary=1200;";
            string search_query = "Select Employee.[First Name] ,Employee.[Last Name],"
                                  + "Employee.Contact,Employee.E_Address as Location ,Bus_Driver.Salary from ";
            string  TableName = "Employee,Bus_Driver where Employee.E_id= Bus_Driver.E_id;";
            methods m         = new methods();

            m.show_table_element(TableName, search_query, DriverGrid);
        }
Esempio n. 8
0
    //邮件发送 短信发送
    protected void Button1_Click(object sender, EventArgs e)
    {
        methods Toop = new methods();
        //if (Emailfs.Checked)  //发送邮件
        //{
        for (int i = 0; i < GridView1.Rows.Count; i++)
        {

            CheckBox Cbox = (CheckBox)GridView1.Rows[i].FindControl("Cbox");
            if (Cbox != null && Cbox.Checked)
            {
               Label MailAddss = (Label)GridView1.Rows[i].FindControl("MailAddss");
                if (MailAddss.Text.Trim() != null && MailAddss.Text.Trim() != "")
                {
                    if (tools.methods.SendEmail(Convert.ToString(MssgeTiTle.Text.Trim()), MailAddss.Text.Trim(), "", 3, "", conter.Value))
                    {
                        Response.Write("<script type=\"text/javascript\">alert(\"发送成功!\"); window.location='../men/mailsend.aspx';</script>");

                    }
                    else
                    {
                        Response.Write("<script type=\"text/javascript\">alert(\"发送异常!\"); window.location='../men/mailsend.aspx';</script>");

                    }
                }
            }
        }
        //}
        //if (Tellfs.Checked)//发送短消息
        //{
        //    for (int i = 0; i < GridView1.Rows.Count; i++)
        //    {
        //        CheckBox check = (CheckBox)GridView1.Rows[i].FindControl("CheckBox1");

        //        StringBuilder sb = new StringBuilder();
        //        StringBuilder str = new StringBuilder();
        //        Regex r = new Regex(@"\w*[\u4E00-\u9FA5]\w*", RegexOptions.Compiled | RegexOptions.IgnoreCase);
        //        foreach (Match m in r.Matches(conter.Value))
        //        {
        //            str.Append(Convert.ToString(m.Groups[0].Value));
        //        }
        //        sb.AppendFormat("http://kltx.sms10000.com.cn/sdk/SMS?cmd=send&uid=1665&psw=D3FD2186DD2B3A4A75C6411C3C9B5427&mobiles={0}&msgid=10002&msg={1}", Convert.ToString(GridView1.Rows[i].Cells[3].Text), HttpUtility.UrlEncode(Convert.ToString(str), System.Text.Encoding.GetEncoding("gb2312")));
        //        if (check.Checked)
        //        {

        //            tools.methods.submitWebMessage(Convert.ToString(sb));
        //        }

        //    }
        //    Response.Write("<script type=\"text/javascript\">alert(\"发送成功!\"); window.location='../men/mailsend.aspx';</script>");

        //}
    }
Esempio n. 9
0
        private void btn_src_Bus_Click(object sender, EventArgs e)
        {
            string search_query = "Select Bus.Bus_number As [Bus Number],Employee.[First Name] as "
                                  + "[Current Driver Name],Seat_plan.[Number of Seat],Garage.[Garage Name],Garage.Place as "
                                  + "[Garage Place],Garage.Contact as [Garage Contact] from ";
            string TableName = "Bus,Employee,Bus_Driver,Seat_plan,Garage where "
                               + "Bus.G_id=Garage.G_id and Bus.Sp_id=Seat_plan.Sp_id "
                               + "and Bus.BD_id= Bus_Driver.BD_id and Bus_Driver.E_id=Employee.E_id ";
            methods m = new methods();

            m.show_table_element(TableName, search_query, BusDataGrid);
        }
Esempio n. 10
0
        private void load_new_ticket_ID()
        {
            string sql = null, member = null;

            sql    = "select TOP 1 T_id from Ticket  order by T_id DESC ;";
            member = "T_id";
            methods m    = new methods();
            string  T_id = m.id_sender(sql, member);

            T_id_label.Text = T_id;
            T_id_label.Show();
            Console.WriteLine("T_id" + T_id);
        }
Esempio n. 11
0
        //
        public void route_and_bustime_combo_loader()
        {
            methods m      = new methods();
            string  sql    = "Select Distinct Road.[Route Name] from Road";
            string  member = "Route Name";

            m.combobox_loader(combo_route, sql, member);
            m.combobox_loader(combo_route1, sql, member);
            sql    = "Select Distinct Shedule.S_Time from Shedule;";
            member = "S_Time";
            m.combobox_loader(combo_bustime, sql, member);
            m.combobox_loader(combo_bustime1, sql, member);
        }
Esempio n. 12
0
        private static StreamReader SdGetRequestResponse(methods method, string uri, object jsonRequest = null, bool tkRequired = true)
        {
            // build url
            var url = $"{JsonBaseUrl}{JsonApi}{uri}";

            // send request and get response
            try
            {
                // create the request with defaults
                var req = (HttpWebRequest)WebRequest.Create(url);
                req.UserAgent = "EPG123";
                req.AutomaticDecompression = DecompressionMethods.Deflate;
                req.Timeout = 3000;

                // add token if it is required
                if (tkRequired && !string.IsNullOrEmpty(Token))
                {
                    req.Headers.Add("token", Token);
                }

                // setup request
                switch (method)
                {
                case methods.GET:
                    req.Method = "GET";
                    break;

                case methods.POST:
                    var body = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(jsonRequest));
                    req.Method        = "POST";
                    req.ContentType   = "application/json";
                    req.Accept        = "application/json";
                    req.ContentLength = body.Length;

                    var reqStream = req.GetRequestStream();
                    reqStream.Write(body, 0, body.Length);
                    reqStream.Close();
                    break;
                }

                var resp = req.GetResponse();
                return(new StreamReader(resp.GetResponseStream(), Encoding.UTF8));
            }
            catch
            {
                // ignored
            }

            return(null);
        }
Esempio n. 13
0
        private static int getMachineCode()
        {
            // please see https://skgl.codeplex.com/workitem/2246 for a list of developers of this code.

            methods m = new methods();

            ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from Win32_Processor");
            string collectedInfo = "";

            // here we will put the informa
            foreach (ManagementObject share in searcher.Get())
            {
                // first of all, the processorid
                collectedInfo += share.GetPropertyValue("ProcessorId");
            }

            searcher.Query = new ObjectQuery("select * from Win32_BIOS");
            foreach (ManagementObject share in searcher.Get())
            {
                //then, the serial number of BIOS
                collectedInfo += share.GetPropertyValue("SerialNumber");
            }

            searcher.Query = new ObjectQuery("select * from Win32_BaseBoard");
            foreach (ManagementObject share in searcher.Get())
            {
                //finally, the serial number of motherboard
                collectedInfo += share.GetPropertyValue("SerialNumber");
            }

            // patch luca bernardini
            if (string.IsNullOrEmpty(collectedInfo) | collectedInfo == "00" | collectedInfo.Length <= 3)
            {
                collectedInfo += getHddSerialNumber();
            }

            // In case we have message "To be filled by O.E.M." - there is incorrect motherboard/BIOS serial number
            // - we should relay to NIC
            if (collectedInfo.Contains("To be filled by O.E.M."))
            {
                var nic = GetNicInfo();

                if (!string.IsNullOrWhiteSpace(nic))
                {
                    collectedInfo += nic;
                }
            }

            return(m.getEightByteHash(collectedInfo, 100000));
        }
Esempio n. 14
0
 //[不需要每秒時間] 可取消修改
 public byte SetCountDown(methods _function, float a)
 {
     if (numberPlate < 230)
     {
         numberPlate++;
     }
     else
     {
         numberPlate = 0;
     }
     tmpFunction = new TmpFunction(a, a + (float)timeToStart, _function, numberPlate);
     myTasks.Add(tmpFunction);
     allTaskAmount = myTasks.Count;
     return(numberPlate);
 }
Esempio n. 15
0
        private void Search_all_ticket_Click(object sender, EventArgs e)
        {
            string  sql = null;
            methods m   = new methods();

            sql = "select Ticket.T_id,Employee.[First Name] as Seller,Passenger.Name as [Passenger Name]"
                  + ",Passenger.Contact as [Passenger Contact],Passenger.Gender as [Passenger Gender] ,Ticket.[Name Of Seat]"
                  + ",Bus_Shedule_manage.Date as [Departure Date] ,Shedule.S_Time as [Schedule Time],Road.[Route Name] from ";
            string sql2 = "Ticket,Passenger,Bus_Shedule_manage,Shedule,Road,Ticket_seller,Employee "
                          + "where Ticket.P_id=Passenger.P_id and Ticket.Ts_id=Ticket_seller.Ts_id and "
                          + "Ticket_seller.E_id=Employee.E_id and Ticket.BS_id=Bus_Shedule_manage.BS_id and "
                          + "Bus_Shedule_manage.S_id=Shedule.S_id and Shedule.Ro_id=Road.Road_id order by T_id DESc";

            m.show_table_element(sql2, sql, dataGrid_admin_Ticket);
        }
Esempio n. 16
0
        private void btn_cancel_ticket_Click(object sender, EventArgs e)
        {
            string  sql = null, member = null, P_id;
            methods m = new methods();

            sql    = "select Ticket.P_id from Ticket where Ticket.T_id='" + textBox_ticket_no.Text + "' ";
            member = "P_id";
            P_id   = m.id_sender(sql, member);

            sql = "DELETE FROM Ticket WHERE Ticket.T_id='" + textBox_ticket_no.Text + "'";
            m.delete_row(sql);

            sql = "DELETE FROM Passenger WHERE P_id='" + P_id + "'";
            m.delete_row(sql);
            MessageBox.Show("Ticket Cancled");
        }
Esempio n. 17
0
 //[需要每秒時間]
 public byte SetCountDown(methods _function, float a, Text _text, Image _img)
 {
     //號碼牌從1開始
     if (numberPlate < 230)
     {
         numberPlate++;
     }
     else
     {
         numberPlate = 0;
     }
     tmpFunction = new TmpFunction(a, a + (float)timeToStart, _function, _text, _img, numberPlate);
     myTasks.Add(tmpFunction);
     allTaskAmount = myTasks.Count;
     return(numberPlate);
 }
Esempio n. 18
0
 //[需要每秒時間] 可取消修改 但bar條從0到1(Bar條反轉)
 public byte SetCountDownReveres(methods _function, float a, Image _img)
 {
     //號碼牌從1開始
     if (numberPlate < 230)
     {
         numberPlate++;
     }
     else
     {
         numberPlate = 0;
     }
     tmpFunction            = new TmpFunction(a, a + (float)timeToStart, _function, null, _img, numberPlate);
     tmpFunction.reverseBar = true;
     myTasks.Add(tmpFunction);
     allTaskAmount = myTasks.Count;
     return(numberPlate);
 }
Esempio n. 19
0
        private void btn_add_garage_Click(object sender, EventArgs e)
        {
            string sql = null;



            sql = "Insert into Garage ([Garage Name],Contact,Place) values "
                  + "('" + txtBox_garage_name.Text + "','" + txtbox_contact.Text + "','" + txtBox_Place.Text + "');";
            methods m = new methods();

            m.single_tab_data_Insert(sql);

            string search_query = "Select * from ";
            string TableName    = "Garage order by Garage.G_id DESC;";

            m.show_table_element(TableName, search_query, dataGrid_Garage);
            //Select Garage.[Garage Name],Garage.Place,Garage.Contact from Garage order by Garage.G_id DESC;
        }
Esempio n. 20
0
        static void Main(string[] args)
        {
            str1 s1 = new str1();

            //concate
            Console.WriteLine("Enter String1 : ");
            string  x   = Console.ReadLine();
            methods m   = new methods(s1.con);
            string  res = m(x);

            Console.WriteLine("Concated String : {0}", res);

            //revserse
            Console.WriteLine("Enter String : ");
            string  s    = Console.ReadLine();
            methods m1   = new methods(s1.rev);
            string  res1 = m1(s);

            Console.WriteLine("Reversed String : {0}", res1);

            Console.ReadLine();
        }
Esempio n. 21
0
        private void btn_src_info_ticket_Click(object sender, EventArgs e)
        {
            bool    bo  = false;
            string  sql = null;
            methods m   = new methods();

            if (comboBox_search_ticket.Text == "-----Pleade Select------")
            {
                MessageBox.Show("Pleade Select Search By");
                bo = true;
            }
            if (!bo)
            {
                if (comboBox_search_ticket.Text == "All")
                {
                    sql = "select Ticket.T_id,Employee.[First Name] as Seller,Passenger.Name as [Passenger Name]"
                          + ",Passenger.Contact as [Passenger Contact],Passenger.Gender as [Passenger Gender] ,Ticket.[Name Of Seat]"
                          + ",Bus_Shedule_manage.Date as [Departure Date] ,Shedule.S_Time as [Schedule Time],Road.[Route Name] from ";
                    string sql2 = "Ticket,Passenger,Bus_Shedule_manage,Shedule,Road,Ticket_seller,Employee "
                                  + "where Ticket.P_id=Passenger.P_id and Ticket.Ts_id=Ticket_seller.Ts_id and "
                                  + "Ticket_seller.E_id=Employee.E_id and Ticket.BS_id=Bus_Shedule_manage.BS_id and "
                                  + "Bus_Shedule_manage.S_id=Shedule.S_id and Shedule.Ro_id=Road.Road_id order by T_id DESc";
                    m.show_table_element(sql2, sql, dataGridView3);
                }
                if (comboBox_search_ticket.Text == "Ticket ID")
                {
                    sql = "select Ticket.T_id,Employee.[First Name] as Seller,Passenger.Name as [Passenger Name]"
                          + ",Passenger.Contact as [Passenger Contact],Passenger.Gender as [Passenger Gender] ,Ticket.[Name Of Seat]"
                          + ",Bus_Shedule_manage.Date as [Departure Date] ,Shedule.S_Time as [Schedule Time],Road.[Route Name] from ";
                    string sql2 = "Ticket,Passenger,Bus_Shedule_manage,Shedule,Road,Ticket_seller,Employee "
                                  + "where Ticket.P_id=Passenger.P_id and Ticket.T_id='" + textBox_src_ticket_info.Text + "' and Ticket.Ts_id=Ticket_seller.Ts_id and "
                                  + "Ticket_seller.E_id=Employee.E_id and Ticket.BS_id=Bus_Shedule_manage.BS_id and "
                                  + "Bus_Shedule_manage.S_id=Shedule.S_id and Shedule.Ro_id=Road.Road_id order by T_id DESc";
                    m.show_table_element(sql2, sql, dataGridView3);
                    MessageBox.Show("Search Complete");
                }
            }
        }
Esempio n. 22
0
        private void btn_scr_cencle_Click(object sender, EventArgs e)
        {
            textBox_date_cancle.Clear();
            textBox_contact_cancle.Clear();
            textBox_gender_Cancle.Clear();
            textBox_passenger_canle.Clear();
            textBox_route_cancle.Clear();
            textBox_seat_name_cencle.Clear();
            textBox_time_cancle.Clear();
            textBox_totalfare_cancle.Clear();

            string  sql = null, member = null, test_1 = null, P_id = null;
            methods m  = new methods();
            bool    bo = false;

            sql = "select Bus_Shedule_manage.Date from Ticket,Bus_Shedule_manage where "
                  + "Ticket.BS_id=Bus_Shedule_manage.BS_id and Ticket.T_id='" + textBox_ticket_no.Text + "'";
            member = "Date";
            test_1 = m.id_sender(sql, member);
            // MessageBox.Show(test_1);
            if (test_1 == null)
            {
                MessageBox.Show("Wrong Ticket No.");

                bo = true;
            }
            //  {
            if (!bo)
            {
                DateTime da  = Convert.ToDateTime(test_1);
                DateTime da1 = Convert.ToDateTime(d1.Text);
                int      i   = DateTime.Compare(da, da1);
                //   MessageBox.Show(""+i);
                if (i == -1 || i == 1)
                {
                    MessageBox.Show("This Ticket is not valid for Cancellation.");
                    bo = true;
                }
                else
                {
                    sql    = "select Ticket.[Name Of Seat] from Ticket where Ticket.T_id='" + textBox_ticket_no.Text + "'";
                    member = "Name Of Seat";
                    test_1 = m.id_sender(sql, member);
                    textBox_seat_name_cencle.Text = test_1;

                    sql    = "select Ticket.[Total Fare] from Ticket where Ticket.T_id='" + textBox_ticket_no.Text + "'";
                    member = "Total Fare";
                    test_1 = m.id_sender(sql, member);
                    textBox_totalfare_cancle.Text = test_1;

                    sql    = "select Passenger.Name from Ticket,Passenger where Ticket.T_id='" + textBox_ticket_no.Text + "' and Ticket.P_id=Passenger.P_id";
                    member = "Name";
                    test_1 = m.id_sender(sql, member);
                    textBox_passenger_canle.Text = test_1;

                    sql    = "select Passenger.Gender from Ticket,Passenger where Ticket.T_id='" + textBox_ticket_no.Text + "' and Ticket.P_id=Passenger.P_id";
                    member = "Gender";
                    test_1 = m.id_sender(sql, member);
                    textBox_gender_Cancle.Text = test_1;

                    sql    = "select Passenger.Contact from Ticket,Passenger where Ticket.T_id='" + textBox_ticket_no.Text + "' and Ticket.P_id=Passenger.P_id";
                    member = "Contact";
                    test_1 = m.id_sender(sql, member);
                    textBox_contact_cancle.Text = test_1;

                    sql    = "select Bus_Shedule_manage.Date from Ticket,Bus_Shedule_manage where Ticket.T_id='" + textBox_ticket_no.Text + "' and Ticket.BS_id=Bus_Shedule_manage.BS_id";
                    member = "Date";
                    test_1 = m.id_sender(sql, member);
                    textBox_date_cancle.Text = test_1;

                    sql = "select Shedule.S_Time from Ticket,Bus_Shedule_manage,Shedule where "
                          + "Ticket.T_id='" + textBox_ticket_no.Text + "' and Ticket.BS_id=Bus_Shedule_manage.BS_id and Bus_Shedule_manage.S_id=Shedule.S_id";
                    member = "S_Time";
                    test_1 = m.id_sender(sql, member);
                    textBox_time_cancle.Text = test_1;

                    sql = "select Road.[Route Name] from Ticket,Bus_Shedule_manage,Shedule,Road where "
                          + " Ticket.T_id='" + textBox_ticket_no.Text + "' and Ticket.BS_id=Bus_Shedule_manage.BS_id and Bus_Shedule_manage.S_id=Shedule.S_id "
                          + "and Shedule.Ro_id=Road.Road_id";
                    member = "Route Name";
                    test_1 = m.id_sender(sql, member);
                    textBox_route_cancle.Text = test_1;

                    /* //delete part
                     *
                     * sql = "select Ticket.P_id from Ticket where Ticket.T_id='" + textBox_ticket_no.Text + "' ";
                     * member = "P_id";
                     * P_id = m.id_sender(sql, member);
                     *
                     * sql = "DELETE FROM Ticket WHERE Ticket.T_id='" + textBox_ticket_no.Text + "'";
                     * m.delete_row(sql);
                     *
                     * sql = "DELETE FROM Passenger WHERE P_id='" + P_id + "'";
                     * m.delete_row(sql);
                     * MessageBox.Show("Ticket Cancled");*/
                }
            }
        }
Esempio n. 23
0
        private static string GetRequestResponse(methods method, string uri, object jsonRequest = null, bool tkRequired = true)
        {
            // clear errorstring
            ErrorString = string.Empty;

            // build url
            var url = $"{JsonBaseUrl}{JsonApi}{uri}";

            // send request and get response
            var maxTries = (uri.Equals("token") || uri.Equals("status")) ? 1 : 2;
            var cntTries = 0;
            var timeout  = (uri.Equals("token") || uri.Equals("status")) ? 3000 : 300000;

            do
            {
                try
                {
                    // create the request with defaults
                    var req = (HttpWebRequest)WebRequest.Create(url);
                    req.UserAgent = userAgent;
                    req.AutomaticDecompression = DecompressionMethods.Deflate;
                    req.Timeout = timeout; ++cntTries;

                    // add token if it is required
                    if (!string.IsNullOrEmpty(myToken) && tkRequired)
                    {
                        req.Headers.Add("token", myToken);
                    }

                    // setup request
                    switch (method)
                    {
                    case methods.GET:
                        req.Method = "GET";
                        break;

                    case methods.GETVERBOSEMAP:
                        req.Method = "GET";
                        req.Headers["verboseMap"] = "true";
                        break;

                    case methods.PUT:
                        req.Method = "PUT";
                        break;

                    case methods.DELETE:
                        req.Method = "DELETE";
                        break;

                    case methods.POST:
                        var body = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(jsonRequest));
                        req.Method        = "POST";
                        req.ContentType   = "application/json";
                        req.Accept        = "application/json";
                        req.ContentLength = body.Length;

                        var reqStream = req.GetRequestStream();
                        reqStream.Write(body, 0, body.Length);
                        reqStream.Close();
                        break;
                    }

                    var resp = req.GetResponse();
                    return(new StreamReader(resp.GetResponseStream(), Encoding.UTF8).ReadToEnd());
                }
                catch (WebException wex)
                {
                    switch (wex.Status)
                    {
                    case WebExceptionStatus.Timeout:
                        if ((wex.Status == WebExceptionStatus.Timeout) && (cntTries <= maxTries))
                        {
                            Logger.WriteVerbose($"SD API WebException Thrown. Message: {wex.Message} , Status: {wex.Status} . Trying again.");
                        }
                        break;

                    default:
                        Logger.WriteVerbose($"SD API WebException Thrown. Message: {wex.Message} , Status: {wex.Status}");
                        try
                        {
                            var sr  = new StreamReader(wex.Response.GetResponseStream(), Encoding.UTF8);
                            var err = JsonConvert.DeserializeObject <BaseResponse>(sr.ReadToEnd());
                            if (err != null)
                            {
                                ErrorString = $"Message: {err.Message ?? string.Empty} Response: {err.Response ?? string.Empty}";
                                Logger.WriteVerbose($"SD responded with error code: {err.Code} , message: {err.Message ?? err.Response} , serverID: {err.ServerId} , datetime: {err.Datetime:s}Z");
                                if (err.Code == 4003)     // invalid user or token expired
                                {
                                    return(null);
                                }
                            }
                        }
                        catch
                        {
                            // ignored
                        }

                        break;     // try again until maxTries
                    }
                }
                catch (Exception ex)
                {
                    Logger.WriteVerbose($"SD API Unknown exception thrown. Message: {ex.Message}");
                }
            } while (cntTries < maxTries);

            // failed miserably
            Logger.WriteVerbose("Failed to complete request. Exiting");
            return(null);
        }
Esempio n. 24
0
        private void btn_submit_Click(object sender, EventArgs e)
        {
            int cou;

            bool    bo = true;
            string  sql = null, member = null, P_id = null, Ts_id = null, BS_id = null, S_id = null, name_of_seat = null;
            methods m = new methods();

            sql = "select [Bus Management System].dbo.Shedule.S_id from [Bus Management System].dbo.Shedule where"
                  + "[Bus Management System].dbo.Shedule.S_Time='" + combo_bustime.Text + "' and"
                  + " [Bus Management System].dbo.Shedule.Ro_id=(select Road.Road_id from Road "
                  + "where Road.[Route Name]='" + combo_route.Text + "')";
            member = "S_id";
            S_id   = m.id_sender(sql, member);
            cou    = checkedListBox_admin_Seat.SelectedItems.Count;
            if (cou == 0)
            {
                MessageBox.Show("No Seat Selected");
                bo = false;
            }
            if (S_id == null)
            {
                MessageBox.Show("Wrong Schedule");
                bo = false;
            }
            if (combo_Gender.Text == "------- Please Select -----")
            {
                MessageBox.Show("Please Select a Gender");
                bo = false;
            }
            if (bo)
            {
                sql = "insert into Passenger (Name,Gender,Contact) values ('" + txtbox_name_pass.Text + "','" + combo_Gender.Text + "','" + textBox_contact_pass.Text + "')";
                m.single_tab_data_Insert(sql);
                sql    = "select TOP 1 P_id from Passenger  order by P_id DESC ;";
                member = "P_id";
                P_id   = m.id_sender(sql, member);
                // Console.WriteLine("PID::" + P_id);
                sql    = "select Ts_id from Ticket_seller where Ticket_seller.[User ID]='" + Aid + "'";
                member = "Ts_id";
                Ts_id  = m.id_sender(sql, member);

                sql = "(select BS_id from [Bus Management System].dbo.Bus_Shedule_manage where "
                      + "[Bus Management System].dbo.Bus_Shedule_manage.Date='" + dateTimePicker_ticket.Text + "' and "
                      + "[Bus Management System].dbo.Bus_Shedule_manage.S_id="
                      + "(select S_id from [Bus Management System].dbo.Shedule where "
                      + "[Bus Management System].dbo.Shedule.S_Time='" + combo_bustime.Text + "' and "
                      + "[Bus Management System].dbo.Shedule.Ro_id="
                      + "(select Road.Road_id from Road where Road.[Route Name]='" + combo_route.Text + "')))";
                member       = "BS_id";
                BS_id        = m.id_sender(sql, member);
                name_of_seat = checkedListBox_admin_Seat.SelectedItem.ToString();
                sql          = "insert into Ticket (Ticket.BS_id,[Name Of Seat],[No of Seat],Ticket.P_id,[Total Fare],Ticket.Ts_id) "
                               + "values ('" + BS_id + "','" + name_of_seat + "','1','" + P_id + "','" + textBox_total_fare.Text + "','" + Ts_id + "')";
                m.single_tab_data_Insert(sql);
                sql = "select Ticket.T_id,Employee.[First Name] as Seller,Passenger.Name as [Passenger Name]"
                      + ",Passenger.Contact as [Passenger Contact],Passenger.Gender as [Passenger Gender] ,Ticket.[Name Of Seat]"
                      + ",Bus_Shedule_manage.Date as [Departure Date] ,Shedule.S_Time as [Schedule Time],Road.[Route Name] from ";
                string sql2 = "Ticket,Passenger,Bus_Shedule_manage,Shedule,Road,Ticket_seller,Employee "
                              + "where Ticket.P_id=Passenger.P_id and Ticket.Ts_id=Ticket_seller.Ts_id and "
                              + "Ticket_seller.E_id=Employee.E_id and Ticket.BS_id=Bus_Shedule_manage.BS_id and "
                              + "Bus_Shedule_manage.S_id=Shedule.S_id and Shedule.Ro_id=Road.Road_id order by T_id DESc";
                m.show_table_element(sql2, sql, dataGrid_admin_Ticket);
                load_new_ticket_ID();
                MessageBox.Show("Ticket Purchased Successfully");

                //Console.WriteLine("cou::" + cou);
            }
        }
Esempio n. 25
0
        private void btn_check_schedule_Click(object sender, EventArgs e)
        {
            string  sql = null, member = null, S_id = null, sql1 = null;
            methods m = new methods();

            //bool flag = false;
            listBox_avai_seat.Items.Clear();

            sql = "select [Bus Management System].dbo.Shedule.S_id from [Bus Management System].dbo.Shedule where"
                  + "[Bus Management System].dbo.Shedule.S_Time='" + combo_bustime1.Text + "' and"
                  + " [Bus Management System].dbo.Shedule.Ro_id=(select Road.Road_id from Road "
                  + "where Road.[Route Name]='" + combo_route1.Text + "')";
            member = "S_id";
            S_id   = m.id_sender(sql, member);
            if (S_id == null)
            {
                MessageBox.Show("Wrong Schedule");
            }
Tag:
            sql = "(select BS_id from [Bus Management System].dbo.Bus_Shedule_manage where "
                  + "[Bus Management System].dbo.Bus_Shedule_manage.Date='" + dateTimePicker_ticket1.Text + "' and "
                  + "[Bus Management System].dbo.Bus_Shedule_manage.S_id="
                  + "(select S_id from [Bus Management System].dbo.Shedule where "
                  + "[Bus Management System].dbo.Shedule.S_Time='" + combo_bustime1.Text + "' and "
                  + "[Bus Management System].dbo.Shedule.Ro_id="
                  + "(select Road.Road_id from Road where Road.[Route Name]='" + combo_route1.Text + "')))";
            member = "BS_id";

            string BS_id = m.id_sender(sql, member);

            if (m.flag_of_method)
            {
                string[] arr;

                Console.WriteLine("HMM:" + BS_id);
                sql    = "select  Ticket.[Name Of Seat] from Ticket where Ticket.BS_id='" + BS_id + "'";
                member = "Name Of Seat";
                arr    = m.sendarray(sql, member);
                arr.Reverse();
                for (int i = m.counter; i >= 0; i--)
                {
                    Console.WriteLine("" + arr[i]);
                }
                for (int j = 0; j < m.seat.Length; j++)
                {
                    bool bo = false;
                    for (int i = 0; i <= m.counter; i++)
                    {
                        if (arr[i] != m.seat[j])
                        {
                            bo = true;
                        }
                        if (arr[i] == m.seat[j])
                        {
                            bo = false;
                            break;
                        }
                    }
                    if (bo)
                    {
                        listBox_avai_seat.Items.Add(m.seat[j]);
                    }
                }
                if (m.counter == -1)
                {
                    for (int j = 0; j < m.seat.Length; j++)
                    {
                        listBox_avai_seat.Items.Add(m.seat[j]);
                    }
                }
            }
            else if (!m.flag_of_method)
            {
                bool insert_flag = false;
                sql = "select [Bus Management System].dbo.Shedule.S_id from [Bus Management System].dbo.Shedule where"
                      + "[Bus Management System].dbo.Shedule.S_Time='" + combo_bustime1.Text + "' and"
                      + " [Bus Management System].dbo.Shedule.Ro_id=(select Road.Road_id from Road "
                      + "where Road.[Route Name]='" + combo_route1.Text + "')";
                member = "S_id";
                //string tes_id = null;
                S_id = m.id_sender(sql, member);
                if (S_id == null)
                {
                    //MessageBox.Show("Wrong Schedule");
                    insert_flag = true;
                }
                if (!insert_flag)
                {
                    sql = "insert into Bus_Shedule_manage (S_id,Date) values ('" + S_id + "','" + dateTimePicker_ticket1.Text + "')";
                    m.single_tab_data_Insert(sql);
                    goto Tag;
                }

                //Console.WriteLine("S_id:" + S_id);
                //Console.WriteLine("\n" + dateTimePicker_ticket1.Text);


                // m.single_tab_data_Insert(sql);
            }
        }
Esempio n. 26
0
 string url; //POST, GET or DELETE url
 //set signature and basic URL
 void finishPar(methods _method, string _resourcePath) {
   method = _method; resourcePath = _resourcePath;
   timestamp = DateTime.UtcNow.ToString("yyyy-MM-dd'T'HH:mm:ssZ");
   access_key = Lib.accessKey;
   signature = generateHMACSignature();
   string apiUrl = "http" + (Lib.apiPort == 443 ? "s" : "") + "://" + Lib.apiHost + (Lib.apiPort != 80 ? (":" + Lib.apiPort) : "") + (Lib.apiVersion == 0 ? null : "/v" + Lib.apiVersion);
   url = apiUrl + resourcePath;
   if (method != methods.post) url += "?" + urlQueryString(toNameValues());
 }
Esempio n. 27
0
 //GET or DELETE constructor
 internal Par(methods _method, string _resourcePath) {
   finishPar(_method, _resourcePath);
 }
        public void RippleAccountInfo(methods method = methods.account_info, string account = null)
        {
            string Request = DoString(method: method, account: account);

            requests.Enqueue(Request);
        }
        public ActionResult CodeAdd(RequestFormInfo formInfo, int bl, int kj, int qj, int mr, int jssx, int ff)
        {
            //遍历自定义变量并放入集合
            List <definition> bianlianglist = new List <definition>();

            for (int i = 1; i <= bl; i++)
            {
                string desc    = Request.Form["bldesc" + i];
                string content = Request.Form["bl" + i];
                if (!string.IsNullOrWhiteSpace(desc) && !string.IsNullOrWhiteSpace(content))
                {
                    definition definition = new definition()
                    {
                        desc    = desc,
                        content = content
                    };
                    bianlianglist.Add(definition);
                }
            }

            //遍历控件部件并放入集合
            List <components> kongjianList = new List <components>();

            for (int i = 1; i <= kj; i++)
            {
                string desc    = Request.Form["kjdesc" + i];
                string content = Request.Form["kj" + i];
                if (!string.IsNullOrWhiteSpace(desc) && !string.IsNullOrWhiteSpace(content))
                {
                    components components = new components()
                    {
                        desc    = desc,
                        content = content
                    };
                    kongjianList.Add(components);
                }
            }

            //遍历全局变量并放入集合
            List <data> quanjuList = new List <data>();

            for (int i = 1; i <= qj; i++)
            {
                string content = Request.Form["qjdesc" + i];
                string desc    = Request.Form["qj" + i];
                if (!string.IsNullOrWhiteSpace(content) && !string.IsNullOrWhiteSpace(desc))
                {
                    data data = new data()
                    {
                        content = content,
                        desc    = desc
                    };
                    quanjuList.Add(data);
                }
            }

            //遍历默认数据并放入集合
            List <@default> morenList = new List <@default>();

            for (int i = 1; i <= mr; i++)
            {
                string desc  = Request.Form["mrdesc" + i];
                string key   = Request.Form["mrkey" + i];
                string value = Request.Form["mrvalue" + i];
                if (!string.IsNullOrWhiteSpace(desc) && !string.IsNullOrWhiteSpace(key) && !string.IsNullOrWhiteSpace(value))
                {
                    @default @default = new @default()
                    {
                        desc  = desc,
                        key   = key,
                        value = value
                    };
                    morenList.Add(@default);
                }
            }

            //遍历计算属性并放入集合
            List <computed> jssxList = new List <computed>();

            for (int i = 1; i <= jssx; i++)
            {
                string jssxname = Request.Form["jssxname" + i];
                string jssxdesc = Request.Form["jssxdesc" + i];
                string jssxff   = Request.Form["jssxff" + i];
                if (!string.IsNullOrWhiteSpace(jssxname) && !string.IsNullOrWhiteSpace(jssxdesc) && !string.IsNullOrWhiteSpace(jssxff))
                {
                    computed computed = new computed()
                    {
                        desc    = jssxdesc,
                        name    = jssxname,
                        content = jssxff
                    };
                    jssxList.Add(computed);
                }
            }

            //遍历控件方法并放入集合
            List <rests> qtfangfaList = new List <rests>();

            for (int i = 1; i <= ff; i++)
            {
                string qtffname = Request.Form["qtffname" + i];
                string qtffdesc = Request.Form["qtffdesc" + i];
                string qtffti   = Request.Form["qtffti" + i];
                if (!string.IsNullOrWhiteSpace(qtffname) && !string.IsNullOrWhiteSpace(qtffdesc) && !string.IsNullOrWhiteSpace(qtffti))
                {
                    rests rests = new rests()
                    {
                        name    = qtffname,
                        desc    = qtffdesc,
                        content = qtffti
                    };
                    qtfangfaList.Add(rests);
                }
            }

            //遍历控件方法并放入集合
            List <methods> fangfaList = new List <methods>();

            for (int i = 1; i <= ff; i++)
            {
                string ffname = Request.Form["ffname" + i];
                string ffdesc = Request.Form["ffdesc" + i];
                string ffti   = Request.Form["ffti" + i];
                if (!string.IsNullOrWhiteSpace(ffname) && !string.IsNullOrWhiteSpace(ffdesc) && !string.IsNullOrWhiteSpace(ffti))
                {
                    methods methods = new methods()
                    {
                        name    = ffname,
                        desc    = ffdesc,
                        content = ffti
                    };
                    fangfaList.Add(methods);
                }
            }


            //调用方法开始进行数据库存储
            //实例化代码入库类
            CodeDataBase codeInDataBase = new CodeDataBase();
            int          result         = codeInDataBase.AddCodeInBase(formInfo, bianlianglist, kongjianList, quanjuList, morenList, jssxList, qtfangfaList, fangfaList);

            switch (result)
            {
            case 0:
                return(Json(new { code = 1, msg = "代码入库失败!" }, JsonRequestBehavior.AllowGet));

            case 1:
                return(Json(new { code = 1, msg = "代码入库成功!" }, JsonRequestBehavior.AllowGet));

            case 2:
                return(Json(new { code = 1, msg = "html代码入库失败!" }, JsonRequestBehavior.AllowGet));

            case 3:
                return(Json(new { code = 1, msg = "Css样式入库失败!" }, JsonRequestBehavior.AllowGet));

            case 4:
                return(Json(new { code = 1, msg = "自定义变量入库失败!" }, JsonRequestBehavior.AllowGet));

            case 5:
                return(Json(new { code = 1, msg = "控件部件入库失败!" }, JsonRequestBehavior.AllowGet));

            case 6:
                return(Json(new { code = 1, msg = "全局变量入库失败!" }, JsonRequestBehavior.AllowGet));

            case 7:
                return(Json(new { code = 1, msg = "默认数据入库失败!" }, JsonRequestBehavior.AllowGet));

            case 8:
                return(Json(new { code = 1, msg = "计算属性入库失败!" }, JsonRequestBehavior.AllowGet));

            case 9:
                return(Json(new { code = 1, msg = "控件方法入库失败!" }, JsonRequestBehavior.AllowGet));

            case 10:
                return(Json(new { code = 1, msg = "添加到PageShow页面失败!" }, JsonRequestBehavior.AllowGet));
            }



            return(View());
        }
        public string DoString(methods method, string start = "10", string transaction = null, int ledger_index_int = 1, string tx_hash = null, int account_index = 0, string strict = "false", string ledger = null, string account = null, int ledger_index_min = -1, int ledger_index_max = -1, string binary = "false", int count = 10, int limit = 10, string forward = "false", string destination = null, long value = 0, string secret = null, long fee = 1000, string[] accounts = null, string[] streamMethods = null, string type = null, string account_root = null, string ledger_index = null)
        {
            switch (method)
            {
            case methods.tx_history:
                return("{\"id\":7," +
                       "\"command\":\"tx_history\"," +
                       "\"start\":" + start + "}");

            case methods.server_info:
                return
                    ("{" +
                     "\"command\":\"server_info\"" +
                     "}");

            case methods.server_state:
                return
                    ("{" +
                     "\"command\":\"server_state\"" +
                     "}");

            case methods.ping:
                return("{" +
                       "\"command\":\"ping\"" +
                       "}");

            case methods.subscribe:
                List <string> ListOfAccounts = new List <string>();
                List <string> ListOfMethods  = new List <string>();

                foreach (string singleAccount in accounts)
                {
                    ListOfAccounts.Add("\"" + singleAccount + "\"");
                }
                var accResult = String.Join(", ", ListOfAccounts.ToArray());

                foreach (string singleMethod in streamMethods)
                {
                    ListOfMethods.Add("\"" + singleMethod + "\"");
                }
                var methodsResult = String.Join(", ", ListOfMethods.ToArray());
                if (ListOfAccounts.Capacity == 0)
                {
                    return
                        ("{" +
                         "\"id\":2," +
                         "\"command\":\"subscribe\"," +
                         "\"accounts\":[]," +
                         "\"streams\":[" + methodsResult + "]" +
                         "}");
                }
                return
                    ("{" +
                     "\"id\":2," +
                     "\"command\":\"subscribe\"," +
                     "\"accounts\":[" + accResult + "]," +
                     "\"streams\":[" + methodsResult + "]" +
                     "}");

            case methods.unsubscribe:
                List <string> UnListOfAccounts = new List <string>();
                List <string> UnListOfMethods  = new List <string>();

                foreach (string singleAccount in accounts)
                {
                    UnListOfAccounts.Add("\"" + singleAccount + "\"");
                }
                var UnaccResult = String.Join(", ", UnListOfAccounts.ToArray());

                foreach (string singleMethod in streamMethods)
                {
                    UnListOfMethods.Add("\"" + singleMethod + "\"");
                }
                var UnmethodsResult = String.Join(", ", UnListOfMethods.ToArray());
                if (UnListOfAccounts.Capacity == 0)
                {
                    return
                        ("{" +
                         "\"id\":2," +
                         "\"command\":\"subscribe\"," +
                         "\"accounts\":[]," +
                         "\"streams\":[" + UnmethodsResult + "]" +
                         "}");
                }
                return
                    ("{" +
                     "\"id\":2," +
                     "\"command\":\"subscribe\"," +
                     "\"accounts\":[" + UnaccResult + "]," +
                     "\"streams\":[" + UnmethodsResult + "]" +
                     "}");

            case methods.account_info:
                return
                    ("{" +
                     "\"command\":\"account_info\"," +
                     "\"account\":\"" + account + "\"" +
                     "}");

            case methods.sign_and_submit:
                return("{" +
                       "\"id\":2," +
                       "\"command\":\"submit\"," +
                       "\"tx_json\":" +
                       "{\"TransactionType\":\"Payment\"," +
                       "\"Account\":\"" + account + "\"," +
                       "\"Destination\":\"" + destination + "\"," +
                       "\"Amount\":" +
                       "{\"" +
                       "currency\":\"XRP\"," +
                       "\"value\":" + value + "," +
                       "\"issuer\":\"" + account + "\"" +
                       "}}," +
                       "\"secret\":\"" + secret + "\"," +
                       "\"offline\":false," +
                       "\"fee_mult_max\":" + fee + "}");

            case methods.ledger:
                return("{" +
                       "\"id\":7," +
                       "\"command\":\"ledger\"," +
                       "\"full\":false," +
                       "\"expand\":false," +
                       "\"transactions\":true," +
                       "\"accounts\":true" +
                       "}");

            case methods.ledger_closed:
                return("{" +
                       "\"command\":\"ledger_closed\"" +
                       "}");

            case methods.ledger_current:
                return("{" +
                       "\"command\":\"ledger_current\"" +
                       "}");

            case methods.ledger_entry:
                return("{" +
                       "\"id\":7," +
                       "\"command\":\"ledger_entry\"," +
                       "\"type\":\"" + type + "\"," +
                       "\"account_root\":" +
                       "\"" + account_root + "\"," +
                       "\"ledger_index\":\"" + ledger_index + "\"}");

            case methods.account_lines:
                return("{\"id\":7," +
                       "\"command\":\"account_lines\"," +
                       "\"account\":\"" + account + "\"," +
                       "\"ledger\":\"" + ledger + "\"}");

            case methods.account_offers:
                return("{\"id\":7," +
                       "\"command\":\"account_offers\"," +
                       "\"account\":\"" + account + "\"," +
                       "\"ledger\":\"" + ledger + "\"}");

            case methods.account_currencies:
                return("{\"id\":7," +
                       "\"command\":\"account_currencies\"," +
                       "\"account\":\"" + account + "\"," +
                       "\"strict\":" + strict + "," +
                       "\"ledger_index\":\"" + ledger_index + "\"," +
                       "\"account_index\":" + account_index + "}");

            case methods.transaction_entry:
                return("{\"id\":7," +
                       "\"command\":\"transaction_entry\"," +
                       "\"tx_hash\":\"" + tx_hash + "\"," +
                       "\"ledger_index\":" + ledger_index_int + "}");

            case methods.account_tx:
                return
                    ("{" +
                     "\"command\":\"account_tx\"," +
                     "\"account\":\"" + account + "\"," +
                     "\"ledger_index_min\": " + ledger_index_min + "," +
                     "\"ledger_index_max\": " + ledger_index_max + "," +
                     "\"binary\":" + binary + "," +
                     "\"count\": " + count + "," +
                     "\"limit\":" + limit + "," +
                     "\"forward\": " + forward + "" +
                     "}");

            case methods.tx:
                return("{\"id\":7,\"command\":\"tx\",\"transaction\":\"" + transaction + "\"}");
            }

            return(null);
        }
        public void RippleUnSubscribe(methods method = methods.subscribe, string[] accounts = null, string[] methods = null)
        {
            string Request = DoString(method: method, accounts: accounts, streamMethods: methods);

            requests.Enqueue(Request);
        }
Esempio n. 32
0
 (memory, memory[name]) = Run(methods, memory, value);
Esempio n. 33
0
 //[不需要每秒時間]不可取消修改
 public void SetCountDownNoCancel(methods _function, float a)
 {
     tmpFunction = new TmpFunction(a, a + (float)timeToStart, _function, 255);
     myTasks.Add(tmpFunction);
     allTaskAmount = myTasks.Count;
 }
Esempio n. 34
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        UserHandle.UserHandle.InitModules_Admin("YJDXQF");
        if (UserHandle.UserHandle.ValidationHandle_Admin(RoleTag.Edit))
        {
            methods Toop = new methods();
            //if (Emailfs.Checked)  //发送邮件
            //{

            string sql = "select Email from userinfo";
            DataSet ds = new DataSet();
            SqlDataReader red = Daxu.BLL.userinfoBll.GetIuserinfoDataReader(sql);
            while (red.Read())
            {
                if (!string.IsNullOrEmpty(Convert.ToString(red["Email"])))
                {
                    if (tools.methods.SendEmail(Convert.ToString(MssgeTiTle.Text.Trim()), Convert.ToString(red["Email"]).Trim(), "", 3, "", conter.Value))
                    {
                        Response.Write("<script type=\"text/javascript\">alert(\"发送成功!\"); window.location='../men/mailsend.aspx';</script>");
                    }
                    else
                    {
                        Response.Write("<script type=\"text/javascript\">alert(\"发送异常!\"); window.location='../men/mailsend.aspx';</script>");

                    }
                }

            }
            red.Close();
            //}
            //if (Tellfs.Checked)//发送短消息
            //{

            //    string sql = "select Email from userinfo";
            //    DataSet ds = new DataSet();
            //    DataTable table = Daxu.BLL.userinfoBll.GetIuserinfoDataTable(sql);
            //    ds.Tables.Add(table);
            //    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            //    {
            //        StringBuilder sb = new StringBuilder();
            //        StringBuilder str = new StringBuilder();
            //        Regex r = new Regex(@"\w*[\u4E00-\u9FA5]\w*", RegexOptions.Compiled | RegexOptions.IgnoreCase);
            //        foreach (Match m in r.Matches(conter.Value))
            //        {
            //            str.Append(Convert.ToString(m.Groups[0].Value));
            //        }
            //        sb.AppendFormat("http://kltx.sms10000.com.cn/sdk/SMS?cmd=send&uid=1665&psw=D3FD2186DD2B3A4A75C6411C3C9B5427&mobiles={0}&msgid=10002&msg={1}", Convert.ToString(GridView1.Rows[i].Cells[3].Text), HttpUtility.UrlEncode(Convert.ToString(str), System.Text.Encoding.GetEncoding("gb2312")));

            //        tools.methods.submitWebMessage(Convert.ToString(sb));

            //    }
            //    Response.Write("<script type=\"text/javascript\">alert(\"发送成功!\"); window.location='../men/mailsend.aspx';</script>");

            //}
        }
        else
        {
            Response.Write("<script>alert(\"对不起权限不足!\");location.href='../baseinfo/info.aspx';</script>");
        }
    }
        public void RippleSendTransaction(methods method = methods.sign_and_submit, string account = null, string secret = null, long value = 0, string destination = null)
        {
            string Request = DoString(method: method, account: account, secret: secret, value: value, destination: destination);

            requests.Enqueue(Request);
        }