private void SetTime() { 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") { string st = DateToHex(T_String.GetDate()); st = dt.SetTime(st); if (st + "" == "1") { vs.Rows[i]["SAT_DR"] = PublicFunction.L_Get_Msg("DT", 1); } else { vs.Rows[i]["SAT_DR"] = PublicFunction.L_Get_Msg("DT", 0); } dt.Disconnect(); } } } catch { vs.Rows[i]["SAT_DR"] = PublicFunction.L_Get_Msg("DT", 0); } } vs.AutoSizeCols(); }
private void Transfer1() { // try // { con11 = new SqlConnection(PublicFunction.C_con.ConnectionString); con11.Open(); d1 = 0; for (int f = 1; f < vs.Rows.Count; f++) { if (vs.Rows[f]["FIN"] + "" == "FIN") { break; } vs.Rows[f]["FIN"] = "FIN"; vs.Rows[f]["SAT"] = "Downloading"; vs.AutoSizeCols(); try { string st = ""; string ip = vs.Rows[f]["ADD_IP"] + ""; string MCH_ID = vs.Rows[f]["MCH_ID"] + ""; l1.Text = MCH_ID + " - " + ip; if (dt1.Connect(ip) != "1") { vs.Rows[f]["SAT"] = "Fail!!!"; } else { string tm = DateToHex(T_String.GetDate()); st = dt1.SetTime(tm); while (true) { if (stop) { dt1.Disconnect(); con11.Close(); return; } st = dt1.GetRecord(); if (st.Length < 20) { if (st + "" == "" || st + "" == "1" || st + "" == "-3") { vs.Rows[f]["SAT"] = "Finished!!!"; dt1.Disconnect(); break; } // loi vs.Rows[f]["SAT"] = "Fail!!!"; dt1.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", con11, "0"); } catch { vs.Rows[f]["SAT"] = "Fail!!!"; dt1.Disconnect(); } } } } } } catch (IOException ex) { MessageBox.Show("File :" + ex.Message); return; } } c1.Text = c1.Text + ". Completed!"; con11.Close(); fin1 = true; // if(fin2) // { // if(BT+""!="") // MessageBox.Show(BT); //this.Close(); // } // } // catch (Exception ex) // { // MessageBox.Show( ex.Message); // } }