Beispiel #1
0
        private void btnGetParam_Click(object sender, EventArgs e)
        {
            string        cmd = "GetDeviceSetting";
            string        sql = "";
            DeviceCmd     devGetDeviceSettingCmd = new DeviceCmd(cmd);
            StringBuilder jsonStringBuilder      = new StringBuilder(JsonConvert.SerializeObject(devGetDeviceSettingCmd));
            frmMJStarOprt frm = new frmMJStarOprt(this.Text, btnGetParam.Text, jsonStringBuilder, 2, null);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (frm.BodyParameter.Length > 0)
                {
                    _ResultInfo <ParameterInfo> parameterInfo = JsonConvert.DeserializeObject <_ResultInfo <ParameterInfo> >(frm.BodyParameter.ToString());

                    if (MacSN == "")
                    {
                        sql = Pub.GetSQL(DBCode.DB_000300, new string[] { "22", "1", parameterInfo.result_data.devName, parameterInfo.result_data.wiegandType, parameterInfo.result_data.language,
                                                                          parameterInfo.result_data.antiPass, parameterInfo.result_data.openDoorDelay, parameterInfo.result_data.tamperAlarm, parameterInfo.result_data.alarmDelay,
                                                                          parameterInfo.result_data.volume, parameterInfo.result_data.reverifyTime, parameterInfo.result_data.screensaversTime,
                                                                          parameterInfo.result_data.sleepTime, parameterInfo.result_data.verifyMode });
                    }
                    else
                    {
                        sql = Pub.GetSQL(DBCode.DB_000300, new string[] { "23", parameterInfo.result_data.devName, parameterInfo.result_data.wiegandType, parameterInfo.result_data.language,
                                                                          parameterInfo.result_data.antiPass, parameterInfo.result_data.openDoorDelay, parameterInfo.result_data.tamperAlarm, parameterInfo.result_data.alarmDelay,
                                                                          parameterInfo.result_data.volume, parameterInfo.result_data.reverifyTime, parameterInfo.result_data.screensaversTime,
                                                                          parameterInfo.result_data.sleepTime, parameterInfo.result_data.verifyMode, "1" });
                    }
                    SystemInfo.db.ExecSQL(sql);
                    Pub.MessageBoxShow(Pub.GetResText("", "MsgReadEndData", ""));
                }

                RefreshParameter();
            }
        }
Beispiel #2
0
        private void btnGetParam_Click(object sender, EventArgs e)
        {
            string        cmd = "GetDeviceSetting";
            string        sql = "";
            DeviceCmd     devGetDeviceSettingCmd = new DeviceCmd(cmd);
            StringBuilder jsonStringBuilder      = new StringBuilder(JsonConvert.SerializeObject(devGetDeviceSettingCmd));
            frmMJStarOprt frm = new frmMJStarOprt(this.Text, btnGetParam.Text, jsonStringBuilder, 2, null);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (frm.BodyParameter.Length > 0)
                {
                    _ResultInfo <NetParameterInfo> parameterInfo = JsonConvert.DeserializeObject <_ResultInfo <NetParameterInfo> > (frm.BodyParameter.ToString());
                    if (MacSN == "")
                    {
                        sql = Pub.GetSQL(DBCode.DB_000300, new string[] { "24", "1", parameterInfo.result_data.serverHost, parameterInfo.result_data.serverPort, parameterInfo.result_data.pushServerHost,
                                                                          parameterInfo.result_data.pushServerPort, parameterInfo.result_data.interval, parameterInfo.result_data.pushEnable });
                    }
                    else
                    {
                        sql = Pub.GetSQL(DBCode.DB_000300, new string[] { "25", parameterInfo.result_data.serverHost, parameterInfo.result_data.serverPort, parameterInfo.result_data.pushServerHost,
                                                                          parameterInfo.result_data.pushServerPort, parameterInfo.result_data.interval, parameterInfo.result_data.pushEnable, MacSN });
                    }

                    Pub.MessageBoxShow(Pub.GetResText("", "MsgReadEndData", ""));
                }
                if (SystemInfo.db.ExecSQL(sql) >= 0)
                {
                    RefreshParameter();
                }
            }
        }
