Beispiel #1
0
        protected override bool ExecMacCommand(byte flag, int MacSN, string url, string NetName, string NetPassword, ref string MacMsg)
        {
            bool ret   = base.ExecMacCommand(flag, MacSN, url, NetName, NetPassword, ref MacMsg);
            byte IsNew = 0;

            if (flag == 0)
            {
                IsNew = 1;
            }
            if (readData == null)
            {
                readData = new FingerReadData(this.Text + "[" + CurrentTool + "]", IsNew);
            }
            int    RecordCount = 0;
            int    RecordIndex = 0;
            string StarTime    = ItemStarTime.Text;
            string EndTime     = ItemEndTime.Text;

            if (StarTime != "")
            {
                StarTime = checkTime(StarTime);
                if (StarTime == "")
                {
                    ItemStarTime.Focus();
                    ShowErrorEnterCorrect(ItemlbDataStartTime.Text);
                    return(false);
                }
            }
            if (EndTime != "")
            {
                EndTime = checkTime(EndTime);
                if (EndTime == "")
                {
                    ItemEndTime.Focus();
                    ShowErrorEnterCorrect(ItemlbDataEndTime.Text);
                    return(false);
                }
            }
            if (StarTime == "" && EndTime != "")
            {
                ItemStarTime.Focus();
                ShowErrorEnterCorrect(ItemlbDataStartTime.Text);
                return(false);
            }
            if (StarTime != "" && EndTime == "")
            {
                ItemEndTime.Focus();
                ShowErrorEnterCorrect(ItemlbDataEndTime.Text);
                return(false);
            }
            if (StarTime != "" && EndTime != "")
            {
                if (Convert.ToDateTime(StarTime) > Convert.ToDateTime(EndTime))
                {
                    Pub.MessageBoxShow(Pub.GetResText(formCode, "Error001", ""), MessageBoxIcon.Error);
                    return(false);
                }
            }

            switch (flag)
            {
            case 0:
            case 1:
                MsgString     = lblMsg.Text;
                progBar.Style = ProgressBarStyle.Blocks;
                progBar.Value = 0;
                ret           = readData.Sea_FK623ReadData(db, textFormat, MacSN, url, NetName, NetPassword, StarTime, EndTime, ref RecordCount, ref RecordIndex, ShowReadDataProcess);
                MacMsg        = string.Format("{0}/{1}", RecordIndex, RecordCount);
                break;

            case 2:
                MsgString     = lblMsg.Text;
                progBar.Style = ProgressBarStyle.Blocks;
                progBar.Value = 0;
                ret           = readData.Sea_SnapShotsData(db, textFormat, MacSN, url, NetName, NetPassword, StarTime, EndTime, ref RecordCount, ref RecordIndex, ShowReadDataProcess);
                MacMsg        = string.Format("{0}/{1}", RecordIndex, RecordCount);
                break;
            }
            readData = null;

            return(ret);
        }