Beispiel #1
0
        private void btnPullData_Click(object sender, EventArgs e)
        {
            try
            {
                // string connetionString = null;
                //MySqlConnection cnn;
                //connetionString = "server=localhost;port=3306;database=rashmi;uid=root;pwd=;";
                //cnn = new MySqlConnection(connetionString);
                //cnn.Open();
                // ICollection<MachineInfo> lstMachineInfo = manipulator.GetLogData(objZkeeper, int.Parse(tbxMachineNumber.Text.Trim()));

                int dwEnrollNumber   = 0;
                int dwEMachineNumber = 0;
                int dwTMachineNumber = 0;
                int dwVerifyMode     = 0;
                int dwInOutMode      = 0;
                int dwYear           = 0;
                int dwMonth          = 0;
                int dwDay            = 0;
                int dwHour           = 0;
                int dwMinute         = 0;
                int dwSecond         = 0;
                // int dwWorkCode = 0;
                int dwMachineNumber = int.Parse(tbxMachineNumber.Text.Trim());


                ICollection <MachineInfo> lstEnrollData = new List <MachineInfo>();

                objZkeeper.ReadGeneralLogData(dwMachineNumber);

                // while (objZkeeper.SSR_GetGeneralLogData(dwMachineNumber, out dwEnrollNumber, out dwVerifyMode, out dwInOutMode, out dwYear, out dwMonth, out dwDay, out dwHour, out dwMinute, out dwSecond, ref dwWorkCode))
                while (objZkeeper.GetGeneralLogData(dwMachineNumber, ref dwTMachineNumber, ref dwEnrollNumber, ref dwEMachineNumber, ref dwVerifyMode, ref dwInOutMode, ref dwYear, ref dwMonth, ref dwDay, ref dwHour, ref dwMinute))

                {
                    c++;
                    string inputDate = new DateTime(dwYear, dwMonth, dwDay, dwHour, dwMinute, dwSecond).ToString();

                    MachineInfo objInfo = new MachineInfo();
                    objInfo.MachineNumber  = dwMachineNumber;
                    objInfo.UserID         = dwEnrollNumber;
                    objInfo.Mode           = dwInOutMode;
                    objInfo.DateTimeRecord = inputDate;

                    using (var client = new WebClient())
                    {
                        var responseStr = client.DownloadString("http://www.drbawasakar.com/ras.php?UserId=" + dwEnrollNumber + "&DateTime=" + inputDate + "");
                    }

                    // string Query = "insert into biometric(machine_num,user_id,inout_mode,date_time)values('" + dwMachineNumber + "','" + dwEnrollNumber + "','" + dwInOutMode + "','" + objInfo.DateTimeRecord + "');";
                    //MySqlCommand MyCommand = new MySqlCommand(Query, cnn);

                    lstEnrollData.Add(objInfo);
                }

                BindToGridView(lstEnrollData);
                //MessageBox.Show("Save Data");
                // cnn.Close();


                if (lstEnrollData.Count > 0)
                {
                    // BindToGridView(lstMachineInfo);
                    ShowStatusBar(lstEnrollData.Count + " records found !!", true);
                }
                else
                {
                    DisplayListOutput("No records found");
                }
            }
            catch (Exception ex)
            {
                DisplayListOutput(ex.Message);
            }
        }