Beispiel #3
0
        private void GetUserIDListFromMac()
        {
            bool   state;
            bool   ret               = false;
            int    vnResultCode      = -1;
            UInt32 vEnrollNumber     = 0;
            int    vBackupNumber     = 0;
            int    vPrivilege        = 0;
            int    vnEnableFlag      = 0;
            string UserName          = "";
            int    EnrollNumberCount = 0;
            int    PersonNum         = 0;

            lblMsg.ForeColor = Color.FromName("Black");
            TDIConnInfo conn;

            progBar1.ProgressType = DevComponents.DotNetBar.eProgressItemType.Marquee;
            progBar1.Visible      = true;
            lblMsg1.Visible       = true;
            btnStop.Visible       = true;
            btnStop.Focus();
            if (connList.Count > 0)
            {
                for (int i = 0; i < connList.Count; i++)
                {
                    conn = connList[i];

                    switch (conn.MacSeriesTypeId)
                    {
                    case 2:
                        if (SystemInfo.ShowSEA != 1)
                        {
                            Pub.MessageBoxShow(string.Format(Pub.GetResText(formCode, "MsgUnModuleInfo", ""), Pub.GetResText(formCode, "SeaDev", "")));
                            break;
                        }
                        if (RegisterInfo.IsValid || RegisterInfo.IsTest)
                        {
                            if (RegisterInfo.EndDate < DateTime.Now)
                            {
                                Pub.MessageBoxShow(RegisterInfo.StateText);
                                break;
                            }
                        }
                        SystemInfo.MacSeriesTypeId = 2;
                        string url = "http://" + conn.NetHost + "/";
                        //查询人员总数
                        string                       searchTotlePersonUrl      = url + "action/SearchPersonNum";
                        SearchTotlePerson            searchTotlePerson         = new SearchTotlePerson(Convert.ToInt32(conn.MacSN), 0, "", "", 2, "0-100", 0, "");
                        jsonBody <SearchTotlePerson> jsonBodySearchTotlePerson = new jsonBody <SearchTotlePerson>("SearchPersonNum", searchTotlePerson);
                        string                       jsonString = JsonConvert.SerializeObject(jsonBodySearchTotlePerson);
                        ret = DeviceObject.objFK623.POST_GetResponse(searchTotlePersonUrl, conn.MacSeriesUserName, conn.SeaSeries_Pwd, ref jsonString);
                        if (!ret)
                        {
                            lblMsg.ForeColor = Color.FromName("red");
                            lblMsg.Text      = DeviceObject.objFK623.SeaBodyStr();
                            continue;
                        }
                        jsonBody <SearchTotlePersonInfo> searchTotlePersonInfo = JsonConvert.DeserializeObject <jsonBody <SearchTotlePersonInfo> >(jsonString);
                        {
                            PersonNum = searchTotlePersonInfo.info.PersonNum;
                        }
                        if (PersonNum == 0)
                        {
                            lblMsg.ForeColor = Color.FromName("red");
                            lblMsg.Text      = (Pub.GetResText(formCode, "ErrorUnUserID", ""));
                            continue;
                        }
                        int count = 0;
                        while (true)
                        {
                            if (Stop || StopGet)
                            {
                                break;
                            }
                            //查询人员
                            string searchMultipleUrl            = url + "action/SearchPersonList";
                            SearchMultiplePerson searchMultiple = new SearchMultiplePerson(Convert.ToInt32(conn.MacSN), 0, "", "", 2, "0-100", 0, "", count * 10, 10, 0);
                            count++;
                            jsonBody <SearchMultiplePerson> jsonBodySearchMultiplePerson = new jsonBody <SearchMultiplePerson>("SearchPersonList", searchMultiple);
                            jsonString = JsonConvert.SerializeObject(jsonBodySearchMultiplePerson);
                            ret        = DeviceObject.objFK623.POST_GetResponse(searchMultipleUrl, conn.MacSeriesUserName, conn.SeaSeries_Pwd, ref jsonString);
                            if (!ret)
                            {
                                break;
                            }
                            jsonBody <SearchMultiplePersonInfo <SearchPersonInfo> > searchMultiplePersonInfo = JsonConvert.DeserializeObject <jsonBody <SearchMultiplePersonInfo <SearchPersonInfo> > >(jsonString);
                            {
                                for (int j = 0; j < searchMultiplePersonInfo.info.Listnum; j++)
                                {
                                    if (Stop || StopGet)
                                    {
                                        break;
                                    }
                                    vEnrollNumber = searchMultiplePersonInfo.info.List[j].CustomizeID;
                                    UserName      = searchMultiplePersonInfo.info.List[j].Name;
                                    if (!selStringList.Contains(vEnrollNumber.ToString()) && vEnrollNumber != 0)
                                    {
                                        //int index = this.cardGrid.Rows.Add();
                                        cardGrid.Rows.Add(new object[] { false, vEnrollNumber.ToString(), UserName });
                                        //// ((DataGridViewCheckBoxCell)cardGrid.Rows[index].Cells[0]).Value = true;
                                        //this.cardGrid.Rows[index].Cells[1].Value = vEnrollNumber.ToString();
                                        //this.cardGrid.Rows[index].Cells[2].Value = UserName;

                                        selStringList.Add(vEnrollNumber.ToString());

                                        lblMsg.Text = string.Format("{0}", cardGrid.Rows.Count);
                                    }
                                    //EnrollNumberCount++;

                                    lblMsg1.Text = Pub.GetResText(formCode, "btnGetListFromMac", "") + string.Format("-{0} /{1} ", cardGrid.Rows.Count, cardGrid.Rows.Count);
                                }
                            }
                            Application.DoEvents();
                        }
                        break;

                    case 3:
                        if (SystemInfo.ShowSTAR != 1)
                        {
                            Pub.MessageBoxShow(string.Format(Pub.GetResText(formCode, "MsgUnModuleInfo", ""), Pub.GetResText(formCode, "StarDev", "")));
                            break;
                        }
                        if (RegisterInfo.IsValid || RegisterInfo.IsTest)
                        {
                            if (RegisterInfo.EndDate < DateTime.Now)
                            {
                                Pub.MessageBoxShow(RegisterInfo.StateText);
                                break;
                            }
                        }
                        try
                        {
                            if (DeviceObject.socKetClient.Open(conn.NetHost, conn.NetPort, conn.NetPassword))
                            {
                                string        cmd               = "GetDeviceInfo";
                                DeviceCmd     getDeviceCmd      = new DeviceCmd(cmd);
                                StringBuilder jsonStringBuilder = new StringBuilder(JsonConvert.SerializeObject(getDeviceCmd));
                                if (DeviceObject.socKetClient.SendData(ref jsonStringBuilder))
                                {
                                    cmd = "GetUserIdList";
                                    GetUserIdListCmd getUserIdListCmd = new GetUserIdListCmd(0);
                                    _DeviceCmd <GetUserIdListCmd> devGetUserIdListCmd = new _DeviceCmd <GetUserIdListCmd>(cmd, getUserIdListCmd);
RE:
                                    if (Stop || StopGet)
                                    {
                                        break;
                                    }
                                    jsonStringBuilder = new StringBuilder(JsonConvert.SerializeObject(devGetUserIdListCmd));
                                    if (DeviceObject.socKetClient.SendData(ref jsonStringBuilder))
                                    {
                                        int back = DeviceObject.socKetClient.JsonRecive(jsonStringBuilder);
                                        if (back == 0)
                                        {
                                            _ResultInfo <UserListInfo <UserIdName> > personIDList = JsonConvert.DeserializeObject <_ResultInfo <UserListInfo <UserIdName> > >(jsonStringBuilder.ToString());
                                            if (personIDList.result_data.users != null)
                                            {
                                                for (int x = 0; x < personIDList.result_data.users.Count; x++)
                                                {
                                                    int index = this.cardGrid.Rows.Add();
                                                    this.cardGrid.Rows[index].Cells[1].Value = personIDList.result_data.users[x].userId;
                                                    this.cardGrid.Rows[index].Cells[2].Value = personIDList.result_data.users[x].name;

                                                    selStringList.Add(personIDList.result_data.users[x].userId);
                                                    EnrollNumberCount = index;
                                                    lblMsg.Text       = string.Format("{0}", index);
                                                }
                                            }
                                            else
                                            {
                                                lblMsg.ForeColor = Color.FromName("red");
                                                lblMsg.Text      = (Pub.GetResText(formCode, "ErrorUnUserID", ""));
                                                ret = false;
                                                continue;
                                            }

                                            if (personIDList.result_data.packageId != 0)
                                            {
                                                devGetUserIdListCmd.data.packageId++;
                                                goto RE;
                                            }

                                            lblMsg1.Text = Pub.GetResText(formCode, "btnGetListFromMac", "") + string.Format("-{0} /{1} ", EnrollNumberCount, EnrollNumberCount);
                                            Application.DoEvents();
                                            ret = true;
                                        }
                                        else
                                        {
                                            ret = false;
                                        }
                                    }
                                    else
                                    {
                                        ret = false;
                                    }
                                }
                            }
                            else
                            {
                                lblMsg.ForeColor = Color.FromName("red");
                                lblMsg.Text      = DeviceObject.objFK623.GetRunMsg((int)enumErrorCode.RUNERR_NO_OPEN_COMM);
                                continue;
                            }
                            DeviceObject.socKetClient.Close();
                        }
                        catch (Exception E)
                        {
                            MessageBox.Show(E.Message);
                        }
                        break;

                    default:
                        SystemInfo.MacSeriesTypeId = 1;
                        DeviceObject.objFK623.InitConn(conn);
                        if (!DeviceObject.objFK623.IsOpen)
                        {
                            DeviceObject.objFK623.Open();
                        }
                        vnResultCode = DeviceObject.objFK623.EnableDevice(0);
                        state        = DeviceObject.objFK623.IsOpen;
                        if (state)
                        {
                            vnResultCode = DeviceObject.objFK623.ReadAllUserID();
                        }
                        else
                        {
                            lblMsg.ForeColor = Color.FromName("red");
                            lblMsg.Text      = DeviceObject.objFK623.GetRunMsg((int)enumErrorCode.RUNERR_NO_OPEN_COMM);
                        }

                        if (vnResultCode != (int)enumErrorCode.RUN_SUCCESS)
                        {
                            if (state)
                            {
                                lblMsg.ForeColor = Color.FromName("red");
                                lblMsg.Text      = (Pub.GetResText(formCode, "ErrorUnUserID", ""));
                            }
                            DeviceObject.objFK623.EnableDevice(1);
                            DeviceObject.objFK623.Close();
                            continue;
                        }

                        do
                        {
                            vnResultCode = DeviceObject.objFK623.GetAllUserID(
                                ref vEnrollNumber,
                                ref vBackupNumber,
                                ref vPrivilege,
                                ref vnEnableFlag);

                            if (vnResultCode != (int)enumErrorCode.RUN_SUCCESS)
                            {
                                DeviceObject.objFK623.EnableDevice(1);
                                DeviceObject.objFK623.Close();
                                break;
                            }
                            DeviceObject.objFK623.GetUserName(vEnrollNumber, ref UserName);
                            if (!selStringList.Contains(vEnrollNumber.ToString()) && vEnrollNumber != 0)
                            {
                                int index = this.cardGrid.Rows.Add();
                                // ((DataGridViewCheckBoxCell)cardGrid.Rows[index].Cells[0]).Value = true;
                                this.cardGrid.Rows[index].Cells[1].Value = vEnrollNumber.ToString();
                                this.cardGrid.Rows[index].Cells[2].Value = UserName;

                                selStringList.Add(vEnrollNumber.ToString());
                                EnrollNumberCount = index;
                                lblMsg.Text       = string.Format("{0}", index);
                            }
                            //EnrollNumberCount++;

                            lblMsg1.Text = Pub.GetResText(formCode, "btnGetListFromMac", "") + string.Format("-{0} /{1} ", EnrollNumberCount, EnrollNumberCount);
                            Application.DoEvents();
                            if (StopGet)
                            {
                                DeviceObject.objFK623.EnableDevice(1);
                                DeviceObject.objFK623.Close();
                                break;
                            }
                            if (Stop)
                            {
                                DeviceObject.objFK623.EnableDevice(1);
                                DeviceObject.objFK623.Close();
                                this.Close();
                            }
                        }while (true);
                        break;
                    }

                    cardGrid.Sort(this.cardGrid.Columns[1], ListSortDirection.Ascending);//排序
                    lblMsg.ForeColor      = Color.FromName("Black");
                    lblMsg.Text           = cardGrid.Rows.Count.ToString();
                    lblMsg1.Text          = Pub.GetResText(formCode, "MsgReadEndData", "");
                    progBar1.ProgressType = DevComponents.DotNetBar.eProgressItemType.Standard;
                    progBar1.Value        = 0;
                    StopGet          = false;
                    progBar1.Visible = false;
                    lblMsg1.Visible  = false;
                    btnStop.Visible  = false;
                }
            }
        }
