示例#1
0
        private void RowToConnInfo(int RowIndex)
        {
            string       MacSN        = dataGrid[2, RowIndex].Value.ToString();
            string       MacIPAddress = dataGrid[3, RowIndex].Value.ToString();
            string       MacPort      = dataGrid[4, RowIndex].Value.ToString();
            string       MacName      = dataGrid[5, RowIndex].Value.ToString();
            string       MacPWD       = dataGrid[6, RowIndex].Value.ToString();
            TConnInfoSEA conn         = Pub.ValueToConnInfoSEA(MacSN, MacIPAddress, MacPort, MacName, MacPWD);

            connList.Add(conn);
        }
示例#2
0
        protected void ExecMacOprt(byte flag, bool IsMac)
        {
            currOprt = CurrentTool;
            bool   state;
            string msg    = "";
            string MacMsg = "";

            if (!InitMacList(IsMac))
            {
                return;
            }
            IsExec = true;
            string tmp = "";

            RefreshForm(false);
            DateTime start = new DateTime();

            start = DateTime.Now;
            string ExecTimes = "";

            txtMag.Text = "";
            string url = "";

            for (int i = 0; i < connList.Count; i++)
            {
                TConnInfoSEA conn = connList[i];
                if (RegisterInfo.IsValid || RegisterInfo.IsTest)
                {
                    if (RegisterInfo.EndDate < DateTime.Now)
                    {
                        MacMsg = RegisterInfo.StateText;
                        break;
                    }
                }

                url = "http://" + conn.NetIP + "/";
                string body         = "";
                string urlTestConnt = "http://" + conn.NetIP + "/action/GetSysParam";
                bool   ret          = DeviceObject.objFK623.POST_GetResponse(urlTestConnt, conn.NetName, conn.NetPassword, ref body);

                if (ret)
                {
                    state = ExecMacCommand(flag, Convert.ToInt32(conn.MacSN), url, conn.NetName, conn.NetPassword, ref MacMsg);
                }
                else
                {
                    state = false;
                }

                ExecTimes = "    " + Pub.GetDateDiffTimes(start, DateTime.Now);
                if (IsMac)
                {
                    if (MacMsg != "")
                    {
                        MacMsg = "[" + MacMsg + "]";
                    }
                    tmp = DeviceObject.objFK623.SeaBodyStr();
                    SetMacResult(Convert.ToInt32(conn.MacSN), state, MacMsg + tmp + ExecTimes);
                    msg = msg + GetMacMsg(Convert.ToInt32(conn.MacSN)) + ":" + MacMsg + DeviceObject.objFK623.SeaBodyStr() + ";";
                }
                else if (state)
                {
                    SetMacResult(Convert.ToInt32(conn.MacSN), state, Pub.GetResText(formCode, "MsgSaveSucceed", "") + ExecTimes);
                    msg = msg + GetMacMsg(Convert.ToInt32(conn.MacSN)) + ":" + Pub.GetResText(formCode, "MsgSaveSucceed", "") + MacMsg + ";";
                }
                else
                {
                    SetMacResult(Convert.ToInt32(conn.MacSN), state, Pub.GetResText(formCode, "MsgSaveFailed", "") + ExecTimes);
                    msg = msg + GetMacMsg(Convert.ToInt32(conn.MacSN)) + ":" + Pub.GetResText(formCode, "MsgSaveFailed", "") + MacMsg + ";";
                }
                Application.DoEvents();
                start = DateTime.Now;
                if (!IsExec)
                {
                    break;
                }
            }
            db.WriteSYLog(this.Text, currOprt, msg);
            IsExec = false;
            RefreshForm(true);
            RefreshMsg("");
        }