private void btnUnockMach_Click(object sender, EventArgs e)
        {
            ResetRemarks();


            LockCtrl();
            Cursor.Current = Cursors.WaitCursor;

            for (int i = 0; i < gv_avbl.DataRowCount; i++)
            {
                //check if selected...
                string tsel = gv_avbl.GetRowCellValue(i, "SEL").ToString();
                if (!Convert.ToBoolean(tsel))
                {
                    continue;
                }

                string ip    = gv_avbl.GetRowCellValue(i, "MachineIP").ToString();
                string ioflg = gv_avbl.GetRowCellValue(i, "IOFLG").ToString().Trim();

                clsMachine m   = new clsMachine(ip, ioflg);
                string     err = string.Empty;

                //try to connect
                m.Connect(out err);

                gv_avbl.SetRowCellValue(i, "Records", 0);
                gv_avbl.SetRowCellValue(i, "Remarks", err);


                string nerr = string.Empty;
                if (!string.IsNullOrEmpty(err))
                {
                    m.DisConnect(out nerr);
                    gv_avbl.SetRowCellValue(i, "Remarks", err + ";" + nerr);
                    continue;
                }


                m.Unlock(out err);
                gv_avbl.SetRowCellValue(i, "Remarks", err);

                if (string.IsNullOrEmpty(err))
                {
                    gv_avbl.SetRowCellValue(i, "Remarks", "Machine Unlocked...");
                }
                else
                {
                    gv_avbl.SetRowCellValue(i, "Remarks", err);
                }

                m.DisConnect(out nerr);
            }

            UnLockCtrl();
            Cursor.Current = Cursors.WaitCursor;
        }
예제 #2
0
        private string[] download(string ip, string ioflg, int rowno)
        {
            string err = string.Empty;

            string[]       outary   = { rowno.ToString(), "0", "" };
            List <AttdLog> tempattd = new List <AttdLog>();

            try
            {
                clsMachine m = new clsMachine(ip, ioflg);
                m.Connect(out err);
                if (!string.IsNullOrEmpty(err))
                {
                    outary[0] = rowno.ToString();
                    outary[1] = "0";
                    outary[2] = err;

                    return(outary);
                }

                err = string.Empty;

                //pending
                //Path.Combine(Utils.Helper.GetLogFilePath, rowno.ToString() + "_attdlog.dat");

                //m.GetAttdRec(out tempattd, out err);
                if (!string.IsNullOrEmpty(err))
                {
                    //gv.SetRowCellValue(rowno, "Records", 0);
                    //gv.SetRowCellValue(rowno, "Remarks", err);
                    outary[0] = rowno.ToString();
                    outary[1] = "0";
                    outary[2] = err;
                    return(outary);
                }

                m.DisConnect(out err);
            }
            catch (Exception ex)
            {
                err       = ex.ToString();
                outary[0] = rowno.ToString();
                outary[1] = "0";
                outary[2] = err;
                return(outary);
            }
            outary[0] = rowno.ToString();
            outary[1] = tempattd.Count.ToString();
            outary[2] = "Download Complete";
            return(outary);
        }
        private void btnClearMach_Click(object sender, EventArgs e)
        {
            string msg = "Make Sure to Download all data in multiple application if running with common machines" + Environment.NewLine +
                         "However Application will download data first, which only accounted in running application. " + Environment.NewLine +
                         "Are You Sure to Clear selected machine ?";


            DialogResult dr = MessageBox.Show(msg, "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dr != DialogResult.Yes)
            {
                return;
            }

            ResetRemarks();
            btnDownload_Click(sender, e);
            ResetRemarks();
            LockCtrl();

            Cursor.Current = Cursors.WaitCursor;

            for (int i = 0; i < gv_avbl.DataRowCount; i++)
            {
                //check if selected...
                string tsel = gv_avbl.GetRowCellValue(i, "SEL").ToString();
                if (!Convert.ToBoolean(tsel))
                {
                    continue;
                }

                string ip    = gv_avbl.GetRowCellValue(i, "MachineIP").ToString();
                string ioflg = gv_avbl.GetRowCellValue(i, "IOFLG").ToString().Trim();

                clsMachine m   = new clsMachine(ip, ioflg);
                string     err = string.Empty;


                //try to connect
                m.Connect(out err);

                gv_avbl.SetRowCellValue(i, "Records", 0);
                gv_avbl.SetRowCellValue(i, "Remarks", err);


                string nerr = string.Empty;

                if (!string.IsNullOrEmpty(err))
                {
                    m.DisConnect(out nerr);
                    gv_avbl.SetRowCellValue(i, "Remarks", err + ";" + nerr);
                    continue;
                }

                //Clear Machine
                m.AttdLogClear(out err);
                if (string.IsNullOrEmpty(err))
                {
                    gv_avbl.SetRowCellValue(i, "Remarks", "Log Clear...");
                }
                else
                {
                    gv_avbl.SetRowCellValue(i, "Remarks", err);
                }
                m.DisConnect(out nerr);
            }

            UnLockCtrl();
            Cursor.Current = Cursors.WaitCursor;
        }
예제 #4
0
        private void btnGetRegCount_Click(object sender, EventArgs e)
        {
            ResetRemarks();


            LockCtrl();
            Cursor.Current = Cursors.WaitCursor;



            for (int i = 0; i < gv_avbl.DataRowCount; i++)
            {
                //check if selected...
                string tsel = gv_avbl.GetRowCellValue(i, "SEL").ToString();
                if (!Convert.ToBoolean(tsel))
                {
                    continue;
                }

                string ip    = gv_avbl.GetRowCellValue(i, "MachineIP").ToString();
                string ioflg = gv_avbl.GetRowCellValue(i, "IOFLG").ToString().Trim();

                clsMachine m   = new clsMachine(ip, ioflg);
                string     err = string.Empty;

                //try to connect
                m.Connect(out err);

                gv_avbl.SetRowCellValue(i, "Records", 0);
                gv_avbl.SetRowCellValue(i, "Remarks", err);


                string nerr = string.Empty;
                if (!string.IsNullOrEmpty(err))
                {
                    m.DisConnect(out nerr);
                    gv_avbl.SetRowCellValue(i, "Remarks", err + ";" + nerr);
                    continue;
                }

                int    UserCount    = 0;
                int    UserCapacity = 0;
                string sql          = "Select FACE from ReaderConfig where MachineIP ='" + ip + "'";
                string tcnt         = Utils.Helper.GetDescription(sql, Utils.Helper.constr);

                //set duplicate punch count
                m.SetDuplicatePunchDuration(3);


                if (Convert.ToBoolean(tcnt))
                {
                    m.Get_StatusInfo_Face(out UserCount, out UserCapacity, out err);
                }
                else
                {
                    m.Get_StatusInfo_Users(out UserCount, out UserCapacity, out err);
                }


                if (string.IsNullOrEmpty(err))
                {
                    gv_avbl.SetRowCellValue(i, "Remarks", UserCapacity.ToString());
                    gv_avbl.SetRowCellValue(i, "Records", UserCount.ToString());
                }

                m.DisConnect(out nerr);
            }

            UnLockCtrl();
            Cursor.Current = Cursors.WaitCursor;
        }