Beispiel #4
0
        private void btnGetMacSN_Click(object sender, EventArgs e)
        {
            if (RegisterInfo.IsValid || RegisterInfo.IsTest)
            {
                if (RegisterInfo.EndDate < DateTime.Now)
                {
                    Pub.MessageBoxShow(RegisterInfo.StateText);
                    return;
                }
            }
            if (!CheckValue())
            {
                return;
            }
            TDIConnInfo connInfo = Pub.ValueToDIConnInfo(MacSN, MacSN_GPRS, MacConnType, MacIP, MacPort, MacConnPWD, IsGPRS, MacSeriesTypeId, SeaSeriesPwd, MacSeriesUserName);

            this.Enabled = false;
            bool   ret    = false;
            string Online = "";
            string msg    = "";

            try
            {
                switch (MacSeriesTypeId)
                {
                case 2:
                    string syncTime = "";
                    string url      = "http://" + MacIP + "/action/GetSysParam";
                    ret = DeviceObject.objFK623.POST_GetResponse(url, MacSeriesUserName, SeaSeriesPwd, ref syncTime);

                    if (ret)
                    {
                        if (syncTime != "")
                        {
                            jsonBody <GetSysParam> answer = JsonConvert.DeserializeObject <jsonBody <GetSysParam> >(syncTime);
                            txtMacSN.Text = answer.info.DeviceID.ToString();
                            Pub.MessageBoxShow(Pub.GetResText("", "MsgReadEndData", ""));
                            Application.DoEvents();
                        }
                    }
                    else
                    {
                        ret = false;
                        Pub.MessageBoxShow(Pub.GetResText("", "FK_RUNERR_NO_OPEN_COMM", ""));
                    }
                    break;

                case 3:
                    string        cmd               = "GetDeviceInfo";
                    DeviceCmd     getDeviceCmd      = new DeviceCmd(cmd);
                    StringBuilder jsonStringBuilder = new StringBuilder(JsonConvert.SerializeObject(getDeviceCmd));
                    int           pwd               = 0;
                    int.TryParse(MacConnPWD, out pwd);
                    if (DeviceObject.socKetClient.Open(MacIP, Convert.ToInt32(MacPort), pwd))
                    {
                        if (DeviceObject.socKetClient.SendData(ref jsonStringBuilder))
                        {
                            int state = DeviceObject.socKetClient.JsonRecive(jsonStringBuilder);
                            if (state == 0)
                            {
                                _ResultInfo <DeviceInfo> deviceInfo = JsonConvert.DeserializeObject <_ResultInfo <DeviceInfo> >(jsonStringBuilder.ToString());

                                string deviceId   = deviceInfo.result_data.deviceId;
                                string deviceName = deviceInfo.result_data.name;
                                txtMacSN.Text = deviceId;
                                ret           = true;
                                Pub.MessageBoxShow(Pub.GetResText("", "MsgReadEndData", ""));
                            }
                            else
                            {
                                ret = false;
                                msg = DeviceObject.socKetClient.GetStarState(state);
                            }
                        }
                        else
                        {
                            ret = false;
                            Pub.MessageBoxShow(Pub.GetResText("", "FK_RUNERR_NO_OPEN_COMM", ""));
                        }
                    }
                    else
                    {
                        ret = false;
                        Pub.MessageBoxShow(Pub.GetResText("", "FK_RUNERR_NO_OPEN_COMM", ""));
                    }
                    DeviceObject.socKetClient.Close();
                    break;
                }
                if (ret)
                {
                    Online = Pub.GetResText(formCode, "Online", "");
                    SystemInfo.db.ExecSQL(Pub.GetSQL(DBCode.DB_000300, new string[] { "304", Online
                                                                                      , "", MacSN_GPRS }));
                }
                else
                {
                    Online = Pub.GetResText(formCode, "Offline", "");
                    SystemInfo.db.ExecSQL(Pub.GetSQL(DBCode.DB_000300, new string[] { "305", Online, MacSN_GPRS }));
                }
            }
            catch (Exception E)
            {
                msg = E.Message;
            }

            this.Enabled = true;
        }
