Esempio n. 1
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 = "";
            for (int i = 0; i < connList.Count; i++)
            {
                TConnInfoFinger conn = connList[i];
                RefreshMsg(currOprt + "[" + conn.MacSN.ToString() + "]......");
                DeviceObject.objFK623.InitConn(conn);
                state     = ExecMacCommand(flag, conn.MacSN, conn.MacType, ref MacMsg);
                ExecTimes = "    " + Pub.GetDateDiffTimes(start, DateTime.Now);
                if (IsMac)
                {
                    if (MacMsg != "")
                    {
                        MacMsg = "[" + MacMsg + "]";
                    }
                    tmp = DeviceObject.objFK623.ErrMsg;
                    SetMacResult(conn.MacSN, state, MacMsg + tmp + ExecTimes);
                    msg = msg + GetMacMsg(conn.MacSN) + ":" + MacMsg + DeviceObject.objFK623.ErrMsg + ";";
                }
                else if (state)
                {
                    SetMacResult(conn.MacSN, state, Pub.GetResText(formCode, "MsgSaveSucceed", "") + ExecTimes);
                    msg = msg + GetMacMsg(conn.MacSN) + ":" + Pub.GetResText(formCode, "MsgSaveSucceed", "") + MacMsg + ";";
                }
                else
                {
                    SetMacResult(conn.MacSN, state, Pub.GetResText(formCode, "MsgSaveFailed", "") + ExecTimes);
                    msg = msg + GetMacMsg(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("");
        }
Esempio n. 2
0
        private void RowToConnInfo(int RowIndex)
        {
            int    MacSN      = 0;
            string MacSN_GRPS = "";
            bool   IsGPRS     = Pub.ValueToBool(dataGrid[9, RowIndex].Value.ToString());

            if (IsGPRS)
            {
                MacSN_GRPS = dataGrid[2, RowIndex].Value.ToString();
            }
            else
            {
                MacSN      = Convert.ToInt32(dataGrid[2, RowIndex].Value.ToString());
                MacSN_GRPS = MacSN.ToString();
            }
            byte            MacType      = Convert.ToByte(dataGrid[3, RowIndex].Value.ToString());
            string          MacConnType  = dataGrid[5, RowIndex].Value.ToString();
            string          MacIPAddress = dataGrid[6, RowIndex].Value.ToString();
            string          MacPort      = dataGrid[7, RowIndex].Value.ToString();
            string          MacConnPWD   = dataGrid[8, RowIndex].Value.ToString();
            TConnInfoFinger conn         = Pub.ValueToConnInfoFinger(MacSN, MacSN_GRPS, MacConnType, MacIPAddress, MacPort, MacConnPWD, IsGPRS);

            connList.Add(conn);
        }
Esempio n. 3
0
        private void btnTestConnect_Click(object sender, EventArgs e)
        {
            if (!CheckValue())
            {
                return;
            }
            TConnInfoFinger conn = Pub.ValueToConnInfoFinger(MacSN, MacSN_GPRS, MacConnType,
                                                             MacIPAddress, MacPort, MacConnPWD, IsGPRS);

            this.Enabled = false;
            bool     ret = false;
            string   msg = "";
            string   dtS = "";
            DateTime dt  = new DateTime();

            DeviceObject.objFK623.InitConn(conn);
            ret = DeviceObject.objFK623.GetDeviceTime(ref dt);
            if (ret)
            {
                dtS = dt.ToString();
            }
            msg = DeviceObject.objFK623.ErrMsg;
            if (ret)
            {
                msg = msg + "\r\n\r\n" + dtS;
            }
            if (ret)
            {
                Pub.MessageBoxShow(msg, MessageBoxIcon.Information);
            }
            else
            {
                Pub.ShowErrorMsg(msg);
            }
            this.Enabled = true;
        }