Пример #1
0
 private void test()
 {
     for (int i = 1; i < vs.Rows.Count; i++)
     {
         try
         {
             string ip = vs.Rows[i]["ADD_IP"] + "";
             if (ip + "" == "")
             {
                 vs.Rows[i]["SAT_DR"] = PublicFunction.L_Get_Msg("DT", 0);
             }
             else
             {
                 if (dt.Connect(ip) == "1")
                 {
                     vs.Rows[i]["SAT_DR"] = PublicFunction.L_Get_Msg("DT", 1);
                     dt.Disconnect();
                 }
                 else
                 {
                     vs.Rows[i]["SAT_DR"] = PublicFunction.L_Get_Msg("DT", 0);
                 }
             }
         }
         catch { vs.Rows[i]["SAT_DR"] = PublicFunction.L_Get_Msg("DT", 0); }
     }
     vs.AutoSizeCols();
 }
Пример #2
0
        private void Transfer2()
        {
            //			try
            //			{
            con21 = new SqlConnection(PublicFunction.C_con.ConnectionString);
            con21.Open();
            d2 = 0;

            for (int f = vs.Rows.Count - 1; f > 0; f--)
            {
                if (vs.Rows[f]["FIN"] + "" == "FIN")
                {
                    break;
                }
                vs.Rows[f]["FIN"] = "FIN";
                vs.Rows[f]["SAT"] = "Downloading";
                try
                {
                    string st     = "";
                    string ip     = vs.Rows[f]["ADD_IP"] + "";
                    string MCH_ID = vs.Rows[f]["MCH_ID"] + "";
                    l2.Text = MCH_ID + " - " + ip;
                    if (dt2.Connect(ip) != "1")
                    {
                        vs.Rows[f]["SAT"] = "Fail!!!";
                    }
                    else
                    {
                        while (true)
                        {
                            if (stop)
                            {
                                dt2.Disconnect();
                                con11.Close();
                                return;
                            }
                            st = dt1.GetRecord();
                            if (st.Length < 4)
                            {
                                if (st + "" == "" || st + "" == "1" || st + "" == "-3")
                                {
                                    vs.Rows[f]["SAT"] = "Finished!!!";
                                    dt2.Disconnect();
                                    break;
                                }
                                // loi
                                vs.Rows[f]["SAT"] = "Fail!!!";
                                dt2.Disconnect();
                                break;
                            }
                            else
                            {
                                int gt = T_String.IsNullTo0(PublicFunction.S_Left(st, 2));
                                if ((gt > 0 && gt <= 77) || PublicFunction.S_Left(st, 2) == "00")
                                {
                                    string tam = PublicFunction.S_Right("000" + MCH_ID, 3) + "20";
                                    //lb2.Items.Add("st:"+st);
                                    string st1 = st.Remove(0, 2);
                                    tam = PublicFunction.S_Right("000" + MCH_ID, 3) + st1;
                                    //lb2.Items.Add("tam:"+tam);
                                    try
                                    {
                                        Data_AQ800(tam, "DT6000", con21, "1");
                                    }
                                    catch
                                    {
                                        vs.Rows[f]["SAT"] = "Fail!!!";
                                        dt2.Disconnect();
                                    }
                                }
                            }
                        }
                    }
                }
                catch (IOException ex)
                {
                    MessageBox.Show("File :" + ex.Message);
                    return;
                }
            }

            c2.Text = c2.Text + ". Completed!";
            con21.Close();
            fin2 = true;
            if (fin1)
            {
                if (BT + "" != "")
                {
                    MessageBox.Show(BT);
                }
                //this.Close();
            }
            //			}
            //			catch (Exception ex)
            //			{
            //				MessageBox.Show( ex.Message);
            //			}
        }