Beispiel #5
0
        private void btnTestConnect_Click(object sender, EventArgs e)
        {
            if (!CheckValue())
            {
                return;
            }
            TDIConnInfo connInfo = Pub.ValueToDIConnInfo(MacSN, MacSN_GPRS, MacConnType, MacIP, MacPort, MacConnPWD, IsGPRS, MacSeriesTypeId, SeaSeriesPwd, MacSeriesUserName);

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

            try
            {
                switch (MacSeriesTypeId)
                {
                case 2:
                    if (RegisterInfo.IsValid || RegisterInfo.IsTest)
                    {
                        if (RegisterInfo.EndDate < DateTime.Now)
                        {
                            Pub.MessageBoxShow(RegisterInfo.StateText);
                            return;
                        }
                    }
                    try
                    {
                        string url      = "http://" + MacIP + "/action/GetSysTime";
                        string syncTime = "";
                        ret = DeviceObject.objFK623.POST_GetResponse(url, MacSeriesUserName, SeaSeriesPwd, ref syncTime);

                        if (ret)
                        {
                            if (syncTime != "")
                            {
                                jsonBody <SeaSeriesSyncTime> answer = JsonConvert.DeserializeObject <jsonBody <SeaSeriesSyncTime> >(syncTime);
                                msg = Pub.GetResText("", "FK_RUN_SUCCESS", "") + "\r\n\r\n" + answer.info.Year + "-" + answer.info.Month + "-" + answer.info.Day + " " + answer.info.Hour
                                      + ":" + answer.info.Minute + ":" + answer.info.Second;
                                FK623Attend.SeaBody = Pub.GetResText("", "FK_RUN_SUCCESS", "");
                            }
                            else
                            {
                                ret = false;
                                msg = Pub.GetResText("", "FK_RUNERR_NO_OPEN_COMM", "") + "\r\n\r\n" + DeviceObject.objFK623.SeaBodyStr();
                            }
                        }
                        else
                        {
                            msg = Pub.GetResText("", "FK_RUNERR_NO_OPEN_COMM", "");
                        }
                    }
                    catch (Exception E)
                    {
                        msg = E.Message;
                    }
                    break;

                case 3:
                    if (RegisterInfo.IsValid || RegisterInfo.IsTest)
                    {
                        if (RegisterInfo.EndDate < DateTime.Now)
                        {
                            Pub.MessageBoxShow(RegisterInfo.StateText);
                            return;
                        }
                    }
                    string        cmd               = "GetDeviceInfo";
                    DeviceCmd     getDeviceCmd      = new DeviceCmd(cmd);
                    StringBuilder jsonStringBuilder = new StringBuilder(JsonConvert.SerializeObject(getDeviceCmd));
                    int           pwd               = 0;
                    int.TryParse(MacConnPWD, out pwd);
                    if (DeviceObject.socKetClient.Open(MacIP, Convert.ToInt32(MacPort), pwd))
                    {
                        if (DeviceObject.socKetClient.SendData(ref jsonStringBuilder))
                        {
                            int state = DeviceObject.socKetClient.JsonRecive(jsonStringBuilder);
                            if (state == 0)
                            {
                                _ResultInfo <DeviceInfo> deviceInfo = JsonConvert.DeserializeObject <_ResultInfo <DeviceInfo> >(jsonStringBuilder.ToString());

                                string deviceId   = deviceInfo.result_data.deviceId;
                                string deviceName = deviceInfo.result_data.name;
                                ret = true;
                                msg = Pub.GetResText("", "FK_RUN_SUCCESS", "") + "\r\n\r\n" + deviceId + "\r\n\r\n" + deviceName;
                            }
                            else
                            {
                                msg = DeviceObject.socKetClient.GetStarState(state);
                            }
                        }
                        else
                        {
                            ret = false;
                            msg = Pub.GetResText("", "FK_RUNERR_NO_OPEN_COMM", "");
                        }
                    }
                    else
                    {
                        ret = false;
                        msg = Pub.GetResText("", "FK_RUNERR_NO_OPEN_COMM", "");
                    }
                    DeviceObject.socKetClient.Close();
                    break;

                default:
                    DeviceObject.objFK623.Close();
                    DeviceObject.objFK623.InitConn(connInfo);
                    DeviceObject.objFK623.Open();
                    ret = DeviceObject.objFK623.GetDeviceTime(ref dTime);
                    DeviceObject.objFK623.Close();
                    if (ret)
                    {
                        dt = dTime.ToString();
                    }
                    msg = DeviceObject.objFK623.ErrMsg;
                    if (ret)
                    {
                        msg = msg + "\r\n\r\n" + dt;
                    }
                    break;
                }

                if (ret)
                {
                    Online = Pub.GetResText(formCode, "Online", "");

                    SystemInfo.db.ExecSQL(Pub.GetSQL(DBCode.DB_000300, new string[] { "304", Online
                                                                                      , "", MacSN_GPRS }));
                    Pub.MessageBoxShow(msg, MessageBoxIcon.Information);
                }
                else
                {
                    Online = Pub.GetResText(formCode, "Offline", "");

                    SystemInfo.db.ExecSQL(Pub.GetSQL(DBCode.DB_000300, new string[] { "305", Online, MacSN_GPRS }));
                    Pub.MessageBoxShow(msg);
                }
            }
            catch (Exception E)
            {
                Pub.MessageBoxShow(E.Message);
            }
            finally
            {
                this.Enabled = true;
            }
        }